Files
cdc-project-management/dist/assets/index-DCvZdXJT.js
T

480 lines
861 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
function hR(e,t){for(var r=0;r<t.length;r++){const s=t[r];if(typeof s!="string"&&!Array.isArray(s)){for(const i in s)if(i!=="default"&&!(i in e)){const l=Object.getOwnPropertyDescriptor(s,i);l&&Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>s[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const l of i)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function r(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(i){if(i.ep)return;i.ep=!0;const l=r(i);fetch(i.href,l)}})();function U_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pm={exports:{}},fl={};/**
* @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 Nx;function mR(){if(Nx)return fl;Nx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,i,l){var c=null;if(l!==void 0&&(c=""+l),i.key!==void 0&&(c=""+i.key),"key"in i){l={};for(var d in i)d!=="key"&&(l[d]=i[d])}else l=i;return i=l.ref,{$$typeof:e,type:s,key:c,ref:i!==void 0?i:null,props:l}}return fl.Fragment=t,fl.jsx=r,fl.jsxs=r,fl}var Tx;function pR(){return Tx||(Tx=1,Pm.exports=mR()),Pm.exports}var f=pR(),Lm={exports:{}},Ve={};/**
* @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 jx;function gR(){if(jx)return Ve;jx=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),c=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"),x=Symbol.iterator;function w(O){return O===null||typeof O!="object"?null:(O=x&&O[x]||O["@@iterator"],typeof O=="function"?O:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,N={};function C(O,M,$){this.props=O,this.context=M,this.refs=N,this.updater=$||E}C.prototype.isReactComponent={},C.prototype.setState=function(O,M){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,M,"setState")},C.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function A(){}A.prototype=C.prototype;function j(O,M,$){this.props=O,this.context=M,this.refs=N,this.updater=$||E}var k=j.prototype=new A;k.constructor=j,S(k,C.prototype),k.isPureReactComponent=!0;var I=Array.isArray;function z(){}var P={H:null,A:null,T:null,S:null},H=Object.prototype.hasOwnProperty;function Z(O,M,$){var Y=$.ref;return{$$typeof:e,type:O,key:M,ref:Y!==void 0?Y:null,props:$}}function de(O,M){return Z(O.type,M,O.props)}function ue(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function me(O){var M={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function($){return M[$]})}var fe=/\/+/g;function pe(O,M){return typeof O=="object"&&O!==null&&O.key!=null?me(""+O.key):M.toString(36)}function ge(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(z,z):(O.status="pending",O.then(function(M){O.status==="pending"&&(O.status="fulfilled",O.value=M)},function(M){O.status==="pending"&&(O.status="rejected",O.reason=M)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function R(O,M,$,Y,B){var ne=typeof O;(ne==="undefined"||ne==="boolean")&&(O=null);var ee=!1;if(O===null)ee=!0;else switch(ne){case"bigint":case"string":case"number":ee=!0;break;case"object":switch(O.$$typeof){case e:case t:ee=!0;break;case b:return ee=O._init,R(ee(O._payload),M,$,Y,B)}}if(ee)return B=B(O),ee=Y===""?"."+pe(O,0):Y,I(B)?($="",ee!=null&&($=ee.replace(fe,"$&/")+"/"),R(B,M,$,"",function(se){return se})):B!=null&&(ue(B)&&(B=de(B,$+(B.key==null||O&&O.key===B.key?"":(""+B.key).replace(fe,"$&/")+"/")+ee)),M.push(B)),1;ee=0;var Q=Y===""?".":Y+":";if(I(O))for(var ae=0;ae<O.length;ae++)Y=O[ae],ne=Q+pe(Y,ae),ee+=R(Y,M,$,ne,B);else if(ae=w(O),typeof ae=="function")for(O=ae.call(O),ae=0;!(Y=O.next()).done;)Y=Y.value,ne=Q+pe(Y,ae++),ee+=R(Y,M,$,ne,B);else if(ne==="object"){if(typeof O.then=="function")return R(ge(O),M,$,Y,B);throw M=String(O),Error("Objects are not valid as a React child (found: "+(M==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":M)+"). If you meant to render a collection of children, use an array instead.")}return ee}function q(O,M,$){if(O==null)return O;var Y=[],B=0;return R(O,Y,"","",function(ne){return M.call($,ne,B++)}),Y}function K(O){if(O._status===-1){var M=O._result;M=M(),M.then(function($){(O._status===0||O._status===-1)&&(O._status=1,O._result=$)},function($){(O._status===0||O._status===-1)&&(O._status=2,O._result=$)}),O._status===-1&&(O._status=0,O._result=M)}if(O._status===1)return O._result.default;throw O._result}var X=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var M=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(M))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},G={map:q,forEach:function(O,M,$){q(O,function(){M.apply(this,arguments)},$)},count:function(O){var M=0;return q(O,function(){M++}),M},toArray:function(O){return q(O,function(M){return M})||[]},only:function(O){if(!ue(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return Ve.Activity=g,Ve.Children=G,Ve.Component=C,Ve.Fragment=r,Ve.Profiler=i,Ve.PureComponent=j,Ve.StrictMode=s,Ve.Suspense=h,Ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P,Ve.__COMPILER_RUNTIME={__proto__:null,c:function(O){return P.H.useMemoCache(O)}},Ve.cache=function(O){return function(){return O.apply(null,arguments)}},Ve.cacheSignal=function(){return null},Ve.cloneElement=function(O,M,$){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var Y=S({},O.props),B=O.key;if(M!=null)for(ne in M.key!==void 0&&(B=""+M.key),M)!H.call(M,ne)||ne==="key"||ne==="__self"||ne==="__source"||ne==="ref"&&M.ref===void 0||(Y[ne]=M[ne]);var ne=arguments.length-2;if(ne===1)Y.children=$;else if(1<ne){for(var ee=Array(ne),Q=0;Q<ne;Q++)ee[Q]=arguments[Q+2];Y.children=ee}return Z(O.type,B,Y)},Ve.createContext=function(O){return O={$$typeof:c,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:l,_context:O},O},Ve.createElement=function(O,M,$){var Y,B={},ne=null;if(M!=null)for(Y in M.key!==void 0&&(ne=""+M.key),M)H.call(M,Y)&&Y!=="key"&&Y!=="__self"&&Y!=="__source"&&(B[Y]=M[Y]);var ee=arguments.length-2;if(ee===1)B.children=$;else if(1<ee){for(var Q=Array(ee),ae=0;ae<ee;ae++)Q[ae]=arguments[ae+2];B.children=Q}if(O&&O.defaultProps)for(Y in ee=O.defaultProps,ee)B[Y]===void 0&&(B[Y]=ee[Y]);return Z(O,ne,B)},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(O){return{$$typeof:d,render:O}},Ve.isValidElement=ue,Ve.lazy=function(O){return{$$typeof:b,_payload:{_status:-1,_result:O},_init:K}},Ve.memo=function(O,M){return{$$typeof:m,type:O,compare:M===void 0?null:M}},Ve.startTransition=function(O){var M=P.T,$={};P.T=$;try{var Y=O(),B=P.S;B!==null&&B($,Y),typeof Y=="object"&&Y!==null&&typeof Y.then=="function"&&Y.then(z,X)}catch(ne){X(ne)}finally{M!==null&&$.types!==null&&(M.types=$.types),P.T=M}},Ve.unstable_useCacheRefresh=function(){return P.H.useCacheRefresh()},Ve.use=function(O){return P.H.use(O)},Ve.useActionState=function(O,M,$){return P.H.useActionState(O,M,$)},Ve.useCallback=function(O,M){return P.H.useCallback(O,M)},Ve.useContext=function(O){return P.H.useContext(O)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(O,M){return P.H.useDeferredValue(O,M)},Ve.useEffect=function(O,M){return P.H.useEffect(O,M)},Ve.useEffectEvent=function(O){return P.H.useEffectEvent(O)},Ve.useId=function(){return P.H.useId()},Ve.useImperativeHandle=function(O,M,$){return P.H.useImperativeHandle(O,M,$)},Ve.useInsertionEffect=function(O,M){return P.H.useInsertionEffect(O,M)},Ve.useLayoutEffect=function(O,M){return P.H.useLayoutEffect(O,M)},Ve.useMemo=function(O,M){return P.H.useMemo(O,M)},Ve.useOptimistic=function(O,M){return P.H.useOptimistic(O,M)},Ve.useReducer=function(O,M,$){return P.H.useReducer(O,M,$)},Ve.useRef=function(O){return P.H.useRef(O)},Ve.useState=function(O){return P.H.useState(O)},Ve.useSyncExternalStore=function(O,M,$){return P.H.useSyncExternalStore(O,M,$)},Ve.useTransition=function(){return P.H.useTransition()},Ve.version="19.2.6",Ve}var Ax;function Id(){return Ax||(Ax=1,Lm.exports=gR()),Lm.exports}var v=Id();const he=U_(v),yg=hR({__proto__:null,default:he},[v]);var zm={exports:{}},hl={},Im={exports:{}},$m={};/**
* @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 Rx;function vR(){return Rx||(Rx=1,(function(e){function t(R,q){var K=R.length;R.push(q);e:for(;0<K;){var X=K-1>>>1,G=R[X];if(0<i(G,q))R[X]=q,R[K]=G,K=X;else break e}}function r(R){return R.length===0?null:R[0]}function s(R){if(R.length===0)return null;var q=R[0],K=R.pop();if(K!==q){R[0]=K;e:for(var X=0,G=R.length,O=G>>>1;X<O;){var M=2*(X+1)-1,$=R[M],Y=M+1,B=R[Y];if(0>i($,K))Y<G&&0>i(B,$)?(R[X]=B,R[Y]=K,X=Y):(R[X]=$,R[M]=K,X=M);else if(Y<G&&0>i(B,K))R[X]=B,R[Y]=K,X=Y;else break e}}return q}function i(R,q){var K=R.sortIndex-q.sortIndex;return K!==0?K:R.id-q.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 c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var h=[],m=[],b=1,g=null,x=3,w=!1,E=!1,S=!1,N=!1,C=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function k(R){for(var q=r(m);q!==null;){if(q.callback===null)s(m);else if(q.startTime<=R)s(m),q.sortIndex=q.expirationTime,t(h,q);else break;q=r(m)}}function I(R){if(S=!1,k(R),!E)if(r(h)!==null)E=!0,z||(z=!0,me());else{var q=r(m);q!==null&&ge(I,q.startTime-R)}}var z=!1,P=-1,H=5,Z=-1;function de(){return N?!0:!(e.unstable_now()-Z<H)}function ue(){if(N=!1,z){var R=e.unstable_now();Z=R;var q=!0;try{e:{E=!1,S&&(S=!1,A(P),P=-1),w=!0;var K=x;try{t:{for(k(R),g=r(h);g!==null&&!(g.expirationTime>R&&de());){var X=g.callback;if(typeof X=="function"){g.callback=null,x=g.priorityLevel;var G=X(g.expirationTime<=R);if(R=e.unstable_now(),typeof G=="function"){g.callback=G,k(R),q=!0;break t}g===r(h)&&s(h),k(R)}else s(h);g=r(h)}if(g!==null)q=!0;else{var O=r(m);O!==null&&ge(I,O.startTime-R),q=!1}}break e}finally{g=null,x=K,w=!1}q=void 0}}finally{q?me():z=!1}}}var me;if(typeof j=="function")me=function(){j(ue)};else if(typeof MessageChannel<"u"){var fe=new MessageChannel,pe=fe.port2;fe.port1.onmessage=ue,me=function(){pe.postMessage(null)}}else me=function(){C(ue,0)};function ge(R,q){P=C(function(){R(e.unstable_now())},q)}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(R){R.callback=null},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(R){switch(x){case 1:case 2:case 3:var q=3;break;default:q=x}var K=x;x=q;try{return R()}finally{x=K}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(R,q){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var K=x;x=R;try{return q()}finally{x=K}},e.unstable_scheduleCallback=function(R,q,K){var X=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?X+K:X):K=X,R){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=K+G,R={id:b++,callback:q,priorityLevel:R,startTime:K,expirationTime:G,sortIndex:-1},K>X?(R.sortIndex=K,t(m,R),r(h)===null&&R===r(m)&&(S?(A(P),P=-1):S=!0,ge(I,K-X))):(R.sortIndex=G,t(h,R),E||w||(E=!0,z||(z=!0,me()))),R},e.unstable_shouldYield=de,e.unstable_wrapCallback=function(R){var q=x;return function(){var K=x;x=q;try{return R.apply(this,arguments)}finally{x=K}}}})($m)),$m}var kx;function yR(){return kx||(kx=1,Im.exports=vR()),Im.exports}var Um={exports:{}},pn={};/**
* @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 Ox;function bR(){if(Ox)return pn;Ox=1;var e=Id();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},i=Symbol.for("react.portal");function l(h,m,b){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:g==null?null:""+g,children:h,containerInfo:m,implementation:b}}var c=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 pn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,pn.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)},pn.flushSync=function(h){var m=c.T,b=s.p;try{if(c.T=null,s.p=2,h)return h()}finally{c.T=m,s.p=b,s.d.f()}},pn.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))},pn.prefetchDNS=function(h){typeof h=="string"&&s.d.D(h)},pn.preinit=function(h,m){if(typeof h=="string"&&m&&typeof m.as=="string"){var b=m.as,g=d(b,m.crossOrigin),x=typeof m.integrity=="string"?m.integrity:void 0,w=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:x,fetchPriority:w}):b==="script"&&s.d.X(h,{crossOrigin:g,integrity:x,fetchPriority:w,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},pn.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)},pn.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})}},pn.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)},pn.requestFormReset=function(h){s.d.r(h)},pn.unstable_batchedUpdates=function(h,m){return h(m)},pn.useFormState=function(h,m,b){return c.H.useFormState(h,m,b)},pn.useFormStatus=function(){return c.H.useHostTransitionStatus()},pn.version="19.2.6",pn}var Mx;function B_(){if(Mx)return Um.exports;Mx=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(),Um.exports=bR(),Um.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 Dx;function xR(){if(Dx)return hl;Dx=1;var e=yR(),t=Id(),r=B_();function s(n){var a="https://react.dev/errors/"+n;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)a+="&args[]="+encodeURIComponent(arguments[o])}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 i(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function l(n){var a=n,o=n;if(n.alternate)for(;a.return;)a=a.return;else{n=a;do a=n,(a.flags&4098)!==0&&(o=a.return),n=a.return;while(n)}return a.tag===3?o:null}function c(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 o=n,u=a;;){var p=o.return;if(p===null)break;var y=p.alternate;if(y===null){if(u=p.return,u!==null){o=u;continue}break}if(p.child===y.child){for(y=p.child;y;){if(y===o)return h(p),n;if(y===u)return h(p),a;y=y.sibling}throw Error(s(188))}if(o.return!==u.return)o=p,u=y;else{for(var _=!1,T=p.child;T;){if(T===o){_=!0,o=p,u=y;break}if(T===u){_=!0,u=p,o=y;break}T=T.sibling}if(!_){for(T=y.child;T;){if(T===o){_=!0,o=y,u=p;break}if(T===u){_=!0,u=y,o=p;break}T=T.sibling}if(!_)throw Error(s(189))}}if(o.alternate!==u)throw Error(s(190))}if(o.tag!==3)throw Error(s(188));return o.stateNode.current===o?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,x=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),j=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),de=Symbol.for("react.memo_cache_sentinel"),ue=Symbol.iterator;function me(n){return n===null||typeof n!="object"?null:(n=ue&&n[ue]||n["@@iterator"],typeof n=="function"?n:null)}var fe=Symbol.for("react.client.reference");function pe(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===fe?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case S:return"Fragment";case C:return"Profiler";case N:return"StrictMode";case I:return"Suspense";case z:return"SuspenseList";case Z:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case E:return"Portal";case j:return n.displayName||"Context";case A:return(n._context.displayName||"Context")+".Consumer";case k: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:pe(n.type)||"Memo";case H:a=n._payload,n=n._init;try{return pe(n(a))}catch{}}return null}var ge=Array.isArray,R=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},X=[],G=-1;function O(n){return{current:n}}function M(n){0>G||(n.current=X[G],X[G]=null,G--)}function $(n,a){G++,X[G]=n.current,n.current=a}var Y=O(null),B=O(null),ne=O(null),ee=O(null);function Q(n,a){switch($(ne,a),$(B,n),$(Y,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?Y0(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=Y0(a),n=X0(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}M(Y),$(Y,n)}function ae(){M(Y),M(B),M(ne)}function se(n){n.memoizedState!==null&&$(ee,n);var a=Y.current,o=X0(a,n.type);a!==o&&($(B,n),$(Y,o))}function Ee(n){B.current===n&&(M(Y),M(B)),ee.current===n&&(M(ee),ll._currentValue=K)}var je,nt;function Qe(n){if(je===void 0)try{throw Error()}catch(o){var a=o.stack.trim().match(/\n( *(at )?)/);je=a&&a[1]||"",nt=-1<o.stack.indexOf(`
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
`+je+n+nt}var Et=!1;function oe(n,a){if(!n||Et)return"";Et=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(a){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(J){var W=J}Reflect.construct(n,[],ie)}else{try{ie.call()}catch(J){W=J}n.call(ie.prototype)}}else{try{throw Error()}catch(J){W=J}(ie=n())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(J){if(J&&W&&typeof J.stack=="string")return[J.stack,W.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=u.DetermineComponentFrameRoot(),_=y[0],T=y[1];if(_&&T){var D=_.split(`
`),F=T.split(`
`);for(p=u=0;u<D.length&&!D[u].includes("DetermineComponentFrameRoot");)u++;for(;p<F.length&&!F[p].includes("DetermineComponentFrameRoot");)p++;if(u===D.length||p===F.length)for(u=D.length-1,p=F.length-1;1<=u&&0<=p&&D[u]!==F[p];)p--;for(;1<=u&&0<=p;u--,p--)if(D[u]!==F[p]){if(u!==1||p!==1)do if(u--,p--,0>p||D[u]!==F[p]){var te=`
`+D[u].replace(" at new "," at ");return n.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",n.displayName)),te}while(1<=u&&0<=p);break}}}finally{Et=!1,Error.prepareStackTrace=o}return(o=n?n.displayName||n.name:"")?Qe(o):""}function Me(n,a){switch(n.tag){case 26:case 27:case 5:return Qe(n.type);case 16:return Qe("Lazy");case 13:return n.child!==a&&a!==null?Qe("Suspense Fallback"):Qe("Suspense");case 19:return Qe("SuspenseList");case 0:case 15:return oe(n.type,!1);case 11:return oe(n.type.render,!1);case 1:return oe(n.type,!0);case 31:return Qe("Activity");default:return""}}function Ke(n){try{var a="",o=null;do a+=Me(n,o),o=n,n=n.return;while(n);return a}catch(u){return`
Error generating stack: `+u.message+`
`+u.stack}}var qe=Object.prototype.hasOwnProperty,_t=e.unstable_scheduleCallback,Ge=e.unstable_cancelCallback,ct=e.unstable_shouldYield,zt=e.unstable_requestPaint,Be=e.unstable_now,ce=e.unstable_getCurrentPriorityLevel,Le=e.unstable_ImmediatePriority,ut=e.unstable_UserBlockingPriority,fn=e.unstable_NormalPriority,Ot=e.unstable_LowPriority,Kt=e.unstable_IdlePriority,Qt=e.log,yn=e.unstable_setDisableYieldValue,hn=null,Ct=null;function Wt(n){if(typeof Qt=="function"&&yn(n),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(hn,n)}catch{}}var At=Math.clz32?Math.clz32:xt,Oe=Math.log,Mt=Math.LN2;function xt(n){return n>>>=0,n===0?32:31-(Oe(n)/Mt|0)|0}var le=256,Ne=262144,Ye=4194304;function st(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 De(n,a,o){var u=n.pendingLanes;if(u===0)return 0;var p=0,y=n.suspendedLanes,_=n.pingedLanes;n=n.warmLanes;var T=u&134217727;return T!==0?(u=T&~y,u!==0?p=st(u):(_&=T,_!==0?p=st(_):o||(o=T&~n,o!==0&&(p=st(o))))):(T=u&~y,T!==0?p=st(T):_!==0?p=st(_):o||(o=u&~n,o!==0&&(p=st(o)))),p===0?0:a!==0&&a!==p&&(a&y)===0&&(y=p&-p,o=a&-a,y>=o||y===32&&(o&4194048)!==0)?a:p}function pt(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function Ut(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 mn(){var n=Ye;return Ye<<=1,(Ye&62914560)===0&&(Ye=4194304),n}function _a(n){for(var a=[],o=0;31>o;o++)a.push(n);return a}function Rt(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Sn(n,a,o,u,p,y){var _=n.pendingLanes;n.pendingLanes=o,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=o,n.entangledLanes&=o,n.errorRecoveryDisabledLanes&=o,n.shellSuspendCounter=0;var T=n.entanglements,D=n.expirationTimes,F=n.hiddenUpdates;for(o=_&~o;0<o;){var te=31-At(o),ie=1<<te;T[te]=0,D[te]=-1;var W=F[te];if(W!==null)for(F[te]=null,te=0;te<W.length;te++){var J=W[te];J!==null&&(J.lane&=-536870913)}o&=~ie}u!==0&&us(n,u,0),y!==0&&p===0&&n.tag!==0&&(n.suspendedLanes|=y&~(_&~a))}function us(n,a,o){n.pendingLanes|=a,n.suspendedLanes&=~a;var u=31-At(a);n.entangledLanes|=a,n.entanglements[u]=n.entanglements[u]|1073741824|o&261930}function En(n,a){var o=n.entangledLanes|=a;for(n=n.entanglements;o;){var u=31-At(o),p=1<<u;p&a|n[u]&a&&(n[u]|=a),o&=~p}}function Cn(n,a){var o=a&-a;return o=(o&42)!==0?1:Ys(o),(o&(n.suspendedLanes|a))!==0?0:o}function Ys(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 dr(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Cf(){var n=q.p;return n!==0?n:(n=window.event,n===void 0?32:bx(n.type))}function Pv(n,a){var o=q.p;try{return q.p=n,a()}finally{q.p=o}}var Sa=Math.random().toString(36).slice(2),rn="__reactFiber$"+Sa,Nn="__reactProps$"+Sa,Xs="__reactContainer$"+Sa,Nf="__reactEvents$"+Sa,nj="__reactListeners$"+Sa,rj="__reactHandles$"+Sa,Lv="__reactResources$"+Sa,So="__reactMarker$"+Sa;function Tf(n){delete n[rn],delete n[Nn],delete n[Nf],delete n[nj],delete n[rj]}function Js(n){var a=n[rn];if(a)return a;for(var o=n.parentNode;o;){if(a=o[Xs]||o[rn]){if(o=a.alternate,a.child!==null||o!==null&&o.child!==null)for(n=rx(n);n!==null;){if(o=n[rn])return o;n=rx(n)}return a}n=o,o=n.parentNode}return null}function Qs(n){if(n=n[rn]||n[Xs]){var a=n.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return n}return null}function Eo(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n.stateNode;throw Error(s(33))}function Zs(n){var a=n[Lv];return a||(a=n[Lv]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Zt(n){n[So]=!0}var zv=new Set,Iv={};function ds(n,a){ei(n,a),ei(n+"Capture",a)}function ei(n,a){for(Iv[n]=a,n=0;n<a.length;n++)zv.add(a[n])}var aj=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]*$"),$v={},Uv={};function sj(n){return qe.call(Uv,n)?!0:qe.call($v,n)?!1:aj.test(n)?Uv[n]=!0:($v[n]=!0,!1)}function fc(n,a,o){if(sj(a))if(o===null)n.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":n.removeAttribute(a);return;case"boolean":var u=a.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){n.removeAttribute(a);return}}n.setAttribute(a,""+o)}}function hc(n,a,o){if(o===null)n.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttribute(a,""+o)}}function Br(n,a,o,u){if(u===null)n.removeAttribute(o);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(o);return}n.setAttributeNS(a,o,""+u)}}function Yn(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Bv(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function ij(n,a,o){var u=Object.getOwnPropertyDescriptor(n.constructor.prototype,a);if(!n.hasOwnProperty(a)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var p=u.get,y=u.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return p.call(this)},set:function(_){o=""+_,y.call(this,_)}}),Object.defineProperty(n,a,{enumerable:u.enumerable}),{getValue:function(){return o},setValue:function(_){o=""+_},stopTracking:function(){n._valueTracker=null,delete n[a]}}}}function jf(n){if(!n._valueTracker){var a=Bv(n)?"checked":"value";n._valueTracker=ij(n,a,""+n[a])}}function Hv(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var o=a.getValue(),u="";return n&&(u=Bv(n)?n.checked?"true":"false":n.value),n=u,n!==o?(a.setValue(n),!0):!1}function mc(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 oj=/[\n"\\]/g;function Xn(n){return n.replace(oj,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Af(n,a,o,u,p,y,_,T){n.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?n.type=_:n.removeAttribute("type"),a!=null?_==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+Yn(a)):n.value!==""+Yn(a)&&(n.value=""+Yn(a)):_!=="submit"&&_!=="reset"||n.removeAttribute("value"),a!=null?Rf(n,_,Yn(a)):o!=null?Rf(n,_,Yn(o)):u!=null&&n.removeAttribute("value"),p==null&&y!=null&&(n.defaultChecked=!!y),p!=null&&(n.checked=p&&typeof p!="function"&&typeof p!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?n.name=""+Yn(T):n.removeAttribute("name")}function qv(n,a,o,u,p,y,_,T){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(n.type=y),a!=null||o!=null){if(!(y!=="submit"&&y!=="reset"||a!=null)){jf(n);return}o=o!=null?""+Yn(o):"",a=a!=null?""+Yn(a):o,T||a===n.value||(n.value=a),n.defaultValue=a}u=u??p,u=typeof u!="function"&&typeof u!="symbol"&&!!u,n.checked=T?n.checked:!!u,n.defaultChecked=!!u,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(n.name=_),jf(n)}function Rf(n,a,o){a==="number"&&mc(n.ownerDocument)===n||n.defaultValue===""+o||(n.defaultValue=""+o)}function ti(n,a,o,u){if(n=n.options,a){a={};for(var p=0;p<o.length;p++)a["$"+o[p]]=!0;for(o=0;o<n.length;o++)p=a.hasOwnProperty("$"+n[o].value),n[o].selected!==p&&(n[o].selected=p),p&&u&&(n[o].defaultSelected=!0)}else{for(o=""+Yn(o),a=null,p=0;p<n.length;p++){if(n[p].value===o){n[p].selected=!0,u&&(n[p].defaultSelected=!0);return}a!==null||n[p].disabled||(a=n[p])}a!==null&&(a.selected=!0)}}function Vv(n,a,o){if(a!=null&&(a=""+Yn(a),a!==n.value&&(n.value=a),o==null)){n.defaultValue!==a&&(n.defaultValue=a);return}n.defaultValue=o!=null?""+Yn(o):""}function Gv(n,a,o,u){if(a==null){if(u!=null){if(o!=null)throw Error(s(92));if(ge(u)){if(1<u.length)throw Error(s(93));u=u[0]}o=u}o==null&&(o=""),a=o}o=Yn(a),n.defaultValue=o,u=n.textContent,u===o&&u!==""&&u!==null&&(n.value=u),jf(n)}function ni(n,a){if(a){var o=n.firstChild;if(o&&o===n.lastChild&&o.nodeType===3){o.nodeValue=a;return}}n.textContent=a}var lj=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 Fv(n,a,o){var u=a.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?u?n.setProperty(a,""):a==="float"?n.cssFloat="":n[a]="":u?n.setProperty(a,o):typeof o!="number"||o===0||lj.has(a)?a==="float"?n.cssFloat=o:n[a]=(""+o).trim():n[a]=o+"px"}function Kv(n,a,o){if(a!=null&&typeof a!="object")throw Error(s(62));if(n=n.style,o!=null){for(var u in o)!o.hasOwnProperty(u)||a!=null&&a.hasOwnProperty(u)||(u.indexOf("--")===0?n.setProperty(u,""):u==="float"?n.cssFloat="":n[u]="");for(var p in a)u=a[p],a.hasOwnProperty(p)&&o[p]!==u&&Fv(n,p,u)}else for(var y in a)a.hasOwnProperty(y)&&Fv(n,y,a[y])}function kf(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 cj=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"]]),uj=/^[\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 pc(n){return uj.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Hr(){}var Of=null;function Mf(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var ri=null,ai=null;function Wv(n){var a=Qs(n);if(a&&(n=a.stateNode)){var o=n[Nn]||null;e:switch(n=a.stateNode,a.type){case"input":if(Af(n,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),a=o.name,o.type==="radio"&&a!=null){for(o=n;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+Xn(""+a)+'"][type="radio"]'),a=0;a<o.length;a++){var u=o[a];if(u!==n&&u.form===n.form){var p=u[Nn]||null;if(!p)throw Error(s(90));Af(u,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(a=0;a<o.length;a++)u=o[a],u.form===n.form&&Hv(u)}break e;case"textarea":Vv(n,o.value,o.defaultValue);break e;case"select":a=o.value,a!=null&&ti(n,!!o.multiple,a,!1)}}}var Df=!1;function Yv(n,a,o){if(Df)return n(a,o);Df=!0;try{var u=n(a);return u}finally{if(Df=!1,(ri!==null||ai!==null)&&(nu(),ri&&(a=ri,n=ai,ai=ri=null,Wv(a),n)))for(a=0;a<n.length;a++)Wv(n[a])}}function Co(n,a){var o=n.stateNode;if(o===null)return null;var u=o[Nn]||null;if(u===null)return null;o=u[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":(u=!u.disabled)||(n=n.type,u=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!u;break e;default:n=!1}if(n)return null;if(o&&typeof o!="function")throw Error(s(231,a,typeof o));return o}var qr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Pf=!1;if(qr)try{var No={};Object.defineProperty(No,"passive",{get:function(){Pf=!0}}),window.addEventListener("test",No,No),window.removeEventListener("test",No,No)}catch{Pf=!1}var Ea=null,Lf=null,gc=null;function Xv(){if(gc)return gc;var n,a=Lf,o=a.length,u,p="value"in Ea?Ea.value:Ea.textContent,y=p.length;for(n=0;n<o&&a[n]===p[n];n++);var _=o-n;for(u=1;u<=_&&a[o-u]===p[y-u];u++);return gc=p.slice(n,1<u?1-u:void 0)}function vc(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 yc(){return!0}function Jv(){return!1}function Tn(n){function a(o,u,p,y,_){this._reactName=o,this._targetInst=p,this.type=u,this.nativeEvent=y,this.target=_,this.currentTarget=null;for(var T in n)n.hasOwnProperty(T)&&(o=n[T],this[T]=o?o(y):y[T]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?yc:Jv,this.isPropagationStopped=Jv,this}return g(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=yc)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=yc)},persist:function(){},isPersistent:yc}),a}var fs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bc=Tn(fs),To=g({},fs,{view:0,detail:0}),dj=Tn(To),zf,If,jo,xc=g({},To,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Uf,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!==jo&&(jo&&n.type==="mousemove"?(zf=n.screenX-jo.screenX,If=n.screenY-jo.screenY):If=zf=0,jo=n),zf)},movementY:function(n){return"movementY"in n?n.movementY:If}}),Qv=Tn(xc),fj=g({},xc,{dataTransfer:0}),hj=Tn(fj),mj=g({},To,{relatedTarget:0}),$f=Tn(mj),pj=g({},fs,{animationName:0,elapsedTime:0,pseudoElement:0}),gj=Tn(pj),vj=g({},fs,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),yj=Tn(vj),bj=g({},fs,{data:0}),Zv=Tn(bj),xj={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wj={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"},_j={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Sj(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=_j[n])?!!a[n]:!1}function Uf(){return Sj}var Ej=g({},To,{key:function(n){if(n.key){var a=xj[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=vc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?wj[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Uf,charCode:function(n){return n.type==="keypress"?vc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?vc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),Cj=Tn(Ej),Nj=g({},xc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ey=Tn(Nj),Tj=g({},To,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Uf}),jj=Tn(Tj),Aj=g({},fs,{propertyName:0,elapsedTime:0,pseudoElement:0}),Rj=Tn(Aj),kj=g({},xc,{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}),Oj=Tn(kj),Mj=g({},fs,{newState:0,oldState:0}),Dj=Tn(Mj),Pj=[9,13,27,32],Bf=qr&&"CompositionEvent"in window,Ao=null;qr&&"documentMode"in document&&(Ao=document.documentMode);var Lj=qr&&"TextEvent"in window&&!Ao,ty=qr&&(!Bf||Ao&&8<Ao&&11>=Ao),ny=" ",ry=!1;function ay(n,a){switch(n){case"keyup":return Pj.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sy(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var si=!1;function zj(n,a){switch(n){case"compositionend":return sy(a);case"keypress":return a.which!==32?null:(ry=!0,ny);case"textInput":return n=a.data,n===ny&&ry?null:n;default:return null}}function Ij(n,a){if(si)return n==="compositionend"||!Bf&&ay(n,a)?(n=Xv(),gc=Lf=Ea=null,si=!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 ty&&a.locale!=="ko"?null:a.data;default:return null}}var $j={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 iy(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!$j[n.type]:a==="textarea"}function oy(n,a,o,u){ri?ai?ai.push(u):ai=[u]:ri=u,a=cu(a,"onChange"),0<a.length&&(o=new bc("onChange","change",null,o,u),n.push({event:o,listeners:a}))}var Ro=null,ko=null;function Uj(n){q0(n,0)}function wc(n){var a=Eo(n);if(Hv(a))return n}function ly(n,a){if(n==="change")return a}var cy=!1;if(qr){var Hf;if(qr){var qf="oninput"in document;if(!qf){var uy=document.createElement("div");uy.setAttribute("oninput","return;"),qf=typeof uy.oninput=="function"}Hf=qf}else Hf=!1;cy=Hf&&(!document.documentMode||9<document.documentMode)}function dy(){Ro&&(Ro.detachEvent("onpropertychange",fy),ko=Ro=null)}function fy(n){if(n.propertyName==="value"&&wc(ko)){var a=[];oy(a,ko,n,Mf(n)),Yv(Uj,a)}}function Bj(n,a,o){n==="focusin"?(dy(),Ro=a,ko=o,Ro.attachEvent("onpropertychange",fy)):n==="focusout"&&dy()}function Hj(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return wc(ko)}function qj(n,a){if(n==="click")return wc(a)}function Vj(n,a){if(n==="input"||n==="change")return wc(a)}function Gj(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var $n=typeof Object.is=="function"?Object.is:Gj;function Oo(n,a){if($n(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var o=Object.keys(n),u=Object.keys(a);if(o.length!==u.length)return!1;for(u=0;u<o.length;u++){var p=o[u];if(!qe.call(a,p)||!$n(n[p],a[p]))return!1}return!0}function hy(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function my(n,a){var o=hy(n);n=0;for(var u;o;){if(o.nodeType===3){if(u=n+o.textContent.length,n<=a&&u>=a)return{node:o,offset:a-n};n=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=hy(o)}}function py(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?py(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function gy(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=mc(n.document);a instanceof n.HTMLIFrameElement;){try{var o=typeof a.contentWindow.location.href=="string"}catch{o=!1}if(o)n=a.contentWindow;else break;a=mc(n.document)}return a}function Vf(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 Fj=qr&&"documentMode"in document&&11>=document.documentMode,ii=null,Gf=null,Mo=null,Ff=!1;function vy(n,a,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Ff||ii==null||ii!==mc(u)||(u=ii,"selectionStart"in u&&Vf(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Mo&&Oo(Mo,u)||(Mo=u,u=cu(Gf,"onSelect"),0<u.length&&(a=new bc("onSelect","select",null,a,o),n.push({event:a,listeners:u}),a.target=ii)))}function hs(n,a){var o={};return o[n.toLowerCase()]=a.toLowerCase(),o["Webkit"+n]="webkit"+a,o["Moz"+n]="moz"+a,o}var oi={animationend:hs("Animation","AnimationEnd"),animationiteration:hs("Animation","AnimationIteration"),animationstart:hs("Animation","AnimationStart"),transitionrun:hs("Transition","TransitionRun"),transitionstart:hs("Transition","TransitionStart"),transitioncancel:hs("Transition","TransitionCancel"),transitionend:hs("Transition","TransitionEnd")},Kf={},yy={};qr&&(yy=document.createElement("div").style,"AnimationEvent"in window||(delete oi.animationend.animation,delete oi.animationiteration.animation,delete oi.animationstart.animation),"TransitionEvent"in window||delete oi.transitionend.transition);function ms(n){if(Kf[n])return Kf[n];if(!oi[n])return n;var a=oi[n],o;for(o in a)if(a.hasOwnProperty(o)&&o in yy)return Kf[n]=a[o];return n}var by=ms("animationend"),xy=ms("animationiteration"),wy=ms("animationstart"),Kj=ms("transitionrun"),Wj=ms("transitionstart"),Yj=ms("transitioncancel"),_y=ms("transitionend"),Sy=new Map,Wf="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(" ");Wf.push("scrollEnd");function fr(n,a){Sy.set(n,a),ds(a,[n])}var _c=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)},Jn=[],li=0,Yf=0;function Sc(){for(var n=li,a=Yf=li=0;a<n;){var o=Jn[a];Jn[a++]=null;var u=Jn[a];Jn[a++]=null;var p=Jn[a];Jn[a++]=null;var y=Jn[a];if(Jn[a++]=null,u!==null&&p!==null){var _=u.pending;_===null?p.next=p:(p.next=_.next,_.next=p),u.pending=p}y!==0&&Ey(o,p,y)}}function Ec(n,a,o,u){Jn[li++]=n,Jn[li++]=a,Jn[li++]=o,Jn[li++]=u,Yf|=u,n.lanes|=u,n=n.alternate,n!==null&&(n.lanes|=u)}function Xf(n,a,o,u){return Ec(n,a,o,u),Cc(n)}function ps(n,a){return Ec(n,null,null,a),Cc(n)}function Ey(n,a,o){n.lanes|=o;var u=n.alternate;u!==null&&(u.lanes|=o);for(var p=!1,y=n.return;y!==null;)y.childLanes|=o,u=y.alternate,u!==null&&(u.childLanes|=o),y.tag===22&&(n=y.stateNode,n===null||n._visibility&1||(p=!0)),n=y,y=y.return;return n.tag===3?(y=n.stateNode,p&&a!==null&&(p=31-At(o),n=y.hiddenUpdates,u=n[p],u===null?n[p]=[a]:u.push(a),a.lane=o|536870912),y):null}function Cc(n){if(50<tl)throw tl=0,sm=null,Error(s(185));for(var a=n.return;a!==null;)n=a,a=n.return;return n.tag===3?n.stateNode:null}var ci={};function Xj(n,a,o,u){this.tag=n,this.key=o,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=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Un(n,a,o,u){return new Xj(n,a,o,u)}function Jf(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Vr(n,a){var o=n.alternate;return o===null?(o=Un(n.tag,a,n.key,n.mode),o.elementType=n.elementType,o.type=n.type,o.stateNode=n.stateNode,o.alternate=n,n.alternate=o):(o.pendingProps=a,o.type=n.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=n.flags&65011712,o.childLanes=n.childLanes,o.lanes=n.lanes,o.child=n.child,o.memoizedProps=n.memoizedProps,o.memoizedState=n.memoizedState,o.updateQueue=n.updateQueue,a=n.dependencies,o.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},o.sibling=n.sibling,o.index=n.index,o.ref=n.ref,o.refCleanup=n.refCleanup,o}function Cy(n,a){n.flags&=65011714;var o=n.alternate;return o===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=o.childLanes,n.lanes=o.lanes,n.child=o.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=o.memoizedProps,n.memoizedState=o.memoizedState,n.updateQueue=o.updateQueue,n.type=o.type,a=o.dependencies,n.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),n}function Nc(n,a,o,u,p,y){var _=0;if(u=n,typeof n=="function")Jf(n)&&(_=1);else if(typeof n=="string")_=tR(n,o,Y.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case Z:return n=Un(31,o,a,p),n.elementType=Z,n.lanes=y,n;case S:return gs(o.children,p,y,a);case N:_=8,p|=24;break;case C:return n=Un(12,o,a,p|2),n.elementType=C,n.lanes=y,n;case I:return n=Un(13,o,a,p),n.elementType=I,n.lanes=y,n;case z:return n=Un(19,o,a,p),n.elementType=z,n.lanes=y,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case j:_=10;break e;case A:_=9;break e;case k:_=11;break e;case P:_=14;break e;case H:_=16,u=null;break e}_=29,o=Error(s(130,n===null?"null":typeof n,"")),u=null}return a=Un(_,o,a,p),a.elementType=n,a.type=u,a.lanes=y,a}function gs(n,a,o,u){return n=Un(7,n,u,a),n.lanes=o,n}function Qf(n,a,o){return n=Un(6,n,null,a),n.lanes=o,n}function Ny(n){var a=Un(18,null,null,0);return a.stateNode=n,a}function Zf(n,a,o){return a=Un(4,n.children!==null?n.children:[],n.key,a),a.lanes=o,a.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},a}var Ty=new WeakMap;function Qn(n,a){if(typeof n=="object"&&n!==null){var o=Ty.get(n);return o!==void 0?o:(a={value:n,source:a,stack:Ke(a)},Ty.set(n,a),a)}return{value:n,source:a,stack:Ke(a)}}var ui=[],di=0,Tc=null,Do=0,Zn=[],er=0,Ca=null,Cr=1,Nr="";function Gr(n,a){ui[di++]=Do,ui[di++]=Tc,Tc=n,Do=a}function jy(n,a,o){Zn[er++]=Cr,Zn[er++]=Nr,Zn[er++]=Ca,Ca=n;var u=Cr;n=Nr;var p=32-At(u)-1;u&=~(1<<p),o+=1;var y=32-At(a)+p;if(30<y){var _=p-p%5;y=(u&(1<<_)-1).toString(32),u>>=_,p-=_,Cr=1<<32-At(a)+p|o<<p|u,Nr=y+n}else Cr=1<<y|o<<p|u,Nr=n}function eh(n){n.return!==null&&(Gr(n,1),jy(n,1,0))}function th(n){for(;n===Tc;)Tc=ui[--di],ui[di]=null,Do=ui[--di],ui[di]=null;for(;n===Ca;)Ca=Zn[--er],Zn[er]=null,Nr=Zn[--er],Zn[er]=null,Cr=Zn[--er],Zn[er]=null}function Ay(n,a){Zn[er++]=Cr,Zn[er++]=Nr,Zn[er++]=Ca,Cr=a.id,Nr=a.overflow,Ca=n}var an=null,Nt=null,it=!1,Na=null,tr=!1,nh=Error(s(519));function Ta(n){var a=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Po(Qn(a,n)),nh}function Ry(n){var a=n.stateNode,o=n.type,u=n.memoizedProps;switch(a[rn]=n,a[Nn]=u,o){case"dialog":et("cancel",a),et("close",a);break;case"iframe":case"object":case"embed":et("load",a);break;case"video":case"audio":for(o=0;o<rl.length;o++)et(rl[o],a);break;case"source":et("error",a);break;case"img":case"image":case"link":et("error",a),et("load",a);break;case"details":et("toggle",a);break;case"input":et("invalid",a),qv(a,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":et("invalid",a);break;case"textarea":et("invalid",a),Gv(a,u.value,u.defaultValue,u.children)}o=u.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||a.textContent===""+o||u.suppressHydrationWarning===!0||K0(a.textContent,o)?(u.popover!=null&&(et("beforetoggle",a),et("toggle",a)),u.onScroll!=null&&et("scroll",a),u.onScrollEnd!=null&&et("scrollend",a),u.onClick!=null&&(a.onclick=Hr),a=!0):a=!1,a||Ta(n,!0)}function ky(n){for(an=n.return;an;)switch(an.tag){case 5:case 31:case 13:tr=!1;return;case 27:case 3:tr=!0;return;default:an=an.return}}function fi(n){if(n!==an)return!1;if(!it)return ky(n),it=!0,!1;var a=n.tag,o;if((o=a!==3&&a!==27)&&((o=a===5)&&(o=n.type,o=!(o!=="form"&&o!=="button")||xm(n.type,n.memoizedProps)),o=!o),o&&Nt&&Ta(n),ky(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Nt=nx(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Nt=nx(n)}else a===27?(a=Nt,Ba(n.type)?(n=Cm,Cm=null,Nt=n):Nt=a):Nt=an?rr(n.stateNode.nextSibling):null;return!0}function vs(){Nt=an=null,it=!1}function rh(){var n=Na;return n!==null&&(kn===null?kn=n:kn.push.apply(kn,n),Na=null),n}function Po(n){Na===null?Na=[n]:Na.push(n)}var ah=O(null),ys=null,Fr=null;function ja(n,a,o){$(ah,a._currentValue),a._currentValue=o}function Kr(n){n._currentValue=ah.current,M(ah)}function sh(n,a,o){for(;n!==null;){var u=n.alternate;if((n.childLanes&a)!==a?(n.childLanes|=a,u!==null&&(u.childLanes|=a)):u!==null&&(u.childLanes&a)!==a&&(u.childLanes|=a),n===o)break;n=n.return}}function ih(n,a,o,u){var p=n.child;for(p!==null&&(p.return=n);p!==null;){var y=p.dependencies;if(y!==null){var _=p.child;y=y.firstContext;e:for(;y!==null;){var T=y;y=p;for(var D=0;D<a.length;D++)if(T.context===a[D]){y.lanes|=o,T=y.alternate,T!==null&&(T.lanes|=o),sh(y.return,o,n),u||(_=null);break e}y=T.next}}else if(p.tag===18){if(_=p.return,_===null)throw Error(s(341));_.lanes|=o,y=_.alternate,y!==null&&(y.lanes|=o),sh(_,o,n),_=null}else _=p.child;if(_!==null)_.return=p;else for(_=p;_!==null;){if(_===n){_=null;break}if(p=_.sibling,p!==null){p.return=_.return,_=p;break}_=_.return}p=_}}function hi(n,a,o,u){n=null;for(var p=a,y=!1;p!==null;){if(!y){if((p.flags&524288)!==0)y=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var _=p.alternate;if(_===null)throw Error(s(387));if(_=_.memoizedProps,_!==null){var T=p.type;$n(p.pendingProps.value,_.value)||(n!==null?n.push(T):n=[T])}}else if(p===ee.current){if(_=p.alternate,_===null)throw Error(s(387));_.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(n!==null?n.push(ll):n=[ll])}p=p.return}n!==null&&ih(a,n,o,u),a.flags|=262144}function jc(n){for(n=n.firstContext;n!==null;){if(!$n(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function bs(n){ys=n,Fr=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function sn(n){return Oy(ys,n)}function Ac(n,a){return ys===null&&bs(n),Oy(n,a)}function Oy(n,a){var o=a._currentValue;if(a={context:a,memoizedValue:o,next:null},Fr===null){if(n===null)throw Error(s(308));Fr=a,n.dependencies={lanes:0,firstContext:a},n.flags|=524288}else Fr=Fr.next=a;return o}var Jj=typeof AbortController<"u"?AbortController:function(){var n=[],a=this.signal={aborted:!1,addEventListener:function(o,u){n.push(u)}};this.abort=function(){a.aborted=!0,n.forEach(function(o){return o()})}},Qj=e.unstable_scheduleCallback,Zj=e.unstable_NormalPriority,Bt={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function oh(){return{controller:new Jj,data:new Map,refCount:0}}function Lo(n){n.refCount--,n.refCount===0&&Qj(Zj,function(){n.controller.abort()})}var zo=null,lh=0,mi=0,pi=null;function eA(n,a){if(zo===null){var o=zo=[];lh=0,mi=dm(),pi={status:"pending",value:void 0,then:function(u){o.push(u)}}}return lh++,a.then(My,My),a}function My(){if(--lh===0&&zo!==null){pi!==null&&(pi.status="fulfilled");var n=zo;zo=null,mi=0,pi=null;for(var a=0;a<n.length;a++)(0,n[a])()}}function tA(n,a){var o=[],u={status:"pending",value:null,reason:null,then:function(p){o.push(p)}};return n.then(function(){u.status="fulfilled",u.value=a;for(var p=0;p<o.length;p++)(0,o[p])(a)},function(p){for(u.status="rejected",u.reason=p,p=0;p<o.length;p++)(0,o[p])(void 0)}),u}var Dy=R.S;R.S=function(n,a){v0=Be(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&eA(n,a),Dy!==null&&Dy(n,a)};var xs=O(null);function ch(){var n=xs.current;return n!==null?n:wt.pooledCache}function Rc(n,a){a===null?$(xs,xs.current):$(xs,a.pool)}function Py(){var n=ch();return n===null?null:{parent:Bt._currentValue,pool:n}}var gi=Error(s(460)),uh=Error(s(474)),kc=Error(s(542)),Oc={then:function(){}};function Ly(n){return n=n.status,n==="fulfilled"||n==="rejected"}function zy(n,a,o){switch(o=n[o],o===void 0?n.push(a):o!==a&&(a.then(Hr,Hr),a=o),a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,$y(n),n;default:if(typeof a.status=="string")a.then(Hr,Hr);else{if(n=wt,n!==null&&100<n.shellSuspendCounter)throw Error(s(482));n=a,n.status="pending",n.then(function(u){if(a.status==="pending"){var p=a;p.status="fulfilled",p.value=u}},function(u){if(a.status==="pending"){var p=a;p.status="rejected",p.reason=u}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,$y(n),n}throw _s=a,gi}}function ws(n){try{var a=n._init;return a(n._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(_s=o,gi):o}}var _s=null;function Iy(){if(_s===null)throw Error(s(459));var n=_s;return _s=null,n}function $y(n){if(n===gi||n===kc)throw Error(s(483))}var vi=null,Io=0;function Mc(n){var a=Io;return Io+=1,vi===null&&(vi=[]),zy(vi,n,a)}function $o(n,a){a=a.props.ref,n.ref=a!==void 0?a:null}function Dc(n,a){throw a.$$typeof===x?Error(s(525)):(n=Object.prototype.toString.call(a),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":n)))}function Uy(n){function a(U,L){if(n){var V=U.deletions;V===null?(U.deletions=[L],U.flags|=16):V.push(L)}}function o(U,L){if(!n)return null;for(;L!==null;)a(U,L),L=L.sibling;return null}function u(U){for(var L=new Map;U!==null;)U.key!==null?L.set(U.key,U):L.set(U.index,U),U=U.sibling;return L}function p(U,L){return U=Vr(U,L),U.index=0,U.sibling=null,U}function y(U,L,V){return U.index=V,n?(V=U.alternate,V!==null?(V=V.index,V<L?(U.flags|=67108866,L):V):(U.flags|=67108866,L)):(U.flags|=1048576,L)}function _(U){return n&&U.alternate===null&&(U.flags|=67108866),U}function T(U,L,V,re){return L===null||L.tag!==6?(L=Qf(V,U.mode,re),L.return=U,L):(L=p(L,V),L.return=U,L)}function D(U,L,V,re){var Pe=V.type;return Pe===S?te(U,L,V.props.children,re,V.key):L!==null&&(L.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===H&&ws(Pe)===L.type)?(L=p(L,V.props),$o(L,V),L.return=U,L):(L=Nc(V.type,V.key,V.props,null,U.mode,re),$o(L,V),L.return=U,L)}function F(U,L,V,re){return L===null||L.tag!==4||L.stateNode.containerInfo!==V.containerInfo||L.stateNode.implementation!==V.implementation?(L=Zf(V,U.mode,re),L.return=U,L):(L=p(L,V.children||[]),L.return=U,L)}function te(U,L,V,re,Pe){return L===null||L.tag!==7?(L=gs(V,U.mode,re,Pe),L.return=U,L):(L=p(L,V),L.return=U,L)}function ie(U,L,V){if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return L=Qf(""+L,U.mode,V),L.return=U,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case w:return V=Nc(L.type,L.key,L.props,null,U.mode,V),$o(V,L),V.return=U,V;case E:return L=Zf(L,U.mode,V),L.return=U,L;case H:return L=ws(L),ie(U,L,V)}if(ge(L)||me(L))return L=gs(L,U.mode,V,null),L.return=U,L;if(typeof L.then=="function")return ie(U,Mc(L),V);if(L.$$typeof===j)return ie(U,Ac(U,L),V);Dc(U,L)}return null}function W(U,L,V,re){var Pe=L!==null?L.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return Pe!==null?null:T(U,L,""+V,re);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case w:return V.key===Pe?D(U,L,V,re):null;case E:return V.key===Pe?F(U,L,V,re):null;case H:return V=ws(V),W(U,L,V,re)}if(ge(V)||me(V))return Pe!==null?null:te(U,L,V,re,null);if(typeof V.then=="function")return W(U,L,Mc(V),re);if(V.$$typeof===j)return W(U,L,Ac(U,V),re);Dc(U,V)}return null}function J(U,L,V,re,Pe){if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return U=U.get(V)||null,T(L,U,""+re,Pe);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case w:return U=U.get(re.key===null?V:re.key)||null,D(L,U,re,Pe);case E:return U=U.get(re.key===null?V:re.key)||null,F(L,U,re,Pe);case H:return re=ws(re),J(U,L,V,re,Pe)}if(ge(re)||me(re))return U=U.get(V)||null,te(L,U,re,Pe,null);if(typeof re.then=="function")return J(U,L,V,Mc(re),Pe);if(re.$$typeof===j)return J(U,L,V,Ac(L,re),Pe);Dc(L,re)}return null}function Se(U,L,V,re){for(var Pe=null,ot=null,Ae=L,We=L=0,at=null;Ae!==null&&We<V.length;We++){Ae.index>We?(at=Ae,Ae=null):at=Ae.sibling;var lt=W(U,Ae,V[We],re);if(lt===null){Ae===null&&(Ae=at);break}n&&Ae&&lt.alternate===null&&a(U,Ae),L=y(lt,L,We),ot===null?Pe=lt:ot.sibling=lt,ot=lt,Ae=at}if(We===V.length)return o(U,Ae),it&&Gr(U,We),Pe;if(Ae===null){for(;We<V.length;We++)Ae=ie(U,V[We],re),Ae!==null&&(L=y(Ae,L,We),ot===null?Pe=Ae:ot.sibling=Ae,ot=Ae);return it&&Gr(U,We),Pe}for(Ae=u(Ae);We<V.length;We++)at=J(Ae,U,We,V[We],re),at!==null&&(n&&at.alternate!==null&&Ae.delete(at.key===null?We:at.key),L=y(at,L,We),ot===null?Pe=at:ot.sibling=at,ot=at);return n&&Ae.forEach(function(Fa){return a(U,Fa)}),it&&Gr(U,We),Pe}function ze(U,L,V,re){if(V==null)throw Error(s(151));for(var Pe=null,ot=null,Ae=L,We=L=0,at=null,lt=V.next();Ae!==null&&!lt.done;We++,lt=V.next()){Ae.index>We?(at=Ae,Ae=null):at=Ae.sibling;var Fa=W(U,Ae,lt.value,re);if(Fa===null){Ae===null&&(Ae=at);break}n&&Ae&&Fa.alternate===null&&a(U,Ae),L=y(Fa,L,We),ot===null?Pe=Fa:ot.sibling=Fa,ot=Fa,Ae=at}if(lt.done)return o(U,Ae),it&&Gr(U,We),Pe;if(Ae===null){for(;!lt.done;We++,lt=V.next())lt=ie(U,lt.value,re),lt!==null&&(L=y(lt,L,We),ot===null?Pe=lt:ot.sibling=lt,ot=lt);return it&&Gr(U,We),Pe}for(Ae=u(Ae);!lt.done;We++,lt=V.next())lt=J(Ae,U,We,lt.value,re),lt!==null&&(n&&lt.alternate!==null&&Ae.delete(lt.key===null?We:lt.key),L=y(lt,L,We),ot===null?Pe=lt:ot.sibling=lt,ot=lt);return n&&Ae.forEach(function(fR){return a(U,fR)}),it&&Gr(U,We),Pe}function yt(U,L,V,re){if(typeof V=="object"&&V!==null&&V.type===S&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case w:e:{for(var Pe=V.key;L!==null;){if(L.key===Pe){if(Pe=V.type,Pe===S){if(L.tag===7){o(U,L.sibling),re=p(L,V.props.children),re.return=U,U=re;break e}}else if(L.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===H&&ws(Pe)===L.type){o(U,L.sibling),re=p(L,V.props),$o(re,V),re.return=U,U=re;break e}o(U,L);break}else a(U,L);L=L.sibling}V.type===S?(re=gs(V.props.children,U.mode,re,V.key),re.return=U,U=re):(re=Nc(V.type,V.key,V.props,null,U.mode,re),$o(re,V),re.return=U,U=re)}return _(U);case E:e:{for(Pe=V.key;L!==null;){if(L.key===Pe)if(L.tag===4&&L.stateNode.containerInfo===V.containerInfo&&L.stateNode.implementation===V.implementation){o(U,L.sibling),re=p(L,V.children||[]),re.return=U,U=re;break e}else{o(U,L);break}else a(U,L);L=L.sibling}re=Zf(V,U.mode,re),re.return=U,U=re}return _(U);case H:return V=ws(V),yt(U,L,V,re)}if(ge(V))return Se(U,L,V,re);if(me(V)){if(Pe=me(V),typeof Pe!="function")throw Error(s(150));return V=Pe.call(V),ze(U,L,V,re)}if(typeof V.then=="function")return yt(U,L,Mc(V),re);if(V.$$typeof===j)return yt(U,L,Ac(U,V),re);Dc(U,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,L!==null&&L.tag===6?(o(U,L.sibling),re=p(L,V),re.return=U,U=re):(o(U,L),re=Qf(V,U.mode,re),re.return=U,U=re),_(U)):o(U,L)}return function(U,L,V,re){try{Io=0;var Pe=yt(U,L,V,re);return vi=null,Pe}catch(Ae){if(Ae===gi||Ae===kc)throw Ae;var ot=Un(29,Ae,null,U.mode);return ot.lanes=re,ot.return=U,ot}finally{}}}var Ss=Uy(!0),By=Uy(!1),Aa=!1;function dh(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function fh(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 Ra(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function ka(n,a,o){var u=n.updateQueue;if(u===null)return null;if(u=u.shared,(dt&2)!==0){var p=u.pending;return p===null?a.next=a:(a.next=p.next,p.next=a),u.pending=a,a=Cc(n),Ey(n,null,o),a}return Ec(n,u,a,o),Cc(n)}function Uo(n,a,o){if(a=a.updateQueue,a!==null&&(a=a.shared,(o&4194048)!==0)){var u=a.lanes;u&=n.pendingLanes,o|=u,a.lanes=o,En(n,o)}}function hh(n,a){var o=n.updateQueue,u=n.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var p=null,y=null;if(o=o.firstBaseUpdate,o!==null){do{var _={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};y===null?p=y=_:y=y.next=_,o=o.next}while(o!==null);y===null?p=y=a:y=y.next=a}else p=y=a;o={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:y,shared:u.shared,callbacks:u.callbacks},n.updateQueue=o;return}n=o.lastBaseUpdate,n===null?o.firstBaseUpdate=a:n.next=a,o.lastBaseUpdate=a}var mh=!1;function Bo(){if(mh){var n=pi;if(n!==null)throw n}}function Ho(n,a,o,u){mh=!1;var p=n.updateQueue;Aa=!1;var y=p.firstBaseUpdate,_=p.lastBaseUpdate,T=p.shared.pending;if(T!==null){p.shared.pending=null;var D=T,F=D.next;D.next=null,_===null?y=F:_.next=F,_=D;var te=n.alternate;te!==null&&(te=te.updateQueue,T=te.lastBaseUpdate,T!==_&&(T===null?te.firstBaseUpdate=F:T.next=F,te.lastBaseUpdate=D))}if(y!==null){var ie=p.baseState;_=0,te=F=D=null,T=y;do{var W=T.lane&-536870913,J=W!==T.lane;if(J?(rt&W)===W:(u&W)===W){W!==0&&W===mi&&(mh=!0),te!==null&&(te=te.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var Se=n,ze=T;W=a;var yt=o;switch(ze.tag){case 1:if(Se=ze.payload,typeof Se=="function"){ie=Se.call(yt,ie,W);break e}ie=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=ze.payload,W=typeof Se=="function"?Se.call(yt,ie,W):Se,W==null)break e;ie=g({},ie,W);break e;case 2:Aa=!0}}W=T.callback,W!==null&&(n.flags|=64,J&&(n.flags|=8192),J=p.callbacks,J===null?p.callbacks=[W]:J.push(W))}else J={lane:W,tag:T.tag,payload:T.payload,callback:T.callback,next:null},te===null?(F=te=J,D=ie):te=te.next=J,_|=W;if(T=T.next,T===null){if(T=p.shared.pending,T===null)break;J=T,T=J.next,J.next=null,p.lastBaseUpdate=J,p.shared.pending=null}}while(!0);te===null&&(D=ie),p.baseState=D,p.firstBaseUpdate=F,p.lastBaseUpdate=te,y===null&&(p.shared.lanes=0),La|=_,n.lanes=_,n.memoizedState=ie}}function Hy(n,a){if(typeof n!="function")throw Error(s(191,n));n.call(a)}function qy(n,a){var o=n.callbacks;if(o!==null)for(n.callbacks=null,n=0;n<o.length;n++)Hy(o[n],a)}var yi=O(null),Pc=O(0);function Vy(n,a){n=na,$(Pc,n),$(yi,a),na=n|a.baseLanes}function ph(){$(Pc,na),$(yi,yi.current)}function gh(){na=Pc.current,M(yi),M(Pc)}var Bn=O(null),nr=null;function Oa(n){var a=n.alternate;$(It,It.current&1),$(Bn,n),nr===null&&(a===null||yi.current!==null||a.memoizedState!==null)&&(nr=n)}function vh(n){$(It,It.current),$(Bn,n),nr===null&&(nr=n)}function Gy(n){n.tag===22?($(It,It.current),$(Bn,n),nr===null&&(nr=n)):Ma()}function Ma(){$(It,It.current),$(Bn,Bn.current)}function Hn(n){M(Bn),nr===n&&(nr=null),M(It)}var It=O(0);function Lc(n){for(var a=n;a!==null;){if(a.tag===13){var o=a.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||Sm(o)||Em(o)))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 Wr=0,Fe=null,gt=null,Ht=null,zc=!1,bi=!1,Es=!1,Ic=0,qo=0,xi=null,nA=0;function Dt(){throw Error(s(321))}function yh(n,a){if(a===null)return!1;for(var o=0;o<a.length&&o<n.length;o++)if(!$n(n[o],a[o]))return!1;return!0}function bh(n,a,o,u,p,y){return Wr=y,Fe=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,R.H=n===null||n.memoizedState===null?jb:Dh,Es=!1,y=o(u,p),Es=!1,bi&&(y=Ky(a,o,u,p)),Fy(n),y}function Fy(n){R.H=Fo;var a=gt!==null&&gt.next!==null;if(Wr=0,Ht=gt=Fe=null,zc=!1,qo=0,xi=null,a)throw Error(s(300));n===null||qt||(n=n.dependencies,n!==null&&jc(n)&&(qt=!0))}function Ky(n,a,o,u){Fe=n;var p=0;do{if(bi&&(xi=null),qo=0,bi=!1,25<=p)throw Error(s(301));if(p+=1,Ht=gt=null,n.updateQueue!=null){var y=n.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}R.H=Ab,y=a(o,u)}while(bi);return y}function rA(){var n=R.H,a=n.useState()[0];return a=typeof a.then=="function"?Vo(a):a,n=n.useState()[0],(gt!==null?gt.memoizedState:null)!==n&&(Fe.flags|=1024),a}function xh(){var n=Ic!==0;return Ic=0,n}function wh(n,a,o){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~o}function _h(n){if(zc){for(n=n.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}zc=!1}Wr=0,Ht=gt=Fe=null,bi=!1,qo=Ic=0,xi=null}function bn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ht===null?Fe.memoizedState=Ht=n:Ht=Ht.next=n,Ht}function $t(){if(gt===null){var n=Fe.alternate;n=n!==null?n.memoizedState:null}else n=gt.next;var a=Ht===null?Fe.memoizedState:Ht.next;if(a!==null)Ht=a,gt=n;else{if(n===null)throw Fe.alternate===null?Error(s(467)):Error(s(310));gt=n,n={memoizedState:gt.memoizedState,baseState:gt.baseState,baseQueue:gt.baseQueue,queue:gt.queue,next:null},Ht===null?Fe.memoizedState=Ht=n:Ht=Ht.next=n}return Ht}function $c(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Vo(n){var a=qo;return qo+=1,xi===null&&(xi=[]),n=zy(xi,n,a),a=Fe,(Ht===null?a.memoizedState:Ht.next)===null&&(a=a.alternate,R.H=a===null||a.memoizedState===null?jb:Dh),n}function Uc(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Vo(n);if(n.$$typeof===j)return sn(n)}throw Error(s(438,String(n)))}function Sh(n){var a=null,o=Fe.updateQueue;if(o!==null&&(a=o.memoCache),a==null){var u=Fe.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(a={data:u.data.map(function(p){return p.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),o===null&&(o=$c(),Fe.updateQueue=o),o.memoCache=a,o=a.data[a.index],o===void 0)for(o=a.data[a.index]=Array(n),u=0;u<n;u++)o[u]=de;return a.index++,o}function Yr(n,a){return typeof a=="function"?a(n):a}function Bc(n){var a=$t();return Eh(a,gt,n)}function Eh(n,a,o){var u=n.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=o;var p=n.baseQueue,y=u.pending;if(y!==null){if(p!==null){var _=p.next;p.next=y.next,y.next=_}a.baseQueue=p=y,u.pending=null}if(y=n.baseState,p===null)n.memoizedState=y;else{a=p.next;var T=_=null,D=null,F=a,te=!1;do{var ie=F.lane&-536870913;if(ie!==F.lane?(rt&ie)===ie:(Wr&ie)===ie){var W=F.revertLane;if(W===0)D!==null&&(D=D.next={lane:0,revertLane:0,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),ie===mi&&(te=!0);else if((Wr&W)===W){F=F.next,W===mi&&(te=!0);continue}else ie={lane:0,revertLane:F.revertLane,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},D===null?(T=D=ie,_=y):D=D.next=ie,Fe.lanes|=W,La|=W;ie=F.action,Es&&o(y,ie),y=F.hasEagerState?F.eagerState:o(y,ie)}else W={lane:ie,revertLane:F.revertLane,gesture:F.gesture,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},D===null?(T=D=W,_=y):D=D.next=W,Fe.lanes|=ie,La|=ie;F=F.next}while(F!==null&&F!==a);if(D===null?_=y:D.next=T,!$n(y,n.memoizedState)&&(qt=!0,te&&(o=pi,o!==null)))throw o;n.memoizedState=y,n.baseState=_,n.baseQueue=D,u.lastRenderedState=y}return p===null&&(u.lanes=0),[n.memoizedState,u.dispatch]}function Ch(n){var a=$t(),o=a.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=n;var u=o.dispatch,p=o.pending,y=a.memoizedState;if(p!==null){o.pending=null;var _=p=p.next;do y=n(y,_.action),_=_.next;while(_!==p);$n(y,a.memoizedState)||(qt=!0),a.memoizedState=y,a.baseQueue===null&&(a.baseState=y),o.lastRenderedState=y}return[y,u]}function Wy(n,a,o){var u=Fe,p=$t(),y=it;if(y){if(o===void 0)throw Error(s(407));o=o()}else o=a();var _=!$n((gt||p).memoizedState,o);if(_&&(p.memoizedState=o,qt=!0),p=p.queue,jh(Jy.bind(null,u,p,n),[n]),p.getSnapshot!==a||_||Ht!==null&&Ht.memoizedState.tag&1){if(u.flags|=2048,wi(9,{destroy:void 0},Xy.bind(null,u,p,o,a),null),wt===null)throw Error(s(349));y||(Wr&127)!==0||Yy(u,a,o)}return o}function Yy(n,a,o){n.flags|=16384,n={getSnapshot:a,value:o},a=Fe.updateQueue,a===null?(a=$c(),Fe.updateQueue=a,a.stores=[n]):(o=a.stores,o===null?a.stores=[n]:o.push(n))}function Xy(n,a,o,u){a.value=o,a.getSnapshot=u,Qy(a)&&Zy(n)}function Jy(n,a,o){return o(function(){Qy(a)&&Zy(n)})}function Qy(n){var a=n.getSnapshot;n=n.value;try{var o=a();return!$n(n,o)}catch{return!0}}function Zy(n){var a=ps(n,2);a!==null&&On(a,n,2)}function Nh(n){var a=bn();if(typeof n=="function"){var o=n;if(n=o(),Es){Wt(!0);try{o()}finally{Wt(!1)}}}return a.memoizedState=a.baseState=n,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yr,lastRenderedState:n},a}function eb(n,a,o,u){return n.baseState=o,Eh(n,gt,typeof u=="function"?u:Yr)}function aA(n,a,o,u,p){if(Vc(n))throw Error(s(485));if(n=a.action,n!==null){var y={payload:p,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){y.listeners.push(_)}};R.T!==null?o(!0):y.isTransition=!1,u(y),o=a.pending,o===null?(y.next=a.pending=y,tb(a,y)):(y.next=o.next,a.pending=o.next=y)}}function tb(n,a){var o=a.action,u=a.payload,p=n.state;if(a.isTransition){var y=R.T,_={};R.T=_;try{var T=o(p,u),D=R.S;D!==null&&D(_,T),nb(n,a,T)}catch(F){Th(n,a,F)}finally{y!==null&&_.types!==null&&(y.types=_.types),R.T=y}}else try{y=o(p,u),nb(n,a,y)}catch(F){Th(n,a,F)}}function nb(n,a,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(u){rb(n,a,u)},function(u){return Th(n,a,u)}):rb(n,a,o)}function rb(n,a,o){a.status="fulfilled",a.value=o,ab(a),n.state=o,a=n.pending,a!==null&&(o=a.next,o===a?n.pending=null:(o=o.next,a.next=o,tb(n,o)))}function Th(n,a,o){var u=n.pending;if(n.pending=null,u!==null){u=u.next;do a.status="rejected",a.reason=o,ab(a),a=a.next;while(a!==u)}n.action=null}function ab(n){n=n.listeners;for(var a=0;a<n.length;a++)(0,n[a])()}function sb(n,a){return a}function ib(n,a){if(it){var o=wt.formState;if(o!==null){e:{var u=Fe;if(it){if(Nt){t:{for(var p=Nt,y=tr;p.nodeType!==8;){if(!y){p=null;break t}if(p=rr(p.nextSibling),p===null){p=null;break t}}y=p.data,p=y==="F!"||y==="F"?p:null}if(p){Nt=rr(p.nextSibling),u=p.data==="F!";break e}}Ta(u)}u=!1}u&&(a=o[0])}}return o=bn(),o.memoizedState=o.baseState=a,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sb,lastRenderedState:a},o.queue=u,o=Cb.bind(null,Fe,u),u.dispatch=o,u=Nh(!1),y=Mh.bind(null,Fe,!1,u.queue),u=bn(),p={state:a,dispatch:null,action:n,pending:null},u.queue=p,o=aA.bind(null,Fe,p,y,o),p.dispatch=o,u.memoizedState=n,[a,o,!1]}function ob(n){var a=$t();return lb(a,gt,n)}function lb(n,a,o){if(a=Eh(n,a,sb)[0],n=Bc(Yr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var u=Vo(a)}catch(_){throw _===gi?kc:_}else u=a;a=$t();var p=a.queue,y=p.dispatch;return o!==a.memoizedState&&(Fe.flags|=2048,wi(9,{destroy:void 0},sA.bind(null,p,o),null)),[u,y,n]}function sA(n,a){n.action=a}function cb(n){var a=$t(),o=gt;if(o!==null)return lb(a,o,n);$t(),a=a.memoizedState,o=$t();var u=o.queue.dispatch;return o.memoizedState=n,[a,u,!1]}function wi(n,a,o,u){return n={tag:n,create:o,deps:u,inst:a,next:null},a=Fe.updateQueue,a===null&&(a=$c(),Fe.updateQueue=a),o=a.lastEffect,o===null?a.lastEffect=n.next=n:(u=o.next,o.next=n,n.next=u,a.lastEffect=n),n}function ub(){return $t().memoizedState}function Hc(n,a,o,u){var p=bn();Fe.flags|=n,p.memoizedState=wi(1|a,{destroy:void 0},o,u===void 0?null:u)}function qc(n,a,o,u){var p=$t();u=u===void 0?null:u;var y=p.memoizedState.inst;gt!==null&&u!==null&&yh(u,gt.memoizedState.deps)?p.memoizedState=wi(a,y,o,u):(Fe.flags|=n,p.memoizedState=wi(1|a,y,o,u))}function db(n,a){Hc(8390656,8,n,a)}function jh(n,a){qc(2048,8,n,a)}function iA(n){Fe.flags|=4;var a=Fe.updateQueue;if(a===null)a=$c(),Fe.updateQueue=a,a.events=[n];else{var o=a.events;o===null?a.events=[n]:o.push(n)}}function fb(n){var a=$t().memoizedState;return iA({ref:a,nextImpl:n}),function(){if((dt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}function hb(n,a){return qc(4,2,n,a)}function mb(n,a){return qc(4,4,n,a)}function pb(n,a){if(typeof a=="function"){n=n();var o=a(n);return function(){typeof o=="function"?o():a(null)}}if(a!=null)return n=n(),a.current=n,function(){a.current=null}}function gb(n,a,o){o=o!=null?o.concat([n]):null,qc(4,4,pb.bind(null,a,n),o)}function Ah(){}function vb(n,a){var o=$t();a=a===void 0?null:a;var u=o.memoizedState;return a!==null&&yh(a,u[1])?u[0]:(o.memoizedState=[n,a],n)}function yb(n,a){var o=$t();a=a===void 0?null:a;var u=o.memoizedState;if(a!==null&&yh(a,u[1]))return u[0];if(u=n(),Es){Wt(!0);try{n()}finally{Wt(!1)}}return o.memoizedState=[u,a],u}function Rh(n,a,o){return o===void 0||(Wr&1073741824)!==0&&(rt&261930)===0?n.memoizedState=a:(n.memoizedState=o,n=b0(),Fe.lanes|=n,La|=n,o)}function bb(n,a,o,u){return $n(o,a)?o:yi.current!==null?(n=Rh(n,o,u),$n(n,a)||(qt=!0),n):(Wr&42)===0||(Wr&1073741824)!==0&&(rt&261930)===0?(qt=!0,n.memoizedState=o):(n=b0(),Fe.lanes|=n,La|=n,a)}function xb(n,a,o,u,p){var y=q.p;q.p=y!==0&&8>y?y:8;var _=R.T,T={};R.T=T,Mh(n,!1,a,o);try{var D=p(),F=R.S;if(F!==null&&F(T,D),D!==null&&typeof D=="object"&&typeof D.then=="function"){var te=tA(D,u);Go(n,a,te,Gn(n))}else Go(n,a,u,Gn(n))}catch(ie){Go(n,a,{then:function(){},status:"rejected",reason:ie},Gn())}finally{q.p=y,_!==null&&T.types!==null&&(_.types=T.types),R.T=_}}function oA(){}function kh(n,a,o,u){if(n.tag!==5)throw Error(s(476));var p=wb(n).queue;xb(n,p,a,K,o===null?oA:function(){return _b(n),o(u)})}function wb(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yr,lastRenderedState:K},next:null};var o={};return a.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yr,lastRenderedState:o},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function _b(n){var a=wb(n);a.next===null&&(a=n.alternate.memoizedState),Go(n,a.next.queue,{},Gn())}function Oh(){return sn(ll)}function Sb(){return $t().memoizedState}function Eb(){return $t().memoizedState}function lA(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var o=Gn();n=Ra(o);var u=ka(a,n,o);u!==null&&(On(u,a,o),Uo(u,a,o)),a={cache:oh()},n.payload=a;return}a=a.return}}function cA(n,a,o){var u=Gn();o={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Vc(n)?Nb(a,o):(o=Xf(n,a,o,u),o!==null&&(On(o,n,u),Tb(o,a,u)))}function Cb(n,a,o){var u=Gn();Go(n,a,o,u)}function Go(n,a,o,u){var p={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Vc(n))Nb(a,p);else{var y=n.alternate;if(n.lanes===0&&(y===null||y.lanes===0)&&(y=a.lastRenderedReducer,y!==null))try{var _=a.lastRenderedState,T=y(_,o);if(p.hasEagerState=!0,p.eagerState=T,$n(T,_))return Ec(n,a,p,0),wt===null&&Sc(),!1}catch{}finally{}if(o=Xf(n,a,p,u),o!==null)return On(o,n,u),Tb(o,a,u),!0}return!1}function Mh(n,a,o,u){if(u={lane:2,revertLane:dm(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Vc(n)){if(a)throw Error(s(479))}else a=Xf(n,o,u,2),a!==null&&On(a,n,2)}function Vc(n){var a=n.alternate;return n===Fe||a!==null&&a===Fe}function Nb(n,a){bi=zc=!0;var o=n.pending;o===null?a.next=a:(a.next=o.next,o.next=a),n.pending=a}function Tb(n,a,o){if((o&4194048)!==0){var u=a.lanes;u&=n.pendingLanes,o|=u,a.lanes=o,En(n,o)}}var Fo={readContext:sn,use:Uc,useCallback:Dt,useContext:Dt,useEffect:Dt,useImperativeHandle:Dt,useLayoutEffect:Dt,useInsertionEffect:Dt,useMemo:Dt,useReducer:Dt,useRef:Dt,useState:Dt,useDebugValue:Dt,useDeferredValue:Dt,useTransition:Dt,useSyncExternalStore:Dt,useId:Dt,useHostTransitionStatus:Dt,useFormState:Dt,useActionState:Dt,useOptimistic:Dt,useMemoCache:Dt,useCacheRefresh:Dt};Fo.useEffectEvent=Dt;var jb={readContext:sn,use:Uc,useCallback:function(n,a){return bn().memoizedState=[n,a===void 0?null:a],n},useContext:sn,useEffect:db,useImperativeHandle:function(n,a,o){o=o!=null?o.concat([n]):null,Hc(4194308,4,pb.bind(null,a,n),o)},useLayoutEffect:function(n,a){return Hc(4194308,4,n,a)},useInsertionEffect:function(n,a){Hc(4,2,n,a)},useMemo:function(n,a){var o=bn();a=a===void 0?null:a;var u=n();if(Es){Wt(!0);try{n()}finally{Wt(!1)}}return o.memoizedState=[u,a],u},useReducer:function(n,a,o){var u=bn();if(o!==void 0){var p=o(a);if(Es){Wt(!0);try{o(a)}finally{Wt(!1)}}}else p=a;return u.memoizedState=u.baseState=p,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:p},u.queue=n,n=n.dispatch=cA.bind(null,Fe,n),[u.memoizedState,n]},useRef:function(n){var a=bn();return n={current:n},a.memoizedState=n},useState:function(n){n=Nh(n);var a=n.queue,o=Cb.bind(null,Fe,a);return a.dispatch=o,[n.memoizedState,o]},useDebugValue:Ah,useDeferredValue:function(n,a){var o=bn();return Rh(o,n,a)},useTransition:function(){var n=Nh(!1);return n=xb.bind(null,Fe,n.queue,!0,!1),bn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,o){var u=Fe,p=bn();if(it){if(o===void 0)throw Error(s(407));o=o()}else{if(o=a(),wt===null)throw Error(s(349));(rt&127)!==0||Yy(u,a,o)}p.memoizedState=o;var y={value:o,getSnapshot:a};return p.queue=y,db(Jy.bind(null,u,y,n),[n]),u.flags|=2048,wi(9,{destroy:void 0},Xy.bind(null,u,y,o,a),null),o},useId:function(){var n=bn(),a=wt.identifierPrefix;if(it){var o=Nr,u=Cr;o=(u&~(1<<32-At(u)-1)).toString(32)+o,a="_"+a+"R_"+o,o=Ic++,0<o&&(a+="H"+o.toString(32)),a+="_"}else o=nA++,a="_"+a+"r_"+o.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:Oh,useFormState:ib,useActionState:ib,useOptimistic:function(n){var a=bn();a.memoizedState=a.baseState=n;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=o,a=Mh.bind(null,Fe,!0,o),o.dispatch=a,[n,a]},useMemoCache:Sh,useCacheRefresh:function(){return bn().memoizedState=lA.bind(null,Fe)},useEffectEvent:function(n){var a=bn(),o={impl:n};return a.memoizedState=o,function(){if((dt&2)!==0)throw Error(s(440));return o.impl.apply(void 0,arguments)}}},Dh={readContext:sn,use:Uc,useCallback:vb,useContext:sn,useEffect:jh,useImperativeHandle:gb,useInsertionEffect:hb,useLayoutEffect:mb,useMemo:yb,useReducer:Bc,useRef:ub,useState:function(){return Bc(Yr)},useDebugValue:Ah,useDeferredValue:function(n,a){var o=$t();return bb(o,gt.memoizedState,n,a)},useTransition:function(){var n=Bc(Yr)[0],a=$t().memoizedState;return[typeof n=="boolean"?n:Vo(n),a]},useSyncExternalStore:Wy,useId:Sb,useHostTransitionStatus:Oh,useFormState:ob,useActionState:ob,useOptimistic:function(n,a){var o=$t();return eb(o,gt,n,a)},useMemoCache:Sh,useCacheRefresh:Eb};Dh.useEffectEvent=fb;var Ab={readContext:sn,use:Uc,useCallback:vb,useContext:sn,useEffect:jh,useImperativeHandle:gb,useInsertionEffect:hb,useLayoutEffect:mb,useMemo:yb,useReducer:Ch,useRef:ub,useState:function(){return Ch(Yr)},useDebugValue:Ah,useDeferredValue:function(n,a){var o=$t();return gt===null?Rh(o,n,a):bb(o,gt.memoizedState,n,a)},useTransition:function(){var n=Ch(Yr)[0],a=$t().memoizedState;return[typeof n=="boolean"?n:Vo(n),a]},useSyncExternalStore:Wy,useId:Sb,useHostTransitionStatus:Oh,useFormState:cb,useActionState:cb,useOptimistic:function(n,a){var o=$t();return gt!==null?eb(o,gt,n,a):(o.baseState=n,[n,o.queue.dispatch])},useMemoCache:Sh,useCacheRefresh:Eb};Ab.useEffectEvent=fb;function Ph(n,a,o,u){a=n.memoizedState,o=o(u,a),o=o==null?a:g({},a,o),n.memoizedState=o,n.lanes===0&&(n.updateQueue.baseState=o)}var Lh={enqueueSetState:function(n,a,o){n=n._reactInternals;var u=Gn(),p=Ra(u);p.payload=a,o!=null&&(p.callback=o),a=ka(n,p,u),a!==null&&(On(a,n,u),Uo(a,n,u))},enqueueReplaceState:function(n,a,o){n=n._reactInternals;var u=Gn(),p=Ra(u);p.tag=1,p.payload=a,o!=null&&(p.callback=o),a=ka(n,p,u),a!==null&&(On(a,n,u),Uo(a,n,u))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var o=Gn(),u=Ra(o);u.tag=2,a!=null&&(u.callback=a),a=ka(n,u,o),a!==null&&(On(a,n,o),Uo(a,n,o))}};function Rb(n,a,o,u,p,y,_){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(u,y,_):a.prototype&&a.prototype.isPureReactComponent?!Oo(o,u)||!Oo(p,y):!0}function kb(n,a,o,u){n=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(o,u),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(o,u),a.state!==n&&Lh.enqueueReplaceState(a,a.state,null)}function Cs(n,a){var o=a;if("ref"in a){o={};for(var u in a)u!=="ref"&&(o[u]=a[u])}if(n=n.defaultProps){o===a&&(o=g({},o));for(var p in n)o[p]===void 0&&(o[p]=n[p])}return o}function Ob(n){_c(n)}function Mb(n){console.error(n)}function Db(n){_c(n)}function Gc(n,a){try{var o=n.onUncaughtError;o(a.value,{componentStack:a.stack})}catch(u){setTimeout(function(){throw u})}}function Pb(n,a,o){try{var u=n.onCaughtError;u(o.value,{componentStack:o.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function zh(n,a,o){return o=Ra(o),o.tag=3,o.payload={element:null},o.callback=function(){Gc(n,a)},o}function Lb(n){return n=Ra(n),n.tag=3,n}function zb(n,a,o,u){var p=o.type.getDerivedStateFromError;if(typeof p=="function"){var y=u.value;n.payload=function(){return p(y)},n.callback=function(){Pb(a,o,u)}}var _=o.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(n.callback=function(){Pb(a,o,u),typeof p!="function"&&(za===null?za=new Set([this]):za.add(this));var T=u.stack;this.componentDidCatch(u.value,{componentStack:T!==null?T:""})})}function uA(n,a,o,u,p){if(o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(a=o.alternate,a!==null&&hi(a,o,p,!0),o=Bn.current,o!==null){switch(o.tag){case 31:case 13:return nr===null?ru():o.alternate===null&&Pt===0&&(Pt=3),o.flags&=-257,o.flags|=65536,o.lanes=p,u===Oc?o.flags|=16384:(a=o.updateQueue,a===null?o.updateQueue=new Set([u]):a.add(u),lm(n,u,p)),!1;case 22:return o.flags|=65536,u===Oc?o.flags|=16384:(a=o.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([u])},o.updateQueue=a):(o=a.retryQueue,o===null?a.retryQueue=new Set([u]):o.add(u)),lm(n,u,p)),!1}throw Error(s(435,o.tag))}return lm(n,u,p),ru(),!1}if(it)return a=Bn.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=p,u!==nh&&(n=Error(s(422),{cause:u}),Po(Qn(n,o)))):(u!==nh&&(a=Error(s(423),{cause:u}),Po(Qn(a,o))),n=n.current.alternate,n.flags|=65536,p&=-p,n.lanes|=p,u=Qn(u,o),p=zh(n.stateNode,u,p),hh(n,p),Pt!==4&&(Pt=2)),!1;var y=Error(s(520),{cause:u});if(y=Qn(y,o),el===null?el=[y]:el.push(y),Pt!==4&&(Pt=2),a===null)return!0;u=Qn(u,o),o=a;do{switch(o.tag){case 3:return o.flags|=65536,n=p&-p,o.lanes|=n,n=zh(o.stateNode,u,n),hh(o,n),!1;case 1:if(a=o.type,y=o.stateNode,(o.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(za===null||!za.has(y))))return o.flags|=65536,p&=-p,o.lanes|=p,p=Lb(p),zb(p,n,o,u),hh(o,p),!1}o=o.return}while(o!==null);return!1}var Ih=Error(s(461)),qt=!1;function on(n,a,o,u){a.child=n===null?By(a,null,o,u):Ss(a,n.child,o,u)}function Ib(n,a,o,u,p){o=o.render;var y=a.ref;if("ref"in u){var _={};for(var T in u)T!=="ref"&&(_[T]=u[T])}else _=u;return bs(a),u=bh(n,a,o,_,y,p),T=xh(),n!==null&&!qt?(wh(n,a,p),Xr(n,a,p)):(it&&T&&eh(a),a.flags|=1,on(n,a,u,p),a.child)}function $b(n,a,o,u,p){if(n===null){var y=o.type;return typeof y=="function"&&!Jf(y)&&y.defaultProps===void 0&&o.compare===null?(a.tag=15,a.type=y,Ub(n,a,y,u,p)):(n=Nc(o.type,null,u,a,a.mode,p),n.ref=a.ref,n.return=a,a.child=n)}if(y=n.child,!Fh(n,p)){var _=y.memoizedProps;if(o=o.compare,o=o!==null?o:Oo,o(_,u)&&n.ref===a.ref)return Xr(n,a,p)}return a.flags|=1,n=Vr(y,u),n.ref=a.ref,n.return=a,a.child=n}function Ub(n,a,o,u,p){if(n!==null){var y=n.memoizedProps;if(Oo(y,u)&&n.ref===a.ref)if(qt=!1,a.pendingProps=u=y,Fh(n,p))(n.flags&131072)!==0&&(qt=!0);else return a.lanes=n.lanes,Xr(n,a,p)}return $h(n,a,o,u,p)}function Bb(n,a,o,u){var p=u.children,y=n!==null?n.memoizedState:null;if(n===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((a.flags&128)!==0){if(y=y!==null?y.baseLanes|o:o,n!==null){for(u=a.child=n.child,p=0;u!==null;)p=p|u.lanes|u.childLanes,u=u.sibling;u=p&~y}else u=0,a.child=null;return Hb(n,a,y,o,u)}if((o&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},n!==null&&Rc(a,y!==null?y.cachePool:null),y!==null?Vy(a,y):ph(),Gy(a);else return u=a.lanes=536870912,Hb(n,a,y!==null?y.baseLanes|o:o,o,u)}else y!==null?(Rc(a,y.cachePool),Vy(a,y),Ma(),a.memoizedState=null):(n!==null&&Rc(a,null),ph(),Ma());return on(n,a,p,o),a.child}function Ko(n,a){return n!==null&&n.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Hb(n,a,o,u,p){var y=ch();return y=y===null?null:{parent:Bt._currentValue,pool:y},a.memoizedState={baseLanes:o,cachePool:y},n!==null&&Rc(a,null),ph(),Gy(a),n!==null&&hi(n,a,u,!0),a.childLanes=p,null}function Fc(n,a){return a=Wc({mode:a.mode,children:a.children},n.mode),a.ref=n.ref,n.child=a,a.return=n,a}function qb(n,a,o){return Ss(a,n.child,null,o),n=Fc(a,a.pendingProps),n.flags|=2,Hn(a),a.memoizedState=null,n}function dA(n,a,o){var u=a.pendingProps,p=(a.flags&128)!==0;if(a.flags&=-129,n===null){if(it){if(u.mode==="hidden")return n=Fc(a,u),a.lanes=536870912,Ko(null,n);if(vh(a),(n=Nt)?(n=tx(n,tr),n=n!==null&&n.data==="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:Ca!==null?{id:Cr,overflow:Nr}:null,retryLane:536870912,hydrationErrors:null},o=Ny(n),o.return=a,a.child=o,an=a,Nt=null)):n=null,n===null)throw Ta(a);return a.lanes=536870912,null}return Fc(a,u)}var y=n.memoizedState;if(y!==null){var _=y.dehydrated;if(vh(a),p)if(a.flags&256)a.flags&=-257,a=qb(n,a,o);else if(a.memoizedState!==null)a.child=n.child,a.flags|=128,a=null;else throw Error(s(558));else if(qt||hi(n,a,o,!1),p=(o&n.childLanes)!==0,qt||p){if(u=wt,u!==null&&(_=Cn(u,o),_!==0&&_!==y.retryLane))throw y.retryLane=_,ps(n,_),On(u,n,_),Ih;ru(),a=qb(n,a,o)}else n=y.treeContext,Nt=rr(_.nextSibling),an=a,it=!0,Na=null,tr=!1,n!==null&&Ay(a,n),a=Fc(a,u),a.flags|=4096;return a}return n=Vr(n.child,{mode:u.mode,children:u.children}),n.ref=a.ref,a.child=n,n.return=a,n}function Kc(n,a){var o=a.ref;if(o===null)n!==null&&n.ref!==null&&(a.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(s(284));(n===null||n.ref!==o)&&(a.flags|=4194816)}}function $h(n,a,o,u,p){return bs(a),o=bh(n,a,o,u,void 0,p),u=xh(),n!==null&&!qt?(wh(n,a,p),Xr(n,a,p)):(it&&u&&eh(a),a.flags|=1,on(n,a,o,p),a.child)}function Vb(n,a,o,u,p,y){return bs(a),a.updateQueue=null,o=Ky(a,u,o,p),Fy(n),u=xh(),n!==null&&!qt?(wh(n,a,y),Xr(n,a,y)):(it&&u&&eh(a),a.flags|=1,on(n,a,o,y),a.child)}function Gb(n,a,o,u,p){if(bs(a),a.stateNode===null){var y=ci,_=o.contextType;typeof _=="object"&&_!==null&&(y=sn(_)),y=new o(u,y),a.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Lh,a.stateNode=y,y._reactInternals=a,y=a.stateNode,y.props=u,y.state=a.memoizedState,y.refs={},dh(a),_=o.contextType,y.context=typeof _=="object"&&_!==null?sn(_):ci,y.state=a.memoizedState,_=o.getDerivedStateFromProps,typeof _=="function"&&(Ph(a,o,_,u),y.state=a.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(_=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),_!==y.state&&Lh.enqueueReplaceState(y,y.state,null),Ho(a,u,y,p),Bo(),y.state=a.memoizedState),typeof y.componentDidMount=="function"&&(a.flags|=4194308),u=!0}else if(n===null){y=a.stateNode;var T=a.memoizedProps,D=Cs(o,T);y.props=D;var F=y.context,te=o.contextType;_=ci,typeof te=="object"&&te!==null&&(_=sn(te));var ie=o.getDerivedStateFromProps;te=typeof ie=="function"||typeof y.getSnapshotBeforeUpdate=="function",T=a.pendingProps!==T,te||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(T||F!==_)&&kb(a,y,u,_),Aa=!1;var W=a.memoizedState;y.state=W,Ho(a,u,y,p),Bo(),F=a.memoizedState,T||W!==F||Aa?(typeof ie=="function"&&(Ph(a,o,ie,u),F=a.memoizedState),(D=Aa||Rb(a,o,D,u,W,F,_))?(te||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(a.flags|=4194308)):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=u,a.memoizedState=F),y.props=u,y.state=F,y.context=_,u=D):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),u=!1)}else{y=a.stateNode,fh(n,a),_=a.memoizedProps,te=Cs(o,_),y.props=te,ie=a.pendingProps,W=y.context,F=o.contextType,D=ci,typeof F=="object"&&F!==null&&(D=sn(F)),T=o.getDerivedStateFromProps,(F=typeof T=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(_!==ie||W!==D)&&kb(a,y,u,D),Aa=!1,W=a.memoizedState,y.state=W,Ho(a,u,y,p),Bo();var J=a.memoizedState;_!==ie||W!==J||Aa||n!==null&&n.dependencies!==null&&jc(n.dependencies)?(typeof T=="function"&&(Ph(a,o,T,u),J=a.memoizedState),(te=Aa||Rb(a,o,te,u,W,J,D)||n!==null&&n.dependencies!==null&&jc(n.dependencies))?(F||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(u,J,D),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(u,J,D)),typeof y.componentDidUpdate=="function"&&(a.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof y.componentDidUpdate!="function"||_===n.memoizedProps&&W===n.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||_===n.memoizedProps&&W===n.memoizedState||(a.flags|=1024),a.memoizedProps=u,a.memoizedState=J),y.props=u,y.state=J,y.context=D,u=te):(typeof y.componentDidUpdate!="function"||_===n.memoizedProps&&W===n.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||_===n.memoizedProps&&W===n.memoizedState||(a.flags|=1024),u=!1)}return y=u,Kc(n,a),u=(a.flags&128)!==0,y||u?(y=a.stateNode,o=u&&typeof o.getDerivedStateFromError!="function"?null:y.render(),a.flags|=1,n!==null&&u?(a.child=Ss(a,n.child,null,p),a.child=Ss(a,null,o,p)):on(n,a,o,p),a.memoizedState=y.state,n=a.child):n=Xr(n,a,p),n}function Fb(n,a,o,u){return vs(),a.flags|=256,on(n,a,o,u),a.child}var Uh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Bh(n){return{baseLanes:n,cachePool:Py()}}function Hh(n,a,o){return n=n!==null?n.childLanes&~o:0,a&&(n|=Vn),n}function Kb(n,a,o){var u=a.pendingProps,p=!1,y=(a.flags&128)!==0,_;if((_=y)||(_=n!==null&&n.memoizedState===null?!1:(It.current&2)!==0),_&&(p=!0,a.flags&=-129),_=(a.flags&32)!==0,a.flags&=-33,n===null){if(it){if(p?Oa(a):Ma(),(n=Nt)?(n=tx(n,tr),n=n!==null&&n.data!=="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:Ca!==null?{id:Cr,overflow:Nr}:null,retryLane:536870912,hydrationErrors:null},o=Ny(n),o.return=a,a.child=o,an=a,Nt=null)):n=null,n===null)throw Ta(a);return Em(n)?a.lanes=32:a.lanes=536870912,null}var T=u.children;return u=u.fallback,p?(Ma(),p=a.mode,T=Wc({mode:"hidden",children:T},p),u=gs(u,p,o,null),T.return=a,u.return=a,T.sibling=u,a.child=T,u=a.child,u.memoizedState=Bh(o),u.childLanes=Hh(n,_,o),a.memoizedState=Uh,Ko(null,u)):(Oa(a),qh(a,T))}var D=n.memoizedState;if(D!==null&&(T=D.dehydrated,T!==null)){if(y)a.flags&256?(Oa(a),a.flags&=-257,a=Vh(n,a,o)):a.memoizedState!==null?(Ma(),a.child=n.child,a.flags|=128,a=null):(Ma(),T=u.fallback,p=a.mode,u=Wc({mode:"visible",children:u.children},p),T=gs(T,p,o,null),T.flags|=2,u.return=a,T.return=a,u.sibling=T,a.child=u,Ss(a,n.child,null,o),u=a.child,u.memoizedState=Bh(o),u.childLanes=Hh(n,_,o),a.memoizedState=Uh,a=Ko(null,u));else if(Oa(a),Em(T)){if(_=T.nextSibling&&T.nextSibling.dataset,_)var F=_.dgst;_=F,u=Error(s(419)),u.stack="",u.digest=_,Po({value:u,source:null,stack:null}),a=Vh(n,a,o)}else if(qt||hi(n,a,o,!1),_=(o&n.childLanes)!==0,qt||_){if(_=wt,_!==null&&(u=Cn(_,o),u!==0&&u!==D.retryLane))throw D.retryLane=u,ps(n,u),On(_,n,u),Ih;Sm(T)||ru(),a=Vh(n,a,o)}else Sm(T)?(a.flags|=192,a.child=n.child,a=null):(n=D.treeContext,Nt=rr(T.nextSibling),an=a,it=!0,Na=null,tr=!1,n!==null&&Ay(a,n),a=qh(a,u.children),a.flags|=4096);return a}return p?(Ma(),T=u.fallback,p=a.mode,D=n.child,F=D.sibling,u=Vr(D,{mode:"hidden",children:u.children}),u.subtreeFlags=D.subtreeFlags&65011712,F!==null?T=Vr(F,T):(T=gs(T,p,o,null),T.flags|=2),T.return=a,u.return=a,u.sibling=T,a.child=u,Ko(null,u),u=a.child,T=n.child.memoizedState,T===null?T=Bh(o):(p=T.cachePool,p!==null?(D=Bt._currentValue,p=p.parent!==D?{parent:D,pool:D}:p):p=Py(),T={baseLanes:T.baseLanes|o,cachePool:p}),u.memoizedState=T,u.childLanes=Hh(n,_,o),a.memoizedState=Uh,Ko(n.child,u)):(Oa(a),o=n.child,n=o.sibling,o=Vr(o,{mode:"visible",children:u.children}),o.return=a,o.sibling=null,n!==null&&(_=a.deletions,_===null?(a.deletions=[n],a.flags|=16):_.push(n)),a.child=o,a.memoizedState=null,o)}function qh(n,a){return a=Wc({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function Wc(n,a){return n=Un(22,n,null,a),n.lanes=0,n}function Vh(n,a,o){return Ss(a,n.child,null,o),n=qh(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function Wb(n,a,o){n.lanes|=a;var u=n.alternate;u!==null&&(u.lanes|=a),sh(n.return,a,o)}function Gh(n,a,o,u,p,y){var _=n.memoizedState;_===null?n.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:u,tail:o,tailMode:p,treeForkCount:y}:(_.isBackwards=a,_.rendering=null,_.renderingStartTime=0,_.last=u,_.tail=o,_.tailMode=p,_.treeForkCount=y)}function Yb(n,a,o){var u=a.pendingProps,p=u.revealOrder,y=u.tail;u=u.children;var _=It.current,T=(_&2)!==0;if(T?(_=_&1|2,a.flags|=128):_&=1,$(It,_),on(n,a,u,o),u=it?Do:0,!T&&n!==null&&(n.flags&128)!==0)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Wb(n,o,a);else if(n.tag===19)Wb(n,o,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(p){case"forwards":for(o=a.child,p=null;o!==null;)n=o.alternate,n!==null&&Lc(n)===null&&(p=o),o=o.sibling;o=p,o===null?(p=a.child,a.child=null):(p=o.sibling,o.sibling=null),Gh(a,!1,p,o,y,u);break;case"backwards":case"unstable_legacy-backwards":for(o=null,p=a.child,a.child=null;p!==null;){if(n=p.alternate,n!==null&&Lc(n)===null){a.child=p;break}n=p.sibling,p.sibling=o,o=p,p=n}Gh(a,!0,o,null,y,u);break;case"together":Gh(a,!1,null,null,void 0,u);break;default:a.memoizedState=null}return a.child}function Xr(n,a,o){if(n!==null&&(a.dependencies=n.dependencies),La|=a.lanes,(o&a.childLanes)===0)if(n!==null){if(hi(n,a,o,!1),(o&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,o=Vr(n,n.pendingProps),a.child=o,o.return=a;n.sibling!==null;)n=n.sibling,o=o.sibling=Vr(n,n.pendingProps),o.return=a;o.sibling=null}return a.child}function Fh(n,a){return(n.lanes&a)!==0?!0:(n=n.dependencies,!!(n!==null&&jc(n)))}function fA(n,a,o){switch(a.tag){case 3:Q(a,a.stateNode.containerInfo),ja(a,Bt,n.memoizedState.cache),vs();break;case 27:case 5:se(a);break;case 4:Q(a,a.stateNode.containerInfo);break;case 10:ja(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,vh(a),null;break;case 13:var u=a.memoizedState;if(u!==null)return u.dehydrated!==null?(Oa(a),a.flags|=128,null):(o&a.child.childLanes)!==0?Kb(n,a,o):(Oa(a),n=Xr(n,a,o),n!==null?n.sibling:null);Oa(a);break;case 19:var p=(n.flags&128)!==0;if(u=(o&a.childLanes)!==0,u||(hi(n,a,o,!1),u=(o&a.childLanes)!==0),p){if(u)return Yb(n,a,o);a.flags|=128}if(p=a.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),$(It,It.current),u)break;return null;case 22:return a.lanes=0,Bb(n,a,o,a.pendingProps);case 24:ja(a,Bt,n.memoizedState.cache)}return Xr(n,a,o)}function Xb(n,a,o){if(n!==null)if(n.memoizedProps!==a.pendingProps)qt=!0;else{if(!Fh(n,o)&&(a.flags&128)===0)return qt=!1,fA(n,a,o);qt=(n.flags&131072)!==0}else qt=!1,it&&(a.flags&1048576)!==0&&jy(a,Do,a.index);switch(a.lanes=0,a.tag){case 16:e:{var u=a.pendingProps;if(n=ws(a.elementType),a.type=n,typeof n=="function")Jf(n)?(u=Cs(n,u),a.tag=1,a=Gb(null,a,n,u,o)):(a.tag=0,a=$h(null,a,n,u,o));else{if(n!=null){var p=n.$$typeof;if(p===k){a.tag=11,a=Ib(null,a,n,u,o);break e}else if(p===P){a.tag=14,a=$b(null,a,n,u,o);break e}}throw a=pe(n)||n,Error(s(306,a,""))}}return a;case 0:return $h(n,a,a.type,a.pendingProps,o);case 1:return u=a.type,p=Cs(u,a.pendingProps),Gb(n,a,u,p,o);case 3:e:{if(Q(a,a.stateNode.containerInfo),n===null)throw Error(s(387));u=a.pendingProps;var y=a.memoizedState;p=y.element,fh(n,a),Ho(a,u,null,o);var _=a.memoizedState;if(u=_.cache,ja(a,Bt,u),u!==y.cache&&ih(a,[Bt],o,!0),Bo(),u=_.element,y.isDehydrated)if(y={element:u,isDehydrated:!1,cache:_.cache},a.updateQueue.baseState=y,a.memoizedState=y,a.flags&256){a=Fb(n,a,u,o);break e}else if(u!==p){p=Qn(Error(s(424)),a),Po(p),a=Fb(n,a,u,o);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(Nt=rr(n.firstChild),an=a,it=!0,Na=null,tr=!0,o=By(a,null,u,o),a.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling}else{if(vs(),u===p){a=Xr(n,a,o);break e}on(n,a,u,o)}a=a.child}return a;case 26:return Kc(n,a),n===null?(o=ox(a.type,null,a.pendingProps,null))?a.memoizedState=o:it||(o=a.type,n=a.pendingProps,u=uu(ne.current).createElement(o),u[rn]=a,u[Nn]=n,ln(u,o,n),Zt(u),a.stateNode=u):a.memoizedState=ox(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return se(a),n===null&&it&&(u=a.stateNode=ax(a.type,a.pendingProps,ne.current),an=a,tr=!0,p=Nt,Ba(a.type)?(Cm=p,Nt=rr(u.firstChild)):Nt=p),on(n,a,a.pendingProps.children,o),Kc(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&it&&((p=u=Nt)&&(u=HA(u,a.type,a.pendingProps,tr),u!==null?(a.stateNode=u,an=a,Nt=rr(u.firstChild),tr=!1,p=!0):p=!1),p||Ta(a)),se(a),p=a.type,y=a.pendingProps,_=n!==null?n.memoizedProps:null,u=y.children,xm(p,y)?u=null:_!==null&&xm(p,_)&&(a.flags|=32),a.memoizedState!==null&&(p=bh(n,a,rA,null,null,o),ll._currentValue=p),Kc(n,a),on(n,a,u,o),a.child;case 6:return n===null&&it&&((n=o=Nt)&&(o=qA(o,a.pendingProps,tr),o!==null?(a.stateNode=o,an=a,Nt=null,n=!0):n=!1),n||Ta(a)),null;case 13:return Kb(n,a,o);case 4:return Q(a,a.stateNode.containerInfo),u=a.pendingProps,n===null?a.child=Ss(a,null,u,o):on(n,a,u,o),a.child;case 11:return Ib(n,a,a.type,a.pendingProps,o);case 7:return on(n,a,a.pendingProps,o),a.child;case 8:return on(n,a,a.pendingProps.children,o),a.child;case 12:return on(n,a,a.pendingProps.children,o),a.child;case 10:return u=a.pendingProps,ja(a,a.type,u.value),on(n,a,u.children,o),a.child;case 9:return p=a.type._context,u=a.pendingProps.children,bs(a),p=sn(p),u=u(p),a.flags|=1,on(n,a,u,o),a.child;case 14:return $b(n,a,a.type,a.pendingProps,o);case 15:return Ub(n,a,a.type,a.pendingProps,o);case 19:return Yb(n,a,o);case 31:return dA(n,a,o);case 22:return Bb(n,a,o,a.pendingProps);case 24:return bs(a),u=sn(Bt),n===null?(p=ch(),p===null&&(p=wt,y=oh(),p.pooledCache=y,y.refCount++,y!==null&&(p.pooledCacheLanes|=o),p=y),a.memoizedState={parent:u,cache:p},dh(a),ja(a,Bt,p)):((n.lanes&o)!==0&&(fh(n,a),Ho(a,null,null,o),Bo()),p=n.memoizedState,y=a.memoizedState,p.parent!==u?(p={parent:u,cache:u},a.memoizedState=p,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=p),ja(a,Bt,u)):(u=y.cache,ja(a,Bt,u),u!==p.cache&&ih(a,[Bt],o,!0))),on(n,a,a.pendingProps.children,o),a.child;case 29:throw a.pendingProps}throw Error(s(156,a.tag))}function Jr(n){n.flags|=4}function Kh(n,a,o,u,p){if((a=(n.mode&32)!==0)&&(a=!1),a){if(n.flags|=16777216,(p&335544128)===p)if(n.stateNode.complete)n.flags|=8192;else if(S0())n.flags|=8192;else throw _s=Oc,uh}else n.flags&=-16777217}function Jb(n,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!fx(a))if(S0())n.flags|=8192;else throw _s=Oc,uh}function Yc(n,a){a!==null&&(n.flags|=4),n.flags&16384&&(a=n.tag!==22?mn():536870912,n.lanes|=a,Ci|=a)}function Wo(n,a){if(!it)switch(n.tailMode){case"hidden":a=n.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?n.tail=null:o.sibling=null;break;case"collapsed":o=n.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?a||n.tail===null?n.tail=null:n.tail.sibling=null:u.sibling=null}}function Tt(n){var a=n.alternate!==null&&n.alternate.child===n.child,o=0,u=0;if(a)for(var p=n.child;p!==null;)o|=p.lanes|p.childLanes,u|=p.subtreeFlags&65011712,u|=p.flags&65011712,p.return=n,p=p.sibling;else for(p=n.child;p!==null;)o|=p.lanes|p.childLanes,u|=p.subtreeFlags,u|=p.flags,p.return=n,p=p.sibling;return n.subtreeFlags|=u,n.childLanes=o,a}function hA(n,a,o){var u=a.pendingProps;switch(th(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Tt(a),null;case 1:return Tt(a),null;case 3:return o=a.stateNode,u=null,n!==null&&(u=n.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Kr(Bt),ae(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(n===null||n.child===null)&&(fi(a)?Jr(a):n===null||n.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,rh())),Tt(a),null;case 26:var p=a.type,y=a.memoizedState;return n===null?(Jr(a),y!==null?(Tt(a),Jb(a,y)):(Tt(a),Kh(a,p,null,u,o))):y?y!==n.memoizedState?(Jr(a),Tt(a),Jb(a,y)):(Tt(a),a.flags&=-16777217):(n=n.memoizedProps,n!==u&&Jr(a),Tt(a),Kh(a,p,n,u,o)),null;case 27:if(Ee(a),o=ne.current,p=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==u&&Jr(a);else{if(!u){if(a.stateNode===null)throw Error(s(166));return Tt(a),null}n=Y.current,fi(a)?Ry(a):(n=ax(p,u,o),a.stateNode=n,Jr(a))}return Tt(a),null;case 5:if(Ee(a),p=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==u&&Jr(a);else{if(!u){if(a.stateNode===null)throw Error(s(166));return Tt(a),null}if(y=Y.current,fi(a))Ry(a);else{var _=uu(ne.current);switch(y){case 1:y=_.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:y=_.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":y=_.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":y=_.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":y=_.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof u.is=="string"?_.createElement("select",{is:u.is}):_.createElement("select"),u.multiple?y.multiple=!0:u.size&&(y.size=u.size);break;default:y=typeof u.is=="string"?_.createElement(p,{is:u.is}):_.createElement(p)}}y[rn]=a,y[Nn]=u;e:for(_=a.child;_!==null;){if(_.tag===5||_.tag===6)y.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===a)break e;for(;_.sibling===null;){if(_.return===null||_.return===a)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}a.stateNode=y;e:switch(ln(y,p,u),p){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Jr(a)}}return Tt(a),Kh(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,o),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==u&&Jr(a);else{if(typeof u!="string"&&a.stateNode===null)throw Error(s(166));if(n=ne.current,fi(a)){if(n=a.stateNode,o=a.memoizedProps,u=null,p=an,p!==null)switch(p.tag){case 27:case 5:u=p.memoizedProps}n[rn]=a,n=!!(n.nodeValue===o||u!==null&&u.suppressHydrationWarning===!0||K0(n.nodeValue,o)),n||Ta(a,!0)}else n=uu(n).createTextNode(u),n[rn]=a,a.stateNode=n}return Tt(a),null;case 31:if(o=a.memoizedState,n===null||n.memoizedState!==null){if(u=fi(a),o!==null){if(n===null){if(!u)throw Error(s(318));if(n=a.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(557));n[rn]=a}else vs(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Tt(a),n=!1}else o=rh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=o),n=!0;if(!n)return a.flags&256?(Hn(a),a):(Hn(a),null);if((a.flags&128)!==0)throw Error(s(558))}return Tt(a),null;case 13:if(u=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(p=fi(a),u!==null&&u.dehydrated!==null){if(n===null){if(!p)throw Error(s(318));if(p=a.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(s(317));p[rn]=a}else vs(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Tt(a),p=!1}else p=rh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=p),p=!0;if(!p)return a.flags&256?(Hn(a),a):(Hn(a),null)}return Hn(a),(a.flags&128)!==0?(a.lanes=o,a):(o=u!==null,n=n!==null&&n.memoizedState!==null,o&&(u=a.child,p=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(p=u.alternate.memoizedState.cachePool.pool),y=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(y=u.memoizedState.cachePool.pool),y!==p&&(u.flags|=2048)),o!==n&&o&&(a.child.flags|=8192),Yc(a,a.updateQueue),Tt(a),null);case 4:return ae(),n===null&&pm(a.stateNode.containerInfo),Tt(a),null;case 10:return Kr(a.type),Tt(a),null;case 19:if(M(It),u=a.memoizedState,u===null)return Tt(a),null;if(p=(a.flags&128)!==0,y=u.rendering,y===null)if(p)Wo(u,!1);else{if(Pt!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(y=Lc(n),y!==null){for(a.flags|=128,Wo(u,!1),n=y.updateQueue,a.updateQueue=n,Yc(a,n),a.subtreeFlags=0,n=o,o=a.child;o!==null;)Cy(o,n),o=o.sibling;return $(It,It.current&1|2),it&&Gr(a,u.treeForkCount),a.child}n=n.sibling}u.tail!==null&&Be()>eu&&(a.flags|=128,p=!0,Wo(u,!1),a.lanes=4194304)}else{if(!p)if(n=Lc(y),n!==null){if(a.flags|=128,p=!0,n=n.updateQueue,a.updateQueue=n,Yc(a,n),Wo(u,!0),u.tail===null&&u.tailMode==="hidden"&&!y.alternate&&!it)return Tt(a),null}else 2*Be()-u.renderingStartTime>eu&&o!==536870912&&(a.flags|=128,p=!0,Wo(u,!1),a.lanes=4194304);u.isBackwards?(y.sibling=a.child,a.child=y):(n=u.last,n!==null?n.sibling=y:a.child=y,u.last=y)}return u.tail!==null?(n=u.tail,u.rendering=n,u.tail=n.sibling,u.renderingStartTime=Be(),n.sibling=null,o=It.current,$(It,p?o&1|2:o&1),it&&Gr(a,u.treeForkCount),n):(Tt(a),null);case 22:case 23:return Hn(a),gh(),u=a.memoizedState!==null,n!==null?n.memoizedState!==null!==u&&(a.flags|=8192):u&&(a.flags|=8192),u?(o&536870912)!==0&&(a.flags&128)===0&&(Tt(a),a.subtreeFlags&6&&(a.flags|=8192)):Tt(a),o=a.updateQueue,o!==null&&Yc(a,o.retryQueue),o=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==o&&(a.flags|=2048),n!==null&&M(xs),null;case 24:return o=null,n!==null&&(o=n.memoizedState.cache),a.memoizedState.cache!==o&&(a.flags|=2048),Kr(Bt),Tt(a),null;case 25:return null;case 30:return null}throw Error(s(156,a.tag))}function mA(n,a){switch(th(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return Kr(Bt),ae(),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(Hn(a),a.alternate===null)throw Error(s(340));vs()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(Hn(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(s(340));vs()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return M(It),null;case 4:return ae(),null;case 10:return Kr(a.type),null;case 22:case 23:return Hn(a),gh(),n!==null&&M(xs),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return Kr(Bt),null;case 25:return null;default:return null}}function Qb(n,a){switch(th(a),a.tag){case 3:Kr(Bt),ae();break;case 26:case 27:case 5:Ee(a);break;case 4:ae();break;case 31:a.memoizedState!==null&&Hn(a);break;case 13:Hn(a);break;case 19:M(It);break;case 10:Kr(a.type);break;case 22:case 23:Hn(a),gh(),n!==null&&M(xs);break;case 24:Kr(Bt)}}function Yo(n,a){try{var o=a.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var p=u.next;o=p;do{if((o.tag&n)===n){u=void 0;var y=o.create,_=o.inst;u=y(),_.destroy=u}o=o.next}while(o!==p)}}catch(T){mt(a,a.return,T)}}function Da(n,a,o){try{var u=a.updateQueue,p=u!==null?u.lastEffect:null;if(p!==null){var y=p.next;u=y;do{if((u.tag&n)===n){var _=u.inst,T=_.destroy;if(T!==void 0){_.destroy=void 0,p=a;var D=o,F=T;try{F()}catch(te){mt(p,D,te)}}}u=u.next}while(u!==y)}}catch(te){mt(a,a.return,te)}}function Zb(n){var a=n.updateQueue;if(a!==null){var o=n.stateNode;try{qy(a,o)}catch(u){mt(n,n.return,u)}}}function e0(n,a,o){o.props=Cs(n.type,n.memoizedProps),o.state=n.memoizedState;try{o.componentWillUnmount()}catch(u){mt(n,a,u)}}function Xo(n,a){try{var o=n.ref;if(o!==null){switch(n.tag){case 26:case 27:case 5:var u=n.stateNode;break;case 30:u=n.stateNode;break;default:u=n.stateNode}typeof o=="function"?n.refCleanup=o(u):o.current=u}}catch(p){mt(n,a,p)}}function Tr(n,a){var o=n.ref,u=n.refCleanup;if(o!==null)if(typeof u=="function")try{u()}catch(p){mt(n,a,p)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(p){mt(n,a,p)}else o.current=null}function t0(n){var a=n.type,o=n.memoizedProps,u=n.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":o.autoFocus&&u.focus();break e;case"img":o.src?u.src=o.src:o.srcSet&&(u.srcset=o.srcSet)}}catch(p){mt(n,n.return,p)}}function Wh(n,a,o){try{var u=n.stateNode;LA(u,n.type,o,a),u[Nn]=a}catch(p){mt(n,n.return,p)}}function n0(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Ba(n.type)||n.tag===4}function Yh(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||n0(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&&Ba(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 Xh(n,a,o){var u=n.tag;if(u===5||u===6)n=n.stateNode,a?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(n,a):(a=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,a.appendChild(n),o=o._reactRootContainer,o!=null||a.onclick!==null||(a.onclick=Hr));else if(u!==4&&(u===27&&Ba(n.type)&&(o=n.stateNode,a=null),n=n.child,n!==null))for(Xh(n,a,o),n=n.sibling;n!==null;)Xh(n,a,o),n=n.sibling}function Xc(n,a,o){var u=n.tag;if(u===5||u===6)n=n.stateNode,a?o.insertBefore(n,a):o.appendChild(n);else if(u!==4&&(u===27&&Ba(n.type)&&(o=n.stateNode),n=n.child,n!==null))for(Xc(n,a,o),n=n.sibling;n!==null;)Xc(n,a,o),n=n.sibling}function r0(n){var a=n.stateNode,o=n.memoizedProps;try{for(var u=n.type,p=a.attributes;p.length;)a.removeAttributeNode(p[0]);ln(a,u,o),a[rn]=n,a[Nn]=o}catch(y){mt(n,n.return,y)}}var Qr=!1,Vt=!1,Jh=!1,a0=typeof WeakSet=="function"?WeakSet:Set,en=null;function pA(n,a){if(n=n.containerInfo,ym=vu,n=gy(n),Vf(n)){if("selectionStart"in n)var o={start:n.selectionStart,end:n.selectionEnd};else e:{o=(o=n.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var p=u.anchorOffset,y=u.focusNode;u=u.focusOffset;try{o.nodeType,y.nodeType}catch{o=null;break e}var _=0,T=-1,D=-1,F=0,te=0,ie=n,W=null;t:for(;;){for(var J;ie!==o||p!==0&&ie.nodeType!==3||(T=_+p),ie!==y||u!==0&&ie.nodeType!==3||(D=_+u),ie.nodeType===3&&(_+=ie.nodeValue.length),(J=ie.firstChild)!==null;)W=ie,ie=J;for(;;){if(ie===n)break t;if(W===o&&++F===p&&(T=_),W===y&&++te===u&&(D=_),(J=ie.nextSibling)!==null)break;ie=W,W=ie.parentNode}ie=J}o=T===-1||D===-1?null:{start:T,end:D}}else o=null}o=o||{start:0,end:0}}else o=null;for(bm={focusedElem:n,selectionRange:o},vu=!1,en=a;en!==null;)if(a=en,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,en=n;else for(;en!==null;){switch(a=en,y=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(o=0;o<n.length;o++)p=n[o],p.ref.impl=p.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&y!==null){n=void 0,o=a,p=y.memoizedProps,y=y.memoizedState,u=o.stateNode;try{var Se=Cs(o.type,p);n=u.getSnapshotBeforeUpdate(Se,y),u.__reactInternalSnapshotBeforeUpdate=n}catch(ze){mt(o,o.return,ze)}}break;case 3:if((n&1024)!==0){if(n=a.stateNode.containerInfo,o=n.nodeType,o===9)_m(n);else if(o===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":_m(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,en=n;break}en=a.return}}function s0(n,a,o){var u=o.flags;switch(o.tag){case 0:case 11:case 15:ea(n,o),u&4&&Yo(5,o);break;case 1:if(ea(n,o),u&4)if(n=o.stateNode,a===null)try{n.componentDidMount()}catch(_){mt(o,o.return,_)}else{var p=Cs(o.type,a.memoizedProps);a=a.memoizedState;try{n.componentDidUpdate(p,a,n.__reactInternalSnapshotBeforeUpdate)}catch(_){mt(o,o.return,_)}}u&64&&Zb(o),u&512&&Xo(o,o.return);break;case 3:if(ea(n,o),u&64&&(n=o.updateQueue,n!==null)){if(a=null,o.child!==null)switch(o.child.tag){case 27:case 5:a=o.child.stateNode;break;case 1:a=o.child.stateNode}try{qy(n,a)}catch(_){mt(o,o.return,_)}}break;case 27:a===null&&u&4&&r0(o);case 26:case 5:ea(n,o),a===null&&u&4&&t0(o),u&512&&Xo(o,o.return);break;case 12:ea(n,o);break;case 31:ea(n,o),u&4&&l0(n,o);break;case 13:ea(n,o),u&4&&c0(n,o),u&64&&(n=o.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(o=EA.bind(null,o),VA(n,o))));break;case 22:if(u=o.memoizedState!==null||Qr,!u){a=a!==null&&a.memoizedState!==null||Vt,p=Qr;var y=Vt;Qr=u,(Vt=a)&&!y?ta(n,o,(o.subtreeFlags&8772)!==0):ea(n,o),Qr=p,Vt=y}break;case 30:break;default:ea(n,o)}}function i0(n){var a=n.alternate;a!==null&&(n.alternate=null,i0(a)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(a=n.stateNode,a!==null&&Tf(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 jt=null,jn=!1;function Zr(n,a,o){for(o=o.child;o!==null;)o0(n,a,o),o=o.sibling}function o0(n,a,o){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(hn,o)}catch{}switch(o.tag){case 26:Vt||Tr(o,a),Zr(n,a,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:Vt||Tr(o,a);var u=jt,p=jn;Ba(o.type)&&(jt=o.stateNode,jn=!1),Zr(n,a,o),sl(o.stateNode),jt=u,jn=p;break;case 5:Vt||Tr(o,a);case 6:if(u=jt,p=jn,jt=null,Zr(n,a,o),jt=u,jn=p,jt!==null)if(jn)try{(jt.nodeType===9?jt.body:jt.nodeName==="HTML"?jt.ownerDocument.body:jt).removeChild(o.stateNode)}catch(y){mt(o,a,y)}else try{jt.removeChild(o.stateNode)}catch(y){mt(o,a,y)}break;case 18:jt!==null&&(jn?(n=jt,Z0(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,o.stateNode),Mi(n)):Z0(jt,o.stateNode));break;case 4:u=jt,p=jn,jt=o.stateNode.containerInfo,jn=!0,Zr(n,a,o),jt=u,jn=p;break;case 0:case 11:case 14:case 15:Da(2,o,a),Vt||Da(4,o,a),Zr(n,a,o);break;case 1:Vt||(Tr(o,a),u=o.stateNode,typeof u.componentWillUnmount=="function"&&e0(o,a,u)),Zr(n,a,o);break;case 21:Zr(n,a,o);break;case 22:Vt=(u=Vt)||o.memoizedState!==null,Zr(n,a,o),Vt=u;break;default:Zr(n,a,o)}}function l0(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Mi(n)}catch(o){mt(a,a.return,o)}}}function c0(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Mi(n)}catch(o){mt(a,a.return,o)}}function gA(n){switch(n.tag){case 31:case 13:case 19:var a=n.stateNode;return a===null&&(a=n.stateNode=new a0),a;case 22:return n=n.stateNode,a=n._retryCache,a===null&&(a=n._retryCache=new a0),a;default:throw Error(s(435,n.tag))}}function Jc(n,a){var o=gA(n);a.forEach(function(u){if(!o.has(u)){o.add(u);var p=CA.bind(null,n,u);u.then(p,p)}})}function An(n,a){var o=a.deletions;if(o!==null)for(var u=0;u<o.length;u++){var p=o[u],y=n,_=a,T=_;e:for(;T!==null;){switch(T.tag){case 27:if(Ba(T.type)){jt=T.stateNode,jn=!1;break e}break;case 5:jt=T.stateNode,jn=!1;break e;case 3:case 4:jt=T.stateNode.containerInfo,jn=!0;break e}T=T.return}if(jt===null)throw Error(s(160));o0(y,_,p),jt=null,jn=!1,y=p.alternate,y!==null&&(y.return=null),p.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)u0(a,n),a=a.sibling}var hr=null;function u0(n,a){var o=n.alternate,u=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:An(a,n),Rn(n),u&4&&(Da(3,n,n.return),Yo(3,n),Da(5,n,n.return));break;case 1:An(a,n),Rn(n),u&512&&(Vt||o===null||Tr(o,o.return)),u&64&&Qr&&(n=n.updateQueue,n!==null&&(u=n.callbacks,u!==null&&(o=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=o===null?u:o.concat(u))));break;case 26:var p=hr;if(An(a,n),Rn(n),u&512&&(Vt||o===null||Tr(o,o.return)),u&4){var y=o!==null?o.memoizedState:null;if(u=n.memoizedState,o===null)if(u===null)if(n.stateNode===null){e:{u=n.type,o=n.memoizedProps,p=p.ownerDocument||p;t:switch(u){case"title":y=p.getElementsByTagName("title")[0],(!y||y[So]||y[rn]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=p.createElement(u),p.head.insertBefore(y,p.querySelector("head > title"))),ln(y,u,o),y[rn]=n,Zt(y),u=y;break e;case"link":var _=ux("link","href",p).get(u+(o.href||""));if(_){for(var T=0;T<_.length;T++)if(y=_[T],y.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&y.getAttribute("rel")===(o.rel==null?null:o.rel)&&y.getAttribute("title")===(o.title==null?null:o.title)&&y.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){_.splice(T,1);break t}}y=p.createElement(u),ln(y,u,o),p.head.appendChild(y);break;case"meta":if(_=ux("meta","content",p).get(u+(o.content||""))){for(T=0;T<_.length;T++)if(y=_[T],y.getAttribute("content")===(o.content==null?null:""+o.content)&&y.getAttribute("name")===(o.name==null?null:o.name)&&y.getAttribute("property")===(o.property==null?null:o.property)&&y.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&y.getAttribute("charset")===(o.charSet==null?null:o.charSet)){_.splice(T,1);break t}}y=p.createElement(u),ln(y,u,o),p.head.appendChild(y);break;default:throw Error(s(468,u))}y[rn]=n,Zt(y),u=y}n.stateNode=u}else dx(p,n.type,n.stateNode);else n.stateNode=cx(p,u,n.memoizedProps);else y!==u?(y===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):y.count--,u===null?dx(p,n.type,n.stateNode):cx(p,u,n.memoizedProps)):u===null&&n.stateNode!==null&&Wh(n,n.memoizedProps,o.memoizedProps)}break;case 27:An(a,n),Rn(n),u&512&&(Vt||o===null||Tr(o,o.return)),o!==null&&u&4&&Wh(n,n.memoizedProps,o.memoizedProps);break;case 5:if(An(a,n),Rn(n),u&512&&(Vt||o===null||Tr(o,o.return)),n.flags&32){p=n.stateNode;try{ni(p,"")}catch(Se){mt(n,n.return,Se)}}u&4&&n.stateNode!=null&&(p=n.memoizedProps,Wh(n,p,o!==null?o.memoizedProps:p)),u&1024&&(Jh=!0);break;case 6:if(An(a,n),Rn(n),u&4){if(n.stateNode===null)throw Error(s(162));u=n.memoizedProps,o=n.stateNode;try{o.nodeValue=u}catch(Se){mt(n,n.return,Se)}}break;case 3:if(hu=null,p=hr,hr=du(a.containerInfo),An(a,n),hr=p,Rn(n),u&4&&o!==null&&o.memoizedState.isDehydrated)try{Mi(a.containerInfo)}catch(Se){mt(n,n.return,Se)}Jh&&(Jh=!1,d0(n));break;case 4:u=hr,hr=du(n.stateNode.containerInfo),An(a,n),Rn(n),hr=u;break;case 12:An(a,n),Rn(n);break;case 31:An(a,n),Rn(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Jc(n,u)));break;case 13:An(a,n),Rn(n),n.child.flags&8192&&n.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Zc=Be()),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Jc(n,u)));break;case 22:p=n.memoizedState!==null;var D=o!==null&&o.memoizedState!==null,F=Qr,te=Vt;if(Qr=F||p,Vt=te||D,An(a,n),Vt=te,Qr=F,Rn(n),u&8192)e:for(a=n.stateNode,a._visibility=p?a._visibility&-2:a._visibility|1,p&&(o===null||D||Qr||Vt||Ns(n)),o=null,a=n;;){if(a.tag===5||a.tag===26){if(o===null){D=o=a;try{if(y=D.stateNode,p)_=y.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{T=D.stateNode;var ie=D.memoizedProps.style,W=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;T.style.display=W==null||typeof W=="boolean"?"":(""+W).trim()}}catch(Se){mt(D,D.return,Se)}}}else if(a.tag===6){if(o===null){D=a;try{D.stateNode.nodeValue=p?"":D.memoizedProps}catch(Se){mt(D,D.return,Se)}}}else if(a.tag===18){if(o===null){D=a;try{var J=D.stateNode;p?ex(J,!0):ex(D.stateNode,!1)}catch(Se){mt(D,D.return,Se)}}}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;o===a&&(o=null),a=a.return}o===a&&(o=null),a.sibling.return=a.return,a=a.sibling}u&4&&(u=n.updateQueue,u!==null&&(o=u.retryQueue,o!==null&&(u.retryQueue=null,Jc(n,o))));break;case 19:An(a,n),Rn(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Jc(n,u)));break;case 30:break;case 21:break;default:An(a,n),Rn(n)}}function Rn(n){var a=n.flags;if(a&2){try{for(var o,u=n.return;u!==null;){if(n0(u)){o=u;break}u=u.return}if(o==null)throw Error(s(160));switch(o.tag){case 27:var p=o.stateNode,y=Yh(n);Xc(n,y,p);break;case 5:var _=o.stateNode;o.flags&32&&(ni(_,""),o.flags&=-33);var T=Yh(n);Xc(n,T,_);break;case 3:case 4:var D=o.stateNode.containerInfo,F=Yh(n);Xh(n,F,D);break;default:throw Error(s(161))}}catch(te){mt(n,n.return,te)}n.flags&=-3}a&4096&&(n.flags&=-4097)}function d0(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var a=n;d0(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),n=n.sibling}}function ea(n,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)s0(n,a.alternate,a),a=a.sibling}function Ns(n){for(n=n.child;n!==null;){var a=n;switch(a.tag){case 0:case 11:case 14:case 15:Da(4,a,a.return),Ns(a);break;case 1:Tr(a,a.return);var o=a.stateNode;typeof o.componentWillUnmount=="function"&&e0(a,a.return,o),Ns(a);break;case 27:sl(a.stateNode);case 26:case 5:Tr(a,a.return),Ns(a);break;case 22:a.memoizedState===null&&Ns(a);break;case 30:Ns(a);break;default:Ns(a)}n=n.sibling}}function ta(n,a,o){for(o=o&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var u=a.alternate,p=n,y=a,_=y.flags;switch(y.tag){case 0:case 11:case 15:ta(p,y,o),Yo(4,y);break;case 1:if(ta(p,y,o),u=y,p=u.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(F){mt(u,u.return,F)}if(u=y,p=u.updateQueue,p!==null){var T=u.stateNode;try{var D=p.shared.hiddenCallbacks;if(D!==null)for(p.shared.hiddenCallbacks=null,p=0;p<D.length;p++)Hy(D[p],T)}catch(F){mt(u,u.return,F)}}o&&_&64&&Zb(y),Xo(y,y.return);break;case 27:r0(y);case 26:case 5:ta(p,y,o),o&&u===null&&_&4&&t0(y),Xo(y,y.return);break;case 12:ta(p,y,o);break;case 31:ta(p,y,o),o&&_&4&&l0(p,y);break;case 13:ta(p,y,o),o&&_&4&&c0(p,y);break;case 22:y.memoizedState===null&&ta(p,y,o),Xo(y,y.return);break;case 30:break;default:ta(p,y,o)}a=a.sibling}}function Qh(n,a){var o=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==o&&(n!=null&&n.refCount++,o!=null&&Lo(o))}function Zh(n,a){n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&Lo(n))}function mr(n,a,o,u){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)f0(n,a,o,u),a=a.sibling}function f0(n,a,o,u){var p=a.flags;switch(a.tag){case 0:case 11:case 15:mr(n,a,o,u),p&2048&&Yo(9,a);break;case 1:mr(n,a,o,u);break;case 3:mr(n,a,o,u),p&2048&&(n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&Lo(n)));break;case 12:if(p&2048){mr(n,a,o,u),n=a.stateNode;try{var y=a.memoizedProps,_=y.id,T=y.onPostCommit;typeof T=="function"&&T(_,a.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(D){mt(a,a.return,D)}}else mr(n,a,o,u);break;case 31:mr(n,a,o,u);break;case 13:mr(n,a,o,u);break;case 23:break;case 22:y=a.stateNode,_=a.alternate,a.memoizedState!==null?y._visibility&2?mr(n,a,o,u):Jo(n,a):y._visibility&2?mr(n,a,o,u):(y._visibility|=2,_i(n,a,o,u,(a.subtreeFlags&10256)!==0||!1)),p&2048&&Qh(_,a);break;case 24:mr(n,a,o,u),p&2048&&Zh(a.alternate,a);break;default:mr(n,a,o,u)}}function _i(n,a,o,u,p){for(p=p&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var y=n,_=a,T=o,D=u,F=_.flags;switch(_.tag){case 0:case 11:case 15:_i(y,_,T,D,p),Yo(8,_);break;case 23:break;case 22:var te=_.stateNode;_.memoizedState!==null?te._visibility&2?_i(y,_,T,D,p):Jo(y,_):(te._visibility|=2,_i(y,_,T,D,p)),p&&F&2048&&Qh(_.alternate,_);break;case 24:_i(y,_,T,D,p),p&&F&2048&&Zh(_.alternate,_);break;default:_i(y,_,T,D,p)}a=a.sibling}}function Jo(n,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var o=n,u=a,p=u.flags;switch(u.tag){case 22:Jo(o,u),p&2048&&Qh(u.alternate,u);break;case 24:Jo(o,u),p&2048&&Zh(u.alternate,u);break;default:Jo(o,u)}a=a.sibling}}var Qo=8192;function Si(n,a,o){if(n.subtreeFlags&Qo)for(n=n.child;n!==null;)h0(n,a,o),n=n.sibling}function h0(n,a,o){switch(n.tag){case 26:Si(n,a,o),n.flags&Qo&&n.memoizedState!==null&&nR(o,hr,n.memoizedState,n.memoizedProps);break;case 5:Si(n,a,o);break;case 3:case 4:var u=hr;hr=du(n.stateNode.containerInfo),Si(n,a,o),hr=u;break;case 22:n.memoizedState===null&&(u=n.alternate,u!==null&&u.memoizedState!==null?(u=Qo,Qo=16777216,Si(n,a,o),Qo=u):Si(n,a,o));break;default:Si(n,a,o)}}function m0(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 Zo(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var o=0;o<a.length;o++){var u=a[o];en=u,g0(u,n)}m0(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)p0(n),n=n.sibling}function p0(n){switch(n.tag){case 0:case 11:case 15:Zo(n),n.flags&2048&&Da(9,n,n.return);break;case 3:Zo(n);break;case 12:Zo(n);break;case 22:var a=n.stateNode;n.memoizedState!==null&&a._visibility&2&&(n.return===null||n.return.tag!==13)?(a._visibility&=-3,Qc(n)):Zo(n);break;default:Zo(n)}}function Qc(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var o=0;o<a.length;o++){var u=a[o];en=u,g0(u,n)}m0(n)}for(n=n.child;n!==null;){switch(a=n,a.tag){case 0:case 11:case 15:Da(8,a,a.return),Qc(a);break;case 22:o=a.stateNode,o._visibility&2&&(o._visibility&=-3,Qc(a));break;default:Qc(a)}n=n.sibling}}function g0(n,a){for(;en!==null;){var o=en;switch(o.tag){case 0:case 11:case 15:Da(8,o,a);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var u=o.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:Lo(o.memoizedState.cache)}if(u=o.child,u!==null)u.return=o,en=u;else e:for(o=n;en!==null;){u=en;var p=u.sibling,y=u.return;if(i0(u),u===o){en=null;break e}if(p!==null){p.return=y,en=p;break e}en=y}}}var vA={getCacheForType:function(n){var a=sn(Bt),o=a.data.get(n);return o===void 0&&(o=n(),a.data.set(n,o)),o},cacheSignal:function(){return sn(Bt).controller.signal}},yA=typeof WeakMap=="function"?WeakMap:Map,dt=0,wt=null,Ze=null,rt=0,ht=0,qn=null,Pa=!1,Ei=!1,em=!1,na=0,Pt=0,La=0,Ts=0,tm=0,Vn=0,Ci=0,el=null,kn=null,nm=!1,Zc=0,v0=0,eu=1/0,tu=null,za=null,Yt=0,Ia=null,Ni=null,ra=0,rm=0,am=null,y0=null,tl=0,sm=null;function Gn(){return(dt&2)!==0&&rt!==0?rt&-rt:R.T!==null?dm():Cf()}function b0(){if(Vn===0)if((rt&536870912)===0||it){var n=Ne;Ne<<=1,(Ne&3932160)===0&&(Ne=262144),Vn=n}else Vn=536870912;return n=Bn.current,n!==null&&(n.flags|=32),Vn}function On(n,a,o){(n===wt&&(ht===2||ht===9)||n.cancelPendingCommit!==null)&&(Ti(n,0),$a(n,rt,Vn,!1)),Rt(n,o),((dt&2)===0||n!==wt)&&(n===wt&&((dt&2)===0&&(Ts|=o),Pt===4&&$a(n,rt,Vn,!1)),jr(n))}function x0(n,a,o){if((dt&6)!==0)throw Error(s(327));var u=!o&&(a&127)===0&&(a&n.expiredLanes)===0||pt(n,a),p=u?wA(n,a):om(n,a,!0),y=u;do{if(p===0){Ei&&!u&&$a(n,a,0,!1);break}else{if(o=n.current.alternate,y&&!bA(o)){p=om(n,a,!1),y=!1;continue}if(p===2){if(y=a,n.errorRecoveryDisabledLanes&y)var _=0;else _=n.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){a=_;e:{var T=n;p=el;var D=T.current.memoizedState.isDehydrated;if(D&&(Ti(T,_).flags|=256),_=om(T,_,!1),_!==2){if(em&&!D){T.errorRecoveryDisabledLanes|=y,Ts|=y,p=4;break e}y=kn,kn=p,y!==null&&(kn===null?kn=y:kn.push.apply(kn,y))}p=_}if(y=!1,p!==2)continue}}if(p===1){Ti(n,0),$a(n,a,0,!0);break}e:{switch(u=n,y=p,y){case 0:case 1:throw Error(s(345));case 4:if((a&4194048)!==a)break;case 6:$a(u,a,Vn,!Pa);break e;case 2:kn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((a&62914560)===a&&(p=Zc+300-Be(),10<p)){if($a(u,a,Vn,!Pa),De(u,0,!0)!==0)break e;ra=a,u.timeoutHandle=J0(w0.bind(null,u,o,kn,tu,nm,a,Vn,Ts,Ci,Pa,y,"Throttled",-0,0),p);break e}w0(u,o,kn,tu,nm,a,Vn,Ts,Ci,Pa,y,null,-0,0)}}break}while(!0);jr(n)}function w0(n,a,o,u,p,y,_,T,D,F,te,ie,W,J){if(n.timeoutHandle=-1,ie=a.subtreeFlags,ie&8192||(ie&16785408)===16785408){ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Hr},h0(a,y,ie);var Se=(y&62914560)===y?Zc-Be():(y&4194048)===y?v0-Be():0;if(Se=rR(ie,Se),Se!==null){ra=y,n.cancelPendingCommit=Se(A0.bind(null,n,a,y,o,u,p,_,T,D,te,ie,null,W,J)),$a(n,y,_,!F);return}}A0(n,a,y,o,u,p,_,T,D)}function bA(n){for(var a=n;;){var o=a.tag;if((o===0||o===11||o===15)&&a.flags&16384&&(o=a.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var u=0;u<o.length;u++){var p=o[u],y=p.getSnapshot;p=p.value;try{if(!$n(y(),p))return!1}catch{return!1}}if(o=a.child,a.subtreeFlags&16384&&o!==null)o.return=a,a=o;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 $a(n,a,o,u){a&=~tm,a&=~Ts,n.suspendedLanes|=a,n.pingedLanes&=~a,u&&(n.warmLanes|=a),u=n.expirationTimes;for(var p=a;0<p;){var y=31-At(p),_=1<<y;u[y]=-1,p&=~_}o!==0&&us(n,o,a)}function nu(){return(dt&6)===0?(nl(0),!1):!0}function im(){if(Ze!==null){if(ht===0)var n=Ze.return;else n=Ze,Fr=ys=null,_h(n),vi=null,Io=0,n=Ze;for(;n!==null;)Qb(n.alternate,n),n=n.return;Ze=null}}function Ti(n,a){var o=n.timeoutHandle;o!==-1&&(n.timeoutHandle=-1,$A(o)),o=n.cancelPendingCommit,o!==null&&(n.cancelPendingCommit=null,o()),ra=0,im(),wt=n,Ze=o=Vr(n.current,null),rt=a,ht=0,qn=null,Pa=!1,Ei=pt(n,a),em=!1,Ci=Vn=tm=Ts=La=Pt=0,kn=el=null,nm=!1,(a&8)!==0&&(a|=a&32);var u=n.entangledLanes;if(u!==0)for(n=n.entanglements,u&=a;0<u;){var p=31-At(u),y=1<<p;a|=n[p],u&=~y}return na=a,Sc(),o}function _0(n,a){Fe=null,R.H=Fo,a===gi||a===kc?(a=Iy(),ht=3):a===uh?(a=Iy(),ht=4):ht=a===Ih?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,qn=a,Ze===null&&(Pt=1,Gc(n,Qn(a,n.current)))}function S0(){var n=Bn.current;return n===null?!0:(rt&4194048)===rt?nr===null:(rt&62914560)===rt||(rt&536870912)!==0?n===nr:!1}function E0(){var n=R.H;return R.H=Fo,n===null?Fo:n}function C0(){var n=R.A;return R.A=vA,n}function ru(){Pt=4,Pa||(rt&4194048)!==rt&&Bn.current!==null||(Ei=!0),(La&134217727)===0&&(Ts&134217727)===0||wt===null||$a(wt,rt,Vn,!1)}function om(n,a,o){var u=dt;dt|=2;var p=E0(),y=C0();(wt!==n||rt!==a)&&(tu=null,Ti(n,a)),a=!1;var _=Pt;e:do try{if(ht!==0&&Ze!==null){var T=Ze,D=qn;switch(ht){case 8:im(),_=6;break e;case 3:case 2:case 9:case 6:Bn.current===null&&(a=!0);var F=ht;if(ht=0,qn=null,ji(n,T,D,F),o&&Ei){_=0;break e}break;default:F=ht,ht=0,qn=null,ji(n,T,D,F)}}xA(),_=Pt;break}catch(te){_0(n,te)}while(!0);return a&&n.shellSuspendCounter++,Fr=ys=null,dt=u,R.H=p,R.A=y,Ze===null&&(wt=null,rt=0,Sc()),_}function xA(){for(;Ze!==null;)N0(Ze)}function wA(n,a){var o=dt;dt|=2;var u=E0(),p=C0();wt!==n||rt!==a?(tu=null,eu=Be()+500,Ti(n,a)):Ei=pt(n,a);e:do try{if(ht!==0&&Ze!==null){a=Ze;var y=qn;t:switch(ht){case 1:ht=0,qn=null,ji(n,a,y,1);break;case 2:case 9:if(Ly(y)){ht=0,qn=null,T0(a);break}a=function(){ht!==2&&ht!==9||wt!==n||(ht=7),jr(n)},y.then(a,a);break e;case 3:ht=7;break e;case 4:ht=5;break e;case 7:Ly(y)?(ht=0,qn=null,T0(a)):(ht=0,qn=null,ji(n,a,y,7));break;case 5:var _=null;switch(Ze.tag){case 26:_=Ze.memoizedState;case 5:case 27:var T=Ze;if(_?fx(_):T.stateNode.complete){ht=0,qn=null;var D=T.sibling;if(D!==null)Ze=D;else{var F=T.return;F!==null?(Ze=F,au(F)):Ze=null}break t}}ht=0,qn=null,ji(n,a,y,5);break;case 6:ht=0,qn=null,ji(n,a,y,6);break;case 8:im(),Pt=6;break e;default:throw Error(s(462))}}_A();break}catch(te){_0(n,te)}while(!0);return Fr=ys=null,R.H=u,R.A=p,dt=o,Ze!==null?0:(wt=null,rt=0,Sc(),Pt)}function _A(){for(;Ze!==null&&!ct();)N0(Ze)}function N0(n){var a=Xb(n.alternate,n,na);n.memoizedProps=n.pendingProps,a===null?au(n):Ze=a}function T0(n){var a=n,o=a.alternate;switch(a.tag){case 15:case 0:a=Vb(o,a,a.pendingProps,a.type,void 0,rt);break;case 11:a=Vb(o,a,a.pendingProps,a.type.render,a.ref,rt);break;case 5:_h(a);default:Qb(o,a),a=Ze=Cy(a,na),a=Xb(o,a,na)}n.memoizedProps=n.pendingProps,a===null?au(n):Ze=a}function ji(n,a,o,u){Fr=ys=null,_h(a),vi=null,Io=0;var p=a.return;try{if(uA(n,p,a,o,rt)){Pt=1,Gc(n,Qn(o,n.current)),Ze=null;return}}catch(y){if(p!==null)throw Ze=p,y;Pt=1,Gc(n,Qn(o,n.current)),Ze=null;return}a.flags&32768?(it||u===1?n=!0:Ei||(rt&536870912)!==0?n=!1:(Pa=n=!0,(u===2||u===9||u===3||u===6)&&(u=Bn.current,u!==null&&u.tag===13&&(u.flags|=16384))),j0(a,n)):au(a)}function au(n){var a=n;do{if((a.flags&32768)!==0){j0(a,Pa);return}n=a.return;var o=hA(a.alternate,a,na);if(o!==null){Ze=o;return}if(a=a.sibling,a!==null){Ze=a;return}Ze=a=n}while(a!==null);Pt===0&&(Pt=5)}function j0(n,a){do{var o=mA(n.alternate,n);if(o!==null){o.flags&=32767,Ze=o;return}if(o=n.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!a&&(n=n.sibling,n!==null)){Ze=n;return}Ze=n=o}while(n!==null);Pt=6,Ze=null}function A0(n,a,o,u,p,y,_,T,D){n.cancelPendingCommit=null;do su();while(Yt!==0);if((dt&6)!==0)throw Error(s(327));if(a!==null){if(a===n.current)throw Error(s(177));if(y=a.lanes|a.childLanes,y|=Yf,Sn(n,o,y,_,T,D),n===wt&&(Ze=wt=null,rt=0),Ni=a,Ia=n,ra=o,rm=y,am=p,y0=u,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,NA(fn,function(){return D0(),null})):(n.callbackNode=null,n.callbackPriority=0),u=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||u){u=R.T,R.T=null,p=q.p,q.p=2,_=dt,dt|=4;try{pA(n,a,o)}finally{dt=_,q.p=p,R.T=u}}Yt=1,R0(),k0(),O0()}}function R0(){if(Yt===1){Yt=0;var n=Ia,a=Ni,o=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||o){o=R.T,R.T=null;var u=q.p;q.p=2;var p=dt;dt|=4;try{u0(a,n);var y=bm,_=gy(n.containerInfo),T=y.focusedElem,D=y.selectionRange;if(_!==T&&T&&T.ownerDocument&&py(T.ownerDocument.documentElement,T)){if(D!==null&&Vf(T)){var F=D.start,te=D.end;if(te===void 0&&(te=F),"selectionStart"in T)T.selectionStart=F,T.selectionEnd=Math.min(te,T.value.length);else{var ie=T.ownerDocument||document,W=ie&&ie.defaultView||window;if(W.getSelection){var J=W.getSelection(),Se=T.textContent.length,ze=Math.min(D.start,Se),yt=D.end===void 0?ze:Math.min(D.end,Se);!J.extend&&ze>yt&&(_=yt,yt=ze,ze=_);var U=my(T,ze),L=my(T,yt);if(U&&L&&(J.rangeCount!==1||J.anchorNode!==U.node||J.anchorOffset!==U.offset||J.focusNode!==L.node||J.focusOffset!==L.offset)){var V=ie.createRange();V.setStart(U.node,U.offset),J.removeAllRanges(),ze>yt?(J.addRange(V),J.extend(L.node,L.offset)):(V.setEnd(L.node,L.offset),J.addRange(V))}}}}for(ie=[],J=T;J=J.parentNode;)J.nodeType===1&&ie.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<ie.length;T++){var re=ie[T];re.element.scrollLeft=re.left,re.element.scrollTop=re.top}}vu=!!ym,bm=ym=null}finally{dt=p,q.p=u,R.T=o}}n.current=a,Yt=2}}function k0(){if(Yt===2){Yt=0;var n=Ia,a=Ni,o=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||o){o=R.T,R.T=null;var u=q.p;q.p=2;var p=dt;dt|=4;try{s0(n,a.alternate,a)}finally{dt=p,q.p=u,R.T=o}}Yt=3}}function O0(){if(Yt===4||Yt===3){Yt=0,zt();var n=Ia,a=Ni,o=ra,u=y0;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Yt=5:(Yt=0,Ni=Ia=null,M0(n,n.pendingLanes));var p=n.pendingLanes;if(p===0&&(za=null),dr(o),a=a.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(hn,a,void 0,(a.current.flags&128)===128)}catch{}if(u!==null){a=R.T,p=q.p,q.p=2,R.T=null;try{for(var y=n.onRecoverableError,_=0;_<u.length;_++){var T=u[_];y(T.value,{componentStack:T.stack})}}finally{R.T=a,q.p=p}}(ra&3)!==0&&su(),jr(n),p=n.pendingLanes,(o&261930)!==0&&(p&42)!==0?n===sm?tl++:(tl=0,sm=n):tl=0,nl(0)}}function M0(n,a){(n.pooledCacheLanes&=a)===0&&(a=n.pooledCache,a!=null&&(n.pooledCache=null,Lo(a)))}function su(){return R0(),k0(),O0(),D0()}function D0(){if(Yt!==5)return!1;var n=Ia,a=rm;rm=0;var o=dr(ra),u=R.T,p=q.p;try{q.p=32>o?32:o,R.T=null,o=am,am=null;var y=Ia,_=ra;if(Yt=0,Ni=Ia=null,ra=0,(dt&6)!==0)throw Error(s(331));var T=dt;if(dt|=4,p0(y.current),f0(y,y.current,_,o),dt=T,nl(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(hn,y)}catch{}return!0}finally{q.p=p,R.T=u,M0(n,a)}}function P0(n,a,o){a=Qn(o,a),a=zh(n.stateNode,a,2),n=ka(n,a,2),n!==null&&(Rt(n,2),jr(n))}function mt(n,a,o){if(n.tag===3)P0(n,n,o);else for(;a!==null;){if(a.tag===3){P0(a,n,o);break}else if(a.tag===1){var u=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(za===null||!za.has(u))){n=Qn(o,n),o=Lb(2),u=ka(a,o,2),u!==null&&(zb(o,u,a,n),Rt(u,2),jr(u));break}}a=a.return}}function lm(n,a,o){var u=n.pingCache;if(u===null){u=n.pingCache=new yA;var p=new Set;u.set(a,p)}else p=u.get(a),p===void 0&&(p=new Set,u.set(a,p));p.has(o)||(em=!0,p.add(o),n=SA.bind(null,n,a,o),a.then(n,n))}function SA(n,a,o){var u=n.pingCache;u!==null&&u.delete(a),n.pingedLanes|=n.suspendedLanes&o,n.warmLanes&=~o,wt===n&&(rt&o)===o&&(Pt===4||Pt===3&&(rt&62914560)===rt&&300>Be()-Zc?(dt&2)===0&&Ti(n,0):tm|=o,Ci===rt&&(Ci=0)),jr(n)}function L0(n,a){a===0&&(a=mn()),n=ps(n,a),n!==null&&(Rt(n,a),jr(n))}function EA(n){var a=n.memoizedState,o=0;a!==null&&(o=a.retryLane),L0(n,o)}function CA(n,a){var o=0;switch(n.tag){case 31:case 13:var u=n.stateNode,p=n.memoizedState;p!==null&&(o=p.retryLane);break;case 19:u=n.stateNode;break;case 22:u=n.stateNode._retryCache;break;default:throw Error(s(314))}u!==null&&u.delete(a),L0(n,o)}function NA(n,a){return _t(n,a)}var iu=null,Ai=null,cm=!1,ou=!1,um=!1,Ua=0;function jr(n){n!==Ai&&n.next===null&&(Ai===null?iu=Ai=n:Ai=Ai.next=n),ou=!0,cm||(cm=!0,jA())}function nl(n,a){if(!um&&ou){um=!0;do for(var o=!1,u=iu;u!==null;){if(n!==0){var p=u.pendingLanes;if(p===0)var y=0;else{var _=u.suspendedLanes,T=u.pingedLanes;y=(1<<31-At(42|n)+1)-1,y&=p&~(_&~T),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(o=!0,U0(u,y))}else y=rt,y=De(u,u===wt?y:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(y&3)===0||pt(u,y)||(o=!0,U0(u,y));u=u.next}while(o);um=!1}}function TA(){z0()}function z0(){ou=cm=!1;var n=0;Ua!==0&&IA()&&(n=Ua);for(var a=Be(),o=null,u=iu;u!==null;){var p=u.next,y=I0(u,a);y===0?(u.next=null,o===null?iu=p:o.next=p,p===null&&(Ai=o)):(o=u,(n!==0||(y&3)!==0)&&(ou=!0)),u=p}Yt!==0&&Yt!==5||nl(n),Ua!==0&&(Ua=0)}function I0(n,a){for(var o=n.suspendedLanes,u=n.pingedLanes,p=n.expirationTimes,y=n.pendingLanes&-62914561;0<y;){var _=31-At(y),T=1<<_,D=p[_];D===-1?((T&o)===0||(T&u)!==0)&&(p[_]=Ut(T,a)):D<=a&&(n.expiredLanes|=T),y&=~T}if(a=wt,o=rt,o=De(n,n===a?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u=n.callbackNode,o===0||n===a&&(ht===2||ht===9)||n.cancelPendingCommit!==null)return u!==null&&u!==null&&Ge(u),n.callbackNode=null,n.callbackPriority=0;if((o&3)===0||pt(n,o)){if(a=o&-o,a===n.callbackPriority)return a;switch(u!==null&&Ge(u),dr(o)){case 2:case 8:o=ut;break;case 32:o=fn;break;case 268435456:o=Kt;break;default:o=fn}return u=$0.bind(null,n),o=_t(o,u),n.callbackPriority=a,n.callbackNode=o,a}return u!==null&&u!==null&&Ge(u),n.callbackPriority=2,n.callbackNode=null,2}function $0(n,a){if(Yt!==0&&Yt!==5)return n.callbackNode=null,n.callbackPriority=0,null;var o=n.callbackNode;if(su()&&n.callbackNode!==o)return null;var u=rt;return u=De(n,n===wt?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u===0?null:(x0(n,u,a),I0(n,Be()),n.callbackNode!=null&&n.callbackNode===o?$0.bind(null,n):null)}function U0(n,a){if(su())return null;x0(n,a,!0)}function jA(){UA(function(){(dt&6)!==0?_t(Le,TA):z0()})}function dm(){if(Ua===0){var n=mi;n===0&&(n=le,le<<=1,(le&261888)===0&&(le=256)),Ua=n}return Ua}function B0(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:pc(""+n)}function H0(n,a){var o=a.ownerDocument.createElement("input");return o.name=a.name,o.value=a.value,n.id&&o.setAttribute("form",n.id),a.parentNode.insertBefore(o,a),n=new FormData(n),o.parentNode.removeChild(o),n}function AA(n,a,o,u,p){if(a==="submit"&&o&&o.stateNode===p){var y=B0((p[Nn]||null).action),_=u.submitter;_&&(a=(a=_[Nn]||null)?B0(a.formAction):_.getAttribute("formAction"),a!==null&&(y=a,_=null));var T=new bc("action","action",null,u,p);n.push({event:T,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(Ua!==0){var D=_?H0(p,_):new FormData(p);kh(o,{pending:!0,data:D,method:p.method,action:y},null,D)}}else typeof y=="function"&&(T.preventDefault(),D=_?H0(p,_):new FormData(p),kh(o,{pending:!0,data:D,method:p.method,action:y},y,D))},currentTarget:p}]})}}for(var fm=0;fm<Wf.length;fm++){var hm=Wf[fm],RA=hm.toLowerCase(),kA=hm[0].toUpperCase()+hm.slice(1);fr(RA,"on"+kA)}fr(by,"onAnimationEnd"),fr(xy,"onAnimationIteration"),fr(wy,"onAnimationStart"),fr("dblclick","onDoubleClick"),fr("focusin","onFocus"),fr("focusout","onBlur"),fr(Kj,"onTransitionRun"),fr(Wj,"onTransitionStart"),fr(Yj,"onTransitionCancel"),fr(_y,"onTransitionEnd"),ei("onMouseEnter",["mouseout","mouseover"]),ei("onMouseLeave",["mouseout","mouseover"]),ei("onPointerEnter",["pointerout","pointerover"]),ei("onPointerLeave",["pointerout","pointerover"]),ds("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ds("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ds("onBeforeInput",["compositionend","keypress","textInput","paste"]),ds("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ds("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ds("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var rl="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(" "),OA=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(rl));function q0(n,a){a=(a&4)!==0;for(var o=0;o<n.length;o++){var u=n[o],p=u.event;u=u.listeners;e:{var y=void 0;if(a)for(var _=u.length-1;0<=_;_--){var T=u[_],D=T.instance,F=T.currentTarget;if(T=T.listener,D!==y&&p.isPropagationStopped())break e;y=T,p.currentTarget=F;try{y(p)}catch(te){_c(te)}p.currentTarget=null,y=D}else for(_=0;_<u.length;_++){if(T=u[_],D=T.instance,F=T.currentTarget,T=T.listener,D!==y&&p.isPropagationStopped())break e;y=T,p.currentTarget=F;try{y(p)}catch(te){_c(te)}p.currentTarget=null,y=D}}}}function et(n,a){var o=a[Nf];o===void 0&&(o=a[Nf]=new Set);var u=n+"__bubble";o.has(u)||(V0(a,n,2,!1),o.add(u))}function mm(n,a,o){var u=0;a&&(u|=4),V0(o,n,u,a)}var lu="_reactListening"+Math.random().toString(36).slice(2);function pm(n){if(!n[lu]){n[lu]=!0,zv.forEach(function(o){o!=="selectionchange"&&(OA.has(o)||mm(o,!1,n),mm(o,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[lu]||(a[lu]=!0,mm("selectionchange",!1,a))}}function V0(n,a,o,u){switch(bx(a)){case 2:var p=iR;break;case 8:p=oR;break;default:p=Rm}o=p.bind(null,a,o,n),p=void 0,!Pf||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(p=!0),u?p!==void 0?n.addEventListener(a,o,{capture:!0,passive:p}):n.addEventListener(a,o,!0):p!==void 0?n.addEventListener(a,o,{passive:p}):n.addEventListener(a,o,!1)}function gm(n,a,o,u,p){var y=u;if((a&1)===0&&(a&2)===0&&u!==null)e:for(;;){if(u===null)return;var _=u.tag;if(_===3||_===4){var T=u.stateNode.containerInfo;if(T===p)break;if(_===4)for(_=u.return;_!==null;){var D=_.tag;if((D===3||D===4)&&_.stateNode.containerInfo===p)return;_=_.return}for(;T!==null;){if(_=Js(T),_===null)return;if(D=_.tag,D===5||D===6||D===26||D===27){u=y=_;continue e}T=T.parentNode}}u=u.return}Yv(function(){var F=y,te=Mf(o),ie=[];e:{var W=Sy.get(n);if(W!==void 0){var J=bc,Se=n;switch(n){case"keypress":if(vc(o)===0)break e;case"keydown":case"keyup":J=Cj;break;case"focusin":Se="focus",J=$f;break;case"focusout":Se="blur",J=$f;break;case"beforeblur":case"afterblur":J=$f;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":J=Qv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":J=hj;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":J=jj;break;case by:case xy:case wy:J=gj;break;case _y:J=Rj;break;case"scroll":case"scrollend":J=dj;break;case"wheel":J=Oj;break;case"copy":case"cut":case"paste":J=yj;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":J=ey;break;case"toggle":case"beforetoggle":J=Dj}var ze=(a&4)!==0,yt=!ze&&(n==="scroll"||n==="scrollend"),U=ze?W!==null?W+"Capture":null:W;ze=[];for(var L=F,V;L!==null;){var re=L;if(V=re.stateNode,re=re.tag,re!==5&&re!==26&&re!==27||V===null||U===null||(re=Co(L,U),re!=null&&ze.push(al(L,re,V))),yt)break;L=L.return}0<ze.length&&(W=new J(W,Se,null,o,te),ie.push({event:W,listeners:ze}))}}if((a&7)===0){e:{if(W=n==="mouseover"||n==="pointerover",J=n==="mouseout"||n==="pointerout",W&&o!==Of&&(Se=o.relatedTarget||o.fromElement)&&(Js(Se)||Se[Xs]))break e;if((J||W)&&(W=te.window===te?te:(W=te.ownerDocument)?W.defaultView||W.parentWindow:window,J?(Se=o.relatedTarget||o.toElement,J=F,Se=Se?Js(Se):null,Se!==null&&(yt=l(Se),ze=Se.tag,Se!==yt||ze!==5&&ze!==27&&ze!==6)&&(Se=null)):(J=null,Se=F),J!==Se)){if(ze=Qv,re="onMouseLeave",U="onMouseEnter",L="mouse",(n==="pointerout"||n==="pointerover")&&(ze=ey,re="onPointerLeave",U="onPointerEnter",L="pointer"),yt=J==null?W:Eo(J),V=Se==null?W:Eo(Se),W=new ze(re,L+"leave",J,o,te),W.target=yt,W.relatedTarget=V,re=null,Js(te)===F&&(ze=new ze(U,L+"enter",Se,o,te),ze.target=V,ze.relatedTarget=yt,re=ze),yt=re,J&&Se)t:{for(ze=MA,U=J,L=Se,V=0,re=U;re;re=ze(re))V++;re=0;for(var Pe=L;Pe;Pe=ze(Pe))re++;for(;0<V-re;)U=ze(U),V--;for(;0<re-V;)L=ze(L),re--;for(;V--;){if(U===L||L!==null&&U===L.alternate){ze=U;break t}U=ze(U),L=ze(L)}ze=null}else ze=null;J!==null&&G0(ie,W,J,ze,!1),Se!==null&&yt!==null&&G0(ie,yt,Se,ze,!0)}}e:{if(W=F?Eo(F):window,J=W.nodeName&&W.nodeName.toLowerCase(),J==="select"||J==="input"&&W.type==="file")var ot=ly;else if(iy(W))if(cy)ot=Vj;else{ot=Hj;var Ae=Bj}else J=W.nodeName,!J||J.toLowerCase()!=="input"||W.type!=="checkbox"&&W.type!=="radio"?F&&kf(F.elementType)&&(ot=ly):ot=qj;if(ot&&(ot=ot(n,F))){oy(ie,ot,o,te);break e}Ae&&Ae(n,W,F),n==="focusout"&&F&&W.type==="number"&&F.memoizedProps.value!=null&&Rf(W,"number",W.value)}switch(Ae=F?Eo(F):window,n){case"focusin":(iy(Ae)||Ae.contentEditable==="true")&&(ii=Ae,Gf=F,Mo=null);break;case"focusout":Mo=Gf=ii=null;break;case"mousedown":Ff=!0;break;case"contextmenu":case"mouseup":case"dragend":Ff=!1,vy(ie,o,te);break;case"selectionchange":if(Fj)break;case"keydown":case"keyup":vy(ie,o,te)}var We;if(Bf)e:{switch(n){case"compositionstart":var at="onCompositionStart";break e;case"compositionend":at="onCompositionEnd";break e;case"compositionupdate":at="onCompositionUpdate";break e}at=void 0}else si?ay(n,o)&&(at="onCompositionEnd"):n==="keydown"&&o.keyCode===229&&(at="onCompositionStart");at&&(ty&&o.locale!=="ko"&&(si||at!=="onCompositionStart"?at==="onCompositionEnd"&&si&&(We=Xv()):(Ea=te,Lf="value"in Ea?Ea.value:Ea.textContent,si=!0)),Ae=cu(F,at),0<Ae.length&&(at=new Zv(at,n,null,o,te),ie.push({event:at,listeners:Ae}),We?at.data=We:(We=sy(o),We!==null&&(at.data=We)))),(We=Lj?zj(n,o):Ij(n,o))&&(at=cu(F,"onBeforeInput"),0<at.length&&(Ae=new Zv("onBeforeInput","beforeinput",null,o,te),ie.push({event:Ae,listeners:at}),Ae.data=We)),AA(ie,n,F,o,te)}q0(ie,a)})}function al(n,a,o){return{instance:n,listener:a,currentTarget:o}}function cu(n,a){for(var o=a+"Capture",u=[];n!==null;){var p=n,y=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||y===null||(p=Co(n,o),p!=null&&u.unshift(al(n,p,y)),p=Co(n,a),p!=null&&u.push(al(n,p,y))),n.tag===3)return u;n=n.return}return[]}function MA(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function G0(n,a,o,u,p){for(var y=a._reactName,_=[];o!==null&&o!==u;){var T=o,D=T.alternate,F=T.stateNode;if(T=T.tag,D!==null&&D===u)break;T!==5&&T!==26&&T!==27||F===null||(D=F,p?(F=Co(o,y),F!=null&&_.unshift(al(o,F,D))):p||(F=Co(o,y),F!=null&&_.push(al(o,F,D)))),o=o.return}_.length!==0&&n.push({event:a,listeners:_})}var DA=/\r\n?/g,PA=/\u0000|\uFFFD/g;function F0(n){return(typeof n=="string"?n:""+n).replace(DA,`
`).replace(PA,"")}function K0(n,a){return a=F0(a),F0(n)===a}function vt(n,a,o,u,p,y){switch(o){case"children":typeof u=="string"?a==="body"||a==="textarea"&&u===""||ni(n,u):(typeof u=="number"||typeof u=="bigint")&&a!=="body"&&ni(n,""+u);break;case"className":hc(n,"class",u);break;case"tabIndex":hc(n,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":hc(n,o,u);break;case"style":Kv(n,u,y);break;case"data":if(a!=="object"){hc(n,"data",u);break}case"src":case"href":if(u===""&&(a!=="a"||o!=="href")){n.removeAttribute(o);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(o);break}u=pc(""+u),n.setAttribute(o,u);break;case"action":case"formAction":if(typeof u=="function"){n.setAttribute(o,"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 y=="function"&&(o==="formAction"?(a!=="input"&&vt(n,a,"name",p.name,p,null),vt(n,a,"formEncType",p.formEncType,p,null),vt(n,a,"formMethod",p.formMethod,p,null),vt(n,a,"formTarget",p.formTarget,p,null)):(vt(n,a,"encType",p.encType,p,null),vt(n,a,"method",p.method,p,null),vt(n,a,"target",p.target,p,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(o);break}u=pc(""+u),n.setAttribute(o,u);break;case"onClick":u!=null&&(n.onclick=Hr);break;case"onScroll":u!=null&&et("scroll",n);break;case"onScrollEnd":u!=null&&et("scrollend",n);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(o=u.__html,o!=null){if(p.children!=null)throw Error(s(60));n.innerHTML=o}}break;case"multiple":n.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":n.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){n.removeAttribute("xlink:href");break}o=pc(""+u),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,""+u):n.removeAttribute(o);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":u&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,""):n.removeAttribute(o);break;case"capture":case"download":u===!0?n.setAttribute(o,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,u):n.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?n.setAttribute(o,u):n.removeAttribute(o);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?n.removeAttribute(o):n.setAttribute(o,u);break;case"popover":et("beforetoggle",n),et("toggle",n),fc(n,"popover",u);break;case"xlinkActuate":Br(n,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Br(n,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Br(n,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Br(n,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Br(n,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Br(n,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Br(n,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Br(n,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Br(n,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":fc(n,"is",u);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=cj.get(o)||o,fc(n,o,u))}}function vm(n,a,o,u,p,y){switch(o){case"style":Kv(n,u,y);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(o=u.__html,o!=null){if(p.children!=null)throw Error(s(60));n.innerHTML=o}}break;case"children":typeof u=="string"?ni(n,u):(typeof u=="number"||typeof u=="bigint")&&ni(n,""+u);break;case"onScroll":u!=null&&et("scroll",n);break;case"onScrollEnd":u!=null&&et("scrollend",n);break;case"onClick":u!=null&&(n.onclick=Hr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Iv.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(p=o.endsWith("Capture"),a=o.slice(2,p?o.length-7:void 0),y=n[Nn]||null,y=y!=null?y[o]:null,typeof y=="function"&&n.removeEventListener(a,y,p),typeof u=="function")){typeof y!="function"&&y!==null&&(o in n?n[o]=null:n.hasAttribute(o)&&n.removeAttribute(o)),n.addEventListener(a,u,p);break e}o in n?n[o]=u:u===!0?n.setAttribute(o,""):fc(n,o,u)}}}function ln(n,a,o){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":et("error",n),et("load",n);var u=!1,p=!1,y;for(y in o)if(o.hasOwnProperty(y)){var _=o[y];if(_!=null)switch(y){case"src":u=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:vt(n,a,y,_,o,null)}}p&&vt(n,a,"srcSet",o.srcSet,o,null),u&&vt(n,a,"src",o.src,o,null);return;case"input":et("invalid",n);var T=y=_=p=null,D=null,F=null;for(u in o)if(o.hasOwnProperty(u)){var te=o[u];if(te!=null)switch(u){case"name":p=te;break;case"type":_=te;break;case"checked":D=te;break;case"defaultChecked":F=te;break;case"value":y=te;break;case"defaultValue":T=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(s(137,a));break;default:vt(n,a,u,te,o,null)}}qv(n,y,T,D,F,_,p,!1);return;case"select":et("invalid",n),u=_=y=null;for(p in o)if(o.hasOwnProperty(p)&&(T=o[p],T!=null))switch(p){case"value":y=T;break;case"defaultValue":_=T;break;case"multiple":u=T;default:vt(n,a,p,T,o,null)}a=y,o=_,n.multiple=!!u,a!=null?ti(n,!!u,a,!1):o!=null&&ti(n,!!u,o,!0);return;case"textarea":et("invalid",n),y=p=u=null;for(_ in o)if(o.hasOwnProperty(_)&&(T=o[_],T!=null))switch(_){case"value":u=T;break;case"defaultValue":p=T;break;case"children":y=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(s(91));break;default:vt(n,a,_,T,o,null)}Gv(n,u,p,y);return;case"option":for(D in o)if(o.hasOwnProperty(D)&&(u=o[D],u!=null))switch(D){case"selected":n.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:vt(n,a,D,u,o,null)}return;case"dialog":et("beforetoggle",n),et("toggle",n),et("cancel",n),et("close",n);break;case"iframe":case"object":et("load",n);break;case"video":case"audio":for(u=0;u<rl.length;u++)et(rl[u],n);break;case"image":et("error",n),et("load",n);break;case"details":et("toggle",n);break;case"embed":case"source":case"link":et("error",n),et("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(F in o)if(o.hasOwnProperty(F)&&(u=o[F],u!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:vt(n,a,F,u,o,null)}return;default:if(kf(a)){for(te in o)o.hasOwnProperty(te)&&(u=o[te],u!==void 0&&vm(n,a,te,u,o,void 0));return}}for(T in o)o.hasOwnProperty(T)&&(u=o[T],u!=null&&vt(n,a,T,u,o,null))}function LA(n,a,o,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,y=null,_=null,T=null,D=null,F=null,te=null;for(J in o){var ie=o[J];if(o.hasOwnProperty(J)&&ie!=null)switch(J){case"checked":break;case"value":break;case"defaultValue":D=ie;default:u.hasOwnProperty(J)||vt(n,a,J,null,u,ie)}}for(var W in u){var J=u[W];if(ie=o[W],u.hasOwnProperty(W)&&(J!=null||ie!=null))switch(W){case"type":y=J;break;case"name":p=J;break;case"checked":F=J;break;case"defaultChecked":te=J;break;case"value":_=J;break;case"defaultValue":T=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(s(137,a));break;default:J!==ie&&vt(n,a,W,J,u,ie)}}Af(n,_,T,D,F,te,y,p);return;case"select":J=_=T=W=null;for(y in o)if(D=o[y],o.hasOwnProperty(y)&&D!=null)switch(y){case"value":break;case"multiple":J=D;default:u.hasOwnProperty(y)||vt(n,a,y,null,u,D)}for(p in u)if(y=u[p],D=o[p],u.hasOwnProperty(p)&&(y!=null||D!=null))switch(p){case"value":W=y;break;case"defaultValue":T=y;break;case"multiple":_=y;default:y!==D&&vt(n,a,p,y,u,D)}a=T,o=_,u=J,W!=null?ti(n,!!o,W,!1):!!u!=!!o&&(a!=null?ti(n,!!o,a,!0):ti(n,!!o,o?[]:"",!1));return;case"textarea":J=W=null;for(T in o)if(p=o[T],o.hasOwnProperty(T)&&p!=null&&!u.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:vt(n,a,T,null,u,p)}for(_ in u)if(p=u[_],y=o[_],u.hasOwnProperty(_)&&(p!=null||y!=null))switch(_){case"value":W=p;break;case"defaultValue":J=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(s(91));break;default:p!==y&&vt(n,a,_,p,u,y)}Vv(n,W,J);return;case"option":for(var Se in o)if(W=o[Se],o.hasOwnProperty(Se)&&W!=null&&!u.hasOwnProperty(Se))switch(Se){case"selected":n.selected=!1;break;default:vt(n,a,Se,null,u,W)}for(D in u)if(W=u[D],J=o[D],u.hasOwnProperty(D)&&W!==J&&(W!=null||J!=null))switch(D){case"selected":n.selected=W&&typeof W!="function"&&typeof W!="symbol";break;default:vt(n,a,D,W,u,J)}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 ze in o)W=o[ze],o.hasOwnProperty(ze)&&W!=null&&!u.hasOwnProperty(ze)&&vt(n,a,ze,null,u,W);for(F in u)if(W=u[F],J=o[F],u.hasOwnProperty(F)&&W!==J&&(W!=null||J!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(s(137,a));break;default:vt(n,a,F,W,u,J)}return;default:if(kf(a)){for(var yt in o)W=o[yt],o.hasOwnProperty(yt)&&W!==void 0&&!u.hasOwnProperty(yt)&&vm(n,a,yt,void 0,u,W);for(te in u)W=u[te],J=o[te],!u.hasOwnProperty(te)||W===J||W===void 0&&J===void 0||vm(n,a,te,W,u,J);return}}for(var U in o)W=o[U],o.hasOwnProperty(U)&&W!=null&&!u.hasOwnProperty(U)&&vt(n,a,U,null,u,W);for(ie in u)W=u[ie],J=o[ie],!u.hasOwnProperty(ie)||W===J||W==null&&J==null||vt(n,a,ie,W,u,J)}function W0(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function zA(){if(typeof performance.getEntriesByType=="function"){for(var n=0,a=0,o=performance.getEntriesByType("resource"),u=0;u<o.length;u++){var p=o[u],y=p.transferSize,_=p.initiatorType,T=p.duration;if(y&&T&&W0(_)){for(_=0,T=p.responseEnd,u+=1;u<o.length;u++){var D=o[u],F=D.startTime;if(F>T)break;var te=D.transferSize,ie=D.initiatorType;te&&W0(ie)&&(D=D.responseEnd,_+=te*(D<T?1:(T-F)/(D-F)))}if(--u,a+=8*(y+_)/(p.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 ym=null,bm=null;function uu(n){return n.nodeType===9?n:n.ownerDocument}function Y0(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 X0(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 xm(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 wm=null;function IA(){var n=window.event;return n&&n.type==="popstate"?n===wm?!1:(wm=n,!0):(wm=null,!1)}var J0=typeof setTimeout=="function"?setTimeout:void 0,$A=typeof clearTimeout=="function"?clearTimeout:void 0,Q0=typeof Promise=="function"?Promise:void 0,UA=typeof queueMicrotask=="function"?queueMicrotask:typeof Q0<"u"?function(n){return Q0.resolve(null).then(n).catch(BA)}:J0;function BA(n){setTimeout(function(){throw n})}function Ba(n){return n==="head"}function Z0(n,a){var o=a,u=0;do{var p=o.nextSibling;if(n.removeChild(o),p&&p.nodeType===8)if(o=p.data,o==="/$"||o==="/&"){if(u===0){n.removeChild(p),Mi(a);return}u--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")u++;else if(o==="html")sl(n.ownerDocument.documentElement);else if(o==="head"){o=n.ownerDocument.head,sl(o);for(var y=o.firstChild;y;){var _=y.nextSibling,T=y.nodeName;y[So]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&y.rel.toLowerCase()==="stylesheet"||o.removeChild(y),y=_}}else o==="body"&&sl(n.ownerDocument.body);o=p}while(o);Mi(a)}function ex(n,a){var o=n;n=0;do{var u=o.nextSibling;if(o.nodeType===1?a?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(a?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),u&&u.nodeType===8)if(o=u.data,o==="/$"){if(n===0)break;n--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||n++;o=u}while(o)}function _m(n){var a=n.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var o=a;switch(a=a.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":_m(o),Tf(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}n.removeChild(o)}}function HA(n,a,o,u){for(;n.nodeType===1;){var p=o;if(n.nodeName.toLowerCase()!==a.toLowerCase()){if(!u&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(u){if(!n[So])switch(a){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(y=n.getAttribute("rel"),y==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(y!==p.rel||n.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||n.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||n.getAttribute("title")!==(p.title==null?null:p.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(y=n.getAttribute("src"),(y!==(p.src==null?null:p.src)||n.getAttribute("type")!==(p.type==null?null:p.type)||n.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&y&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(a==="input"&&n.type==="hidden"){var y=p.name==null?null:""+p.name;if(p.type==="hidden"&&n.getAttribute("name")===y)return n}else return n;if(n=rr(n.nextSibling),n===null)break}return null}function qA(n,a,o){if(a==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!o||(n=rr(n.nextSibling),n===null))return null;return n}function tx(n,a){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=rr(n.nextSibling),n===null))return null;return n}function Sm(n){return n.data==="$?"||n.data==="$~"}function Em(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function VA(n,a){var o=n.ownerDocument;if(n.data==="$~")n._reactRetry=a;else if(n.data!=="$?"||o.readyState!=="loading")a();else{var u=function(){a(),o.removeEventListener("DOMContentLoaded",u)};o.addEventListener("DOMContentLoaded",u),n._reactRetry=u}}function rr(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 Cm=null;function nx(n){n=n.nextSibling;for(var a=0;n;){if(n.nodeType===8){var o=n.data;if(o==="/$"||o==="/&"){if(a===0)return rr(n.nextSibling);a--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||a++}n=n.nextSibling}return null}function rx(n){n=n.previousSibling;for(var a=0;n;){if(n.nodeType===8){var o=n.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(a===0)return n;a--}else o!=="/$"&&o!=="/&"||a++}n=n.previousSibling}return null}function ax(n,a,o){switch(a=uu(o),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 sl(n){for(var a=n.attributes;a.length;)n.removeAttributeNode(a[0]);Tf(n)}var ar=new Map,sx=new Set;function du(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var aa=q.d;q.d={f:GA,r:FA,D:KA,C:WA,L:YA,m:XA,X:QA,S:JA,M:ZA};function GA(){var n=aa.f(),a=nu();return n||a}function FA(n){var a=Qs(n);a!==null&&a.tag===5&&a.type==="form"?_b(a):aa.r(n)}var Ri=typeof document>"u"?null:document;function ix(n,a,o){var u=Ri;if(u&&typeof a=="string"&&a){var p=Xn(a);p='link[rel="'+n+'"][href="'+p+'"]',typeof o=="string"&&(p+='[crossorigin="'+o+'"]'),sx.has(p)||(sx.add(p),n={rel:n,crossOrigin:o,href:a},u.querySelector(p)===null&&(a=u.createElement("link"),ln(a,"link",n),Zt(a),u.head.appendChild(a)))}}function KA(n){aa.D(n),ix("dns-prefetch",n,null)}function WA(n,a){aa.C(n,a),ix("preconnect",n,a)}function YA(n,a,o){aa.L(n,a,o);var u=Ri;if(u&&n&&a){var p='link[rel="preload"][as="'+Xn(a)+'"]';a==="image"&&o&&o.imageSrcSet?(p+='[imagesrcset="'+Xn(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(p+='[imagesizes="'+Xn(o.imageSizes)+'"]')):p+='[href="'+Xn(n)+'"]';var y=p;switch(a){case"style":y=ki(n);break;case"script":y=Oi(n)}ar.has(y)||(n=g({rel:"preload",href:a==="image"&&o&&o.imageSrcSet?void 0:n,as:a},o),ar.set(y,n),u.querySelector(p)!==null||a==="style"&&u.querySelector(il(y))||a==="script"&&u.querySelector(ol(y))||(a=u.createElement("link"),ln(a,"link",n),Zt(a),u.head.appendChild(a)))}}function XA(n,a){aa.m(n,a);var o=Ri;if(o&&n){var u=a&&typeof a.as=="string"?a.as:"script",p='link[rel="modulepreload"][as="'+Xn(u)+'"][href="'+Xn(n)+'"]',y=p;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=Oi(n)}if(!ar.has(y)&&(n=g({rel:"modulepreload",href:n},a),ar.set(y,n),o.querySelector(p)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(ol(y)))return}u=o.createElement("link"),ln(u,"link",n),Zt(u),o.head.appendChild(u)}}}function JA(n,a,o){aa.S(n,a,o);var u=Ri;if(u&&n){var p=Zs(u).hoistableStyles,y=ki(n);a=a||"default";var _=p.get(y);if(!_){var T={loading:0,preload:null};if(_=u.querySelector(il(y)))T.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":a},o),(o=ar.get(y))&&Nm(n,o);var D=_=u.createElement("link");Zt(D),ln(D,"link",n),D._p=new Promise(function(F,te){D.onload=F,D.onerror=te}),D.addEventListener("load",function(){T.loading|=1}),D.addEventListener("error",function(){T.loading|=2}),T.loading|=4,fu(_,a,u)}_={type:"stylesheet",instance:_,count:1,state:T},p.set(y,_)}}}function QA(n,a){aa.X(n,a);var o=Ri;if(o&&n){var u=Zs(o).hoistableScripts,p=Oi(n),y=u.get(p);y||(y=o.querySelector(ol(p)),y||(n=g({src:n,async:!0},a),(a=ar.get(p))&&Tm(n,a),y=o.createElement("script"),Zt(y),ln(y,"link",n),o.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},u.set(p,y))}}function ZA(n,a){aa.M(n,a);var o=Ri;if(o&&n){var u=Zs(o).hoistableScripts,p=Oi(n),y=u.get(p);y||(y=o.querySelector(ol(p)),y||(n=g({src:n,async:!0,type:"module"},a),(a=ar.get(p))&&Tm(n,a),y=o.createElement("script"),Zt(y),ln(y,"link",n),o.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},u.set(p,y))}}function ox(n,a,o,u){var p=(p=ne.current)?du(p):null;if(!p)throw Error(s(446));switch(n){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(a=ki(o.href),o=Zs(p).hoistableStyles,u=o.get(a),u||(u={type:"style",instance:null,count:0,state:null},o.set(a,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){n=ki(o.href);var y=Zs(p).hoistableStyles,_=y.get(n);if(_||(p=p.ownerDocument||p,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(n,_),(y=p.querySelector(il(n)))&&!y._p&&(_.instance=y,_.state.loading=5),ar.has(n)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},ar.set(n,o),y||eR(p,n,o,_.state))),a&&u===null)throw Error(s(528,""));return _}if(a&&u!==null)throw Error(s(529,""));return null;case"script":return a=o.async,o=o.src,typeof o=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Oi(o),o=Zs(p).hoistableScripts,u=o.get(a),u||(u={type:"script",instance:null,count:0,state:null},o.set(a,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,n))}}function ki(n){return'href="'+Xn(n)+'"'}function il(n){return'link[rel="stylesheet"]['+n+"]"}function lx(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function eR(n,a,o,u){n.querySelector('link[rel="preload"][as="style"]['+a+"]")?u.loading=1:(a=n.createElement("link"),u.preload=a,a.addEventListener("load",function(){return u.loading|=1}),a.addEventListener("error",function(){return u.loading|=2}),ln(a,"link",o),Zt(a),n.head.appendChild(a))}function Oi(n){return'[src="'+Xn(n)+'"]'}function ol(n){return"script[async]"+n}function cx(n,a,o){if(a.count++,a.instance===null)switch(a.type){case"style":var u=n.querySelector('style[data-href~="'+Xn(o.href)+'"]');if(u)return a.instance=u,Zt(u),u;var p=g({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return u=(n.ownerDocument||n).createElement("style"),Zt(u),ln(u,"style",p),fu(u,o.precedence,n),a.instance=u;case"stylesheet":p=ki(o.href);var y=n.querySelector(il(p));if(y)return a.state.loading|=4,a.instance=y,Zt(y),y;u=lx(o),(p=ar.get(p))&&Nm(u,p),y=(n.ownerDocument||n).createElement("link"),Zt(y);var _=y;return _._p=new Promise(function(T,D){_.onload=T,_.onerror=D}),ln(y,"link",u),a.state.loading|=4,fu(y,o.precedence,n),a.instance=y;case"script":return y=Oi(o.src),(p=n.querySelector(ol(y)))?(a.instance=p,Zt(p),p):(u=o,(p=ar.get(y))&&(u=g({},o),Tm(u,p)),n=n.ownerDocument||n,p=n.createElement("script"),Zt(p),ln(p,"link",u),n.head.appendChild(p),a.instance=p);case"void":return null;default:throw Error(s(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(u=a.instance,a.state.loading|=4,fu(u,o.precedence,n));return a.instance}function fu(n,a,o){for(var u=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=u.length?u[u.length-1]:null,y=p,_=0;_<u.length;_++){var T=u[_];if(T.dataset.precedence===a)y=T;else if(y!==p)break}y?y.parentNode.insertBefore(n,y.nextSibling):(a=o.nodeType===9?o.head:o,a.insertBefore(n,a.firstChild))}function Nm(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.title==null&&(n.title=a.title)}function Tm(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.integrity==null&&(n.integrity=a.integrity)}var hu=null;function ux(n,a,o){if(hu===null){var u=new Map,p=hu=new Map;p.set(o,u)}else p=hu,u=p.get(o),u||(u=new Map,p.set(o,u));if(u.has(n))return u;for(u.set(n,null),o=o.getElementsByTagName(n),p=0;p<o.length;p++){var y=o[p];if(!(y[So]||y[rn]||n==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var _=y.getAttribute(a)||"";_=n+_;var T=u.get(_);T?T.push(y):u.set(_,[y])}}return u}function dx(n,a,o){n=n.ownerDocument||n,n.head.insertBefore(o,a==="title"?n.querySelector("head > title"):null)}function tR(n,a,o){if(o===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 fx(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function nR(n,a,o,u){if(o.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var p=ki(u.href),y=a.querySelector(il(p));if(y){a=y._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=mu.bind(n),a.then(n,n)),o.state.loading|=4,o.instance=y,Zt(y);return}y=a.ownerDocument||a,u=lx(u),(p=ar.get(p))&&Nm(u,p),y=y.createElement("link"),Zt(y);var _=y;_._p=new Promise(function(T,D){_.onload=T,_.onerror=D}),ln(y,"link",u),o.instance=y}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(o,a),(a=o.state.preload)&&(o.state.loading&3)===0&&(n.count++,o=mu.bind(n),a.addEventListener("load",o),a.addEventListener("error",o))}}var jm=0;function rR(n,a){return n.stylesheets&&n.count===0&&gu(n,n.stylesheets),0<n.count||0<n.imgCount?function(o){var u=setTimeout(function(){if(n.stylesheets&&gu(n,n.stylesheets),n.unsuspend){var y=n.unsuspend;n.unsuspend=null,y()}},6e4+a);0<n.imgBytes&&jm===0&&(jm=62500*zA());var p=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&gu(n,n.stylesheets),n.unsuspend)){var y=n.unsuspend;n.unsuspend=null,y()}},(n.imgBytes>jm?50:800)+a);return n.unsuspend=o,function(){n.unsuspend=null,clearTimeout(u),clearTimeout(p)}}:null}function mu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)gu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var pu=null;function gu(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,pu=new Map,a.forEach(aR,n),pu=null,mu.call(n))}function aR(n,a){if(!(a.state.loading&4)){var o=pu.get(n);if(o)var u=o.get(null);else{o=new Map,pu.set(n,o);for(var p=n.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<p.length;y++){var _=p[y];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(o.set(_.dataset.precedence,_),u=_)}u&&o.set(null,u)}p=a.instance,_=p.getAttribute("data-precedence"),y=o.get(_)||u,y===u&&o.set(null,p),o.set(_,p),this.count++,u=mu.bind(this),p.addEventListener("load",u),p.addEventListener("error",u),y?y.parentNode.insertBefore(p,y.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(p,n.firstChild)),a.state.loading|=4}}var ll={$$typeof:j,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function sR(n,a,o,u,p,y,_,T,D){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=_a(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_a(0),this.hiddenUpdates=_a(null),this.identifierPrefix=u,this.onUncaughtError=p,this.onCaughtError=y,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=D,this.incompleteTransitions=new Map}function hx(n,a,o,u,p,y,_,T,D,F,te,ie){return n=new sR(n,a,o,_,D,F,te,ie,T),a=1,y===!0&&(a|=24),y=Un(3,null,null,a),n.current=y,y.stateNode=n,a=oh(),a.refCount++,n.pooledCache=a,a.refCount++,y.memoizedState={element:u,isDehydrated:o,cache:a},dh(y),n}function mx(n){return n?(n=ci,n):ci}function px(n,a,o,u,p,y){p=mx(p),u.context===null?u.context=p:u.pendingContext=p,u=Ra(a),u.payload={element:o},y=y===void 0?null:y,y!==null&&(u.callback=y),o=ka(n,u,a),o!==null&&(On(o,n,a),Uo(o,n,a))}function gx(n,a){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var o=n.retryLane;n.retryLane=o!==0&&o<a?o:a}}function Am(n,a){gx(n,a),(n=n.alternate)&&gx(n,a)}function vx(n){if(n.tag===13||n.tag===31){var a=ps(n,67108864);a!==null&&On(a,n,67108864),Am(n,67108864)}}function yx(n){if(n.tag===13||n.tag===31){var a=Gn();a=Ys(a);var o=ps(n,a);o!==null&&On(o,n,a),Am(n,a)}}var vu=!0;function iR(n,a,o,u){var p=R.T;R.T=null;var y=q.p;try{q.p=2,Rm(n,a,o,u)}finally{q.p=y,R.T=p}}function oR(n,a,o,u){var p=R.T;R.T=null;var y=q.p;try{q.p=8,Rm(n,a,o,u)}finally{q.p=y,R.T=p}}function Rm(n,a,o,u){if(vu){var p=km(u);if(p===null)gm(n,a,u,yu,o),xx(n,u);else if(cR(p,n,a,o,u))u.stopPropagation();else if(xx(n,u),a&4&&-1<lR.indexOf(n)){for(;p!==null;){var y=Qs(p);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var _=st(y.pendingLanes);if(_!==0){var T=y;for(T.pendingLanes|=2,T.entangledLanes|=2;_;){var D=1<<31-At(_);T.entanglements[1]|=D,_&=~D}jr(y),(dt&6)===0&&(eu=Be()+500,nl(0))}}break;case 31:case 13:T=ps(y,2),T!==null&&On(T,y,2),nu(),Am(y,2)}if(y=km(u),y===null&&gm(n,a,u,yu,o),y===p)break;p=y}p!==null&&u.stopPropagation()}else gm(n,a,u,null,o)}}function km(n){return n=Mf(n),Om(n)}var yu=null;function Om(n){if(yu=null,n=Js(n),n!==null){var a=l(n);if(a===null)n=null;else{var o=a.tag;if(o===13){if(n=c(a),n!==null)return n;n=null}else if(o===31){if(n=d(a),n!==null)return n;n=null}else if(o===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;n=null}else a!==n&&(n=null)}}return yu=n,null}function bx(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(ce()){case Le:return 2;case ut:return 8;case fn:case Ot:return 32;case Kt:return 268435456;default:return 32}default:return 32}}var Mm=!1,Ha=null,qa=null,Va=null,cl=new Map,ul=new Map,Ga=[],lR="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 xx(n,a){switch(n){case"focusin":case"focusout":Ha=null;break;case"dragenter":case"dragleave":qa=null;break;case"mouseover":case"mouseout":Va=null;break;case"pointerover":case"pointerout":cl.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":ul.delete(a.pointerId)}}function dl(n,a,o,u,p,y){return n===null||n.nativeEvent!==y?(n={blockedOn:a,domEventName:o,eventSystemFlags:u,nativeEvent:y,targetContainers:[p]},a!==null&&(a=Qs(a),a!==null&&vx(a)),n):(n.eventSystemFlags|=u,a=n.targetContainers,p!==null&&a.indexOf(p)===-1&&a.push(p),n)}function cR(n,a,o,u,p){switch(a){case"focusin":return Ha=dl(Ha,n,a,o,u,p),!0;case"dragenter":return qa=dl(qa,n,a,o,u,p),!0;case"mouseover":return Va=dl(Va,n,a,o,u,p),!0;case"pointerover":var y=p.pointerId;return cl.set(y,dl(cl.get(y)||null,n,a,o,u,p)),!0;case"gotpointercapture":return y=p.pointerId,ul.set(y,dl(ul.get(y)||null,n,a,o,u,p)),!0}return!1}function wx(n){var a=Js(n.target);if(a!==null){var o=l(a);if(o!==null){if(a=o.tag,a===13){if(a=c(o),a!==null){n.blockedOn=a,Pv(n.priority,function(){yx(o)});return}}else if(a===31){if(a=d(o),a!==null){n.blockedOn=a,Pv(n.priority,function(){yx(o)});return}}else if(a===3&&o.stateNode.current.memoizedState.isDehydrated){n.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}n.blockedOn=null}function bu(n){if(n.blockedOn!==null)return!1;for(var a=n.targetContainers;0<a.length;){var o=km(n.nativeEvent);if(o===null){o=n.nativeEvent;var u=new o.constructor(o.type,o);Of=u,o.target.dispatchEvent(u),Of=null}else return a=Qs(o),a!==null&&vx(a),n.blockedOn=o,!1;a.shift()}return!0}function _x(n,a,o){bu(n)&&o.delete(a)}function uR(){Mm=!1,Ha!==null&&bu(Ha)&&(Ha=null),qa!==null&&bu(qa)&&(qa=null),Va!==null&&bu(Va)&&(Va=null),cl.forEach(_x),ul.forEach(_x)}function xu(n,a){n.blockedOn===a&&(n.blockedOn=null,Mm||(Mm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,uR)))}var wu=null;function Sx(n){wu!==n&&(wu=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){wu===n&&(wu=null);for(var a=0;a<n.length;a+=3){var o=n[a],u=n[a+1],p=n[a+2];if(typeof u!="function"){if(Om(u||o)===null)continue;break}var y=Qs(o);y!==null&&(n.splice(a,3),a-=3,kh(y,{pending:!0,data:p,method:o.method,action:u},u,p))}}))}function Mi(n){function a(D){return xu(D,n)}Ha!==null&&xu(Ha,n),qa!==null&&xu(qa,n),Va!==null&&xu(Va,n),cl.forEach(a),ul.forEach(a);for(var o=0;o<Ga.length;o++){var u=Ga[o];u.blockedOn===n&&(u.blockedOn=null)}for(;0<Ga.length&&(o=Ga[0],o.blockedOn===null);)wx(o),o.blockedOn===null&&Ga.shift();if(o=(n.ownerDocument||n).$$reactFormReplay,o!=null)for(u=0;u<o.length;u+=3){var p=o[u],y=o[u+1],_=p[Nn]||null;if(typeof y=="function")_||Sx(o);else if(_){var T=null;if(y&&y.hasAttribute("formAction")){if(p=y,_=y[Nn]||null)T=_.formAction;else if(Om(p)!==null)continue}else T=_.action;typeof T=="function"?o[u+1]=T:(o.splice(u,3),u-=3),Sx(o)}}}function Ex(){function n(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(_){return p=_})},focusReset:"manual",scroll:"manual"})}function a(){p!==null&&(p(),p=null),u||setTimeout(o,20)}function o(){if(!u&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,p=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(o,100),function(){u=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),p!==null&&(p(),p=null)}}}function Dm(n){this._internalRoot=n}_u.prototype.render=Dm.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(s(409));var o=a.current,u=Gn();px(o,u,n,a,null,null)},_u.prototype.unmount=Dm.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;px(n.current,2,null,n,null,null),nu(),a[Xs]=null}};function _u(n){this._internalRoot=n}_u.prototype.unstable_scheduleHydration=function(n){if(n){var a=Cf();n={blockedOn:null,target:n,priority:a};for(var o=0;o<Ga.length&&a!==0&&a<Ga[o].priority;o++);Ga.splice(o,0,n),o===0&&wx(n)}};var Cx=t.version;if(Cx!=="19.2.6")throw Error(s(527,Cx,"19.2.6"));q.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 dR={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:R,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Su=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Su.isDisabled&&Su.supportsFiber)try{hn=Su.inject(dR),Ct=Su}catch{}}return hl.createRoot=function(n,a){if(!i(n))throw Error(s(299));var o=!1,u="",p=Ob,y=Mb,_=Db;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(_=a.onRecoverableError)),a=hx(n,1,!1,null,null,o,u,null,p,y,_,Ex),n[Xs]=a.current,pm(n),new Dm(a)},hl.hydrateRoot=function(n,a,o){if(!i(n))throw Error(s(299));var u=!1,p="",y=Ob,_=Mb,T=Db,D=null;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(p=o.identifierPrefix),o.onUncaughtError!==void 0&&(y=o.onUncaughtError),o.onCaughtError!==void 0&&(_=o.onCaughtError),o.onRecoverableError!==void 0&&(T=o.onRecoverableError),o.formState!==void 0&&(D=o.formState)),a=hx(n,1,!0,a,o??null,u,p,D,y,_,T,Ex),a.context=mx(null),o=a.current,u=Gn(),u=Ys(u),p=Ra(u),p.callback=null,ka(o,p,u),o=u,a.current.lanes=o,Rt(a,o),jr(a),n[Xs]=a.current,pm(n),new _u(a)},hl.version="19.2.6",hl}var Px;function wR(){if(Px)return zm.exports;Px=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(),zm.exports=xR(),zm.exports}var _R=wR();/**
* 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 Lx="popstate";function zx(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function SR(e={}){function t(s,i){var m;let l=(m=i.state)==null?void 0:m.masked,{pathname:c,search:d,hash:h}=l||s.location;return Cp("",{pathname:c,search:d,hash:h},i.state&&i.state.usr||null,i.state&&i.state.key||"default",l?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,i){return typeof i=="string"?i:Ml(i)}return CR(t,r,null,e)}function kt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ir(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function ER(){return Math.random().toString(36).substring(2,10)}function Ix(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 Cp(e,t,r=null,s,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?uo(t):t,state:r,key:t&&t.key||s||ER(),mask:i}}function Ml({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 uo(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 CR(e,t,r,s={}){let{window:i=document.defaultView,v5Compat:l=!1}=s,c=i.history,d="POP",h=null,m=b();m==null&&(m=0,c.replaceState({...c.state,idx:m},""));function b(){return(c.state||{idx:null}).idx}function g(){d="POP";let N=b(),C=N==null?null:N-m;m=N,h&&h({action:d,location:S.location,delta:C})}function x(N,C){d="PUSH";let A=zx(N)?N:Cp(S.location,N,C);m=b()+1;let j=Ix(A,m),k=S.createHref(A.mask||A);try{c.pushState(j,"",k)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;i.location.assign(k)}l&&h&&h({action:d,location:S.location,delta:1})}function w(N,C){d="REPLACE";let A=zx(N)?N:Cp(S.location,N,C);m=b();let j=Ix(A,m),k=S.createHref(A.mask||A);c.replaceState(j,"",k),l&&h&&h({action:d,location:S.location,delta:0})}function E(N){return NR(N)}let S={get action(){return d},get location(){return e(i,c)},listen(N){if(h)throw new Error("A history only accepts one active listener");return i.addEventListener(Lx,g),h=N,()=>{i.removeEventListener(Lx,g),h=null}},createHref(N){return t(i,N)},createURL:E,encodeLocation(N){let C=E(N);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:x,replace:w,go(N){return c.go(N)}};return S}function NR(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),kt(r,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:Ml(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function H_(e,t,r="/"){return TR(e,t,r,!1)}function TR(e,t,r,s,i){let l=typeof t=="string"?uo(t):t,c=fa(l.pathname||"/",r);if(c==null)return null;let d=jR(e),h=null,m=UR(c);for(let b=0;h==null&&b<d.length;++b)h=IR(d[b],m,s);return h}function jR(e){let t=q_(e);return AR(t),t}function q_(e,t=[],r=[],s="",i=!1){let l=(c,d,h=i,m)=>{let b={relativePath:m===void 0?c.path||"":m,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(s)&&h)return;kt(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=wr([s,b.relativePath]),x=r.concat(b);c.children&&c.children.length>0&&(kt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),q_(c.children,t,x,g,h)),!(c.path==null&&!c.index)&&t.push({path:g,score:LR(g,c.index),routesMeta:x})};return e.forEach((c,d)=>{var h;if(c.path===""||!((h=c.path)!=null&&h.includes("?")))l(c,d);else for(let m of V_(c.path))l(c,d,!0,m)}),t}function V_(e){let t=e.split("/");if(t.length===0)return[];let[r,...s]=t,i=r.endsWith("?"),l=r.replace(/\?$/,"");if(s.length===0)return i?[l,""]:[l];let c=V_(s.join("/")),d=[];return d.push(...c.map(h=>h===""?l:[l,h].join("/"))),i&&d.push(...c),d.map(h=>e.startsWith("/")&&h===""?"/":h)}function AR(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:zR(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var RR=/^:[\w-]+$/,kR=3,OR=2,MR=1,DR=10,PR=-2,$x=e=>e==="*";function LR(e,t){let r=e.split("/"),s=r.length;return r.some($x)&&(s+=PR),t&&(s+=OR),r.filter(i=>!$x(i)).reduce((i,l)=>i+(RR.test(l)?kR:l===""?MR:DR),s)}function zR(e,t){return e.length===t.length&&e.slice(0,-1).every((s,i)=>s===t[i])?e[e.length-1]-t[t.length-1]:0}function IR(e,t,r=!1){let{routesMeta:s}=e,i={},l="/",c=[];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=ud({path:h.relativePath,caseSensitive:h.caseSensitive,end:m},b),x=h.route;if(!g&&m&&r&&!s[s.length-1].route.index&&(g=ud({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},b)),!g)return null;Object.assign(i,g.params),c.push({params:i,pathname:wr([l,g.pathname]),pathnameBase:VR(wr([l,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(l=wr([l,g.pathnameBase]))}return c}function ud(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=$R(e.path,e.caseSensitive,e.end),i=t.match(r);if(!i)return null;let l=i[0],c=l.replace(/(.)\/+$/,"$1"),d=i.slice(1);return{params:s.reduce((m,{paramName:b,isOptional:g},x)=>{if(b==="*"){let E=d[x]||"";c=l.slice(0,l.length-E.length).replace(/(.)\/+$/,"$1")}const w=d[x];return g&&!w?m[b]=void 0:m[b]=(w||"").replace(/%2F/g,"/"),m},{}),pathname:l,pathnameBase:c,pattern:e}}function $R(e,t=!1,r=!0){Ir(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=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,d,h,m,b)=>{if(s.push({paramName:d,isOptional:h!=null}),h){let g=b.charAt(m+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),s]}function UR(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ir(!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 fa(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 BR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function HR(e,t="/"){let{pathname:r,search:s="",hash:i=""}=typeof e=="string"?uo(e):e,l;return r?(r=F_(r),r.startsWith("/")?l=Ux(r.substring(1),"/"):l=Ux(r,t)):l=t,{pathname:l,search:GR(s),hash:FR(i)}}function Ux(e,t){let r=dd(t).split("/");return e.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Bm(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 qR(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function G_(e){let t=qR(e);return t.map((r,s)=>s===t.length-1?r.pathname:r.pathnameBase)}function bg(e,t,r,s=!1){let i;typeof e=="string"?i=uo(e):(i={...e},kt(!i.pathname||!i.pathname.includes("?"),Bm("?","pathname","search",i)),kt(!i.pathname||!i.pathname.includes("#"),Bm("#","pathname","hash",i)),kt(!i.search||!i.search.includes("#"),Bm("#","search","hash",i)));let l=e===""||i.pathname==="",c=l?"/":i.pathname,d;if(c==null)d=r;else{let g=t.length-1;if(!s&&c.startsWith("..")){let x=c.split("/");for(;x[0]==="..";)x.shift(),g-=1;i.pathname=x.join("/")}d=g>=0?t[g]:"/"}let h=HR(i,d),m=c&&c!=="/"&&c.endsWith("/"),b=(l||c===".")&&r.endsWith("/");return!h.pathname.endsWith("/")&&(m||b)&&(h.pathname+="/"),h}var F_=e=>e.replace(/\/\/+/g,"/"),wr=e=>F_(e.join("/")),dd=e=>e.replace(/\/+$/,""),VR=e=>dd(e).replace(/^\/*/,"/"),GR=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,FR=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,KR=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 WR(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function YR(e){let t=e.map(r=>r.route.path).filter(Boolean);return wr(t)||"/"}var K_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function W_(e,t){let r=e;if(typeof r!="string"||!BR.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,i=!1;if(K_)try{let l=new URL(window.location.href),c=r.startsWith("//")?new URL(l.protocol+r):new URL(r),d=fa(c.pathname,t);c.origin===l.origin&&d!=null?r=d+c.search+c.hash:i=!0}catch{Ir(!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:i,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Y_=["POST","PUT","PATCH","DELETE"];new Set(Y_);var XR=["GET",...Y_];new Set(XR);var fo=v.createContext(null);fo.displayName="DataRouter";var $d=v.createContext(null);$d.displayName="DataRouterState";var X_=v.createContext(!1);function JR(){return v.useContext(X_)}var J_=v.createContext({isTransitioning:!1});J_.displayName="ViewTransition";var QR=v.createContext(new Map);QR.displayName="Fetchers";var ZR=v.createContext(null);ZR.displayName="Await";var lr=v.createContext(null);lr.displayName="Navigation";var Yl=v.createContext(null);Yl.displayName="Location";var ya=v.createContext({outlet:null,matches:[],isDataRoute:!1});ya.displayName="Route";var xg=v.createContext(null);xg.displayName="RouteError";var Q_="REACT_ROUTER_ERROR",ek="REDIRECT",tk="ROUTE_ERROR_RESPONSE";function nk(e){if(e.startsWith(`${Q_}:${ek}:{`))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 rk(e){if(e.startsWith(`${Q_}:${tk}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new KR(t.status,t.statusText,t.data)}catch{}}function ak(e,{relative:t}={}){kt(Xl(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=v.useContext(lr),{hash:i,pathname:l,search:c}=Jl(e,{relative:t}),d=l;return r!=="/"&&(d=l==="/"?r:wr([r,l])),s.createHref({pathname:d,search:c,hash:i})}function Xl(){return v.useContext(Yl)!=null}function ba(){return kt(Xl(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(Yl).location}var Z_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function eS(e){v.useContext(lr).static||v.useLayoutEffect(e)}function sk(){let{isDataRoute:e}=v.useContext(ya);return e?yk():ik()}function ik(){kt(Xl(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(fo),{basename:t,navigator:r}=v.useContext(lr),{matches:s}=v.useContext(ya),{pathname:i}=ba(),l=JSON.stringify(G_(s)),c=v.useRef(!1);return eS(()=>{c.current=!0}),v.useCallback((h,m={})=>{if(Ir(c.current,Z_),!c.current)return;if(typeof h=="number"){r.go(h);return}let b=bg(h,JSON.parse(l),i,m.relative==="path");e==null&&t!=="/"&&(b.pathname=b.pathname==="/"?t:wr([t,b.pathname])),(m.replace?r.replace:r.push)(b,m.state,m)},[t,r,l,i,e])}v.createContext(null);function Jl(e,{relative:t}={}){let{matches:r}=v.useContext(ya),{pathname:s}=ba(),i=JSON.stringify(G_(r));return v.useMemo(()=>bg(e,JSON.parse(i),s,t==="path"),[e,i,s,t])}function ok(e,t){return tS(e,t)}function tS(e,t,r){var N;kt(Xl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=v.useContext(lr),{matches:i}=v.useContext(ya),l=i[i.length-1],c=l?l.params:{},d=l?l.pathname:"/",h=l?l.pathnameBase:"/",m=l&&l.route;{let C=m&&m.path||"";rS(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=ba(),g;if(t){let C=typeof t=="string"?uo(t):t;kt(h==="/"||((N=C.pathname)==null?void 0:N.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 x=g.pathname||"/",w=x;if(h!=="/"){let C=h.replace(/^\//,"").split("/");w="/"+x.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})):H_(e,{pathname:w});Ir(m||E!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Ir(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=fk(E&&E.map(C=>Object.assign({},C,{params:Object.assign({},c,C.params),pathname:wr([h,s.encodeLocation?s.encodeLocation(C.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?h:wr([h,s.encodeLocation?s.encodeLocation(C.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),i,r);return t&&S?v.createElement(Yl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...g},navigationType:"POP"}},S):S}function lk(){let e=vk(),t=WR(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)",i={padding:"0.5rem",backgroundColor:s},l={padding:"2px 4px",backgroundColor:s},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:l},"ErrorBoundary")," or"," ",v.createElement("code",{style:l},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),r?v.createElement("pre",{style:i},r):null,c)}var ck=v.createElement(lk,null),nS=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){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=rk(e.digest);r&&(e=r)}let t=e!==void 0?v.createElement(ya.Provider,{value:this.props.routeContext},v.createElement(xg.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?v.createElement(uk,{error:e},t):t}};nS.contextType=X_;var Hm=new WeakMap;function uk({children:e,error:t}){let{basename:r}=v.useContext(lr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=nk(t.digest);if(s){let i=Hm.get(t);if(i)throw i;let l=W_(s.location,r);if(K_&&!Hm.get(t))if(l.isExternal||s.reloadDocument)window.location.href=l.absoluteURL||l.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:s.replace}));throw Hm.set(t,c),c}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function dk({routeContext:e,match:t,children:r}){let s=v.useContext(fo);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(ya.Provider,{value:e},r)}function fk(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 i=e,l=s==null?void 0:s.errors;if(l!=null){let b=i.findIndex(g=>g.route.id&&(l==null?void 0:l[g.route.id])!==void 0);kt(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),i=i.slice(0,Math.min(i.length,b+1))}let c=!1,d=-1;if(r&&s){c=s.renderFallback;for(let b=0;b<i.length;b++){let g=i[b];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(d=b),g.route.id){let{loaderData:x,errors:w}=s,E=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!w||w[g.route.id]===void 0);if(g.route.lazy||E){r.isStatic&&(c=!0),d>=0?i=i.slice(0,d+1):i=[i[0]];break}}}}let h=r==null?void 0:r.onError,m=s&&h?(b,g)=>{var x,w;h(b,{location:s.location,params:((w=(x=s.matches)==null?void 0:x[0])==null?void 0:w.params)??{},pattern:YR(s.matches),errorInfo:g})}:void 0;return i.reduceRight((b,g,x)=>{let w,E=!1,S=null,N=null;s&&(w=l&&g.route.id?l[g.route.id]:void 0,S=g.route.errorElement||ck,c&&(d<0&&x===0?(rS("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),E=!0,N=null):d===x&&(E=!0,N=g.route.hydrateFallbackElement||null)));let C=t.concat(i.slice(0,x+1)),A=()=>{let j;return w?j=S:E?j=N:g.route.Component?j=v.createElement(g.route.Component,null):g.route.element?j=g.route.element:j=b,v.createElement(dk,{match:g,routeContext:{outlet:b,matches:C,isDataRoute:s!=null},children:j})};return s&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?v.createElement(nS,{location:s.location,revalidation:s.revalidation,component:S,error:w,children:A(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:m}):A()},null)}function wg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function hk(e){let t=v.useContext(fo);return kt(t,wg(e)),t}function mk(e){let t=v.useContext($d);return kt(t,wg(e)),t}function pk(e){let t=v.useContext(ya);return kt(t,wg(e)),t}function _g(e){let t=pk(e),r=t.matches[t.matches.length-1];return kt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function gk(){return _g("useRouteId")}function vk(){var s;let e=v.useContext(xg),t=mk("useRouteError"),r=_g("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[r]}function yk(){let{router:e}=hk("useNavigate"),t=_g("useNavigate"),r=v.useRef(!1);return eS(()=>{r.current=!0}),v.useCallback(async(i,l={})=>{Ir(r.current,Z_),r.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:t,...l}))},[e,t])}var Bx={};function rS(e,t,r){!t&&!Bx[e]&&(Bx[e]=!0,Ir(!1,r))}v.memo(bk);function bk({routes:e,manifest:t,future:r,state:s,isStatic:i,onError:l}){return tS(e,void 0,{manifest:t,state:s,isStatic:i,onError:l})}function aS(e){kt(!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 xk({basename:e="/",children:t=null,location:r,navigationType:s="POP",navigator:i,static:l=!1,useTransitions:c}){kt(!Xl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),h=v.useMemo(()=>({basename:d,navigator:i,static:l,useTransitions:c,future:{}}),[d,i,l,c]);typeof r=="string"&&(r=uo(r));let{pathname:m="/",search:b="",hash:g="",state:x=null,key:w="default",mask:E}=r,S=v.useMemo(()=>{let N=fa(m,d);return N==null?null:{location:{pathname:N,search:b,hash:g,state:x,key:w,mask:E},navigationType:s}},[d,m,b,g,x,w,s,E]);return Ir(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:v.createElement(lr.Provider,{value:h},v.createElement(Yl.Provider,{children:t,value:S}))}function wk({children:e,location:t}){return ok(Np(e),t)}function Np(e,t=[]){let r=[];return v.Children.forEach(e,(s,i)=>{if(!v.isValidElement(s))return;let l=[...t,i];if(s.type===v.Fragment){r.push.apply(r,Np(s.props.children,l));return}kt(s.type===aS,`[${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>`),kt(!s.props.index||!s.props.children,"An index route cannot have child routes.");let c={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&&(c.children=Np(s.props.children,l)),r.push(c)}),r}var Qu="get",Zu="application/x-www-form-urlencoded";function Ud(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function _k(e){return Ud(e)&&e.tagName.toLowerCase()==="button"}function Sk(e){return Ud(e)&&e.tagName.toLowerCase()==="form"}function Ek(e){return Ud(e)&&e.tagName.toLowerCase()==="input"}function Ck(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Nk(e,t){return e.button===0&&(!t||t==="_self")&&!Ck(e)}var Eu=null;function Tk(){if(Eu===null)try{new FormData(document.createElement("form"),0),Eu=!1}catch{Eu=!0}return Eu}var jk=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function qm(e){return e!=null&&!jk.has(e)?(Ir(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Zu}"`),null):e}function Ak(e,t){let r,s,i,l,c;if(Sk(e)){let d=e.getAttribute("action");s=d?fa(d,t):null,r=e.getAttribute("method")||Qu,i=qm(e.getAttribute("enctype"))||Zu,l=new FormData(e)}else if(_k(e)||Ek(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?fa(h,t):null,r=e.getAttribute("formmethod")||d.getAttribute("method")||Qu,i=qm(e.getAttribute("formenctype"))||qm(d.getAttribute("enctype"))||Zu,l=new FormData(d,e),!Tk()){let{name:m,type:b,value:g}=e;if(b==="image"){let x=m?`${m}.`:"";l.append(`${x}x`,"0"),l.append(`${x}y`,"0")}else m&&l.append(m,g)}}else{if(Ud(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Qu,s=null,i=Zu,c=e}return l&&i==="text/plain"&&(c=l,l=void 0),{action:s,method:r.toLowerCase(),encType:i,formData:l,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Sg(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function sS(e,t,r,s){let i=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${s}`:i.pathname=`${i.pathname}.${s}`:i.pathname==="/"?i.pathname=`_root.${s}`:t&&fa(i.pathname,t)==="/"?i.pathname=`${dd(t)}/_root.${s}`:i.pathname=`${dd(i.pathname)}.${s}`,i}async function Rk(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 kk(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 Ok(e,t,r){let s=await Promise.all(e.map(async i=>{let l=t.routes[i.route.id];if(l){let c=await Rk(l,r);return c.links?c.links():[]}return[]}));return Lk(s.flat(1).filter(kk).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function Hx(e,t,r,s,i,l){let c=(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)=>c(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(c(h,m)||d(h,m))return!0;if(h.route.shouldRevalidate){let x=h.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.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 x=="boolean")return x}return!0}):[]}function Mk(e,t,{includeHydrateFallback:r}={}){return Dk(e.map(s=>{let i=t.routes[s.route.id];if(!i)return[];let l=[i.module];return i.clientActionModule&&(l=l.concat(i.clientActionModule)),i.clientLoaderModule&&(l=l.concat(i.clientLoaderModule)),r&&i.hydrateFallbackModule&&(l=l.concat(i.hydrateFallbackModule)),i.imports&&(l=l.concat(i.imports)),l}).flat(1))}function Dk(e){return[...new Set(e)]}function Pk(e){let t={},r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function Lk(e,t){let r=new Set;return new Set(t),e.reduce((s,i)=>{let l=JSON.stringify(Pk(i));return r.has(l)||(r.add(l),s.push({key:l,link:i})),s},[])}function Eg(){let e=v.useContext(fo);return Sg(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function zk(){let e=v.useContext($d);return Sg(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Cg=v.createContext(void 0);Cg.displayName="FrameworkContext";function Ng(){let e=v.useContext(Cg);return Sg(e,"You must render this element inside a <HydratedRouter> element"),e}function Ik(e,t){let r=v.useContext(Cg),[s,i]=v.useState(!1),[l,c]=v.useState(!1),{onFocus:d,onBlur:h,onMouseEnter:m,onMouseLeave:b,onTouchStart:g}=t,x=v.useRef(null);v.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let S=C=>{C.forEach(A=>{c(A.isIntersecting)})},N=new IntersectionObserver(S,{threshold:.5});return x.current&&N.observe(x.current),()=>{N.disconnect()}}},[e]),v.useEffect(()=>{if(s){let S=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(S)}}},[s]);let w=()=>{i(!0)},E=()=>{i(!1),c(!1)};return r?e!=="intent"?[l,x,{}]:[l,x,{onFocus:ml(d,w),onBlur:ml(h,E),onMouseEnter:ml(m,w),onMouseLeave:ml(b,E),onTouchStart:ml(g,w)}]:[!1,x,{}]}function ml(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function $k({page:e,...t}){let r=JR(),{router:s}=Eg(),i=v.useMemo(()=>H_(s.routes,e,s.basename),[s.routes,e,s.basename]);return i?r?v.createElement(Bk,{page:e,matches:i,...t}):v.createElement(Hk,{page:e,matches:i,...t}):null}function Uk(e){let{manifest:t,routeModules:r}=Ng(),[s,i]=v.useState([]);return v.useEffect(()=>{let l=!1;return Ok(e,t,r).then(c=>{l||i(c)}),()=>{l=!0}},[e,t,r]),s}function Bk({page:e,matches:t,...r}){let s=ba(),{future:i}=Ng(),{basename:l}=Eg(),c=v.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let d=sS(e,l,i.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,i.unstable_trailingSlashAwareDataRequests,e,s,t]);return v.createElement(v.Fragment,null,c.map(d=>v.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...r})))}function Hk({page:e,matches:t,...r}){let s=ba(),{future:i,manifest:l,routeModules:c}=Ng(),{basename:d}=Eg(),{loaderData:h,matches:m}=zk(),b=v.useMemo(()=>Hx(e,t,m,l,s,"data"),[e,t,m,l,s]),g=v.useMemo(()=>Hx(e,t,m,l,s,"assets"),[e,t,m,l,s]),x=v.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let S=new Set,N=!1;if(t.forEach(A=>{var k;let j=l.routes[A.route.id];!j||!j.hasLoader||(!b.some(I=>I.route.id===A.route.id)&&A.route.id in h&&((k=c[A.route.id])!=null&&k.shouldRevalidate)||j.hasClientLoader?N=!0:S.add(A.route.id))}),S.size===0)return[];let C=sS(e,d,i.unstable_trailingSlashAwareDataRequests,"data");return N&&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,i.unstable_trailingSlashAwareDataRequests,h,s,l,b,t,e,c]),w=v.useMemo(()=>Mk(g,l),[g,l]),E=Uk(g);return v.createElement(v.Fragment,null,x.map(S=>v.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...r})),w.map(S=>v.createElement("link",{key:S,rel:"modulepreload",href:S,...r})),E.map(({key:S,link:N})=>v.createElement("link",{key:S,nonce:r.nonce,...N,crossOrigin:N.crossOrigin??r.crossOrigin})))}function qk(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var Vk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Vk&&(window.__reactRouterVersion="7.15.1")}catch{}function Gk({basename:e,children:t,useTransitions:r,window:s}){let i=v.useRef();i.current==null&&(i.current=SR({window:s,v5Compat:!0}));let l=i.current,[c,d]=v.useState({action:l.action,location:l.location}),h=v.useCallback(m=>{r===!1?d(m):v.startTransition(()=>d(m))},[r]);return v.useLayoutEffect(()=>l.listen(h),[l,h]),v.createElement(xk,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:l,useTransitions:r})}var iS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,oS=v.forwardRef(function({onClick:t,discover:r="render",prefetch:s="none",relative:i,reloadDocument:l,replace:c,mask:d,state:h,target:m,to:b,preventScrollReset:g,viewTransition:x,defaultShouldRevalidate:w,...E},S){let{basename:N,navigator:C,useTransitions:A}=v.useContext(lr),j=typeof b=="string"&&iS.test(b),k=W_(b,N);b=k.to;let I=ak(b,{relative:i}),z=ba(),P=null;if(d){let ge=bg(d,[],z.mask?z.mask.pathname:"/",!0);N!=="/"&&(ge.pathname=ge.pathname==="/"?N:wr([N,ge.pathname])),P=C.createHref(ge)}let[H,Z,de]=Ik(s,E),ue=Yk(b,{replace:c,mask:d,state:h,target:m,preventScrollReset:g,relative:i,viewTransition:x,defaultShouldRevalidate:w,useTransitions:A});function me(ge){t&&t(ge),ge.defaultPrevented||ue(ge)}let fe=!(k.isExternal||l),pe=v.createElement("a",{...E,...de,href:(fe?P:void 0)||k.absoluteURL||I,onClick:fe?me:t,ref:qk(S,Z),target:m,"data-discover":!j&&r==="render"?"true":void 0});return H&&!j?v.createElement(v.Fragment,null,pe,v.createElement($k,{page:I})):pe});oS.displayName="Link";var Fk=v.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:s="",end:i=!1,style:l,to:c,viewTransition:d,children:h,...m},b){let g=Jl(c,{relative:m.relative}),x=ba(),w=v.useContext($d),{navigator:E,basename:S}=v.useContext(lr),N=w!=null&&e2(g)&&d===!0,C=E.encodeLocation?E.encodeLocation(g).pathname:g.pathname,A=x.pathname,j=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;r||(A=A.toLowerCase(),j=j?j.toLowerCase():null,C=C.toLowerCase()),j&&S&&(j=fa(j,S)||j);const k=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let I=A===C||!i&&A.startsWith(C)&&A.charAt(k)==="/",z=j!=null&&(j===C||!i&&j.startsWith(C)&&j.charAt(C.length)==="/"),P={isActive:I,isPending:z,isTransitioning:N},H=I?t:void 0,Z;typeof s=="function"?Z=s(P):Z=[s,I?"active":null,z?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let de=typeof l=="function"?l(P):l;return v.createElement(oS,{...m,"aria-current":H,className:Z,ref:b,style:de,to:c,viewTransition:d},typeof h=="function"?h(P):h)});Fk.displayName="NavLink";var Kk=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:s,replace:i,state:l,method:c=Qu,action:d,onSubmit:h,relative:m,preventScrollReset:b,viewTransition:g,defaultShouldRevalidate:x,...w},E)=>{let{useTransitions:S}=v.useContext(lr),N=Qk(),C=Zk(d,{relative:m}),A=c.toLowerCase()==="get"?"get":"post",j=typeof d=="string"&&iS.test(d),k=I=>{if(h&&h(I),I.defaultPrevented)return;I.preventDefault();let z=I.nativeEvent.submitter,P=(z==null?void 0:z.getAttribute("formmethod"))||c,H=()=>N(z||I.currentTarget,{fetcherKey:t,method:P,navigate:r,replace:i,state:l,relative:m,preventScrollReset:b,viewTransition:g,defaultShouldRevalidate:x});S&&r!==!1?v.startTransition(()=>H()):H()};return v.createElement("form",{ref:E,method:A,action:C,onSubmit:s?h:k,...w,"data-discover":!j&&e==="render"?"true":void 0})});Kk.displayName="Form";function Wk(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function lS(e){let t=v.useContext(fo);return kt(t,Wk(e)),t}function Yk(e,{target:t,replace:r,mask:s,state:i,preventScrollReset:l,relative:c,viewTransition:d,defaultShouldRevalidate:h,useTransitions:m}={}){let b=sk(),g=ba(),x=Jl(e,{relative:c});return v.useCallback(w=>{if(Nk(w,t)){w.preventDefault();let E=r!==void 0?r:Ml(g)===Ml(x),S=()=>b(e,{replace:E,mask:s,state:i,preventScrollReset:l,relative:c,viewTransition:d,defaultShouldRevalidate:h});m?v.startTransition(()=>S()):S()}},[g,b,x,r,s,i,t,e,l,c,d,h,m])}var Xk=0,Jk=()=>`__${String(++Xk)}__`;function Qk(){let{router:e}=lS("useSubmit"),{basename:t}=v.useContext(lr),r=gk(),s=e.fetch,i=e.navigate;return v.useCallback(async(l,c={})=>{let{action:d,method:h,encType:m,formData:b,body:g}=Ak(l,t);if(c.navigate===!1){let x=c.fetcherKey||Jk();await s(x,r,c.action||d,{defaultShouldRevalidate:c.defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,body:g,formMethod:c.method||h,formEncType:c.encType||m,flushSync:c.flushSync})}else await i(c.action||d,{defaultShouldRevalidate:c.defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:b,body:g,formMethod:c.method||h,formEncType:c.encType||m,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[s,i,t,r])}function Zk(e,{relative:t}={}){let{basename:r}=v.useContext(lr),s=v.useContext(ya);kt(s,"useFormAction must be used inside a RouteContext");let[i]=s.matches.slice(-1),l={...Jl(e||".",{relative:t})},c=ba();if(e==null){l.search=c.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===".")&&i.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(l.pathname=l.pathname==="/"?r:wr([r,l.pathname])),Ml(l)}function e2(e,{relative:t}={}){let r=v.useContext(J_);kt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=lS("useViewTransitionState"),i=Jl(e,{relative:t});if(!r.isTransitioning)return!1;let l=fa(r.currentLocation.pathname,s)||r.currentLocation.pathname,c=fa(r.nextLocation.pathname,s)||r.nextLocation.pathname;return ud(i.pathname,c)!=null||ud(i.pathname,l)!=null}var Ql=B_();const cS=U_(Ql);var Dr=function(){return Dr=Object.assign||function(t){for(var r,s=1,i=arguments.length;s<i;s++){r=arguments[s];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(t[l]=r[l])}return t},Dr.apply(this,arguments)};function ho(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 i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(r[s[i]]=e[s[i]]);return r}function t2(e,t,r,s){function i(l){return l instanceof r?l:new r(function(c){c(l)})}return new(r||(r=Promise))(function(l,c){function d(b){try{m(s.next(b))}catch(g){c(g)}}function h(b){try{m(s.throw(b))}catch(g){c(g)}}function m(b){b.done?l(b.value):i(b.value).then(d,h)}m((s=s.apply(e,t||[])).next())})}function n2(e,t,r){if(r||arguments.length===2)for(var s=0,i=t.length,l;s<i;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 r2=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class Tg 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 a2 extends Tg{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class qx extends Tg{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Vx extends Tg{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Tp;(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"})(Tp||(Tp={}));class s2{constructor(t,{headers:r={},customFetch:s,region:i=Tp.Any}={}){this.url=t,this.headers=r,this.region=i,this.fetch=r2(s)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return t2(this,arguments,void 0,function*(r,s={}){var i;let l,c;try{const{headers:d,method:h,body:m,signal:b,timeout:g}=s;let x={},{region:w}=s;w||(w=this.region);const E=new URL(`${this.url}/${r}`);w&&w!=="any"&&(x["x-region"]=w,E.searchParams.set("forceFunctionRegion",w));let S;m&&(d&&!Object.prototype.hasOwnProperty.call(d,"Content-Type")||!d)?typeof Blob<"u"&&m instanceof Blob||m instanceof ArrayBuffer?(x["Content-Type"]="application/octet-stream",S=m):typeof m=="string"?(x["Content-Type"]="text/plain",S=m):typeof FormData<"u"&&m instanceof FormData?S=m:(x["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 N=b;g&&(c=new AbortController,l=setTimeout(()=>c.abort(),g),b?(N=c.signal,b.addEventListener("abort",()=>c.abort())):N=c.signal);const C=yield this.fetch(E.toString(),{method:h||"POST",headers:Object.assign(Object.assign(Object.assign({},x),this.headers),d),body:S,signal:N}).catch(I=>{throw new a2(I)}),A=C.headers.get("x-relay-error");if(A&&A==="true")throw new qx(C);if(!C.ok)throw new Vx(C);let j=((i=C.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),k;return j==="application/json"?k=yield C.json():j==="application/octet-stream"||j==="application/pdf"?k=yield C.blob():j==="text/event-stream"?k=C:j==="multipart/form-data"?k=yield C.formData():k=yield C.text(),{data:k,error:null,response:C}}catch(d){return{data:null,error:d,response:d instanceof Vx||d instanceof qx?d.context:void 0}}finally{l&&clearTimeout(l)}})}}const uS=3,Gx=e=>Math.min(1e3*2**e,3e4),i2=[520,503],dS=["GET","HEAD","OPTIONS"];var o2=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 Fx(e,t){return new Promise(r=>{if(t!=null&&t.aborted){r();return}const s=setTimeout(()=>{t==null||t.removeEventListener("abort",i),r()},e);function i(){clearTimeout(s),r()}t==null||t.addEventListener("abort",i)})}function l2(e,t,r,s){return!(!s||r>=uS||!dS.includes(e)||!i2.includes(t))}var c2=class{constructor(e){var t,r,s,i,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=(i=e.urlLengthLimit)!==null&&i!==void 0?i: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 c=this.headers.get("Accept");c==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!c||c==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const s=this.fetch;let l=(async()=>{let c=0;for(;;){const m=new Headers(r.headers);c>0&&m.set("X-Retry-Count",String(c));let b;try{b=await s(r.url.toString(),{method:r.method,headers:m,body:JSON.stringify(r.body,(g,x)=>typeof x=="bigint"?x.toString():x),signal:r.signal})}catch(g){if((g==null?void 0:g.name)==="AbortError"||(g==null?void 0:g.code)==="ABORT_ERR"||!dS.includes(r.method))throw g;if(r.retryEnabled&&c<uS){const x=Gx(c);c++,await Fx(x,r.signal);continue}throw g}if(l2(r.method,b.status,c,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,x=g!==null?Math.max(0,parseInt(g,10)||0)*1e3:Gx(c);await b.text(),c++,await Fx(x,r.signal);continue}return await r.processResponse(b)}})();return this.shouldThrowOnError||(l=l.catch(c=>{var d;let h="",m="",b="";const g=c==null?void 0:c.cause;if(g){var x,w,E,S;const A=(x=g==null?void 0:g.message)!==null&&x!==void 0?x:"",j=(w=g==null?void 0:g.code)!==null&&w!==void 0?w:"";h=`${(E=c==null?void 0:c.name)!==null&&E!==void 0?E:"FetchError"}: ${c==null?void 0:c.message}`,h+=`
Caused by: ${(S=g==null?void 0:g.name)!==null&&S!==void 0?S:"Error"}: ${A}`,j&&(h+=` (${j})`),g!=null&&g.stack&&(h+=`
${g.stack}`)}else{var N;h=(N=c==null?void 0:c.stack)!==null&&N!==void 0?N:""}const C=this.url.toString().length;return(c==null?void 0:c.name)==="AbortError"||(c==null?void 0:c.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=c==null?void 0:c.name)!==null&&d!==void 0?d:"FetchError"}: ${c==null?void 0:c.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,i=null,l=e.status,c=e.statusText;if(e.ok){var d,h;if(t.method!=="HEAD"){var m;const x=await e.text();x===""||(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=x:s=JSON.parse(x))}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&&(i=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,i=null,l=406,c="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,c="OK")}catch{e.status===404&&b===""?(l=204,c="No Content"):r={message:b}}if(r&&t.shouldThrowOnError)throw new o2(r)}return{success:r===null,error:r,data:s,count:i,status:l,statusText:c}}returns(){return this}overrideTypes(){return this}},u2=class extends c2{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:i=s}={}){const l=i?`${i}.order`:"order",c=this.url.searchParams.get(l);return this.url.searchParams.set(l,`${c?`${c},`:""}${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 i=typeof s>"u"?"offset":`${s}.offset`,l=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(i,`${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:i=!1,format:l="text"}={}){var c;const d=[e?"analyze":null,t?"verbose":null,r?"settings":null,s?"buffers":null,i?"wal":null].filter(Boolean).join("|"),h=(c=this.headers.get("Accept"))!==null&&c!==void 0?c:"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 Kx=new RegExp("[,()]");var Gi=class extends u2{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"&&Kx.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"&&Kx.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 i="";s==="plain"?i="pl":s==="phrase"?i="ph":s==="websearch"&&(i="w");const l=r===void 0?"":`(${r})`;return this.url.searchParams.append(e,`${i}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}},d2=class{constructor(e,{headers:t={},schema:r,fetch:s,urlLengthLimit:i=8e3,retry:l}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=s,this.urlLengthLimit=i,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??{},i=r?"HEAD":"GET";let l=!1;const c=(e??"*").split("").map(m=>/\s/.test(m)&&!l?"":(m==='"'&&(l=!l),m)).join(""),{url:d,headers:h}=this.cloneRequestState();return d.searchParams.set("select",c),s&&h.append("Prefer",`count=${s}`),new Gi({method:i,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 i="POST",{url:l,headers:c}=this.cloneRequestState();if(t&&c.append("Prefer",`count=${t}`),r||c.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 Gi({method:i,url:l,headers:c,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:i=!0}={}){var l;const c="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}`),i||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 Gi({method:c,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:i,headers:l}=this.cloneRequestState();return t&&l.append("Prefer",`count=${t}`),new Gi({method:s,url:i,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:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new Gi({method:r,url:s,headers:i,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Dl(e){"@babel/helpers - typeof";return Dl=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},Dl(e)}function f2(e,t){if(Dl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Dl(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function h2(e){var t=f2(e,"string");return Dl(t)=="symbol"?t:t+""}function m2(e,t,r){return(t=h2(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Wx(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function Cu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Wx(Object(r),!0).forEach(function(s){m2(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wx(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}var p2=class fS{constructor(t,{headers:r={},schema:s,fetch:i,timeout:l,urlLengthLimit:c=8e3,retry:d}={}){this.url=t,this.headers=new Headers(r),this.schemaName=s,this.urlLengthLimit=c;const h=i??globalThis.fetch;l!==void 0&&l>0?this.fetch=(m,b)=>{const g=new AbortController,x=setTimeout(()=>g.abort(),l),w=b==null?void 0:b.signal;if(w){if(w.aborted)return clearTimeout(x),h(m,b);const E=()=>{clearTimeout(x),g.abort()};return w.addEventListener("abort",E,{once:!0}),h(m,Cu(Cu({},b),{},{signal:g.signal})).finally(()=>{clearTimeout(x),w.removeEventListener("abort",E)})}return h(m,Cu(Cu({},b),{},{signal:g.signal})).finally(()=>clearTimeout(x))}: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 d2(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 fS(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(t,r={},{head:s=!1,get:i=!1,count:l}={}){var c;let d;const h=new URL(`${this.url}/rpc/${t}`);let m;const b=w=>w!==null&&typeof w=="object"&&(!Array.isArray(w)||w.some(b)),g=s&&Object.values(r).some(b);g?(d="POST",m=r):s||i?(d=s?"HEAD":"GET",Object.entries(r).filter(([w,E])=>E!==void 0).map(([w,E])=>[w,Array.isArray(E)?`{${E.join(",")}}`:`${E}`]).forEach(([w,E])=>{h.searchParams.append(w,E)})):(d="POST",m=r);const x=new Headers(this.headers);return g?x.set("Prefer",l?`count=${l},return=minimal`:"return=minimal"):l&&x.set("Prefer",`count=${l}`),new Gi({method:d,url:h,headers:x,schema:this.schemaName,body:m,fetch:(c=this.fetch)!==null&&c!==void 0?c:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class g2{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 i=globalThis.process;if(i){const l=i.versions;if(l&&l.node){const c=l.node,d=parseInt(c.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 v2="2.106.2",y2=`realtime-js/${v2}`,b2="1.0.0",hS="2.0.0",x2=hS,w2=1e4,_2=100,Za={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},mS={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},jp={connecting:"connecting",closing:"closing",closed:"closed"};class S2{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 i=(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,i)}_encodeJsonUserBroadcastPush(t){var r,s;const i=(s=(r=t.payload)===null||r===void 0?void 0:r.payload)!==null&&s!==void 0?s:{},c=new TextEncoder().encode(JSON.stringify(i)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,c)}_encodeUserBroadcastPush(t,r,s){var i,l;const c=t.topic,d=(i=t.ref)!==null&&i!==void 0?i:"",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(c.length>255)throw new Error(`topic length ${c.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 x=this.USER_BROADCAST_PUSH_META_LENGTH+h.length+d.length+c.length+m.length+g.length,w=new ArrayBuffer(this.HEADER_LENGTH+x);let E=new DataView(w),S=0;E.setUint8(S++,this.KINDS.userBroadcastPush),E.setUint8(S++,h.length),E.setUint8(S++,d.length),E.setUint8(S++,c.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(c,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 N=new Uint8Array(w.byteLength+s.byteLength);return N.set(new Uint8Array(w),0),N.set(new Uint8Array(s),w.byteLength),N.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),[i,l,c,d,h]=s;return r({join_ref:i,ref:l,topic:c,event:d,payload:h})}return r({})}_binaryDecode(t){const r=new DataView(t),s=r.getUint8(0),i=new TextDecoder;switch(s){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,r,i)}}_decodeUserBroadcast(t,r,s){const i=r.getUint8(1),l=r.getUint8(2),c=r.getUint8(3),d=r.getUint8(4);let h=this.HEADER_LENGTH+4;const m=s.decode(t.slice(h,h+i));h=h+i;const b=s.decode(t.slice(h,h+l));h=h+l;const g=s.decode(t.slice(h,h+c));h=h+c;const x=t.slice(h,t.byteLength),w=d===this.JSON_ENCODING?JSON.parse(s.decode(x)):x,E={type:this.BROADCAST_EVENT,event:b,payload:w};return c>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 St;(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"})(St||(St={}));const Yx=(e,t,r={})=>{var s;const i=(s=r.skipTypes)!==null&&s!==void 0?s:[];return t?Object.keys(t).reduce((l,c)=>(l[c]=E2(c,e,t,i),l),{}):{}},E2=(e,t,r,s)=>{const i=t.find(d=>d.name===e),l=i==null?void 0:i.type,c=r[e];return l&&!s.includes(l)?pS(l,c):Ap(c)},pS=(e,t)=>{if(e.charAt(0)==="_"){const r=e.slice(1,e.length);return j2(t,r)}switch(e){case St.bool:return C2(t);case St.float4:case St.float8:case St.int2:case St.int4:case St.int8:case St.numeric:case St.oid:return N2(t);case St.json:case St.jsonb:return T2(t);case St.timestamp:return A2(t);case St.abstime:case St.date:case St.daterange:case St.int4range:case St.int8range:case St.money:case St.reltime:case St.text:case St.time:case St.timestamptz:case St.timetz:case St.tsrange:case St.tstzrange:return Ap(t);default:return Ap(t)}},Ap=e=>e,C2=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},N2=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},T2=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},j2=(e,t)=>{if(typeof e!="string")return e;const r=e.length-1,s=e[r];if(e[0]==="{"&&s==="}"){let l;const c=e.slice(1,r);try{l=JSON.parse("["+c+"]")}catch{l=c?c.split(","):[]}return l.map(d=>pS(t,d))}return e},A2=e=>typeof e=="string"?e.replace(" ","T"):e,gS=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 Cl=e=>typeof e=="function"?e:function(){return e},R2=typeof self<"u"?self:null,Fi=typeof window<"u"?window:null,Or=R2||Fi||globalThis,k2="2.0.0",O2=1e4,M2=1e3,Mr={connecting:0,open:1,closing:2,closed:3},Mn={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},la={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Rp={longpoll:"longpoll",websocket:"websocket"},D2={complete:4},kp="base64url.bearer.phx.",Nu=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})}},vS=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))}},P2=class{constructor(e,t,r){this.state=Mn.closed,this.topic=e,this.params=Cl(t||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Nu(this,la.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new vS(()=>{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=Mn.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this.joinPush.receive("error",s=>{this.state=Mn.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=Mn.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=Mn.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 Nu(this,la.leave,Cl({}),this.timeout).send(),this.state=Mn.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(la.reply,(s,i)=>{this.trigger(this.replyEventName(i),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=Mn.closed,this.bindings=[]}onClose(e){this.on(la.close,e)}onError(e){return this.on(la.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 Nu(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=Mn.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(la.close,"leave")},r=new Nu(this,la.leave,Cl({}),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=Mn.joining,this.joinPush.resend(e))}trigger(e,t,r,s){let i=this.onMessage(e,t,r,s);if(t&&!i)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let l=this.bindings.filter(c=>c.event===e&&this.filterBindings(c,t,r));for(let c=0;c<l.length;c++)l[c].callback(i,r,s||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===Mn.closed}isErrored(){return this.state===Mn.errored}isJoined(){return this.state===Mn.joined}isJoining(){return this.state===Mn.joining}isLeaving(){return this.state===Mn.leaving}},fd=class{static request(e,t,r,s,i,l,c){if(Or.XDomainRequest){let d=new Or.XDomainRequest;return this.xdomainRequest(d,e,t,s,i,l,c)}else if(Or.XMLHttpRequest){let d=new Or.XMLHttpRequest;return this.xhrRequest(d,e,t,r,s,i,l,c)}else{if(Or.fetch&&Or.AbortController)return this.fetchRequest(e,t,r,s,i,l,c);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,r,s,i,l,c){let d={method:e,headers:r,body:s},h=null;return i&&(h=new AbortController,setTimeout(()=>h.abort(),i),d.signal=h.signal),Or.fetch(t,d).then(m=>m.text()).then(m=>this.parseJSON(m)).then(m=>c&&c(m)).catch(m=>{m.name==="AbortError"&&l?l():c&&c(null)}),h}static xdomainRequest(e,t,r,s,i,l,c){return e.timeout=i,e.open(t,r),e.onload=()=>{let d=this.parseJSON(e.responseText);c&&c(d)},l&&(e.ontimeout=l),e.onprogress=()=>{},e.send(s),e}static xhrRequest(e,t,r,s,i,l,c,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===D2.complete&&d){let h=this.parseJSON(e.responseText);d(h)}},c&&(e.ontimeout=c),e.send(i),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 i=t?`${t}[${s}]`:s,l=e[s];typeof l=="object"?r.push(this.serialize(l,i)):r.push(encodeURIComponent(i)+"="+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)}`}},L2=e=>{let t="",r=new Uint8Array(e),s=r.byteLength;for(let i=0;i<s;i++)t+=String.fromCharCode(r[i]);return btoa(t)},Di=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(kp)&&(this.authToken=atob(t[1].slice(kp.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=Mr.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Rp.websocket),"$1/"+Rp.longpoll)}endpointURL(){return fd.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,r){this.close(e,t,r),this.readyState=Mr.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Mr.open||this.readyState===Mr.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:i}=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:i.forEach(l=>{setTimeout(()=>this.onmessage({data:l}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Mr.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=L2(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 i of this.reqs)i.abort();this.readyState=Mr.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,i){let l,c=()=>{this.reqs.delete(l),s()};l=fd.request(e,this.endpointURL(),t,r,this.timeout,c,d=>{this.reqs.delete(l),this.isActive()&&i(d)}),this.reqs.add(l)}},z2=class xl{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,i=>{let{onJoin:l,onLeave:c,onSync:d}=this.caller;this.joinRef=this.channel.joinRef(),this.state=xl.syncState(this.state,i,l,c),this.pendingDiffs.forEach(h=>{this.state=xl.syncDiff(this.state,h,l,c)}),this.pendingDiffs=[],d()}),this.channel.on(s.diff,i=>{let{onJoin:l,onLeave:c,onSync:d}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=xl.syncDiff(this.state,i,l,c),d())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return xl.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,r,s,i){let l=this.clone(t),c={},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),x=b.metas.map(S=>S.phx_ref),w=m.metas.filter(S=>x.indexOf(S.phx_ref)<0),E=b.metas.filter(S=>g.indexOf(S.phx_ref)<0);w.length>0&&(c[h]=m,c[h].metas=w),E.length>0&&(d[h]=this.clone(b),d[h].metas=E)}else c[h]=m}),this.syncDiff(l,{joins:c,leaves:d},s,i)}static syncDiff(t,r,s,i){let{joins:l,leaves:c}=this.clone(r);return s||(s=function(){}),i||(i=function(){}),this.map(l,(d,h)=>{let m=t[d];if(t[d]=this.clone(h),m){let b=t[d].metas.map(x=>x.phx_ref),g=m.metas.filter(x=>b.indexOf(x.phx_ref)<0);t[d].metas.unshift(...g)}s(d,m,h)}),this.map(c,(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),i(d,m,h),m.metas.length===0&&delete t[d]}),t}static list(t,r){return r||(r=function(s,i){return i}),this.map(t,(s,i)=>r(s,i))}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,i,l,c]=JSON.parse(e);return t({join_ref:r,ref:s,topic:i,event:l,payload:c})}},binaryEncode(e){let{join_ref:t,ref:r,event:s,topic:i,payload:l}=e,c=this.META_LENGTH+t.length+r.length+i.length+s.length,d=new ArrayBuffer(this.HEADER_LENGTH+c),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++,i.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(i,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),i=t.getUint8(2),l=t.getUint8(3),c=this.HEADER_LENGTH+this.META_LENGTH-1,d=r.decode(e.slice(c,c+s));c=c+s;let h=r.decode(e.slice(c,c+i));c=c+i;let m=r.decode(e.slice(c,c+l));c=c+l;let b=e.slice(c,e.byteLength);return{join_ref:d,ref:null,topic:h,event:m,payload:b}},decodeReply(e,t,r){let s=t.getUint8(1),i=t.getUint8(2),l=t.getUint8(3),c=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+i));d=d+i;let b=r.decode(e.slice(d,d+l));d=d+l;let g=r.decode(e.slice(d,d+c));d=d+c;let x=e.slice(d,e.byteLength),w={status:g,response:x};return{join_ref:h,ref:m,topic:b,event:la.reply,payload:w}},decodeBroadcast(e,t,r){let s=t.getUint8(1),i=t.getUint8(2),l=this.HEADER_LENGTH+2,c=r.decode(e.slice(l,l+s));l=l+s;let d=r.decode(e.slice(l,l+i));l=l+i;let h=e.slice(l,e.byteLength);return{join_ref:null,ref:null,topic:c,event:d,payload:h}}},I2=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||O2,this.transport=t.transport||Or.WebSocket||Di,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=Or&&Or.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!==Di?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let s=null;Fi&&Fi.addEventListener&&(Fi.addEventListener("pagehide",i=>{this.conn&&(this.disconnect(),s=this.connectClock)}),Fi.addEventListener("pageshow",i=>{s===this.connectClock&&(s=null,this.connect())}),Fi.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=i=>t.rejoinAfterMs?t.rejoinAfterMs(i):[1e3,2e3,5e3][i-1]||1e4,this.reconnectAfterMs=i=>t.reconnectAfterMs?t.reconnectAfterMs(i):[10,50,100,150,200,250,500,1e3,2e3][i-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(i,l,c)=>{console.log(`${i}: ${l}`,c)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=Cl(t.params||{}),this.endPoint=`${e}/${Rp.websocket}`,this.vsn=t.vsn||k2,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new vS(()=>{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 Di}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=fd.appendParams(fd.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=Cl(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Di?this.connectWithFallback(Di,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(i=>{i.ref===t&&(this.off([s]),e(Date.now()-r))});return!0}transportName(e){switch(e){case Di:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${kp}${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,i,l,c=this.transportName(e),d=h=>{this.log("transport",`falling back to ${c}...`,h),this.off([i,l]),s=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${c}`))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(),M2,"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===Mr.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(la.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case Mr.connecting:return"connecting";case Mr.open:return"open";case Mr.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 P2(e,t,this);return this.channels.push(r),r}push(e){if(this.hasLogger()){let{topic:t,event:r,payload:s,ref:i,join_ref:l}=e;this.log("push",`${t} ${r} (${l}, ${i})`,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:i,ref:l,join_ref:c}=t;if(l&&l===this.pendingHeartbeatRef){const d=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(i.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",`${i.status||""} ${r} ${s} ${l&&"("+l+")"||""}`.trim(),i);for(let d=0;d<this.channels.length;d++){const h=this.channels[d];h.isMember(r,s,i,c)&&h.trigger(s,i,l,c)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([r,s])=>{try{s(...t)}catch(i){this.log("error",`error in ${e} callback`,i)}})}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 Nl{constructor(t,r){const s=U2(r);this.presence=new z2(t.getChannel(),s),this.presence.onJoin((i,l,c)=>{const d=Nl.onJoinPayload(i,l,c);t.getChannel().trigger("presence",d)}),this.presence.onLeave((i,l,c)=>{const d=Nl.onLeavePayload(i,l,c);t.getChannel().trigger("presence",d)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return Nl.transformState(this.presence.state)}static transformState(t){return t=$2(t),Object.getOwnPropertyNames(t).reduce((r,s)=>{const i=t[s];return r[s]=ed(i),r},{})}static onJoinPayload(t,r,s){const i=Xx(r),l=ed(s);return{event:"join",key:t,currentPresences:i,newPresences:l}}static onLeavePayload(t,r,s){const i=Xx(r),l=ed(s);return{event:"leave",key:t,currentPresences:i,leftPresences:l}}}function ed(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function $2(e){return JSON.parse(JSON.stringify(e))}function U2(e){return(e==null?void 0:e.events)&&{events:e.events}}function Xx(e){return e!=null&&e.metas?ed(e):[]}var Jx;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(Jx||(Jx={}));class B2{get state(){return this.presenceAdapter.state}constructor(t,r){this.channel=t,this.presenceAdapter=new Nl(this.channel.channelAdapter,r)}}function H2(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 q2{constructor(t,r,s){const i=V2(s);this.channel=t.getSocket().channel(r,i),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 i;try{i=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>_2){const l=this.channel.pushBuffer.shift();l.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${l.event}`,l.payload())}return i}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===Za.joined}isJoined(){return this.state===Za.joined}isJoining(){return this.state===Za.joining}isClosed(){return this.state===Za.closed}isLeaving(){return this.state===Za.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function V2(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}var Qx;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(Qx||(Qx={}));var Ji;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(Ji||(Ji={}));var ca;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(ca||(ca={}));class Tl{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 i,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 q2(this.socket.socketAdapter,t,this.params),this.presence=new B2(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=gS(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((l=(i=this.params.config)===null||i===void 0?void 0:i.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,i,l;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:c,presence:d,private:h}}=this.params,m=(i=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(w=>w.filter))!==null&&i!==void 0?i:[],b=!!this.bindings[Ji.PRESENCE]&&this.bindings[Ji.PRESENCE].length>0||((l=this.params.config.presence)===null||l===void 0?void 0:l.enabled)===!0,g={},x={broadcast:c,presence:Object.assign(Object.assign({},d),{enabled:b}),postgres_changes:m,private:h};this.socket.accessTokenValue&&(g.access_token=this.socket.accessTokenValue),this._onError(w=>{t==null||t(ca.CHANNEL_ERROR,H2(w))}),this._onClose(()=>t==null?void 0:t(ca.CLOSED)),this.updateJoinPayload(Object.assign({config:x},g)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:w})=>{if(this.socket._isManualToken()||this.socket.setAuth(),w===void 0){t==null||t(ca.SUBSCRIBED);return}this._updatePostgresBindings(w,t)}).receive("error",w=>{this.state=Za.errored;const E=Object.values(w).join(", ")||"error";t==null||t(ca.CHANNEL_ERROR,new Error(E,{cause:w}))}).receive("timeout",()=>{t==null||t(ca.TIMED_OUT)})}return this}_updatePostgresBindings(t,r){var s;const i=this.bindings.postgres_changes,l=(s=i==null?void 0:i.length)!==null&&s!==void 0?s:0,c=[];for(let d=0;d<l;d++){const h=i[d],{filter:{event:m,schema:b,table:g,filter:x}}=h,w=t&&t[d];if(w&&w.event===m&&Tl.isFilterValueEqual(w.schema,b)&&Tl.isFilterValueEqual(w.table,g)&&Tl.isFilterValueEqual(w.filter,x))c.push(Object.assign(Object.assign({},h),{id:w.id}));else{this.unsubscribe(),this.state=Za.errored,r==null||r(ca.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=c,this.state!=Za.errored&&r&&r(ca.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 i=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),l=t===Ji.PRESENCE||t===Ji.POSTGRES_CHANGES;if(i&&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 i;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 c={method:"POST",headers:l,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:r,private:this.private}]})},d=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(i=s.timeout)!==null&&i!==void 0?i: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,i;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:c}=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:c,private:this.private}]})};try{const m=await this._fetchWithTimeout(this.broadcastEndpointURL,h,(s=r.timeout)!==null&&s!==void 0?s:this.timeout);return await((i=m.body)===null||i===void 0?void 0:i.cancel()),m.ok?"ok":"error"}catch(m){return m instanceof Error&&m.name==="AbortError"?"timed out":"error"}}else return new Promise(l=>{var c,d,h;const m=this.channelAdapter.push(t.type,t,r.timeout||this.timeout);t.type==="broadcast"&&!(!((h=(d=(c=this.params)===null||c===void 0?void 0:c.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 i=new AbortController,l=setTimeout(()=>i.abort(),s),c=await this.socket.fetch(t,Object.assign(Object.assign({},r),{signal:i.signal}));return clearTimeout(l),c}_on(t,r,s){const i=t.toLocaleLowerCase(),l=this.channelAdapter.on(t,s),c={type:i,filter:r,callback:s,ref:l};return this.bindings[i]?this.bindings[i].push(c):this.bindings[i]=[c],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,r,s)=>{var i,l,c,d,h,m,b;const g=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(g,s))return!1;const x=(i=this.bindings[g])===null||i===void 0?void 0:i.find(w=>w.ref===t.ref);if(!x)return!0;if(["broadcast","presence","postgres_changes"].includes(g))if("id"in x){const w=x.id,E=(l=x.filter)===null||l===void 0?void 0:l.event;return w&&((c=r.ids)===null||c===void 0?void 0:c.includes(w))&&(E==="*"||(E==null?void 0:E.toLocaleLowerCase())===((d=r.data)===null||d===void 0?void 0:d.type.toLocaleLowerCase()))}else{const w=(m=(h=x==null?void 0:x.filter)===null||h===void 0?void 0:h.event)===null||m===void 0?void 0:m.toLocaleLowerCase();return w==="*"||w===((b=r==null?void 0:r.event)===null||b===void 0?void 0:b.toLocaleLowerCase())}else return x.type.toLocaleLowerCase()===g})}_notThisChannelEvent(t,r){const{close:s,error:i,leave:l,join:c}=mS;return r&&[s,i,l,c].includes(t)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,r,s)=>{if(typeof r=="object"&&"ids"in r){const i=r.data,{schema:l,table:c,commit_timestamp:d,type:h,errors:m}=i;return Object.assign(Object.assign({},{schema:l,table:c,commit_timestamp:d,eventType:h,new:{},old:{},errors:m}),this._getPayloadRecords(i))}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=Yx(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(r.old=Yx(t.columns,t.old_record)),r}}class G2{constructor(t,r){this.socket=new I2(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,i=1e4){return new Promise(l=>{setTimeout(()=>l("timeout"),i),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()==jp.connecting}isDisconnecting(){return this.socket.connectionState()==jp.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const Zx={HEARTBEAT_INTERVAL:25e3},F2=[1e3,2e3,5e3,1e4],K2=1e4;function W2(){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 Y2(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return W2()}const X2=`
addEventListener("message", (e) => {
if (e.data.event === "start") {
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
}
});`;class J2{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 S2,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=l=>l?(...c)=>l(...c):(...c)=>fetch(...c),!(!((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 i=this._initializeOptions(r);this.socketAdapter=new G2(t,i),this.httpEndpoint=gS(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 i=await s.unsubscribe();return s.teardown(),i}),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()||jp.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,r={config:{}}){const s=`realtime:${t}`,i=this.getChannels().find(l=>l.topic===s);if(i)return i;{const l=new Tl(`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(i){this.log("error","Error fetching access token from callback",i),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(i=>{const l={access_token:r,version:y2};r&&i.updateJoinPayload(l),i.joinedOnce&&i.channelAdapter.isJoined()&&i.channelAdapter.push(mS.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([X2],{type:"application/javascript"});r=URL.createObjectURL(s)}return r}_initializeOptions(t){var r,s,i,l,c,d,h,m,b,g,x,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=(i=t==null?void 0:t.timeout)!==null&&i!==void 0?i:w2,E.heartbeatIntervalMs=(l=t==null?void 0:t.heartbeatIntervalMs)!==null&&l!==void 0?l:Zx.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(c=t==null?void 0:t.disconnectOnEmptyChannelsAfterMs)!==null&&c!==void 0?c:2*((d=t==null?void 0:t.heartbeatIntervalMs)!==null&&d!==void 0?d:Zx.HEARTBEAT_INTERVAL),E.transport=(h=t==null?void 0:t.transport)!==null&&h!==void 0?h:g2.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:Y2(),E.reconnectAfterMs=(b=t==null?void 0:t.reconnectAfterMs)!==null&&b!==void 0?b:(A=>F2[A-1]||K2);let S,N;const C=(g=t==null?void 0:t.vsn)!==null&&g!==void 0?g:x2;switch(C){case b2:S=(A,j)=>j(JSON.stringify(A)),N=(A,j)=>j(JSON.parse(A));break;case hS:S=this.serializer.encode.bind(this.serializer),N=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${E.vsn}`)}if(E.vsn=C,E.encode=(x=t==null?void 0:t.encode)!==null&&x!==void 0?x:S,E.decode=(w=t==null?void 0:t.decode)!==null&&w!==void 0?w:N,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 Pl=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 Q2(e,t,r){const s=new URL(t,e);if(r)for(const[i,l]of Object.entries(r))l!==void 0&&s.searchParams.set(i,l);return s.toString()}async function Z2(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 eO(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:r,path:s,query:i,body:l,headers:c}){const d=Q2(e.baseUrl,s,i),h=await Z2(e.auth),m=await t(d,{method:r,headers:{...l?{"Content-Type":"application/json"}:{},...h,...c},body:l?JSON.stringify(l):void 0}),b=await m.text(),g=(m.headers.get("content-type")||"").includes("application/json"),x=g&&b?JSON.parse(b):b;if(!m.ok){const w=g?x:void 0,E=w==null?void 0:w.error;throw new Pl((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:w})}return{status:m.status,headers:m.headers,data:x}}}}function ju(e){return e.join("")}var tO=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:ju(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/${ju(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ju(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${ju(e.namespace)}`}),!0}catch(t){if(t instanceof Pl&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(r){if(r instanceof Pl&&r.status===409)return;throw r}}};function Pi(e){return e.join("")}var nO=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/${Pi(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/${Pi(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/${Pi(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/${Pi(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/${Pi(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/${Pi(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(r){if(r instanceof Pl&&r.status===404)return!1;throw r}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(r){if(r instanceof Pl&&r.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw r}}},rO=class{constructor(e){var s;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const r=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=eO({baseUrl:r,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(s=e.accessDelegation)==null?void 0:s.join(","),this.namespaceOps=new tO(this.client,t),this.tableOps=new nO(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 Ll(e){"@babel/helpers - typeof";return Ll=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},Ll(e)}function aO(e,t){if(Ll(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(Ll(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sO(e){var t=aO(e,"string");return Ll(t)=="symbol"?t:t+""}function iO(e,t,r){return(t=sO(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ew(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function Ie(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ew(Object(r),!0).forEach(function(s){iO(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ew(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}var Bd=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 Hd(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var Op=class extends Bd{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 Ie({},super.toJSON())}},yS=class extends Bd{constructor(e,t,r="storage"){super(e,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function hd(e,t,r){const s=Ie({},e),i=t.toLowerCase();for(const l of Object.keys(s))l.toLowerCase()===i&&delete s[l];return s[i]=r,s}function oO(e){const t={};for(const[r,s]of Object.entries(e))t[r.toLowerCase()]=s;return t}const lO=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),cO=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)},Mp=e=>{if(Array.isArray(e))return e.map(r=>Mp(r));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([r,s])=>{const i=r.replace(/([-_][a-z])/gi,l=>l.toUpperCase().replace(/[-_]/g,""));t[i]=Mp(s)}),t},uO=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),tw=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)},dO=async(e,t,r,s)=>{if(e!==null&&typeof e=="object"&&"json"in e&&typeof e.json=="function"){const i=e;let l=parseInt(String(i.status),10);Number.isFinite(l)||(l=500),i.json().then(c=>{const d=(c==null?void 0:c.statusCode)||(c==null?void 0:c.code)||l+"";t(new Op(tw(c),l,d,s))}).catch(()=>{const c=l+"";t(new Op(i.statusText||`HTTP ${l} error`,l,c,s))})}else t(new yS(tw(e),e,s))},fO=(e,t,r,s)=>{const i={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!s)return Ie(Ie({},i),r);if(cO(s)){var l;const c=(t==null?void 0:t.headers)||{};let d;for(const[h,m]of Object.entries(c))h.toLowerCase()==="content-type"&&(d=m);i.headers=hd(c,"Content-Type",(l=d)!==null&&l!==void 0?l:"application/json"),i.body=JSON.stringify(s)}else i.body=s;return t!=null&&t.duplex&&(i.duplex=t.duplex),Ie(Ie({},i),r)};async function pl(e,t,r,s,i,l,c){return new Promise((d,h)=>{e(r,fO(t,s,i,l)).then(m=>{if(!m.ok)throw m;if(s!=null&&s.noResolveJson)return m;if(c==="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=>dO(m,h,s,c))})}function bS(e="storage"){return{get:async(t,r,s,i)=>pl(t,"GET",r,s,i,void 0,e),post:async(t,r,s,i,l)=>pl(t,"POST",r,i,l,s,e),put:async(t,r,s,i,l)=>pl(t,"PUT",r,i,l,s,e),head:async(t,r,s,i)=>pl(t,"HEAD",r,Ie(Ie({},s),{},{noResolveJson:!0}),i,void 0,e),remove:async(t,r,s,i,l)=>pl(t,"DELETE",r,i,l,s,e)}}const hO=bS("storage"),{get:zl,post:vr,put:Dp,head:mO,remove:jg}=hO,Kn=bS("vectors");var mo=class{constructor(e,t={},r,s="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=oO(t),this.fetch=lO(r),this.namespace=s}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=hd(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(Hd(r))return{data:null,error:r};throw r}}};let xS;xS=Symbol.toStringTag;var pO=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[xS]="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(Hd(t))return{data:null,error:t};throw t}}};let wS;wS=Symbol.toStringTag;var gO=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[wS]="BlobDownloadBuilder",this.promise=null}asStream(){return new pO(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(Hd(t))return{data:null,error:t};throw t}}};const vO={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},nw={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var yO=class extends mo{constructor(e,t={},r,s){super(e,t,s,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,s){var i=this;return i.handleOperation(async()=>{let l;const c=Ie(Ie({},nw),s);let d=Ie(Ie({},i.headers),e==="POST"&&{"x-upsert":String(c.upsert)});const h=c.metadata;if(typeof Blob<"u"&&r instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),h&&l.append("metadata",i.encodeMetadata(h)),l.append("",r)):typeof FormData<"u"&&r instanceof FormData?(l=r,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),h&&!l.has("metadata")&&l.append("metadata",i.encodeMetadata(h))):(l=r,d["cache-control"]=`max-age=${c.cacheControl}`,d["content-type"]=c.contentType,h&&(d["x-metadata"]=i.toBase64(i.encodeMetadata(h))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!c.duplex&&(c.duplex="half")),s!=null&&s.headers)for(const[x,w]of Object.entries(s.headers))d=hd(d,x,w);const m=i._removeEmptyFolders(t),b=i._getFinalPath(m),g=await(e=="PUT"?Dp:vr)(i.fetch,`${i.url}/object/${b}`,l,Ie({headers:d},c!=null&&c.duplex?{duplex:c.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 i=this;const l=i._removeEmptyFolders(e),c=i._getFinalPath(l),d=new URL(i.url+`/object/upload/sign/${c}`);return d.searchParams.set("token",t),i.handleOperation(async()=>{let h;const m=Ie(Ie({},nw),s);let b=Ie(Ie({},i.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",i.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",i.encodeMetadata(g))):(h=r,b["cache-control"]=`max-age=${m.cacheControl}`,b["content-type"]=m.contentType,g&&(b["x-metadata"]=i.toBase64(i.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[x,w]of Object.entries(s.headers))b=hd(b,x,w);return{path:l,fullPath:(await Dp(i.fetch,d.toString(),h,Ie({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 i=Ie({},r.headers);t!=null&&t.upsert&&(i["x-upsert"]="true");const l=await vr(r.fetch,`${r.url}/object/upload/sign/${s}`,{},{headers:i}),c=new URL(r.url+l.url),d=c.searchParams.get("token");if(!d)throw new Bd("No token returned by API");return{signedUrl:c.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 vr(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 vr(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 i=s._getFinalPath(e);const l=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let c=await vr(s.fetch,`${s.url}/object/sign/${i}`,Ie({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}${c.signedURL}${h?`&${h}`:""}`)}})}async createSignedUrls(e,t,r){var s=this;return s.handleOperation(async()=>{const i=await vr(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 c=l.toString();return i.map(d=>Ie(Ie({},d),{},{signedUrl:d.signedURL?encodeURI(`${s.url}${d.signedURL}${c?`&${c}`:""}`):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",i=new URLSearchParams;t!=null&&t.transform&&this.applyTransformOptsToQuery(i,t.transform),(t==null?void 0:t.cacheNonce)!=null&&i.set("cacheNonce",String(t.cacheNonce));const l=i.toString(),c=this._getFinalPath(e),d=()=>zl(this.fetch,`${this.url}/${s}/${c}${l?`?${l}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new gO(d,this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>Mp(await zl(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await mO(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(i){if(t.shouldThrowOnError)throw i;if(Hd(i)){var s;const l=i instanceof Op?i.status:i instanceof yS?(s=i.originalError)===null||s===void 0?void 0:s.status:void 0;if(l!==void 0&&[400,404].includes(l))return{data:!1,error:i}}throw i}}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 i=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}`)+(i?`?${i}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await jg(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 i=Ie(Ie(Ie({},vO),t),{},{prefix:e||""});return await vr(s.fetch,`${s.url}/object/list/${s.bucketId}`,i,{headers:s.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{const s=Ie({},e);return await vr(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 bO="2.106.2",Zl={"X-Client-Info":`storage-js/${bO}`};var xO=class extends mo{constructor(e,t={},r,s){const i=new URL(e);s!=null&&s.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase."));const l=i.href.replace(/\/$/,""),c=Ie(Ie({},Zl),t);super(l,c,r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await zl(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await zl(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await vr(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 Dp(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 vr(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await jg(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():""}},wO=class extends mo{constructor(e,t={},r){const s=e.replace(/\/$/,""),i=Ie(Ie({},Zl),t);super(s,i,r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await vr(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(),i=s?`${t.url}/bucket?${s}`:`${t.url}/bucket`;return await zl(t.fetch,i,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await jg(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!uO(e))throw new Bd("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 rO({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),s=this.shouldThrowOnError;return new Proxy(r,{get(i,l){const c=i[l];return typeof c!="function"?c:async(...d)=>{try{return{data:await c.apply(i,d),error:null}}catch(h){if(s)throw h;return{data:null,error:h}}}}})}},_O=class extends mo{constructor(e,t={},r){const s=e.replace(/\/$/,""),i=Ie(Ie({},Zl),{},{"Content-Type":"application/json"},t);super(s,i,r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await Kn.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await Kn.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await Kn.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await Kn.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},SO=class extends mo{constructor(e,t={},r){const s=e.replace(/\/$/,""),i=Ie(Ie({},Zl),{},{"Content-Type":"application/json"},t);super(s,i,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 Kn.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await Kn.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 Kn.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await Kn.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 Kn.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},EO=class extends mo{constructor(e,t={},r){const s=e.replace(/\/$/,""),i=Ie(Ie({},Zl),{},{"Content-Type":"application/json"},t);super(s,i,r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await Kn.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Kn.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await Kn.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Kn.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},CO=class extends EO{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new NO(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)}},NO=class extends _O{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,Ie(Ie({},e),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,r=this;return t().call(r,Ie(Ie({},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 TO(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},TO=class extends SO{constructor(e,t,r,s,i){super(e,t,i),this.vectorBucketName=r,this.indexName=s}async putVectors(e){var t=()=>super.putVectors,r=this;return t().call(r,Ie(Ie({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(e){var t=()=>super.getVectors,r=this;return t().call(r,Ie(Ie({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,r=this;return t().call(r,Ie(Ie({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,r=this;return t().call(r,Ie(Ie({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,r=this;return t().call(r,Ie(Ie({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},jO=class extends xO{constructor(e,t={},r,s){super(e,t,r,s)}from(e){return new yO(this.url,this.headers,e,this.fetch)}get vectors(){return new CO(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new wO(this.url+"/iceberg",this.headers,this.fetch)}};const _S="2.106.2",Ki=30*1e3,Pp=3,Vm=Pp*Ki,AO="http://localhost:9999",RO="supabase.auth.token",kO={"X-Client-Info":`gotrue-js/${_S}`},Lp="X-Supabase-Api-Version",SS={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},OO=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,MO=600*1e3;class ao 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 ve(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class DO extends ao{constructor(t,r,s){super(t,r,s),this.name="AuthApiError",this.status=r,this.code=s}}function PO(e){return ve(e)&&e.name==="AuthApiError"}class yr extends ao{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}}class xa extends ao{constructor(t,r,s,i){super(t,s,i),this.name=r,this.status=s}}class tn extends xa{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Au(e){return ve(e)&&e.name==="AuthSessionMissingError"}class Li extends xa{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Ru extends xa{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class ku extends xa{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 LO(e){return ve(e)&&e.name==="AuthImplicitGrantRedirectError"}class rw extends xa{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 zO extends xa{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 zp extends xa{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}}function Gm(e){return ve(e)&&e.name==="AuthRetryableFetchError"}class aw extends xa{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 Ip extends xa{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const md="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),sw=`
\r=`.split(""),IO=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<sw.length;t+=1)e[sw[t].charCodeAt(0)]=-2;for(let t=0;t<md.length;t+=1)e[md[t].charCodeAt(0)]=t;return e})();function iw(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(md[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(md[s]),t.queuedBits-=6}}function ES(e,t,r){const s=IO[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 ow(e){const t=[],r=c=>{t.push(String.fromCodePoint(c))},s={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},l=c=>{BO(c,s,r)};for(let c=0;c<e.length;c+=1)ES(e.charCodeAt(c),i,l);return t.join("")}function $O(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 UO(e,t){for(let r=0;r<e.length;r+=1){let s=e.charCodeAt(r);if(s>55295&&s<=56319){const i=(s-55296)*1024&65535;s=(e.charCodeAt(r+1)-56320&65535|i)+65536,r+=1}$O(s,t)}}function BO(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 Zi(e){const t=[],r={queue:0,queuedBits:0},s=i=>{t.push(i)};for(let i=0;i<e.length;i+=1)ES(e.charCodeAt(i),r,s);return new Uint8Array(t)}function HO(e){const t=[];return UO(e,r=>t.push(r)),new Uint8Array(t)}function Ls(e){const t=[],r={queue:0,queuedBits:0},s=i=>{t.push(i)};return e.forEach(i=>iw(i,r,s)),iw(null,r,s),t.join("")}function qO(e){return Math.round(Date.now()/1e3)+e}function VO(){return Symbol("auth-callback")}const un=()=>typeof window<"u"&&typeof document<"u",js={tested:!1,writable:!1},CS=()=>{if(!un())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(js.tested)return js.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),js.tested=!0,js.writable=!0}catch{js.tested=!0,js.writable=!1}return js.writable};function GO(e){const t={},r=new URL(e);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((i,l)=>{t[l]=i})}catch{}return r.searchParams.forEach((s,i)=>{t[i]=s}),t}const NS=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),FO=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Wi=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},As=async(e,t)=>{const r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return null}},cn=async(e,t)=>{await e.removeItem(t)};class qd{constructor(){this.promise=new qd.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}}qd.promiseConstructor=Promise;function Ou(e){const t=e.split(".");if(t.length!==3)throw new Ip("Invalid JWT structure");for(let s=0;s<t.length;s++)if(!OO.test(t[s]))throw new Ip("JWT not in base64url format");return{header:JSON.parse(ow(t[0])),payload:JSON.parse(ow(t[1])),signature:Zi(t[2]),raw:{header:t[0],payload:t[1]}}}async function KO(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function WO(e,t){return new Promise((s,i)=>{(async()=>{for(let l=0;l<1/0;l++)try{const c=await e(l);if(!t(l,null,c)){s(c);return}}catch(c){if(!t(l,c)){i(c);return}}})()})}function YO(e){return("0"+e.toString(16)).substr(-2)}function XO(){const t=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=r.length;let i="";for(let l=0;l<56;l++)i+=r.charAt(Math.floor(Math.random()*s));return i}return crypto.getRandomValues(t),Array.from(t,YO).join("")}async function JO(e){const r=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",r),i=new Uint8Array(s);return Array.from(i).map(l=>String.fromCharCode(l)).join("")}async function QO(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 JO(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function zi(e,t,r=!1){const s=XO();let i=s;r&&(i+="/recovery"),await Wi(e,`${t}-code-verifier`,i);const l=await QO(s);return[l,s===l?"plain":"s256"]}const ZO=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function eM(e){const t=e.headers.get(Lp);if(!t||!t.match(ZO))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function tM(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 nM(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 rM=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function sa(e){if(!rM.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function pr(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 Fm(){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 aM(e,t){return new Proxy(e,{get:(r,s,i)=>{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,i)}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,i)}})}function lw(e){return JSON.parse(JSON.stringify(e))}const Ds=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)},sM=[502,503,504,520,521,522,523,524,530];async function cw(e){var t;if(!FO(e))throw new zp(Ds(e),0);if(sM.includes(e.status))throw new zp(Ds(e),e.status);let r;try{r=await e.json()}catch(l){throw new yr(Ds(l),l)}let s;const i=eM(e);if(i&&i.getTime()>=SS["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 aw(Ds(r),e.status,((t=r.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(s==="session_not_found")throw new tn}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,c)=>l&&typeof c=="string",!0))throw new aw(Ds(r),e.status,r.weak_password.reasons);throw new DO(Ds(r),e.status||500,s)}const iM=(e,t,r,s)=>{const i={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),i.body=JSON.stringify(s),Object.assign(Object.assign({},i),r))};async function Ce(e,t,r,s){var i;const l=Object.assign({},s==null?void 0:s.headers);l[Lp]||(l[Lp]=SS["2024-01-01"].name),s!=null&&s.jwt&&(l.Authorization=`Bearer ${s.jwt}`);const c=(i=s==null?void 0:s.query)!==null&&i!==void 0?i:{};s!=null&&s.redirectTo&&(c.redirect_to=s.redirectTo);const d=Object.keys(c).length?"?"+new URLSearchParams(c).toString():"",h=await oM(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 oM(e,t,r,s,i,l){const c=iM(t,s,i,l);let d;try{d=await e(r,Object.assign({},c))}catch(h){throw console.error(h),new zp(Ds(h),0)}if(d.ok||await cw(d),s!=null&&s.noResolveJson)return d;try{return await d.json()}catch(h){await cw(h)}}function ir(e){var t;let r=null;uM(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=qO(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 uw(e){const t=ir(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 es(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function lM(e){return{data:e,error:null}}function cM(e){const{action_link:t,email_otp:r,hashed_token:s,redirect_to:i,verification_type:l}=e,c=ho(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),d={action_link:t,email_otp:r,hashed_token:s,redirect_to:i,verification_type:l},h=Object.assign({},c);return{data:{properties:d,user:h},error:null}}function dw(e){return e}function uM(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const Km=["global","local","others"];class dM{_encodePathSegment(t){if(t==="."||t==="..")throw new ao("Invalid path segment");return encodeURIComponent(t)}constructor({url:t="",headers:r={},fetch:s,experimental:i}){this.url=t,this.headers=r,this.fetch=NS(s),this.experimental=i??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},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=Km[0]){if(Km.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Km.join(", ")}`);try{return await Ce(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(s){if(ve(s))return{data:null,error:s};throw s}}async inviteUserByEmail(t,r={}){try{return await Ce(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:es})}catch(s){if(ve(s))return{data:{user:null},error:s};throw s}}async generateLink(t){try{const{options:r}=t,s=ho(t,["options"]),i=Object.assign(Object.assign({},s),r);return"newEmail"in s&&(i.new_email=s==null?void 0:s.newEmail,delete i.newEmail),await Ce(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:cM,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(ve(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(t){try{return await Ce(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:es})}catch(r){if(ve(r))return{data:{user:null},error:r};throw r}}async listUsers(t){var r,s,i,l,c,d,h;try{const m={nextPage:null,lastPage:0,total:0},b=await Ce(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=(i=t==null?void 0:t.perPage)===null||i===void 0?void 0:i.toString())!==null&&l!==void 0?l:""},xform:dw});if(b.error)throw b.error;const g=await b.json(),x=(c=b.headers.get("x-total-count"))!==null&&c!==void 0?c:0,w=(h=(d=b.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&h!==void 0?h:[];return w.length>0&&(w.forEach(E=>{const S=parseInt(E.split(";")[0].split("=")[1].substring(0,1)),N=JSON.parse(E.split(";")[1].split("=")[1]);m[`${N}Page`]=S}),m.total=parseInt(x)),{data:Object.assign(Object.assign({},g),m),error:null}}catch(m){if(ve(m))return{data:{users:[]},error:m};throw m}}async getUserById(t){sa(t);try{return await Ce(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:es})}catch(r){if(ve(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){sa(t);try{return await Ce(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:es})}catch(s){if(ve(s))return{data:{user:null},error:s};throw s}}async deleteUser(t,r=!1){sa(t);try{return await Ce(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:es})}catch(s){if(ve(s))return{data:{user:null},error:s};throw s}}async _listFactors(t){sa(t.userId);try{const{data:r,error:s}=await Ce(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:r,error:s}}catch(r){if(ve(r))return{data:null,error:r};throw r}}async _deleteFactor(t){sa(t.userId),sa(t.id);try{return{data:await Ce(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(r){if(ve(r))return{data:null,error:r};throw r}}async _listOAuthClients(t){var r,s,i,l,c,d,h;try{const m={nextPage:null,lastPage:0,total:0},b=await Ce(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=(i=t==null?void 0:t.perPage)===null||i===void 0?void 0:i.toString())!==null&&l!==void 0?l:""},xform:dw});if(b.error)throw b.error;const g=await b.json(),x=(c=b.headers.get("x-total-count"))!==null&&c!==void 0?c:0,w=(h=(d=b.headers.get("link"))===null||d===void 0?void 0:d.split(","))!==null&&h!==void 0?h:[];return w.length>0&&(w.forEach(E=>{const S=parseInt(E.split(";")[0].split("=")[1].substring(0,1)),N=JSON.parse(E.split(";")[1].split("=")[1]);m[`${N}Page`]=S}),m.total=parseInt(x)),{data:Object.assign(Object.assign({},g),m),error:null}}catch(m){if(ve(m))return{data:{clients:[]},error:m};throw m}}async _createOAuthClient(t){try{return await Ce(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ve(r))return{data:null,error:r};throw r}}async _getOAuthClient(t){try{const r=this._encodePathSegment(t);return await Ce(this.fetch,"GET",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(r){if(ve(r))return{data:null,error:r};throw r}}async _updateOAuthClient(t,r){try{const s=this._encodePathSegment(t);return await Ce(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${s}`,{body:r,headers:this.headers,xform:i=>({data:i,error:null})})}catch(s){if(ve(s))return{data:null,error:s};throw s}}async _deleteOAuthClient(t){try{const r=this._encodePathSegment(t);return await Ce(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(ve(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(t){try{const r=this._encodePathSegment(t);return await Ce(this.fetch,"POST",`${this.url}/admin/oauth/clients/${r}/regenerate_secret`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(r){if(ve(r))return{data:null,error:r};throw r}}async _listCustomProviders(t){try{const r={};return t!=null&&t.type&&(r.type=t.type),await Ce(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:s=>{var i;return{data:{providers:(i=s==null?void 0:s.providers)!==null&&i!==void 0?i:[]},error:null}}})}catch(r){if(ve(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(t){try{return await Ce(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ve(r))return{data:null,error:r};throw r}}async _getCustomProvider(t){try{const r=this._encodePathSegment(t);return await Ce(this.fetch,"GET",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(r){if(ve(r))return{data:null,error:r};throw r}}async _updateCustomProvider(t,r){try{const s=this._encodePathSegment(t);return await Ce(this.fetch,"PUT",`${this.url}/admin/custom-providers/${s}`,{body:r,headers:this.headers,xform:i=>({data:i,error:null})})}catch(s){if(ve(s))return{data:null,error:s};throw s}}async _deleteCustomProvider(t){try{const r=this._encodePathSegment(t);return await Ce(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(ve(r))return{data:null,error:r};throw r}}async _adminListPasskeys(t){pr(this.experimental),sa(t.userId);try{return await Ce(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(ve(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(t){pr(this.experimental),sa(t.userId),sa(t.passkeyId);try{return await Ce(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(ve(r))return{data:null,error:r};throw r}}}function fw(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}const Ar={debug:!!(globalThis&&CS()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class TS extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class hw extends TS{}async function fM(e,t,r){Ar.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const s=new globalThis.AbortController;let i;t>0&&(i=setTimeout(()=>{s.abort(),Ar.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(i),Ar.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,l.name);try{return await r()}finally{Ar.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,l.name)}}else{if(t===0)throw Ar.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new hw(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(Ar.debug)try{const c=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(c,null," "))}catch(c){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",c)}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(i),await r()}})}catch(l){if(t>0&&clearTimeout(i),l!==null&&typeof l=="object"&&"name"in l&&l.name==="AbortError"&&t>0){if(s.signal.aborted)return Ar.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 c=>{if(c){Ar.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,c.name);try{return await r()}finally{Ar.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",e,c.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await r()}));throw Ar.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new hw(`Lock "${e}" was released because another request stole it`)}throw l}}function hM(){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 jS(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function mM(e){return parseInt(e,16)}function pM(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,s=>s.toString(16).padStart(2,"0")).join("")}function gM(e){var t;const{chainId:r,domain:s,expirationTime:i,issuedAt:l=new Date,nonce:c,notBefore:d,requestId:h,resources:m,scheme:b,uri:g,version:x}=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(c&&c.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${c}`);if(!g)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(x!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${x}`);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 w=jS(e.address),E=b?`${b}://${s}`:s,S=e.statement?`${e.statement}
`:"",N=`${E} wants you to sign in with your Ethereum account:
${w}
${S}`;let C=`URI: ${g}
Version: ${x}
Chain ID: ${r}${c?`
Nonce: ${c}`:""}
Issued At: ${l.toISOString()}`;if(i&&(C+=`
Expiration Time: ${i.toISOString()}`),d&&(C+=`
Not Before: ${d.toISOString()}`),h&&(C+=`
Request ID: ${h}`),m){let A=`
Resources:`;for(const j of m){if(!j||typeof j!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${j}`);A+=`
- ${j}`}C+=A}return`${N}
${C}`}class Gt extends Error{constructor({message:t,code:r,cause:s,name:i}){var l;super(t,{cause:s}),this.__isWebAuthnError=!0,this.name=(l=i??(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 pd extends Gt{constructor(t,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:t}),this.name="WebAuthnUnknownError",this.originalError=r}}function vM({error:e,options:t}){var r,s,i;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 Gt({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 Gt({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 Gt({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((i=l.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new Gt({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 Gt({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new Gt({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 Gt({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Gt({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 c=window.location.hostname;if(AS(c)){if(l.rp.id!==c)return new Gt({message:`The RP ID "${l.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Gt({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 Gt({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 Gt({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 Gt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function yM({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 Gt({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new Gt({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const s=window.location.hostname;if(AS(s)){if(r.rpId!==s)return new Gt({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Gt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new Gt({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 Gt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class bM{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 $p=new bM;function mw(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,i=ho(e,["challenge","user","excludeCredentials"]),l=Zi(t).buffer,c=Object.assign(Object.assign({},r),{id:Zi(r.id).buffer}),d=Object.assign(Object.assign({},i),{challenge:l,user:c});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:Zi(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function pw(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=ho(e,["challenge","allowCredentials"]),i=Zi(t).buffer,l=Object.assign(Object.assign({},s),{challenge:i});if(r&&r.length>0){l.allowCredentials=new Array(r.length);for(let c=0;c<r.length;c++){const d=r[c];l.allowCredentials[c]=Object.assign(Object.assign({},d),{id:Zi(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return l}function gw(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:Ls(new Uint8Array(e.response.attestationObject)),clientDataJSON:Ls(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function vw(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const r=e,s=e.getClientExtensionResults(),i=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:Ls(new Uint8Array(i.authenticatorData)),clientDataJSON:Ls(new Uint8Array(i.clientDataJSON)),signature:Ls(new Uint8Array(i.signature)),userHandle:i.userHandle?Ls(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:s,authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function AS(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function gd(){var e,t;return!!(un()&&"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 RS(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new pd("Browser returned unexpected credential type",t)}:{data:null,error:new pd("Empty credential response",t)}}catch(t){return{data:null,error:vM({error:t,options:e})}}}async function kS(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new pd("Browser returned unexpected credential type",t)}:{data:null,error:new pd("Empty credential response",t)}}catch(t){return{data:null,error:yM({error:t,options:e})}}}const xM={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},wM={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function vd(...e){const t=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),r=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),s={};for(const i of e)if(i)for(const l in i){const c=i[l];if(c!==void 0)if(Array.isArray(c))s[l]=c;else if(r(c))s[l]=c;else if(t(c)){const d=s[l];t(d)?s[l]=vd(d,c):s[l]=vd(c)}else s[l]=c}return s}function _M(e,t){return vd(xM,e,t||{})}function SM(e,t){return vd(wM,e,t||{})}class EM{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:i},l){var c;try{const{data:d,error:h}=await this.client.mfa.challenge({factorId:t,webauthn:r});if(!d)return{data:null,error:h};const m=i??$p.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 w=(await this.client.getUser()).data.user,E=((c=w==null?void 0:w.user_metadata)===null||c===void 0?void 0:c.name)||(w==null?void 0:w.email)||(w==null?void 0:w.id)||"User";b.name=`${b.id}:${E}`}}b.displayName||(b.displayName=b.name)}switch(d.webauthn.type){case"create":{const b=_M(d.webauthn.credential_options.publicKey,l==null?void 0:l.create),{data:g,error:x}=await RS({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:x}}case"request":{const b=SM(d.webauthn.credential_options.publicKey,l==null?void 0:l.request),{data:g,error:x}=await kS(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:x}}}}catch(d){return ve(d)?{data:null,error:d}:{data:null,error:new yr("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:i}={}},l){if(!r)return{data:null,error:new ao("rpId is required for WebAuthn authentication")};try{if(!gd())return{data:null,error:new yr("Browser does not support WebAuthn",null)};const{data:c,error:d}=await this.challenge({factorId:t,webauthn:{rpId:r,rpOrigins:s},signal:i},{request:l});if(!c)return{data:null,error:d};const{webauthn:h}=c;return this._verify({factorId:t,challengeId:c.challengeId,webauthn:{type:h.type,rpId:r,rpOrigins:s,credential_response:h.credential_response}})}catch(c){return ve(c)?{data:null,error:c}:{data:null,error:new yr("Unexpected error in authenticate",c)}}}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:i}={}},l){if(!r)return{data:null,error:new ao("rpId is required for WebAuthn registration")};try{if(!gd())return{data:null,error:new yr("Browser does not support WebAuthn",null)};const{data:c,error:d}=await this._enroll({friendlyName:t});if(!c)return await this.client.mfa.listFactors().then(b=>{var g;return(g=b.data)===null||g===void 0?void 0:g.all.find(x=>x.factor_type==="webauthn"&&x.friendly_name===t&&x.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:c.id,friendlyName:c.friendly_name,webauthn:{rpId:r,rpOrigins:s},signal:i},{create:l});return h?this._verify({factorId:c.id,challengeId:h.challengeId,webauthn:{rpId:r,rpOrigins:s,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:m}}catch(c){return ve(c)?{data:null,error:c}:{data:null,error:new yr("Unexpected error in register",c)}}}}hM();const CM={url:AO,storageKey:RO,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:kO,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function yw(e,t,r){return await r()}const Ii={};class Il{get jwks(){var t,r;return(r=(t=Ii[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(t){Ii[this.storageKey]=Object.assign(Object.assign({},Ii[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,r;return(r=(t=Ii[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Ii[this.storageKey]=Object.assign(Object.assign({},Ii[this.storageKey]),{cachedAt:t})}constructor(t){var r,s,i,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 c=Object.assign(Object.assign({},CM),t);if(this.storageKey=c.storageKey,this.instanceID=(r=Il.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Il.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!c.debug,typeof c.debug=="function"&&(this.logger=c.debug),this.instanceID>0&&un()){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=c.persistSession,this.autoRefreshToken=c.autoRefreshToken,this.experimental=(s=c.experimental)!==null&&s!==void 0?s:{},this.admin=new dM({url:c.url,headers:c.headers,fetch:c.fetch,experimental:this.experimental}),this.url=c.url,this.headers=c.headers,this.fetch=NS(c.fetch),this.lock=c.lock||yw,this.detectSessionInUrl=c.detectSessionInUrl,this.flowType=c.flowType,this.hasCustomAuthorizationHeader=c.hasCustomAuthorizationHeader,this.throwOnError=c.throwOnError,this.lockAcquireTimeout=c.lockAcquireTimeout,c.lock?this.lock=c.lock:this.persistSession&&un()&&(!((i=globalThis==null?void 0:globalThis.navigator)===null||i===void 0)&&i.locks)?this.lock=fM:this.lock=yw,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 EM(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?(c.storage?this.storage=c.storage:CS()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=fw(this.memoryStorage)),c.userStorage&&(this.userStorage=c.userStorage)):(this.memoryStorage={},this.storage=fw(this.memoryStorage)),un()&&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)}})}c.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} (${_S}) ${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(un()&&(r=GO(window.location.href),this._isImplicitGrantCallback(r)?s="implicit":await this._isPKCECallback(r)&&(s="pkce")),un()&&this.detectSessionInUrl&&s!=="none"){const{data:i,error:l}=await this._getSessionFromURL(r,s);if(l){if(this._debug("#_initialize()","error detecting session from URL",l),LO(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:c,redirectType:d}=i;return this._debug("#_initialize()","detected session in URL",c,"redirect type",d),await this._saveSession(c),setTimeout(async()=>{d==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",c):await this._notifyAllSubscribers("SIGNED_IN",c)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return ve(r)?this._returnResult({error:r}):this._returnResult({error:new yr("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var r,s,i;try{const l=await Ce(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:(i=t==null?void 0:t.options)===null||i===void 0?void 0:i.captchaToken}},xform:ir}),{data:c,error:d}=l;if(d||!c)return this._returnResult({data:{user:null,session:null},error:d});const h=c.session,m=c.user;return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",h)),this._returnResult({data:{user:m,session:h},error:null})}catch(l){if(ve(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signUp(t){var r,s,i;try{let l;if("email"in t){const{email:b,password:g,options:x}=t;let w=null,E=null;this.flowType==="pkce"&&([w,E]=await zi(this.storage,this.storageKey)),l=await Ce(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:x==null?void 0:x.emailRedirectTo,body:{email:b,password:g,data:(r=x==null?void 0:x.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:x==null?void 0:x.captchaToken},code_challenge:w,code_challenge_method:E},xform:ir})}else if("phone"in t){const{phone:b,password:g,options:x}=t;l=await Ce(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:b,password:g,data:(s=x==null?void 0:x.data)!==null&&s!==void 0?s:{},channel:(i=x==null?void 0:x.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:x==null?void 0:x.captchaToken}},xform:ir})}else throw new Ru("You must provide either an email or phone number and a password");const{data:c,error:d}=l;if(d||!c)return await cn(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:d});const h=c.session,m=c.user;return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",h)),this._returnResult({data:{user:m,session:h},error:null})}catch(l){if(await cn(this.storage,`${this.storageKey}-code-verifier`),ve(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:c,options:d}=t;r=await Ce(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:l,password:c,gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:uw})}else if("phone"in t){const{phone:l,password:c,options:d}=t;r=await Ce(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:l,password:c,gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:uw})}else throw new Ru("You must provide either an email or phone number and a password");const{data:s,error:i}=r;if(i)return this._returnResult({data:{user:null,session:null},error:i});if(!s||!s.session||!s.user){const l=new Li;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:i})}catch(r){if(ve(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(t){var r,s,i,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:(i=t.options)===null||i===void 0?void 0:i.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,i,l,c,d,h,m,b,g,x;let w,E;if("message"in t)w=t.message,E=t.signature;else{const{chain:S,wallet:N,statement:C,options:A}=t;let j;if(un())if(typeof N=="object")j=N;else{const Z=window;if("ethereum"in Z&&typeof Z.ethereum=="object"&&"request"in Z.ethereum&&typeof Z.ethereum.request=="function")j=Z.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 N!="object"||!(A!=null&&A.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");j=N}const k=new URL((r=A==null?void 0:A.url)!==null&&r!==void 0?r:window.location.href),I=await j.request({method:"eth_requestAccounts"}).then(Z=>Z).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!I||I.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const z=jS(I[0]);let P=(s=A==null?void 0:A.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!P){const Z=await j.request({method:"eth_chainId"});P=mM(Z)}const H={domain:k.host,address:z,statement:C,uri:k.href,version:"1",chainId:P,nonce:(i=A==null?void 0:A.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(c=(l=A==null?void 0:A.signInWithEthereum)===null||l===void 0?void 0:l.issuedAt)!==null&&c!==void 0?c: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};w=gM(H),E=await j.request({method:"personal_sign",params:[pM(w),z]})}try{const{data:S,error:N}=await Ce(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:w,signature:E},!((g=t.options)===null||g===void 0)&&g.captchaToken?{gotrue_meta_security:{captcha_token:(x=t.options)===null||x===void 0?void 0:x.captchaToken}}:null),xform:ir});if(N)throw N;if(!S||!S.session||!S.user){const C=new Li;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:N})}catch(S){if(ve(S))return this._returnResult({data:{user:null,session:null},error:S});throw S}}async signInWithSolana(t){var r,s,i,l,c,d,h,m,b,g,x,w;let E,S;if("message"in t)E=t.message,S=t.signature;else{const{chain:N,wallet:C,statement:A,options:j}=t;let k;if(un())if(typeof C=="object")k=C;else{const z=window;if("solana"in z&&typeof z.solana=="object"&&("signIn"in z.solana&&typeof z.solana.signIn=="function"||"signMessage"in z.solana&&typeof z.solana.signMessage=="function"))k=z.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof C!="object"||!(j!=null&&j.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");k=C}const I=new URL((r=j==null?void 0:j.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in k&&k.signIn){const z=await k.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},j==null?void 0:j.signInWithSolana),{version:"1",domain:I.host,uri:I.href}),A?{statement:A}:null));let P;if(Array.isArray(z)&&z[0]&&typeof z[0]=="object")P=z[0];else if(z&&typeof z=="object"&&"signedMessage"in z&&"signature"in z)P=z;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 k)||typeof k.signMessage!="function"||!("publicKey"in k)||typeof k!="object"||!k.publicKey||!("toBase58"in k.publicKey)||typeof k.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");E=[`${I.host} wants you to sign in with your Solana account:`,k.publicKey.toBase58(),...A?["",A,""]:[""],"Version: 1",`URI: ${I.href}`,`Issued At: ${(i=(s=j==null?void 0:j.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((l=j==null?void 0:j.signInWithSolana)===null||l===void 0)&&l.notBefore?[`Not Before: ${j.signInWithSolana.notBefore}`]:[],...!((c=j==null?void 0:j.signInWithSolana)===null||c===void 0)&&c.expirationTime?[`Expiration Time: ${j.signInWithSolana.expirationTime}`]:[],...!((d=j==null?void 0:j.signInWithSolana)===null||d===void 0)&&d.chainId?[`Chain ID: ${j.signInWithSolana.chainId}`]:[],...!((h=j==null?void 0:j.signInWithSolana)===null||h===void 0)&&h.nonce?[`Nonce: ${j.signInWithSolana.nonce}`]:[],...!((m=j==null?void 0:j.signInWithSolana)===null||m===void 0)&&m.requestId?[`Request ID: ${j.signInWithSolana.requestId}`]:[],...!((g=(b=j==null?void 0:j.signInWithSolana)===null||b===void 0?void 0:b.resources)===null||g===void 0)&&g.length?["Resources",...j.signInWithSolana.resources.map(P=>`- ${P}`)]:[]].join(`
`);const z=await k.signMessage(new TextEncoder().encode(E),"utf8");if(!z||!(z instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");S=z}}try{const{data:N,error:C}=await Ce(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:E,signature:Ls(S)},!((x=t.options)===null||x===void 0)&&x.captchaToken?{gotrue_meta_security:{captcha_token:(w=t.options)===null||w===void 0?void 0:w.captchaToken}}:null),xform:ir});if(C)throw C;if(!N||!N.session||!N.user){const A=new Li;return this._returnResult({data:{user:null,session:null},error:A})}return N.session&&(await this._saveSession(N.session),await this._notifyAllSubscribers("SIGNED_IN",N.session)),this._returnResult({data:Object.assign({},N),error:C})}catch(N){if(ve(N))return this._returnResult({data:{user:null,session:null},error:N});throw N}}async _exchangeCodeForSession(t){const r=await As(this.storage,`${this.storageKey}-code-verifier`),[s,i]=(r??"").split("/");try{if(!s&&this.flowType==="pkce")throw new zO;const{data:l,error:c}=await Ce(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:s},xform:ir});if(await cn(this.storage,`${this.storageKey}-code-verifier`),c)throw c;if(!l||!l.session||!l.user){const d=new Li;return this._returnResult({data:{user:null,session:null,redirectType:null},error:d})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers(i==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l.session)),this._returnResult({data:Object.assign(Object.assign({},l),{redirectType:i??null}),error:c})}catch(l){if(await cn(this.storage,`${this.storageKey}-code-verifier`),ve(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:i,access_token:l,nonce:c}=t,d=await Ce(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:i,access_token:l,nonce:c,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:ir}),{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 Li;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(ve(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(t){var r,s,i,l,c;try{if("email"in t){const{email:d,options:h}=t;let m=null,b=null;this.flowType==="pkce"&&([m,b]=await zi(this.storage,this.storageKey));const{error:g}=await Ce(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 Ce(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:d,data:(i=h==null?void 0:h.data)!==null&&i!==void 0?i:{},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:(c=h==null?void 0:h.channel)!==null&&c!==void 0?c:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:m==null?void 0:m.message_id},error:b})}throw new Ru("You must provide either an email or phone number.")}catch(d){if(await cn(this.storage,`${this.storageKey}-code-verifier`),ve(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async verifyOtp(t){var r,s;try{let i,l;"options"in t&&(i=(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:c,error:d}=await Ce(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:l}}),redirectTo:i,xform:ir});if(d)throw d;if(!c)throw new Error("An error occurred on token verification.");const h=c.session,m=c.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(i){if(ve(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(t){var r,s,i,l,c;try{let d=null,h=null;this.flowType==="pkce"&&([d,h]=await zi(this.storage,this.storageKey));const m=await Ce(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in 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}),!((i=t==null?void 0:t.options)===null||i===void 0)&&i.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:lM});return!((l=m.data)===null||l===void 0)&&l.url&&un()&&!(!((c=t.options)===null||c===void 0)&&c.skipBrowserRedirect)&&window.location.assign(m.data.url),this._returnResult(m)}catch(d){if(await cn(this.storage,`${this.storageKey}-code-verifier`),ve(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 tn;const{error:i}=await Ce(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:i})})}catch(t){if(ve(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:i,options:l}=t,{error:c}=await Ce(this.fetch,"POST",r,{headers:this.headers,body:{email:s,type:i,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:c})}else if("phone"in t){const{phone:s,type:i,options:l}=t,{data:c,error:d}=await Ce(this.fetch,"POST",r,{headers:this.headers,body:{phone:s,type:i,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:d})}throw new Ru("You must provide either an email or phone number and a type")}catch(r){if(ve(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(),i=(async()=>(await s,await r()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}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 i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.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 As(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()<Vm:!1;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",t.expires_at),!s){if(this.userStorage){const c=await As(this.userStorage,this.storageKey+"-user");c!=null&&c.user?t.user=c.user:t.user=Fm()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const c={value:this.suppressGetSessionWarning};t.user=aM(t.user,c),c.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:i,error:l}=await this._callRefreshToken(t.refresh_token);return l?this._returnResult({data:{session:null},error:l}):this._returnResult({data:{session:i},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 Ce(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:es}):await this._useSession(async r=>{var s,i,l;const{data:c,error:d}=r;if(d)throw d;return!(!((s=c.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new tn}:await Ce(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(l=(i=c.session)===null||i===void 0?void 0:i.access_token)!==null&&l!==void 0?l:void 0,xform:es})})}catch(r){if(ve(r))return Au(r)&&(await this._removeSession(),await cn(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:i,error:l}=s;if(l)throw l;if(!i.session)throw new tn;const c=i.session;let d=null,h=null;this.flowType==="pkce"&&t.email!=null&&([d,h]=await zi(this.storage,this.storageKey));const{data:m,error:b}=await Ce(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:c.access_token,xform:es});if(b)throw b;return c.user=m.user,await this._saveSession(c),await this._notifyAllSubscribers("USER_UPDATED",c),this._returnResult({data:{user:c.user},error:null})})}catch(s){if(await cn(this.storage,`${this.storageKey}-code-verifier`),ve(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 tn;const r=Date.now()/1e3;let s=r,i=!0,l=null;const{payload:c}=Ou(t.access_token);if(c.exp&&(s=c.exp,i=s<=r),i){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(ve(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:c,error:d}=r;if(d)throw d;t=(s=c.session)!==null&&s!==void 0?s:void 0}if(!(t!=null&&t.refresh_token))throw new tn;const{data:i,error:l}=await this._callRefreshToken(t.refresh_token);return l?this._returnResult({data:{user:null,session:null},error:l}):i?this._returnResult({data:{user:i.user,session:i},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(ve(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(t,r){var s;try{if(!un())throw new ku("No browser detected.");if(t.error||t.error_description||t.error_code)throw new ku(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 rw("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new ku("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 rw("No code detected.");const{data:j,error:k}=await this._exchangeCodeForSession(t.code);if(k)throw k;const I=new URL(window.location.href);return I.searchParams.delete("code"),window.history.replaceState(window.history.state,"",I.toString()),{data:{session:j.session,redirectType:(s=j.redirectType)!==null&&s!==void 0?s:null},error:null}}const{provider_token:i,provider_refresh_token:l,access_token:c,refresh_token:d,expires_in:h,expires_at:m,token_type:b}=t;if(!c||!h||!d||!b)throw new ku("No session defined in URL");const g=Math.round(Date.now()/1e3),x=parseInt(h);let w=g+x;m&&(w=parseInt(m));const E=w-g;E*1e3<=Ki&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${E}s, should have been closer to ${x}s`);const S=w-x;g-S>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",S,w,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,w,g);const{data:N,error:C}=await this._getUser(c);if(C)throw C;const A={provider_token:i,provider_refresh_token:l,access_token:c,expires_in:x,expires_at:w,refresh_token:d,token_type:b,user:N.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:A,redirectType:t.type},error:null})}catch(i){if(ve(i))return this._returnResult({data:{session:null,redirectType:null},error:i});throw i}}_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 As(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:i,error:l}=r;if(l&&!Au(l))return this._returnResult({error:l});const c=(s=i.session)===null||s===void 0?void 0:s.access_token;if(c){const{error:d}=await this.admin.signOut(c,t);if(d&&!(PO(d)&&(d.status===404||d.status===401||d.status===403)||Au(d)))return this._returnResult({error:d})}return t!=="others"&&(await this._removeSession(),await cn(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const r=VO(),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,i;try{const{data:{session:l},error:c}=r;if(c)throw c;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((i=this.stateChangeEmitters.get(t))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",l),Au(l)?console.warn(l):console.error(l)}})}async resetPasswordForEmail(t,r={}){let s=null,i=null;this.flowType==="pkce"&&([s,i]=await zi(this.storage,this.storageKey,!0));try{return await Ce(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:s,code_challenge_method:i,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(l){if(await cn(this.storage,`${this.storageKey}-code-verifier`),ve(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(ve(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:i}=await this._useSession(async l=>{var c,d,h,m,b;const{data:g,error:x}=l;if(x)throw x;const w=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(c=t.options)===null||c===void 0?void 0:c.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 Ce(this.fetch,"GET",w,{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(i)throw i;return un()&&!(!((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(ve(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:i,data:{session:l}}=r;if(i)throw i;const{options:c,provider:d,token:h,access_token:m,nonce:b}=t,g=await Ce(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:c==null?void 0:c.captchaToken}},xform:ir}),{data:x,error:w}=g;return w?this._returnResult({data:{user:null,session:null},error:w}):!x||!x.session||!x.user?this._returnResult({data:{user:null,session:null},error:new Li}):(x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("USER_UPDATED",x.session)),this._returnResult({data:x,error:w}))}catch(i){if(await cn(this.storage,`${this.storageKey}-code-verifier`),ve(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}})}async unlinkIdentity(t){try{return await this._useSession(async r=>{var s,i;const{data:l,error:c}=r;if(c)throw c;return await Ce(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(i=(s=l.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0})})}catch(r){if(ve(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 WO(async i=>(i>0&&await KO(200*Math.pow(2,i-1)),this._debug(r,"refreshing attempt",i),await Ce(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:ir})),(i,l)=>{const c=200*Math.pow(2,i);return l&&Gm(l)&&Date.now()+c-s<Ki})}catch(s){if(this._debug(r,"error",s),ve(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),un()&&!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 i=await As(this.storage,this.storageKey);if(i&&this.userStorage){let c=await As(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!c&&(c={user:i.user},await Wi(this.userStorage,this.storageKey+"-user",c)),i.user=(t=c==null?void 0:c.user)!==null&&t!==void 0?t:Fm()}else if(i&&!i.user&&!i.user){const c=await As(this.storage,this.storageKey+"-user");c&&(c!=null&&c.user)?(i.user=c.user,await cn(this.storage,this.storageKey+"-user"),await Wi(this.storage,this.storageKey,i)):i.user=Fm()}if(this._debug(s,"session from storage",i),!this._isValidSession(i)){this._debug(s,"session is not valid"),i!==null&&await this._removeSession();return}const l=((r=i.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<Vm;if(this._debug(s,`session has${l?"":" not"} expired with margin of ${Vm}s`),l){if(this.autoRefreshToken&&i.refresh_token){const{error:c}=await this._callRefreshToken(i.refresh_token);c&&(console.error(c),Gm(c)||(this._debug(s,"refresh failed with a non-retryable error, removing the session",c),await this._removeSession()))}}else if(i.user&&i.user.__isUserNotAvailableProxy===!0)try{const{data:c,error:d}=await this._getUser(i.access_token);!d&&(c!=null&&c.user)?(i.user=c.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):this._debug(s,"could not get user data, skipping SIGNED_IN notification")}catch(c){console.error("Error getting user data:",c),this._debug(s,"error getting user data, skipping SIGNED_IN notification",c)}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(s,"error",i),console.error(i);return}finally{this._debug(s,"end")}}async _callRefreshToken(t){var r,s;if(!t)throw new tn;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const i=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new qd;const{data:l,error:c}=await this._refreshAccessToken(t);if(c)throw c;if(!l.session)throw new tn;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(i,"error",l),ve(l)){const c={data:null,error:l};return Gm(l)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(c),c}throw(s=this.refreshingDeferred)===null||s===void 0||s.reject(l),l}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(t,r,s=!0){const i=`#_notifyAllSubscribers(${t})`;this._debug(i,"begin",r,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:t,session:r});const l=[],c=Array.from(this.stateChangeEmitters.values()).map(async d=>{try{await d.callback(t,r)}catch(h){l.push(h)}});if(await Promise.all(c),l.length>0){for(let d=0;d<l.length;d+=1)console.error(l[d]);throw l[0]}}finally{this._debug(i,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await cn(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 Wi(this.userStorage,this.storageKey+"-user",{user:r.user});const i=Object.assign({},r);delete i.user;const l=lw(i);await Wi(this.storage,this.storageKey,l)}else{const i=lw(r);await Wi(this.storage,this.storageKey,i)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await cn(this.storage,this.storageKey),await cn(this.storage,this.storageKey+"-code-verifier"),await cn(this.storage,this.storageKey+"-user"),this.userStorage&&await cn(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&un()&&(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(),Ki);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 i=Math.floor((s.expires_at*1e3-t)/Ki);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${Ki}ms, refresh threshold is ${Pp} ticks`),i<=Pp&&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 TS)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!un()||!(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 i=[`provider=${encodeURIComponent(r)}`];if(s!=null&&s.redirectTo&&i.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s!=null&&s.scopes&&i.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[l,c]=await zi(this.storage,this.storageKey),d=new URLSearchParams({code_challenge:`${encodeURIComponent(l)}`,code_challenge_method:`${encodeURIComponent(c)}`});i.push(d.toString())}if(s!=null&&s.queryParams){const l=new URLSearchParams(s.queryParams);i.push(l.toString())}return s!=null&&s.skipBrowserRedirect&&i.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${t}?${i.join("&")}`}async _unenroll(t){try{return await this._useSession(async r=>{var s;const{data:i,error:l}=r;return l?this._returnResult({data:null,error:l}):await Ce(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token})})}catch(r){if(ve(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(t){try{return await this._useSession(async r=>{var s,i;const{data:l,error:c}=r;if(c)return this._returnResult({data:null,error:c});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 Ce(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"&&(!((i=h==null?void 0:h.totp)===null||i===void 0)&&i.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(ve(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:i,error:l}=r;if(l)return this._returnResult({data:null,error:l});const c=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?gw(t.webauthn.credential_response):vw(t.webauthn.credential_response)})}:{code:t.code}),{data:d,error:h}=await Ce(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:c,headers:this.headers,jwt:(s=i==null?void 0:i.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(ve(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:i,error:l}=r;if(l)return this._returnResult({data:null,error:l});const c=await Ce(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});if(c.error)return c;const{data:d}=c;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:mw(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:pw(d.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(ve(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 i={all:[],phone:[],totp:[],webauthn:[]};for(const l of(t=r==null?void 0:r.factors)!==null&&t!==void 0?t:[])i.all.push(l),l.status==="verified"&&i[l.factor_type].push(l);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(t){var r,s,i,l;if(t)try{const{payload:w}=Ou(t);let E=null;w.aal&&(E=w.aal);let S=E;const{data:{user:N},error:C}=await this.getUser(t);if(C)return this._returnResult({data:null,error:C});((s=(r=N==null?void 0:N.factors)===null||r===void 0?void 0:r.filter(k=>k.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(S="aal2");const j=w.amr||[];return{data:{currentLevel:E,nextLevel:S,currentAuthenticationMethods:j},error:null}}catch(w){if(ve(w))return this._returnResult({data:null,error:w});throw w}const{data:{session:c},error:d}=await this.getSession();if(d)return this._returnResult({data:null,error:d});if(!c)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:h}=Ou(c.access_token);let m=null;h.aal&&(m=h.aal);let b=m;((l=(i=c.user.factors)===null||i===void 0?void 0:i.filter(w=>w.status==="verified"))!==null&&l!==void 0?l:[]).length>0&&(b="aal2");const x=h.amr||[];return{data:{currentLevel:m,nextLevel:b,currentAuthenticationMethods:x},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;return i?this._returnResult({data:null,error:i}):s?await Ce(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 tn})})}catch(r){if(ve(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(t,r){try{return await this._useSession(async s=>{const{data:{session:i},error:l}=s;if(l)return this._returnResult({data:null,error:l});if(!i)return this._returnResult({data:null,error:new tn});const c=await Ce(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:d=>({data:d,error:null})});return c.data&&c.data.redirect_url&&un()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(c.data.redirect_url),c})}catch(s){if(ve(s))return this._returnResult({data:null,error:s});throw s}}async _denyAuthorization(t,r){try{return await this._useSession(async s=>{const{data:{session:i},error:l}=s;if(l)return this._returnResult({data:null,error:l});if(!i)return this._returnResult({data:null,error:new tn});const c=await Ce(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:d=>({data:d,error:null})});return c.data&&c.data.redirect_url&&un()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(c.data.redirect_url),c})}catch(s){if(ve(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 Ce(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new tn})})}catch(t){if(ve(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:i}=r;return i?this._returnResult({data:null,error:i}):s?(await Ce(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 tn})})}catch(r){if(ve(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 i=Date.now();if(s=this.jwks.keys.find(d=>d.kid===t),s&&this.jwks_cached_at+MO>i)return s;const{data:l,error:c}=await Ce(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(c)throw c;return!l.keys||l.keys.length===0||(this.jwks=l,this.jwks_cached_at=i,s=l.keys.find(d=>d.kid===t),!s)?null:s}async getClaims(t,r={}){try{let s=t;if(!s){const{data:w,error:E}=await this.getSession();if(E||!w.session)return this._returnResult({data:null,error:E});s=w.session.access_token}const{header:i,payload:l,signature:c,raw:{header:d,payload:h}}=Ou(s);r!=null&&r.allowExpired||tM(l.exp);const m=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!m){const{error:w}=await this.getUser(s);if(w)throw w;return{data:{claims:l,header:i,signature:c},error:null}}const b=nM(i.alg),g=await crypto.subtle.importKey("jwk",m,b,!0,["verify"]);if(!await crypto.subtle.verify(b,g,c,HO(`${d}.${h}`)))throw new Ip("Invalid JWT signature");return{data:{claims:l,header:i,signature:c},error:null}}catch(s){if(ve(s))return this._returnResult({data:null,error:s});throw s}}async signInWithPasskey(t){var r,s,i;pr(this.experimental);try{if(!gd())return this._returnResult({data:null,error:new yr("Browser does not support WebAuthn",null)});const{data:l,error:c}=await this._startPasskeyAuthentication({options:{captchaToken:(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.captchaToken}});if(c||!l)return this._returnResult({data:null,error:c});const d=pw(l.options),h=(i=(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.signal)!==null&&i!==void 0?i:$p.createNewAbortSignal(),{data:m,error:b}=await kS({publicKey:d,signal:h});if(b||!m)return this._returnResult({data:null,error:b??new yr("WebAuthn ceremony failed",null)});const g=vw(m);return this._verifyPasskeyAuthentication({challengeId:l.challenge_id,credential:g})}catch(l){if(ve(l))return this._returnResult({data:null,error:l});throw l}}async registerPasskey(t){var r,s;pr(this.experimental);try{if(!gd())return this._returnResult({data:null,error:new yr("Browser does not support WebAuthn",null)});const{data:i,error:l}=await this._startPasskeyRegistration();if(l||!i)return this._returnResult({data:null,error:l});const c=mw(i.options),d=(s=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.signal)!==null&&s!==void 0?s:$p.createNewAbortSignal(),{data:h,error:m}=await RS({publicKey:c,signal:d});if(m||!h)return this._returnResult({data:null,error:m??new yr("WebAuthn ceremony failed",null)});const b=gw(h);return this._verifyPasskeyRegistration({challengeId:i.challenge_id,credential:b})}catch(i){if(ve(i))return this._returnResult({data:null,error:i});throw i}}async _startPasskeyRegistration(){pr(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 tn});const{data:i,error:l}=await Ce(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:i,error:null})})}catch(t){if(ve(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){pr(this.experimental);try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new tn});const{data:l,error:c}=await Ce(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:s.access_token,body:{challenge_id:t.challengeId,credential:t.credential}});return c?this._returnResult({data:null,error:c}):this._returnResult({data:l,error:null})})}catch(r){if(ve(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(t){var r;pr(this.experimental);try{const{data:s,error:i}=await Ce(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 i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})}catch(s){if(ve(s))return this._returnResult({data:null,error:s});throw s}}async _verifyPasskeyAuthentication(t){pr(this.experimental);try{const{data:r,error:s}=await Ce(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:t.challengeId,credential:t.credential},xform:ir});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(ve(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){pr(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 tn});const{data:i,error:l}=await Ce(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:r.access_token,xform:c=>({data:c,error:null})});return l?this._returnResult({data:null,error:l}):this._returnResult({data:i,error:null})})}catch(t){if(ve(t))return this._returnResult({data:null,error:t});throw t}}async _updatePasskey(t){pr(this.experimental);try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new tn});const{data:l,error:c}=await Ce(this.fetch,"PATCH",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:s.access_token,body:{friendly_name:t.friendlyName}});return c?this._returnResult({data:null,error:c}):this._returnResult({data:l,error:null})})}catch(r){if(ve(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(t){pr(this.experimental);try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new tn});const{error:l}=await Ce(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(ve(r))return this._returnResult({data:null,error:r});throw r}}}Il.nextInstanceID={};const NM=Il,TM="2.106.2";let wl="";typeof Deno<"u"?wl="deno":typeof document<"u"?wl="web":typeof navigator<"u"&&navigator.product==="ReactNative"?wl="react-native":wl="node";const jM={"X-Client-Info":`supabase-js-${wl}/${TM}`},AM={headers:jM},RM={schema:"public"},kM={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},OM={},MM={enabled:!1,respectSamplingDecision:!0};function DM(e,t,r,s){function i(l){return l instanceof r?l:new r(function(c){c(l)})}return new(r||(r=Promise))(function(l,c){function d(b){try{m(s.next(b))}catch(g){c(g)}}function h(b){try{m(s.throw(b))}catch(g){c(g)}}function m(b){b.done?l(b.value):i(b.value).then(d,h)}m((s=s.apply(e,[])).next())})}let Wm=null;const PM="@opentelemetry/api";function LM(){return Wm===null&&(Wm=import(PM).catch(()=>null)),Wm}function zM(){return DM(this,void 0,void 0,function*(){try{const e=yield LM();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 IM(e){if(!e||typeof e!="string")return null;const t=e.split("-");if(t.length!==4)return null;const[r,s,i,l]=t;if(r.length!==2||s.length!==32||i.length!==16||l.length!==2)return null;const c=/^[0-9a-f]+$/i;return!c.test(r)||!c.test(s)||!c.test(i)||!c.test(l)||s==="00000000000000000000000000000000"||i==="0000000000000000"?null:{version:r,traceId:s,parentId:i,traceFlags:l,isSampled:(parseInt(l,16)&1)===1}}function $M(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(UM(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 UM(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 BM(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 $l(e){"@babel/helpers - typeof";return $l=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},$l(e)}function HM(e,t){if($l(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if($l(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function qM(e){var t=HM(e,"string");return $l(t)=="symbol"?t:t+""}function VM(e,t,r){return(t=qM(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function Lt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bw(Object(r),!0).forEach(function(s){VM(e,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bw(Object(r)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(r,s))})}return e}const GM=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),FM=()=>Headers,KM=(e,t,r,s,i)=>{const l=GM(s),c=FM(),d=(i==null?void 0:i.enabled)===!0,h=(i==null?void 0:i.respectSamplingDecision)!==!1,m=d?BM(t):null;return async(b,g)=>{var x;const w=(x=await r())!==null&&x!==void 0?x:e;let E=new c(g==null?void 0:g.headers);if(E.has("apikey")||E.set("apikey",e),E.has("Authorization")||E.set("Authorization",`Bearer ${w}`),m){const S=await WM(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,Lt(Lt({},g),{},{headers:E}))}};async function WM(e,t,r){if(!$M(typeof e=="string"||e instanceof URL?e:e.url,t))return null;const s=await zM();if(!s||!s.traceparent)return null;if(r){const i=IM(s.traceparent);if(i&&!i.isSampled)return null}return s}function xw(e){return typeof e=="boolean"?{enabled:e}:e}function YM(e){return e.endsWith("/")?e:e+"/"}function XM(e,t){var r,s,i,l,c,d;const{db:h,auth:m,realtime:b,global:g}=e,{db:x,auth:w,realtime:E,global:S}=t,N=xw(e.tracePropagation),C=xw(t.tracePropagation),A={db:Lt(Lt({},x),h),auth:Lt(Lt({},w),m),realtime:Lt(Lt({},E),b),storage:{},global:Lt(Lt(Lt({},S),g),{},{headers:Lt(Lt({},(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:(i=(l=N==null?void 0:N.enabled)!==null&&l!==void 0?l:C==null?void 0:C.enabled)!==null&&i!==void 0?i:!1,respectSamplingDecision:(c=(d=N==null?void 0:N.respectSamplingDecision)!==null&&d!==void 0?d:C==null?void 0:C.respectSamplingDecision)!==null&&c!==void 0?c:!0},accessToken:async()=>""};return e.accessToken?A.accessToken=e.accessToken:delete A.accessToken,A}function JM(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(YM(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var QM=class extends NM{constructor(e){super(e)}},ZM=class{constructor(e,t,r){var s,i;this.supabaseUrl=e,this.supabaseKey=t;const l=JM(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 c=`sb-${l.hostname.split(".")[0]}-auth-token`,d={db:RM,realtime:OM,auth:Lt(Lt({},kM),{},{storageKey:c}),global:AM,tracePropagation:MM},h=XM(r??{},d);if(this.settings=h,this.storageKey=(s=h.auth.storageKey)!==null&&s!==void 0?s:"",this.headers=(i=h.global.headers)!==null&&i!==void 0?i:{},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=KM(t,e,this._getAccessToken.bind(this),h.global.fetch,h.tracePropagation),this.realtime=this._initRealtimeClient(Lt({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 p2(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 jO(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),h.accessToken||this._listenForAuthEvents()}get functions(){return new s2(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:i,storageKey:l,flowType:c,lock:d,debug:h,throwOnError:m,experimental:b,lockAcquireTimeout:g,skipAutoInitialize:x},w,E){const S={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new QM({url:this.authUrl.href,headers:Lt(Lt({},S),w),storageKey:l,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:s,userStorage:i,flowType:c,lock:d,debug:h,throwOnError:m,experimental:b,fetch:E,lockAcquireTimeout:g,skipAutoInitialize:x,hasCustomAuthorizationHeader:Object.keys(this.headers).some(N=>N.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new J2(this.realtimeUrl.href,Lt(Lt({},e),{},{params:Lt(Lt({},{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 eD=(e,t,r)=>new ZM(e,t,r);function tD(){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}tD()&&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 nD={BASE_URL:"/tablero-cdc/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_SUPABASE_ANON_KEY:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE",VITE_SUPABASE_URL:"https://dbit.digitalcompass.agency",VITE_WEBHOOK_URL:"https://agenteit.digitalcompass.agency/webhook/tablero-cdc-sync-proyecto"},rD=["VITE_SUPABASE_URL","VITE_SUPABASE_ANON_KEY"],ww=rD.filter(e=>!nD[e]);if(ww.length>0)throw new Error(`Faltan variables de entorno de Supabase. Revisa tu archivo .env.
Variables faltantes: ${ww.join(", ")}`);const Te=eD("https://dbit.digitalcompass.agency","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE",{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}});function OS(e){return String(e??"").trim().toLowerCase()}function _w(e){return!(e!=null&&e.email)||e.is_active!==!0?null:{email:OS(e.email),fullName:e.full_name??null,role:String(e.role||"user").trim()||"user",isActive:!0,canDeleteProjects:e.can_delete_projects===!0,canManageInternalPricing:e.can_manage_internal_pricing===!0,canControlPricingSummary:e.can_control_pricing_summary===!0,canManageTariffCatalog:e.can_manage_tariff_catalog===!0}}async function MS(e){const t=OS(e);if(!t)return null;const r=await Te.from("tablero_cdc_allowed_users").select("email, full_name, role, is_active, can_delete_projects, can_manage_internal_pricing, can_control_pricing_summary, can_manage_tariff_catalog").eq("email",t).eq("is_active",!0).maybeSingle();if(!r.error)return _w(r.data);const s=r.error.message||"";if(!(s.includes("can_manage_tariff_catalog")||s.includes("column")||s.includes("schema cache")))throw r.error;const l=await Te.from("tablero_cdc_allowed_users").select("email, full_name, role, is_active, can_delete_projects, can_manage_internal_pricing, can_control_pricing_summary").eq("email",t).eq("is_active",!0).maybeSingle();if(l.error)throw l.error;return _w(l.data)}async function Ag(){const{data:e,error:t}=await Te.auth.getUser();if(t||!e.user)throw new Error("No hay una sesión activa de Supabase.");const r=await MS(e.user.email);if(!r)throw new Error("Tu correo no está autorizado para acceder al Tablero CDC.");return r}function aD(){return typeof window>"u"?"/tablero-cdc/":new URL("/tablero-cdc/",window.location.origin).toString()}function sD(e){var i;const t=e.user_metadata||{},r=t.full_name||t.name||t.display_name||((i=e.email)==null?void 0:i.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 DS=v.createContext(null);function iD({children:e}){const[t,r]=v.useState(null),[s,i]=v.useState(null),[l,c]=v.useState(!0),[d,h]=v.useState(null),m=v.useCallback(async C=>{if(!C){r(null),i(null);return}let A=null;try{A=await MS(C.email)}catch(j){console.error("Error al validar acceso al Tablero CDC:",j),await Te.auth.signOut(),r(null),i(null),h("No se pudo validar tu acceso al Tablero CDC. Verifica que el SQL de accesos esté ejecutado o contacta a IT.");return}if(!A){await Te.auth.signOut(),r(null),i(null),h("Tu correo no está autorizado para acceder al Tablero CDC. Solicita acceso a IT o al equipo CDC.");return}r(sD(C)),i(A),h(null)},[]);v.useEffect(()=>{let C=!0;Te.auth.getSession().then(async({data:j,error:k})=>{var I;if(C){if(k){console.error("Error al recuperar sesión de Supabase:",k),r(null),h("No se pudo recuperar la sesión. Intenta iniciar sesión de nuevo.");return}await m(((I=j.session)==null?void 0:I.user)??null)}}).catch(j=>{C&&(console.error("Error inesperado al recuperar sesión:",j),r(null),h("No se pudo recuperar la sesión. Intenta iniciar sesión de nuevo."))}).finally(()=>{C&&c(!1)});const{data:A}=Te.auth.onAuthStateChange((j,k)=>{c(!0),m((k==null?void 0:k.user)??null).finally(()=>{C&&c(!1)})});return()=>{C=!1,A.subscription.unsubscribe()}},[m]);const b=v.useCallback(async()=>{h(null);const{error:C}=await Te.auth.signInWithOAuth({provider:"google",options:{redirectTo:aD(),queryParams:{prompt:"select_account"}}});C&&(console.error("Error al iniciar sesión con Google:",C),h("No se pudo iniciar sesión. Intenta de nuevo."))},[]),g=v.useCallback(async()=>{const{error:C}=await Te.auth.signOut();if(C){console.error("Error al cerrar sesión:",C),h("No se pudo cerrar sesión. Intenta de nuevo.");return}r(null),i(null),h(null)},[]),x=v.useMemo(()=>(s==null?void 0:s.role)==="director_creativo",[s==null?void 0:s.role]),w=v.useMemo(()=>(s==null?void 0:s.canManageInternalPricing)===!0,[s==null?void 0:s.canManageInternalPricing]),E=v.useMemo(()=>(s==null?void 0:s.canDeleteProjects)===!0,[s==null?void 0:s.canDeleteProjects]),S=v.useMemo(()=>(s==null?void 0:s.canControlPricingSummary)===!0,[s==null?void 0:s.canControlPricingSummary]),N=v.useMemo(()=>(s==null?void 0:s.canManageTariffCatalog)===!0,[s==null?void 0:s.canManageTariffCatalog]);return f.jsx(DS.Provider,{value:{user:t,loading:l,error:d,isGerardo:x,canDeleteProjects:E,canManageInternalPricing:w,canControlPricingSummary:S,canManageTariffCatalog:N,loginWithGoogle:b,logout:g},children:e})}function Vd(){const e=v.useContext(DS);if(!e)throw new Error("useAuth debe usarse dentro de <AuthProvider>");return e}function Sw(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function wn(...e){return t=>{let r=!1;const s=e.map(i=>{const l=Sw(i,t);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let i=0;i<s.length;i++){const l=s[i];typeof l=="function"?l():Sw(e[i],null)}}}}function Je(...e){return v.useCallback(wn(...e),e)}var oD=Symbol.for("react.lazy"),yd=yg[" use ".trim().toString()];function lD(e){return typeof e=="object"&&e!==null&&"then"in e}function PS(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===oD&&"_payload"in e&&lD(e._payload)}function Gd(e){const t=uD(e),r=v.forwardRef((s,i)=>{let{children:l,...c}=s;PS(l)&&typeof yd=="function"&&(l=yd(l._payload));const d=v.Children.toArray(l),h=d.find(fD);if(h){const m=h.props.children,b=d.map(g=>g===h?v.Children.count(m)>1?v.Children.only(null):v.isValidElement(m)?m.props.children:null:g);return f.jsx(t,{...c,ref:i,children:v.isValidElement(m)?v.cloneElement(m,void 0,b):null})}return f.jsx(t,{...c,ref:i,children:l})});return r.displayName=`${e}.Slot`,r}var cD=Gd("Slot");function uD(e){const t=v.forwardRef((r,s)=>{let{children:i,...l}=r;if(PS(i)&&typeof yd=="function"&&(i=yd(i._payload)),v.isValidElement(i)){const c=mD(i),d=hD(l,i.props);return i.type!==v.Fragment&&(d.ref=s?wn(s,c):c),v.cloneElement(i,d)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var dD=Symbol("radix.slottable");function fD(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===dD}function hD(e,t){const r={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?r[s]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(r[s]=i):s==="style"?r[s]={...i,...l}:s==="className"&&(r[s]=[i,l].filter(Boolean).join(" "))}return{...e,...r}}function mD(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function LS(e){var t,r,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=LS(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function zS(){for(var e,t,r=0,s="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=LS(e))&&(s&&(s+=" "),s+=t);return s}const Ew=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Cw=zS,Rg=(e,t)=>r=>{var s;if((t==null?void 0:t.variants)==null)return Cw(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:i,defaultVariants:l}=t,c=Object.keys(i).map(m=>{const b=r==null?void 0:r[m],g=l==null?void 0:l[m];if(b===null)return null;const x=Ew(b)||Ew(g);return i[m][x]}),d=r&&Object.entries(r).reduce((m,b)=>{let[g,x]=b;return x===void 0||(m[g]=x),m},{}),h=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((m,b)=>{let{class:g,className:x,...w}=b;return Object.entries(w).every(E=>{let[S,N]=E;return Array.isArray(N)?N.includes({...l,...d}[S]):{...l,...d}[S]===N})?[...m,g,x]:m},[]);return Cw(e,c,h,r==null?void 0:r.class,r==null?void 0:r.className)},pD=(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},gD=(e,t)=>({classGroupId:e,validator:t}),IS=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),bd="-",Nw=[],vD="arbitrary..",yD=e=>{const t=xD(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return bD(c);const d=c.split(bd),h=d[0]===""&&d.length>1?1:0;return $S(d,h,t)},getConflictingClassGroupIds:(c,d)=>{if(d){const h=s[c],m=r[c];return h?m?pD(m,h):h:m||Nw}return r[c]||Nw}}},$S=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const i=e[t],l=r.nextPart.get(i);if(l){const m=$S(e,t+1,l);if(m)return m}const c=r.validators;if(c===null)return;const d=t===0?e.join(bd):e.slice(t).join(bd),h=c.length;for(let m=0;m<h;m++){const b=c[m];if(b.validator(d))return b.classGroupId}},bD=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?vD+s:void 0})(),xD=e=>{const{theme:t,classGroups:r}=e;return wD(r,t)},wD=(e,t)=>{const r=IS();for(const s in e){const i=e[s];kg(i,r,s,t)}return r},kg=(e,t,r,s)=>{const i=e.length;for(let l=0;l<i;l++){const c=e[l];_D(c,t,r,s)}},_D=(e,t,r,s)=>{if(typeof e=="string"){SD(e,t,r);return}if(typeof e=="function"){ED(e,t,r,s);return}CD(e,t,r,s)},SD=(e,t,r)=>{const s=e===""?t:US(t,e);s.classGroupId=r},ED=(e,t,r,s)=>{if(ND(e)){kg(e(s),t,r,s);return}t.validators===null&&(t.validators=[]),t.validators.push(gD(r,e))},CD=(e,t,r,s)=>{const i=Object.entries(e),l=i.length;for(let c=0;c<l;c++){const[d,h]=i[c];kg(h,US(t,d),r,s)}},US=(e,t)=>{let r=e;const s=t.split(bd),i=s.length;for(let l=0;l<i;l++){const c=s[l];let d=r.nextPart.get(c);d||(d=IS(),r.nextPart.set(c,d)),r=d}return r},ND=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,TD=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),s=Object.create(null);const i=(l,c)=>{r[l]=c,t++,t>e&&(t=0,s=r,r=Object.create(null))};return{get(l){let c=r[l];if(c!==void 0)return c;if((c=s[l])!==void 0)return i(l,c),c},set(l,c){l in r?r[l]=c:i(l,c)}}},Up="!",Tw=":",jD=[],jw=(e,t,r,s,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:s,isExternal:i}),AD=e=>{const{prefix:t,experimentalParseClassName:r}=e;let s=i=>{const l=[];let c=0,d=0,h=0,m;const b=i.length;for(let S=0;S<b;S++){const N=i[S];if(c===0&&d===0){if(N===Tw){l.push(i.slice(h,S)),h=S+1;continue}if(N==="/"){m=S;continue}}N==="["?c++:N==="]"?c--:N==="("?d++:N===")"&&d--}const g=l.length===0?i:i.slice(h);let x=g,w=!1;g.endsWith(Up)?(x=g.slice(0,-1),w=!0):g.startsWith(Up)&&(x=g.slice(1),w=!0);const E=m&&m>h?m-h:void 0;return jw(l,w,x,E)};if(t){const i=t+Tw,l=s;s=c=>c.startsWith(i)?l(c.slice(i.length)):jw(jD,!1,c,void 0,!0)}if(r){const i=s;s=l=>r({className:l,parseClassName:i})}return s},RD=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,s)=>{t.set(r,1e6+s)}),r=>{const s=[];let i=[];for(let l=0;l<r.length;l++){const c=r[l],d=c[0]==="[",h=t.has(c);d||h?(i.length>0&&(i.sort(),s.push(...i),i=[]),s.push(c)):i.push(c)}return i.length>0&&(i.sort(),s.push(...i)),s}},kD=e=>({cache:TD(e.cacheSize),parseClassName:AD(e),sortModifiers:RD(e),postfixLookupClassGroupIds:OD(e),...yD(e)}),OD=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},MD=/\s+/,DD=(e,t)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:i,sortModifiers:l,postfixLookupClassGroupIds:c}=t,d=[],h=e.trim().split(MD);let m="";for(let b=h.length-1;b>=0;b-=1){const g=h[b],{isExternal:x,modifiers:w,hasImportantModifier:E,baseClassName:S,maybePostfixModifierPosition:N}=r(g);if(x){m=g+(m.length>0?" "+m:m);continue}let C=!!N,A;if(C){const P=S.substring(0,N);A=s(P);const H=A&&c[A]?s(S):void 0;H&&H!==A&&(A=H,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 j=w.length===0?"":w.length===1?w[0]:l(w).join(":"),k=E?j+Up:j,I=k+A;if(d.indexOf(I)>-1)continue;d.push(I);const z=i(A,C);for(let P=0;P<z.length;++P){const H=z[P];d.push(k+H)}m=g+(m.length>0?" "+m:m)}return m},PD=(...e)=>{let t=0,r,s,i="";for(;t<e.length;)(r=e[t++])&&(s=BS(r))&&(i&&(i+=" "),i+=s);return i},BS=e=>{if(typeof e=="string")return e;let t,r="";for(let s=0;s<e.length;s++)e[s]&&(t=BS(e[s]))&&(r&&(r+=" "),r+=t);return r},LD=(e,...t)=>{let r,s,i,l;const c=h=>{const m=t.reduce((b,g)=>g(b),e());return r=kD(m),s=r.cache.get,i=r.cache.set,l=d,d(h)},d=h=>{const m=s(h);if(m)return m;const b=DD(h,r);return i(h,b),b};return l=c,(...h)=>l(PD(...h))},zD=[],Xt=e=>{const t=r=>r[e]||zD;return t.isThemeGetter=!0,t},HS=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,qS=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ID=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,$D=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,UD=/\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$/,BD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,HD=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ka=e=>ID.test(e),Xe=e=>!!e&&!Number.isNaN(Number(e)),Rr=e=>!!e&&Number.isInteger(Number(e)),Ym=e=>e.endsWith("%")&&Xe(e.slice(0,-1)),ia=e=>$D.test(e),VS=()=>!0,VD=e=>UD.test(e)&&!BD.test(e),Og=()=>!1,GD=e=>HD.test(e),FD=e=>qD.test(e),KD=e=>!we(e)&&!_e(e),WD=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)),YD=e=>is(e,KS,Og),we=e=>HS.test(e),Rs=e=>is(e,WS,VD),Aw=e=>is(e,r5,Xe),XD=e=>is(e,XS,VS),JD=e=>is(e,YS,Og),Rw=e=>is(e,GS,Og),QD=e=>is(e,FS,FD),Mu=e=>is(e,JS,GD),_e=e=>qS.test(e),gl=e=>Fs(e,WS),ZD=e=>Fs(e,YS),kw=e=>Fs(e,GS),e5=e=>Fs(e,KS),t5=e=>Fs(e,FS),Du=e=>Fs(e,JS,!0),n5=e=>Fs(e,XS,!0),is=(e,t,r)=>{const s=HS.exec(e);return s?s[1]?t(s[1]):r(s[2]):!1},Fs=(e,t,r=!1)=>{const s=qS.exec(e);return s?s[1]?t(s[1]):r:!1},GS=e=>e==="position"||e==="percentage",FS=e=>e==="image"||e==="url",KS=e=>e==="length"||e==="size"||e==="bg-size",WS=e=>e==="length",r5=e=>e==="number",YS=e=>e==="family-name",XS=e=>e==="number"||e==="weight",JS=e=>e==="shadow",a5=()=>{const e=Xt("color"),t=Xt("font"),r=Xt("text"),s=Xt("font-weight"),i=Xt("tracking"),l=Xt("leading"),c=Xt("breakpoint"),d=Xt("container"),h=Xt("spacing"),m=Xt("radius"),b=Xt("shadow"),g=Xt("inset-shadow"),x=Xt("text-shadow"),w=Xt("drop-shadow"),E=Xt("blur"),S=Xt("perspective"),N=Xt("aspect"),C=Xt("ease"),A=Xt("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],I=()=>[...k(),_e,we],z=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],H=()=>[_e,we,h],Z=()=>[Ka,"full","auto",...H()],de=()=>[Rr,"none","subgrid",_e,we],ue=()=>["auto",{span:["full",Rr,_e,we]},Rr,_e,we],me=()=>[Rr,"auto",_e,we],fe=()=>["auto","min","max","fr",_e,we],pe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ge=()=>["start","end","center","stretch","center-safe","end-safe"],R=()=>["auto",...H()],q=()=>[Ka,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...H()],K=()=>[Ka,"screen","full","dvw","lvw","svw","min","max","fit",...H()],X=()=>[Ka,"screen","full","lh","dvh","lvh","svh","min","max","fit",...H()],G=()=>[e,_e,we],O=()=>[...k(),kw,Rw,{position:[_e,we]}],M=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",e5,YD,{size:[_e,we]}],Y=()=>[Ym,gl,Rs],B=()=>["","none","full",m,_e,we],ne=()=>["",Xe,gl,Rs],ee=()=>["solid","dashed","dotted","double"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[Xe,Ym,kw,Rw],se=()=>["","none",E,_e,we],Ee=()=>["none",Xe,_e,we],je=()=>["none",Xe,_e,we],nt=()=>[Xe,_e,we],Qe=()=>[Ka,"full",...H()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ia],breakpoint:[ia],color:[VS],container:[ia],"drop-shadow":[ia],ease:["in","out","in-out"],font:[KD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ia],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ia],shadow:[ia],spacing:["px",Xe],text:[ia],"text-shadow":[ia],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ka,we,_e,N]}],container:["container"],"container-type":[{"@container":["","normal","size",_e,we]}],"container-named":[WD],columns:[{columns:[Xe,we,_e,d]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"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:I()}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Z()}],"inset-x":[{"inset-x":Z()}],"inset-y":[{"inset-y":Z()}],start:[{"inset-s":Z(),start:Z()}],end:[{"inset-e":Z(),end:Z()}],"inset-bs":[{"inset-bs":Z()}],"inset-be":[{"inset-be":Z()}],top:[{top:Z()}],right:[{right:Z()}],bottom:[{bottom:Z()}],left:[{left:Z()}],visibility:["visible","invisible","collapse"],z:[{z:[Rr,"auto",_e,we]}],basis:[{basis:[Ka,"full","auto",d,...H()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Xe,Ka,"auto","initial","none",we]}],grow:[{grow:["",Xe,_e,we]}],shrink:[{shrink:["",Xe,_e,we]}],order:[{order:[Rr,"first","last","none",_e,we]}],"grid-cols":[{"grid-cols":de()}],"col-start-end":[{col:ue()}],"col-start":[{"col-start":me()}],"col-end":[{"col-end":me()}],"grid-rows":[{"grid-rows":de()}],"row-start-end":[{row:ue()}],"row-start":[{"row-start":me()}],"row-end":[{"row-end":me()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":fe()}],"auto-rows":[{"auto-rows":fe()}],gap:[{gap:H()}],"gap-x":[{"gap-x":H()}],"gap-y":[{"gap-y":H()}],"justify-content":[{justify:[...pe(),"normal"]}],"justify-items":[{"justify-items":[...ge(),"normal"]}],"justify-self":[{"justify-self":["auto",...ge()]}],"align-content":[{content:["normal",...pe()]}],"align-items":[{items:[...ge(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ge(),{baseline:["","last"]}]}],"place-content":[{"place-content":pe()}],"place-items":[{"place-items":[...ge(),"baseline"]}],"place-self":[{"place-self":["auto",...ge()]}],p:[{p:H()}],px:[{px:H()}],py:[{py:H()}],ps:[{ps:H()}],pe:[{pe:H()}],pbs:[{pbs:H()}],pbe:[{pbe:H()}],pt:[{pt:H()}],pr:[{pr:H()}],pb:[{pb:H()}],pl:[{pl:H()}],m:[{m:R()}],mx:[{mx:R()}],my:[{my:R()}],ms:[{ms:R()}],me:[{me:R()}],mbs:[{mbs:R()}],mbe:[{mbe:R()}],mt:[{mt:R()}],mr:[{mr:R()}],mb:[{mb:R()}],ml:[{ml:R()}],"space-x":[{"space-x":H()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":H()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],"inline-size":[{inline:["auto",...K()]}],"min-inline-size":[{"min-inline":["auto",...K()]}],"max-inline-size":[{"max-inline":["none",...K()]}],"block-size":[{block:["auto",...X()]}],"min-block-size":[{"min-block":["auto",...X()]}],"max-block-size":[{"max-block":["none",...X()]}],w:[{w:[d,"screen",...q()]}],"min-w":[{"min-w":[d,"screen","none",...q()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[c]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh",...q()]}],"font-size":[{text:["base",r,gl,Rs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,n5,XD]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ym,we]}],"font-family":[{font:[ZD,JD,t]}],"font-features":[{"font-features":[we]}],"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:[i,_e,we]}],"line-clamp":[{"line-clamp":[Xe,"none",_e,Aw]}],leading:[{leading:[l,...H()]}],"list-image":[{"list-image":["none",_e,we]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",_e,we]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:G()}],"text-color":[{text:G()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[Xe,"from-font","auto",_e,Rs]}],"text-decoration-color":[{decoration:G()}],"underline-offset":[{"underline-offset":[Xe,"auto",_e,we]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"tab-size":[{tab:[Rr,_e,we]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",_e,we]}],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",_e,we]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:O()}],"bg-repeat":[{bg:M()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Rr,_e,we],radial:["",_e,we],conic:[Rr,_e,we]},t5,QD]}],"bg-color":[{bg:G()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:G()}],"gradient-via":[{via:G()}],"gradient-to":[{to:G()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:ne()}],"border-w-x":[{"border-x":ne()}],"border-w-y":[{"border-y":ne()}],"border-w-s":[{"border-s":ne()}],"border-w-e":[{"border-e":ne()}],"border-w-bs":[{"border-bs":ne()}],"border-w-be":[{"border-be":ne()}],"border-w-t":[{"border-t":ne()}],"border-w-r":[{"border-r":ne()}],"border-w-b":[{"border-b":ne()}],"border-w-l":[{"border-l":ne()}],"divide-x":[{"divide-x":ne()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ne()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:G()}],"border-color-x":[{"border-x":G()}],"border-color-y":[{"border-y":G()}],"border-color-s":[{"border-s":G()}],"border-color-e":[{"border-e":G()}],"border-color-bs":[{"border-bs":G()}],"border-color-be":[{"border-be":G()}],"border-color-t":[{"border-t":G()}],"border-color-r":[{"border-r":G()}],"border-color-b":[{"border-b":G()}],"border-color-l":[{"border-l":G()}],"divide-color":[{divide:G()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Xe,_e,we]}],"outline-w":[{outline:["",Xe,gl,Rs]}],"outline-color":[{outline:G()}],shadow:[{shadow:["","none",b,Du,Mu]}],"shadow-color":[{shadow:G()}],"inset-shadow":[{"inset-shadow":["none",g,Du,Mu]}],"inset-shadow-color":[{"inset-shadow":G()}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:G()}],"ring-offset-w":[{"ring-offset":[Xe,Rs]}],"ring-offset-color":[{"ring-offset":G()}],"inset-ring-w":[{"inset-ring":ne()}],"inset-ring-color":[{"inset-ring":G()}],"text-shadow":[{"text-shadow":["none",x,Du,Mu]}],"text-shadow-color":[{"text-shadow":G()}],opacity:[{opacity:[Xe,_e,we]}],"mix-blend":[{"mix-blend":[...Q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Q()}],"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":[Xe]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":G()}],"mask-image-linear-to-color":[{"mask-linear-to":G()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":G()}],"mask-image-t-to-color":[{"mask-t-to":G()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":G()}],"mask-image-r-to-color":[{"mask-r-to":G()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":G()}],"mask-image-b-to-color":[{"mask-b-to":G()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":G()}],"mask-image-l-to-color":[{"mask-l-to":G()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":G()}],"mask-image-x-to-color":[{"mask-x-to":G()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":G()}],"mask-image-y-to-color":[{"mask-y-to":G()}],"mask-image-radial":[{"mask-radial":[_e,we]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":G()}],"mask-image-radial-to-color":[{"mask-radial-to":G()}],"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":k()}],"mask-image-conic-pos":[{"mask-conic":[Xe]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":G()}],"mask-image-conic-to-color":[{"mask-conic-to":G()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:O()}],"mask-repeat":[{mask:M()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",_e,we]}],filter:[{filter:["","none",_e,we]}],blur:[{blur:se()}],brightness:[{brightness:[Xe,_e,we]}],contrast:[{contrast:[Xe,_e,we]}],"drop-shadow":[{"drop-shadow":["","none",w,Du,Mu]}],"drop-shadow-color":[{"drop-shadow":G()}],grayscale:[{grayscale:["",Xe,_e,we]}],"hue-rotate":[{"hue-rotate":[Xe,_e,we]}],invert:[{invert:["",Xe,_e,we]}],saturate:[{saturate:[Xe,_e,we]}],sepia:[{sepia:["",Xe,_e,we]}],"backdrop-filter":[{"backdrop-filter":["","none",_e,we]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[Xe,_e,we]}],"backdrop-contrast":[{"backdrop-contrast":[Xe,_e,we]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Xe,_e,we]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Xe,_e,we]}],"backdrop-invert":[{"backdrop-invert":["",Xe,_e,we]}],"backdrop-opacity":[{"backdrop-opacity":[Xe,_e,we]}],"backdrop-saturate":[{"backdrop-saturate":[Xe,_e,we]}],"backdrop-sepia":[{"backdrop-sepia":["",Xe,_e,we]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":H()}],"border-spacing-x":[{"border-spacing-x":H()}],"border-spacing-y":[{"border-spacing-y":H()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",_e,we]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Xe,"initial",_e,we]}],ease:[{ease:["linear","initial",C,_e,we]}],delay:[{delay:[Xe,_e,we]}],animate:[{animate:["none",A,_e,we]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,_e,we]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:Ee()}],"rotate-x":[{"rotate-x":Ee()}],"rotate-y":[{"rotate-y":Ee()}],"rotate-z":[{"rotate-z":Ee()}],scale:[{scale:je()}],"scale-x":[{"scale-x":je()}],"scale-y":[{"scale-y":je()}],"scale-z":[{"scale-z":je()}],"scale-3d":["scale-3d"],skew:[{skew:nt()}],"skew-x":[{"skew-x":nt()}],"skew-y":[{"skew-y":nt()}],transform:[{transform:[_e,we,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Qe()}],"translate-x":[{"translate-x":Qe()}],"translate-y":[{"translate-y":Qe()}],"translate-z":[{"translate-z":Qe()}],"translate-none":["translate-none"],zoom:[{zoom:[Rr,_e,we]}],accent:[{accent:G()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:G()}],"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",_e,we]}],"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":G()}],"scrollbar-track-color":[{"scrollbar-track":G()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mbs":[{"scroll-mbs":H()}],"scroll-mbe":[{"scroll-mbe":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pbs":[{"scroll-pbs":H()}],"scroll-pbe":[{"scroll-pbe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"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",_e,we]}],fill:[{fill:["none",...G()]}],"stroke-w":[{stroke:[Xe,gl,Rs,Aw]}],stroke:[{stroke:["none",...G()]}],"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"]}},s5=LD(a5);function xe(...e){return s5(zS(e))}const i5=Rg("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"}}),$e=v.forwardRef(({className:e,variant:t,size:r,asChild:s=!1,...i},l)=>{const c=s?cD:"button";return f.jsx(c,{className:xe(i5({variant:t,size:r,className:e})),ref:l,...i})});$e.displayName="Button";function Mg({size:e="sm",className:t}){const r=e==="lg"?"h-auto w-[168px]":"h-auto w-[104px]",s=e==="lg"?"-translate-x-1":"";return f.jsx("div",{className:xe("inline-flex items-center",t),"aria-label":"GLM",children:f.jsx("img",{src:"/tablero-cdc/glm-logo.png",alt:"GLM",className:xe(r,s),loading:"eager",decoding:"async"})})}function o5(){const{loginWithGoogle:e,error:t,loading:r}=Vd();return f.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:f.jsxs("div",{className:"w-full max-w-sm",children:[f.jsxs("div",{className:"flex flex-col items-center mb-8 gap-3",children:[f.jsx(Mg,{size:"lg"}),f.jsx("h1",{className:"text-2xl font-bold tracking-tight text-[#4F758B] text-center",children:"CDC Project Management"})]}),f.jsxs("div",{className:"bg-card border border-border rounded-2xl p-8 shadow-sm",children:[f.jsxs($e,{onClick:e,disabled:r,className:"w-full gap-2.5 h-10 rounded-full font-medium",children:[f.jsxs("svg",{"aria-hidden":"true",className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[f.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"}),f.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"}),f.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"}),f.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&&f.jsx("div",{className:"mt-4 rounded-lg bg-destructive/10 border border-destructive/20 px-4 py-3",children:f.jsx("p",{className:"text-sm text-destructive text-center leading-snug",children:t})})]}),f.jsx("p",{className:"text-center text-xs text-muted-foreground mt-6",children:"Acceso restringido a usuarios autorizados"})]})})}/**
* @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 QS=(...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 l5=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 c5=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 Ow=e=>{const t=c5(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 u5={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 d5=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 f5=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:i="",children:l,iconNode:c,...d},h)=>v.createElement("svg",{ref:h,...u5,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:QS("lucide",i),...!l&&!d5(d)&&{"aria-hidden":"true"},...d},[...c.map(([m,b])=>v.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 Ue=(e,t)=>{const r=v.forwardRef(({className:s,...i},l)=>v.createElement(f5,{ref:l,iconNode:t,className:QS(`lucide-${l5(Ow(e))}`,`lucide-${e}`,s),...i}));return r.displayName=Ow(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 h5=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]],Mw=Ue("archive-restore",h5);/**
* @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 m5=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]],ZS=Ue("badge-dollar-sign",m5);/**
* @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 p5=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],Dw=Ue("building-2",p5);/**
* @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 g5=[["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"}]],v5=Ue("calculator",g5);/**
* @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 y5=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],b5=Ue("calendar-clock",y5);/**
* @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 x5=[["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"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],w5=Ue("calendar-days",x5);/**
* @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 _5=[["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"}]],S5=Ue("calendar",_5);/**
* @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 E5=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ha=Ue("check",E5);/**
* @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 C5=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Dg=Ue("chevron-down",C5);/**
* @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 N5=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Pg=Ue("chevron-left",N5);/**
* @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 T5=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Fd=Ue("chevron-right",T5);/**
* @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 j5=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],A5=Ue("chevron-up",j5);/**
* @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 R5=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],e1=Ue("chevrons-up-down",R5);/**
* @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 k5=[["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"}]],xd=Ue("circle-alert",k5);/**
* @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 O5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],t1=Ue("circle-check",O5);/**
* @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 M5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]],Pw=Ue("circle-dollar-sign",M5);/**
* @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 D5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],P5=Ue("circle-x",D5);/**
* @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 L5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],z5=Ue("circle",L5);/**
* @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 I5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],jl=Ue("clock-3",I5);/**
* @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 $5=[["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"}]],Bp=Ue("dollar-sign",$5);/**
* @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 U5=[["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"}]],n1=Ue("external-link",U5);/**
* @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 B5=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],H5=Ue("eye-off",B5);/**
* @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 q5=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],V5=Ue("eye",q5);/**
* @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 G5=[["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"}]],F5=Ue("file-check-corner",G5);/**
* @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 K5=[["path",{d:"M11 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 8v5",key:"1jo35a"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m15 17 5 5",key:"36xl1x"}],["path",{d:"m20 17-5 5",key:"vdz27y"}]],W5=Ue("file-x-corner",K5);/**
* @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 Y5=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],X5=Ue("folder-open",Y5);/**
* @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 J5=[["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"}]],Q5=Ue("history",J5);/**
* @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 Z5=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],e3=Ue("inbox",Z5);/**
* @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 t3=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],n3=Ue("info",t3);/**
* @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 r3=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],a3=Ue("layers",r3);/**
* @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 s3=[["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"}]],i3=Ue("layout-grid",s3);/**
* @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 o3=[["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"}]],l3=Ue("link-2",o3);/**
* @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 c3=[["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"}]],u3=Ue("link",c3);/**
* @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 d3=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],Lw=Ue("list-checks",d3);/**
* @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 f3=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],gn=Ue("loader-circle",f3);/**
* @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 h3=[["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"}]],m3=Ue("lock",h3);/**
* @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 p3=[["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"}]],g3=Ue("log-out",p3);/**
* @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 v3=[["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"}]],wd=Ue("map-pin",v3);/**
* @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 y3=[["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"}]],b3=Ue("message-square-plus",y3);/**
* @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 x3=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],w3=Ue("pen-line",x3);/**
* @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 _3=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ua=Ue("plus",_3);/**
* @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 S3=[["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"}]],Lg=Ue("refresh-cw",S3);/**
* @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 E3=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ul=Ue("search",E3);/**
* @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 C3=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],N3=Ue("settings-2",C3);/**
* @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 T3=[["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"}]],j3=Ue("sliders-horizontal",T3);/**
* @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 A3=[["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"}]],_d=Ue("tag",A3);/**
* @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 R3=[["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"}]],zg=Ue("trash-2",R3);/**
* @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 k3=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],O3=Ue("user-round",k3);/**
* @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 M3=[["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"}]],r1=Ue("user",M3);/**
* @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 D3=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Bl=Ue("x",D3),ft=v.forwardRef(({className:e,type:t,...r},s)=>f.jsx("input",{type:t,className:xe("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}));ft.displayName="Input";function ye(e,t,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e==null||e(i),r===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function P3(e,t){const r=v.createContext(t),s=l=>{const{children:c,...d}=l,h=v.useMemo(()=>d,Object.values(d));return f.jsx(r.Provider,{value:h,children:c})};s.displayName=e+"Provider";function i(l){const c=v.useContext(r);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[s,i]}function cr(e,t=[]){let r=[];function s(l,c){const d=v.createContext(c),h=r.length;r=[...r,c];const m=g=>{var C;const{scope:x,children:w,...E}=g,S=((C=x==null?void 0:x[e])==null?void 0:C[h])||d,N=v.useMemo(()=>E,Object.values(E));return f.jsx(S.Provider,{value:N,children:w})};m.displayName=l+"Provider";function b(g,x){var S;const w=((S=x==null?void 0:x[e])==null?void 0:S[h])||d,E=v.useContext(w);if(E)return E;if(c!==void 0)return c;throw new Error(`\`${g}\` must be used within \`${l}\``)}return[m,b]}const i=()=>{const l=r.map(c=>v.createContext(c));return function(d){const h=(d==null?void 0:d[e])||l;return v.useMemo(()=>({[`__scope${e}`]:{...d,[e]:h}}),[d,h])}};return i.scopeName=e,[s,L3(i,...t)]}function L3(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(l){const c=s.reduce((d,{useScope:h,scopeName:m})=>{const g=h(l)[`__scope${m}`];return{...d,...g}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return r.scopeName=t.scopeName,r}var Ft=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},z3=yg[" useInsertionEffect ".trim().toString()]||Ft;function ma({prop:e,defaultProp:t,onChange:r=()=>{},caller:s}){const[i,l,c]=I3({defaultProp:t,onChange:r}),d=e!==void 0,h=d?e:i;{const b=v.useRef(e!==void 0);v.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=v.useCallback(b=>{var g;if(d){const x=$3(b)?b(e):b;x!==e&&((g=c.current)==null||g.call(c,x))}else l(b)},[d,e,l,c]);return[h,m]}function I3({defaultProp:e,onChange:t}){const[r,s]=v.useState(e),i=v.useRef(r),l=v.useRef(t);return z3(()=>{l.current=t},[t]),v.useEffect(()=>{var c;i.current!==r&&((c=l.current)==null||c.call(l,r),i.current=r)},[r,i]),[r,s,l]}function $3(e){return typeof e=="function"}function U3(e){const t=B3(e),r=v.forwardRef((s,i)=>{const{children:l,...c}=s,d=v.Children.toArray(l),h=d.find(q3);if(h){const m=h.props.children,b=d.map(g=>g===h?v.Children.count(m)>1?v.Children.only(null):v.isValidElement(m)?m.props.children:null:g);return f.jsx(t,{...c,ref:i,children:v.isValidElement(m)?v.cloneElement(m,void 0,b):null})}return f.jsx(t,{...c,ref:i,children:l})});return r.displayName=`${e}.Slot`,r}function B3(e){const t=v.forwardRef((r,s)=>{const{children:i,...l}=r;if(v.isValidElement(i)){const c=G3(i),d=V3(l,i.props);return i.type!==v.Fragment&&(d.ref=s?wn(s,c):c),v.cloneElement(i,d)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var H3=Symbol("radix.slottable");function q3(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===H3}function V3(e,t){const r={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?r[s]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(r[s]=i):s==="style"?r[s]={...i,...l}:s==="className"&&(r[s]=[i,l].filter(Boolean).join(" "))}return{...e,...r}}function G3(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var F3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ke=F3.reduce((e,t)=>{const r=U3(`Primitive.${t}`),s=v.forwardRef((i,l)=>{const{asChild:c,...d}=i,h=c?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(h,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function a1(e,t){e&&Ql.flushSync(()=>e.dispatchEvent(t))}function zw(e){const t=K3(e),r=v.forwardRef((s,i)=>{const{children:l,...c}=s,d=v.Children.toArray(l),h=d.find(Y3);if(h){const m=h.props.children,b=d.map(g=>g===h?v.Children.count(m)>1?v.Children.only(null):v.isValidElement(m)?m.props.children:null:g);return f.jsx(t,{...c,ref:i,children:v.isValidElement(m)?v.cloneElement(m,void 0,b):null})}return f.jsx(t,{...c,ref:i,children:l})});return r.displayName=`${e}.Slot`,r}function K3(e){const t=v.forwardRef((r,s)=>{const{children:i,...l}=r;if(v.isValidElement(i)){const c=J3(i),d=X3(l,i.props);return i.type!==v.Fragment&&(d.ref=s?wn(s,c):c),v.cloneElement(i,d)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var W3=Symbol("radix.slottable");function Y3(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===W3}function X3(e,t){const r={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?r[s]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(r[s]=i):s==="style"?r[s]={...i,...l}:s==="className"&&(r[s]=[i,l].filter(Boolean).join(" "))}return{...e,...r}}function J3(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Ig(e){const t=e+"CollectionProvider",[r,s]=cr(t),[i,l]=r(t,{collectionRef:{current:null},itemMap:new Map}),c=S=>{const{scope:N,children:C}=S,A=he.useRef(null),j=he.useRef(new Map).current;return f.jsx(i,{scope:N,itemMap:j,collectionRef:A,children:C})};c.displayName=t;const d=e+"CollectionSlot",h=zw(d),m=he.forwardRef((S,N)=>{const{scope:C,children:A}=S,j=l(d,C),k=Je(N,j.collectionRef);return f.jsx(h,{ref:k,children:A})});m.displayName=d;const b=e+"CollectionItemSlot",g="data-radix-collection-item",x=zw(b),w=he.forwardRef((S,N)=>{const{scope:C,children:A,...j}=S,k=he.useRef(null),I=Je(N,k),z=l(b,C);return he.useEffect(()=>(z.itemMap.set(k,{ref:k,...j}),()=>void z.itemMap.delete(k))),f.jsx(x,{[g]:"",ref:I,children:A})});w.displayName=b;function E(S){const N=l(e+"CollectionConsumer",S);return he.useCallback(()=>{const A=N.collectionRef.current;if(!A)return[];const j=Array.from(A.querySelectorAll(`[${g}]`));return Array.from(N.itemMap.values()).sort((z,P)=>j.indexOf(z.ref.current)-j.indexOf(P.ref.current))},[N.collectionRef,N.itemMap])}return[{Provider:c,Slot:m,ItemSlot:w},E,s]}var Q3=v.createContext(void 0);function ec(e){const t=v.useContext(Q3);return e||t||"ltr"}function nn(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...r)=>{var s;return(s=t.current)==null?void 0:s.call(t,...r)},[])}function Z3(e,t=globalThis==null?void 0:globalThis.document){const r=nn(e);v.useEffect(()=>{const s=i=>{i.key==="Escape"&&r(i)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[r,t])}var eP="DismissableLayer",Hp="dismissableLayer.update",tP="dismissableLayer.pointerDownOutside",nP="dismissableLayer.focusOutside",Iw,s1=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),tc=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:l,onInteractOutside:c,onDismiss:d,...h}=e,m=v.useContext(s1),[b,g]=v.useState(null),x=(b==null?void 0:b.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=v.useState({}),E=Je(t,P=>g(P)),S=Array.from(m.layers),[N]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),C=S.indexOf(N),A=b?S.indexOf(b):-1,j=m.layersWithOutsidePointerEventsDisabled.size>0,k=A>=C,I=sP(P=>{const H=P.target,Z=[...m.branches].some(de=>de.contains(H));!k||Z||(i==null||i(P),c==null||c(P),P.defaultPrevented||d==null||d())},x),z=iP(P=>{const H=P.target;[...m.branches].some(de=>de.contains(H))||(l==null||l(P),c==null||c(P),P.defaultPrevented||d==null||d())},x);return Z3(P=>{A===m.layers.size-1&&(s==null||s(P),!P.defaultPrevented&&d&&(P.preventDefault(),d()))},x),v.useEffect(()=>{if(b)return r&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(Iw=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(b)),m.layers.add(b),$w(),()=>{r&&m.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=Iw)}},[b,x,r,m]),v.useEffect(()=>()=>{b&&(m.layers.delete(b),m.layersWithOutsidePointerEventsDisabled.delete(b),$w())},[b,m]),v.useEffect(()=>{const P=()=>w({});return document.addEventListener(Hp,P),()=>document.removeEventListener(Hp,P)},[]),f.jsx(ke.div,{...h,ref:E,style:{pointerEvents:j?k?"auto":"none":void 0,...e.style},onFocusCapture:ye(e.onFocusCapture,z.onFocusCapture),onBlurCapture:ye(e.onBlurCapture,z.onBlurCapture),onPointerDownCapture:ye(e.onPointerDownCapture,I.onPointerDownCapture)})});tc.displayName=eP;var rP="DismissableLayerBranch",aP=v.forwardRef((e,t)=>{const r=v.useContext(s1),s=v.useRef(null),i=Je(t,s);return v.useEffect(()=>{const l=s.current;if(l)return r.branches.add(l),()=>{r.branches.delete(l)}},[r.branches]),f.jsx(ke.div,{...e,ref:i})});aP.displayName=rP;function sP(e,t=globalThis==null?void 0:globalThis.document){const r=nn(e),s=v.useRef(!1),i=v.useRef(()=>{});return v.useEffect(()=>{const l=d=>{if(d.target&&!s.current){let h=function(){i1(tP,r,m,{discrete:!0})};const m={originalEvent:d};d.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=h,t.addEventListener("click",i.current,{once:!0})):h()}else t.removeEventListener("click",i.current);s.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",l),t.removeEventListener("click",i.current)}},[t,r]),{onPointerDownCapture:()=>s.current=!0}}function iP(e,t=globalThis==null?void 0:globalThis.document){const r=nn(e),s=v.useRef(!1);return v.useEffect(()=>{const i=l=>{l.target&&!s.current&&i1(nP,r,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,r]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function $w(){const e=new CustomEvent(Hp);document.dispatchEvent(e)}function i1(e,t,r,{discrete:s}){const i=r.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),s?a1(i,l):i.dispatchEvent(l)}var Xm=0;function Kd(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Uw()),document.body.insertAdjacentElement("beforeend",e[1]??Uw()),Xm++,()=>{Xm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Xm--}},[])}function Uw(){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 Jm="focusScope.autoFocusOnMount",Qm="focusScope.autoFocusOnUnmount",Bw={bubbles:!1,cancelable:!0},oP="FocusScope",nc=v.forwardRef((e,t)=>{const{loop:r=!1,trapped:s=!1,onMountAutoFocus:i,onUnmountAutoFocus:l,...c}=e,[d,h]=v.useState(null),m=nn(i),b=nn(l),g=v.useRef(null),x=Je(t,S=>h(S)),w=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(s){let S=function(j){if(w.paused||!d)return;const k=j.target;d.contains(k)?g.current=k:Ya(g.current,{select:!0})},N=function(j){if(w.paused||!d)return;const k=j.relatedTarget;k!==null&&(d.contains(k)||Ya(g.current,{select:!0}))},C=function(j){if(document.activeElement===document.body)for(const I of j)I.removedNodes.length>0&&Ya(d)};document.addEventListener("focusin",S),document.addEventListener("focusout",N);const A=new MutationObserver(C);return d&&A.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",N),A.disconnect()}}},[s,d,w.paused]),v.useEffect(()=>{if(d){qw.add(w);const S=document.activeElement;if(!d.contains(S)){const C=new CustomEvent(Jm,Bw);d.addEventListener(Jm,m),d.dispatchEvent(C),C.defaultPrevented||(lP(hP(o1(d)),{select:!0}),document.activeElement===S&&Ya(d))}return()=>{d.removeEventListener(Jm,m),setTimeout(()=>{const C=new CustomEvent(Qm,Bw);d.addEventListener(Qm,b),d.dispatchEvent(C),C.defaultPrevented||Ya(S??document.body,{select:!0}),d.removeEventListener(Qm,b),qw.remove(w)},0)}}},[d,m,b,w]);const E=v.useCallback(S=>{if(!r&&!s||w.paused)return;const N=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,C=document.activeElement;if(N&&C){const A=S.currentTarget,[j,k]=cP(A);j&&k?!S.shiftKey&&C===k?(S.preventDefault(),r&&Ya(j,{select:!0})):S.shiftKey&&C===j&&(S.preventDefault(),r&&Ya(k,{select:!0})):C===A&&S.preventDefault()}},[r,s,w.paused]);return f.jsx(ke.div,{tabIndex:-1,...c,ref:x,onKeyDown:E})});nc.displayName=oP;function lP(e,{select:t=!1}={}){const r=document.activeElement;for(const s of e)if(Ya(s,{select:t}),document.activeElement!==r)return}function cP(e){const t=o1(e),r=Hw(t,e),s=Hw(t.reverse(),e);return[r,s]}function o1(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Hw(e,t){for(const r of e)if(!uP(r,{upTo:t}))return r}function uP(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 dP(e){return e instanceof HTMLInputElement&&"select"in e}function Ya(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&dP(e)&&t&&e.select()}}var qw=fP();function fP(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Vw(e,t),e.unshift(t)},remove(t){var r;e=Vw(e,t),(r=e[0])==null||r.resume()}}}function Vw(e,t){const r=[...e],s=r.indexOf(t);return s!==-1&&r.splice(s,1),r}function hP(e){return e.filter(t=>t.tagName!=="A")}var mP=yg[" useId ".trim().toString()]||(()=>{}),pP=0;function dn(e){const[t,r]=v.useState(mP());return Ft(()=>{r(s=>s??String(pP++))},[e]),t?`radix-${t}`:""}const gP=["top","right","bottom","left"],rs=Math.min,Fn=Math.max,Sd=Math.round,Pu=Math.floor,Lr=e=>({x:e,y:e}),vP={left:"right",right:"left",bottom:"top",top:"bottom"};function qp(e,t,r){return Fn(e,rs(t,r))}function pa(e,t){return typeof e=="function"?e(t):e}function ga(e){return e.split("-")[0]}function po(e){return e.split("-")[1]}function $g(e){return e==="x"?"y":"x"}function Ug(e){return e==="y"?"height":"width"}function Pr(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Bg(e){return $g(Pr(e))}function yP(e,t,r){r===void 0&&(r=!1);const s=po(e),i=Bg(e),l=Ug(i);let c=i==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(c=Ed(c)),[c,Ed(c)]}function bP(e){const t=Ed(e);return[Vp(e),t,Vp(t)]}function Vp(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Gw=["left","right"],Fw=["right","left"],xP=["top","bottom"],wP=["bottom","top"];function _P(e,t,r){switch(e){case"top":case"bottom":return r?t?Fw:Gw:t?Gw:Fw;case"left":case"right":return t?xP:wP;default:return[]}}function SP(e,t,r,s){const i=po(e);let l=_P(ga(e),r==="start",s);return i&&(l=l.map(c=>c+"-"+i),t&&(l=l.concat(l.map(Vp)))),l}function Ed(e){const t=ga(e);return vP[t]+e.slice(t.length)}function EP(e){return{top:0,right:0,bottom:0,left:0,...e}}function l1(e){return typeof e!="number"?EP(e):{top:e,right:e,bottom:e,left:e}}function Cd(e){const{x:t,y:r,width:s,height:i}=e;return{width:s,height:i,top:r,left:t,right:t+s,bottom:r+i,x:t,y:r}}function Kw(e,t,r){let{reference:s,floating:i}=e;const l=Pr(t),c=Bg(t),d=Ug(c),h=ga(t),m=l==="y",b=s.x+s.width/2-i.width/2,g=s.y+s.height/2-i.height/2,x=s[d]/2-i[d]/2;let w;switch(h){case"top":w={x:b,y:s.y-i.height};break;case"bottom":w={x:b,y:s.y+s.height};break;case"right":w={x:s.x+s.width,y:g};break;case"left":w={x:s.x-i.width,y:g};break;default:w={x:s.x,y:s.y}}switch(po(t)){case"start":w[c]-=x*(r&&m?-1:1);break;case"end":w[c]+=x*(r&&m?-1:1);break}return w}async function CP(e,t){var r;t===void 0&&(t={});const{x:s,y:i,platform:l,rects:c,elements:d,strategy:h}=e,{boundary:m="clippingAncestors",rootBoundary:b="viewport",elementContext:g="floating",altBoundary:x=!1,padding:w=0}=pa(t,e),E=l1(w),N=d[x?g==="floating"?"reference":"floating":g],C=Cd(await l.getClippingRect({element:(r=await(l.isElement==null?void 0:l.isElement(N)))==null||r?N:N.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(d.floating)),boundary:m,rootBoundary:b,strategy:h})),A=g==="floating"?{x:s,y:i,width:c.floating.width,height:c.floating.height}:c.reference,j=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),k=await(l.isElement==null?void 0:l.isElement(j))?await(l.getScale==null?void 0:l.getScale(j))||{x:1,y:1}:{x:1,y:1},I=Cd(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:A,offsetParent:j,strategy:h}):A);return{top:(C.top-I.top+E.top)/k.y,bottom:(I.bottom-C.bottom+E.bottom)/k.y,left:(C.left-I.left+E.left)/k.x,right:(I.right-C.right+E.right)/k.x}}const NP=50,TP=async(e,t,r)=>{const{placement:s="bottom",strategy:i="absolute",middleware:l=[],platform:c}=r,d=c.detectOverflow?c:{...c,detectOverflow:CP},h=await(c.isRTL==null?void 0:c.isRTL(t));let m=await c.getElementRects({reference:e,floating:t,strategy:i}),{x:b,y:g}=Kw(m,s,h),x=s,w=0;const E={};for(let S=0;S<l.length;S++){const N=l[S];if(!N)continue;const{name:C,fn:A}=N,{x:j,y:k,data:I,reset:z}=await A({x:b,y:g,initialPlacement:s,placement:x,strategy:i,middlewareData:E,rects:m,platform:d,elements:{reference:e,floating:t}});b=j??b,g=k??g,E[C]={...E[C],...I},z&&w<NP&&(w++,typeof z=="object"&&(z.placement&&(x=z.placement),z.rects&&(m=z.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:i}):z.rects),{x:b,y:g}=Kw(m,x,h)),S=-1)}return{x:b,y:g,placement:x,strategy:i,middlewareData:E}},jP=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:s,placement:i,rects:l,platform:c,elements:d,middlewareData:h}=t,{element:m,padding:b=0}=pa(e,t)||{};if(m==null)return{};const g=l1(b),x={x:r,y:s},w=Bg(i),E=Ug(w),S=await c.getDimensions(m),N=w==="y",C=N?"top":"left",A=N?"bottom":"right",j=N?"clientHeight":"clientWidth",k=l.reference[E]+l.reference[w]-x[w]-l.floating[E],I=x[w]-l.reference[w],z=await(c.getOffsetParent==null?void 0:c.getOffsetParent(m));let P=z?z[j]:0;(!P||!await(c.isElement==null?void 0:c.isElement(z)))&&(P=d.floating[j]||l.floating[E]);const H=k/2-I/2,Z=P/2-S[E]/2-1,de=rs(g[C],Z),ue=rs(g[A],Z),me=de,fe=P-S[E]-ue,pe=P/2-S[E]/2+H,ge=qp(me,pe,fe),R=!h.arrow&&po(i)!=null&&pe!==ge&&l.reference[E]/2-(pe<me?de:ue)-S[E]/2<0,q=R?pe<me?pe-me:pe-fe:0;return{[w]:x[w]+q,data:{[w]:ge,centerOffset:pe-ge-q,...R&&{alignmentOffset:q}},reset:R}}}),AP=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,s;const{placement:i,middlewareData:l,rects:c,initialPlacement:d,platform:h,elements:m}=t,{mainAxis:b=!0,crossAxis:g=!0,fallbackPlacements:x,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:E="none",flipAlignment:S=!0,...N}=pa(e,t);if((r=l.arrow)!=null&&r.alignmentOffset)return{};const C=ga(i),A=Pr(d),j=ga(d)===d,k=await(h.isRTL==null?void 0:h.isRTL(m.floating)),I=x||(j||!S?[Ed(d)]:bP(d)),z=E!=="none";!x&&z&&I.push(...SP(d,S,E,k));const P=[d,...I],H=await h.detectOverflow(t,N),Z=[];let de=((s=l.flip)==null?void 0:s.overflows)||[];if(b&&Z.push(H[C]),g){const pe=yP(i,c,k);Z.push(H[pe[0]],H[pe[1]])}if(de=[...de,{placement:i,overflows:Z}],!Z.every(pe=>pe<=0)){var ue,me;const pe=(((ue=l.flip)==null?void 0:ue.index)||0)+1,ge=P[pe];if(ge&&(!(g==="alignment"?A!==Pr(ge):!1)||de.every(K=>Pr(K.placement)===A?K.overflows[0]>0:!0)))return{data:{index:pe,overflows:de},reset:{placement:ge}};let R=(me=de.filter(q=>q.overflows[0]<=0).sort((q,K)=>q.overflows[1]-K.overflows[1])[0])==null?void 0:me.placement;if(!R)switch(w){case"bestFit":{var fe;const q=(fe=de.filter(K=>{if(z){const X=Pr(K.placement);return X===A||X==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(X=>X>0).reduce((X,G)=>X+G,0)]).sort((K,X)=>K[1]-X[1])[0])==null?void 0:fe[0];q&&(R=q);break}case"initialPlacement":R=d;break}if(i!==R)return{reset:{placement:R}}}return{}}}};function Ww(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 gP.some(t=>e[t]>=0)}const RP=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:s}=t,{strategy:i="referenceHidden",...l}=pa(e,t);switch(i){case"referenceHidden":{const c=await s.detectOverflow(t,{...l,elementContext:"reference"}),d=Ww(c,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:Yw(d)}}}case"escaped":{const c=await s.detectOverflow(t,{...l,altBoundary:!0}),d=Ww(c,r.floating);return{data:{escapedOffsets:d,escaped:Yw(d)}}}default:return{}}}}},c1=new Set(["left","top"]);async function kP(e,t){const{placement:r,platform:s,elements:i}=e,l=await(s.isRTL==null?void 0:s.isRTL(i.floating)),c=ga(r),d=po(r),h=Pr(r)==="y",m=c1.has(c)?-1:1,b=l&&h?-1:1,g=pa(t,e);let{mainAxis:x,crossAxis:w,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"&&(w=d==="end"?E*-1:E),h?{x:w*b,y:x*m}:{x:x*m,y:w*b}}const OP=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,s;const{x:i,y:l,placement:c,middlewareData:d}=t,h=await kP(t,e);return c===((r=d.offset)==null?void 0:r.placement)&&(s=d.arrow)!=null&&s.alignmentOffset?{}:{x:i+h.x,y:l+h.y,data:{...h,placement:c}}}}},MP=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:s,placement:i,platform:l}=t,{mainAxis:c=!0,crossAxis:d=!1,limiter:h={fn:C=>{let{x:A,y:j}=C;return{x:A,y:j}}},...m}=pa(e,t),b={x:r,y:s},g=await l.detectOverflow(t,m),x=Pr(ga(i)),w=$g(x);let E=b[w],S=b[x];if(c){const C=w==="y"?"top":"left",A=w==="y"?"bottom":"right",j=E+g[C],k=E-g[A];E=qp(j,E,k)}if(d){const C=x==="y"?"top":"left",A=x==="y"?"bottom":"right",j=S+g[C],k=S-g[A];S=qp(j,S,k)}const N=h.fn({...t,[w]:E,[x]:S});return{...N,data:{x:N.x-r,y:N.y-s,enabled:{[w]:c,[x]:d}}}}}},DP=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:s,placement:i,rects:l,middlewareData:c}=t,{offset:d=0,mainAxis:h=!0,crossAxis:m=!0}=pa(e,t),b={x:r,y:s},g=Pr(i),x=$g(g);let w=b[x],E=b[g];const S=pa(d,t),N=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(h){const j=x==="y"?"height":"width",k=l.reference[x]-l.floating[j]+N.mainAxis,I=l.reference[x]+l.reference[j]-N.mainAxis;w<k?w=k:w>I&&(w=I)}if(m){var C,A;const j=x==="y"?"width":"height",k=c1.has(ga(i)),I=l.reference[g]-l.floating[j]+(k&&((C=c.offset)==null?void 0:C[g])||0)+(k?0:N.crossAxis),z=l.reference[g]+l.reference[j]+(k?0:((A=c.offset)==null?void 0:A[g])||0)-(k?N.crossAxis:0);E<I?E=I:E>z&&(E=z)}return{[x]:w,[g]:E}}}},PP=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,s;const{placement:i,rects:l,platform:c,elements:d}=t,{apply:h=()=>{},...m}=pa(e,t),b=await c.detectOverflow(t,m),g=ga(i),x=po(i),w=Pr(i)==="y",{width:E,height:S}=l.floating;let N,C;g==="top"||g==="bottom"?(N=g,C=x===(await(c.isRTL==null?void 0:c.isRTL(d.floating))?"start":"end")?"left":"right"):(C=g,N=x==="end"?"top":"bottom");const A=S-b.top-b.bottom,j=E-b.left-b.right,k=rs(S-b[N],A),I=rs(E-b[C],j),z=!t.middlewareData.shift;let P=k,H=I;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(H=j),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(P=A),z&&!x){const de=Fn(b.left,0),ue=Fn(b.right,0),me=Fn(b.top,0),fe=Fn(b.bottom,0);w?H=E-2*(de!==0||ue!==0?de+ue:Fn(b.left,b.right)):P=S-2*(me!==0||fe!==0?me+fe:Fn(b.top,b.bottom))}await h({...t,availableWidth:H,availableHeight:P});const Z=await c.getDimensions(d.floating);return E!==Z.width||S!==Z.height?{reset:{rects:!0}}:{}}}};function Wd(){return typeof window<"u"}function go(e){return u1(e)?(e.nodeName||"").toLowerCase():"#document"}function Wn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function $r(e){var t;return(t=(u1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function u1(e){return Wd()?e instanceof Node||e instanceof Wn(e).Node:!1}function _r(e){return Wd()?e instanceof Element||e instanceof Wn(e).Element:!1}function wa(e){return Wd()?e instanceof HTMLElement||e instanceof Wn(e).HTMLElement:!1}function Xw(e){return!Wd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Wn(e).ShadowRoot}function rc(e){const{overflow:t,overflowX:r,overflowY:s,display:i}=Sr(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+r)&&i!=="inline"&&i!=="contents"}function LP(e){return/^(table|td|th)$/.test(go(e))}function Yd(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const zP=/transform|translate|scale|rotate|perspective|filter/,IP=/paint|layout|strict|content/,ks=e=>!!e&&e!=="none";let Zm;function Hg(e){const t=_r(e)?Sr(e):e;return ks(t.transform)||ks(t.translate)||ks(t.scale)||ks(t.rotate)||ks(t.perspective)||!qg()&&(ks(t.backdropFilter)||ks(t.filter))||zP.test(t.willChange||"")||IP.test(t.contain||"")}function $P(e){let t=as(e);for(;wa(t)&&!so(t);){if(Hg(t))return t;if(Yd(t))return null;t=as(t)}return null}function qg(){return Zm==null&&(Zm=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Zm}function so(e){return/^(html|body|#document)$/.test(go(e))}function Sr(e){return Wn(e).getComputedStyle(e)}function Xd(e){return _r(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function as(e){if(go(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Xw(e)&&e.host||$r(e);return Xw(t)?t.host:t}function d1(e){const t=as(e);return so(t)?e.ownerDocument?e.ownerDocument.body:e.body:wa(t)&&rc(t)?t:d1(t)}function Hl(e,t,r){var s;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=d1(e),l=i===((s=e.ownerDocument)==null?void 0:s.body),c=Wn(i);if(l){const d=Gp(c);return t.concat(c,c.visualViewport||[],rc(i)?i:[],d&&r?Hl(d):[])}else return t.concat(i,Hl(i,[],r))}function Gp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function f1(e){const t=Sr(e);let r=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=wa(e),l=i?e.offsetWidth:r,c=i?e.offsetHeight:s,d=Sd(r)!==l||Sd(s)!==c;return d&&(r=l,s=c),{width:r,height:s,$:d}}function Vg(e){return _r(e)?e:e.contextElement}function eo(e){const t=Vg(e);if(!wa(t))return Lr(1);const r=t.getBoundingClientRect(),{width:s,height:i,$:l}=f1(t);let c=(l?Sd(r.width):r.width)/s,d=(l?Sd(r.height):r.height)/i;return(!c||!Number.isFinite(c))&&(c=1),(!d||!Number.isFinite(d))&&(d=1),{x:c,y:d}}const UP=Lr(0);function h1(e){const t=Wn(e);return!qg()||!t.visualViewport?UP:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function BP(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Wn(e)?!1:t}function Bs(e,t,r,s){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),l=Vg(e);let c=Lr(1);t&&(s?_r(s)&&(c=eo(s)):c=eo(e));const d=BP(l,r,s)?h1(l):Lr(0);let h=(i.left+d.x)/c.x,m=(i.top+d.y)/c.y,b=i.width/c.x,g=i.height/c.y;if(l){const x=Wn(l),w=s&&_r(s)?Wn(s):s;let E=x,S=Gp(E);for(;S&&s&&w!==E;){const N=eo(S),C=S.getBoundingClientRect(),A=Sr(S),j=C.left+(S.clientLeft+parseFloat(A.paddingLeft))*N.x,k=C.top+(S.clientTop+parseFloat(A.paddingTop))*N.y;h*=N.x,m*=N.y,b*=N.x,g*=N.y,h+=j,m+=k,E=Wn(S),S=Gp(E)}}return Cd({width:b,height:g,x:h,y:m})}function Jd(e,t){const r=Xd(e).scrollLeft;return t?t.left+r:Bs($r(e)).left+r}function m1(e,t){const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-Jd(e,r),i=r.top+t.scrollTop;return{x:s,y:i}}function HP(e){let{elements:t,rect:r,offsetParent:s,strategy:i}=e;const l=i==="fixed",c=$r(s),d=t?Yd(t.floating):!1;if(s===c||d&&l)return r;let h={scrollLeft:0,scrollTop:0},m=Lr(1);const b=Lr(0),g=wa(s);if((g||!g&&!l)&&((go(s)!=="body"||rc(c))&&(h=Xd(s)),g)){const w=Bs(s);m=eo(s),b.x=w.x+s.clientLeft,b.y=w.y+s.clientTop}const x=c&&!g&&!l?m1(c,h):Lr(0);return{width:r.width*m.x,height:r.height*m.y,x:r.x*m.x-h.scrollLeft*m.x+b.x+x.x,y:r.y*m.y-h.scrollTop*m.y+b.y+x.y}}function qP(e){return Array.from(e.getClientRects())}function VP(e){const t=$r(e),r=Xd(e),s=e.ownerDocument.body,i=Fn(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=Fn(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let c=-r.scrollLeft+Jd(e);const d=-r.scrollTop;return Sr(s).direction==="rtl"&&(c+=Fn(t.clientWidth,s.clientWidth)-i),{width:i,height:l,x:c,y:d}}const Jw=25;function GP(e,t){const r=Wn(e),s=$r(e),i=r.visualViewport;let l=s.clientWidth,c=s.clientHeight,d=0,h=0;if(i){l=i.width,c=i.height;const b=qg();(!b||b&&t==="fixed")&&(d=i.offsetLeft,h=i.offsetTop)}const m=Jd(s);if(m<=0){const b=s.ownerDocument,g=b.body,x=getComputedStyle(g),w=b.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,E=Math.abs(s.clientWidth-g.clientWidth-w);E<=Jw&&(l-=E)}else m<=Jw&&(l+=m);return{width:l,height:c,x:d,y:h}}function FP(e,t){const r=Bs(e,!0,t==="fixed"),s=r.top+e.clientTop,i=r.left+e.clientLeft,l=wa(e)?eo(e):Lr(1),c=e.clientWidth*l.x,d=e.clientHeight*l.y,h=i*l.x,m=s*l.y;return{width:c,height:d,x:h,y:m}}function Qw(e,t,r){let s;if(t==="viewport")s=GP(e,r);else if(t==="document")s=VP($r(e));else if(_r(t))s=FP(t,r);else{const i=h1(e);s={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Cd(s)}function p1(e,t){const r=as(e);return r===t||!_r(r)||so(r)?!1:Sr(r).position==="fixed"||p1(r,t)}function KP(e,t){const r=t.get(e);if(r)return r;let s=Hl(e,[],!1).filter(d=>_r(d)&&go(d)!=="body"),i=null;const l=Sr(e).position==="fixed";let c=l?as(e):e;for(;_r(c)&&!so(c);){const d=Sr(c),h=Hg(c);!h&&d.position==="fixed"&&(i=null),(l?!h&&!i:!h&&d.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||rc(c)&&!h&&p1(e,c))?s=s.filter(b=>b!==c):i=d,c=as(c)}return t.set(e,s),s}function WP(e){let{element:t,boundary:r,rootBoundary:s,strategy:i}=e;const c=[...r==="clippingAncestors"?Yd(t)?[]:KP(t,this._c):[].concat(r),s],d=Qw(t,c[0],i);let h=d.top,m=d.right,b=d.bottom,g=d.left;for(let x=1;x<c.length;x++){const w=Qw(t,c[x],i);h=Fn(w.top,h),m=rs(w.right,m),b=rs(w.bottom,b),g=Fn(w.left,g)}return{width:m-g,height:b-h,x:g,y:h}}function YP(e){const{width:t,height:r}=f1(e);return{width:t,height:r}}function XP(e,t,r){const s=wa(t),i=$r(t),l=r==="fixed",c=Bs(e,!0,l,t);let d={scrollLeft:0,scrollTop:0};const h=Lr(0);function m(){h.x=Jd(i)}if(s||!s&&!l)if((go(t)!=="body"||rc(i))&&(d=Xd(t)),s){const w=Bs(t,!0,l,t);h.x=w.x+t.clientLeft,h.y=w.y+t.clientTop}else i&&m();l&&!s&&i&&m();const b=i&&!s&&!l?m1(i,d):Lr(0),g=c.left+d.scrollLeft-h.x-b.x,x=c.top+d.scrollTop-h.y-b.y;return{x:g,y:x,width:c.width,height:c.height}}function ep(e){return Sr(e).position==="static"}function Zw(e,t){if(!wa(e)||Sr(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return $r(e)===r&&(r=r.ownerDocument.body),r}function g1(e,t){const r=Wn(e);if(Yd(e))return r;if(!wa(e)){let i=as(e);for(;i&&!so(i);){if(_r(i)&&!ep(i))return i;i=as(i)}return r}let s=Zw(e,t);for(;s&&LP(s)&&ep(s);)s=Zw(s,t);return s&&so(s)&&ep(s)&&!Hg(s)?r:s||$P(e)||r}const JP=async function(e){const t=this.getOffsetParent||g1,r=this.getDimensions,s=await r(e.floating);return{reference:XP(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function QP(e){return Sr(e).direction==="rtl"}const ZP={convertOffsetParentRelativeRectToViewportRelativeRect:HP,getDocumentElement:$r,getClippingRect:WP,getOffsetParent:g1,getElementRects:JP,getClientRects:qP,getDimensions:YP,getScale:eo,isElement:_r,isRTL:QP};function v1(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function eL(e,t){let r=null,s;const i=$r(e);function l(){var d;clearTimeout(s),(d=r)==null||d.disconnect(),r=null}function c(d,h){d===void 0&&(d=!1),h===void 0&&(h=1),l();const m=e.getBoundingClientRect(),{left:b,top:g,width:x,height:w}=m;if(d||t(),!x||!w)return;const E=Pu(g),S=Pu(i.clientWidth-(b+x)),N=Pu(i.clientHeight-(g+w)),C=Pu(b),j={rootMargin:-E+"px "+-S+"px "+-N+"px "+-C+"px",threshold:Fn(0,rs(1,h))||1};let k=!0;function I(z){const P=z[0].intersectionRatio;if(P!==h){if(!k)return c();P?c(!1,P):s=setTimeout(()=>{c(!1,1e-7)},1e3)}P===1&&!v1(m,e.getBoundingClientRect())&&c(),k=!1}try{r=new IntersectionObserver(I,{...j,root:i.ownerDocument})}catch{r=new IntersectionObserver(I,j)}r.observe(e)}return c(!0),l}function tL(e,t,r,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:l=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:h=!1}=s,m=Vg(e),b=i||l?[...m?Hl(m):[],...t?Hl(t):[]]:[];b.forEach(C=>{i&&C.addEventListener("scroll",r,{passive:!0}),l&&C.addEventListener("resize",r)});const g=m&&d?eL(m,r):null;let x=-1,w=null;c&&(w=new ResizeObserver(C=>{let[A]=C;A&&A.target===m&&w&&t&&(w.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var j;(j=w)==null||j.observe(t)})),r()}),m&&!h&&w.observe(m),t&&w.observe(t));let E,S=h?Bs(e):null;h&&N();function N(){const C=Bs(e);S&&!v1(S,C)&&r(),S=C,E=requestAnimationFrame(N)}return r(),()=>{var C;b.forEach(A=>{i&&A.removeEventListener("scroll",r),l&&A.removeEventListener("resize",r)}),g==null||g(),(C=w)==null||C.disconnect(),w=null,h&&cancelAnimationFrame(E)}}const nL=OP,rL=MP,aL=AP,sL=PP,iL=RP,e_=jP,oL=DP,lL=(e,t,r)=>{const s=new Map,i={platform:ZP,...r},l={...i.platform,_c:s};return TP(e,t,{...i,platform:l})};var cL=typeof document<"u",uL=function(){},td=cL?v.useLayoutEffect:uL;function Nd(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,i;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(!Nd(e[s],t[s]))return!1;return!0}if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(s=r;s--!==0;)if(!{}.hasOwnProperty.call(t,i[s]))return!1;for(s=r;s--!==0;){const l=i[s];if(!(l==="_owner"&&e.$$typeof)&&!Nd(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function y1(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function t_(e,t){const r=y1(e);return Math.round(t*r)/r}function tp(e){const t=v.useRef(e);return td(()=>{t.current=e}),t}function dL(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:s=[],platform:i,elements:{reference:l,floating:c}={},transform:d=!0,whileElementsMounted:h,open:m}=e,[b,g]=v.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[x,w]=v.useState(s);Nd(x,s)||w(s);const[E,S]=v.useState(null),[N,C]=v.useState(null),A=v.useCallback(K=>{K!==z.current&&(z.current=K,S(K))},[]),j=v.useCallback(K=>{K!==P.current&&(P.current=K,C(K))},[]),k=l||E,I=c||N,z=v.useRef(null),P=v.useRef(null),H=v.useRef(b),Z=h!=null,de=tp(h),ue=tp(i),me=tp(m),fe=v.useCallback(()=>{if(!z.current||!P.current)return;const K={placement:t,strategy:r,middleware:x};ue.current&&(K.platform=ue.current),lL(z.current,P.current,K).then(X=>{const G={...X,isPositioned:me.current!==!1};pe.current&&!Nd(H.current,G)&&(H.current=G,Ql.flushSync(()=>{g(G)}))})},[x,t,r,ue,me]);td(()=>{m===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,g(K=>({...K,isPositioned:!1})))},[m]);const pe=v.useRef(!1);td(()=>(pe.current=!0,()=>{pe.current=!1}),[]),td(()=>{if(k&&(z.current=k),I&&(P.current=I),k&&I){if(de.current)return de.current(k,I,fe);fe()}},[k,I,fe,de,Z]);const ge=v.useMemo(()=>({reference:z,floating:P,setReference:A,setFloating:j}),[A,j]),R=v.useMemo(()=>({reference:k,floating:I}),[k,I]),q=v.useMemo(()=>{const K={position:r,left:0,top:0};if(!R.floating)return K;const X=t_(R.floating,b.x),G=t_(R.floating,b.y);return d?{...K,transform:"translate("+X+"px, "+G+"px)",...y1(R.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:X,top:G}},[r,d,R.floating,b.x,b.y]);return v.useMemo(()=>({...b,update:fe,refs:ge,elements:R,floatingStyles:q}),[b,fe,ge,R,q])}const fL=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:s,padding:i}=typeof e=="function"?e(r):e;return s&&t(s)?s.current!=null?e_({element:s.current,padding:i}).fn(r):{}:s?e_({element:s,padding:i}).fn(r):{}}}},hL=(e,t)=>{const r=nL(e);return{name:r.name,fn:r.fn,options:[e,t]}},mL=(e,t)=>{const r=rL(e);return{name:r.name,fn:r.fn,options:[e,t]}},pL=(e,t)=>({fn:oL(e).fn,options:[e,t]}),gL=(e,t)=>{const r=aL(e);return{name:r.name,fn:r.fn,options:[e,t]}},vL=(e,t)=>{const r=sL(e);return{name:r.name,fn:r.fn,options:[e,t]}},yL=(e,t)=>{const r=iL(e);return{name:r.name,fn:r.fn,options:[e,t]}},bL=(e,t)=>{const r=fL(e);return{name:r.name,fn:r.fn,options:[e,t]}};var xL="Arrow",b1=v.forwardRef((e,t)=>{const{children:r,width:s=10,height:i=5,...l}=e;return f.jsx(ke.svg,{...l,ref:t,width:s,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});b1.displayName=xL;var wL=b1;function Gg(e){const[t,r]=v.useState(void 0);return Ft(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const l=i[0];let c,d;if("borderBoxSize"in l){const h=l.borderBoxSize,m=Array.isArray(h)?h[0]:h;c=m.inlineSize,d=m.blockSize}else c=e.offsetWidth,d=e.offsetHeight;r({width:c,height:d})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else r(void 0)},[e]),t}var Fg="Popper",[x1,vo]=cr(Fg),[_L,w1]=x1(Fg),_1=e=>{const{__scopePopper:t,children:r}=e,[s,i]=v.useState(null);return f.jsx(_L,{scope:t,anchor:s,onAnchorChange:i,children:r})};_1.displayName=Fg;var S1="PopperAnchor",E1=v.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:s,...i}=e,l=w1(S1,r),c=v.useRef(null),d=Je(t,c),h=v.useRef(null);return v.useEffect(()=>{const m=h.current;h.current=(s==null?void 0:s.current)||c.current,m!==h.current&&l.onAnchorChange(h.current)}),s?null:f.jsx(ke.div,{...i,ref:d})});E1.displayName=S1;var Kg="PopperContent",[SL,EL]=x1(Kg),C1=v.forwardRef((e,t)=>{var ee,Q,ae,se,Ee,je;const{__scopePopper:r,side:s="bottom",sideOffset:i=0,align:l="center",alignOffset:c=0,arrowPadding:d=0,avoidCollisions:h=!0,collisionBoundary:m=[],collisionPadding:b=0,sticky:g="partial",hideWhenDetached:x=!1,updatePositionStrategy:w="optimized",onPlaced:E,...S}=e,N=w1(Kg,r),[C,A]=v.useState(null),j=Je(t,nt=>A(nt)),[k,I]=v.useState(null),z=Gg(k),P=(z==null?void 0:z.width)??0,H=(z==null?void 0:z.height)??0,Z=s+(l!=="center"?"-"+l:""),de=typeof b=="number"?b:{top:0,right:0,bottom:0,left:0,...b},ue=Array.isArray(m)?m:[m],me=ue.length>0,fe={padding:de,boundary:ue.filter(NL),altBoundary:me},{refs:pe,floatingStyles:ge,placement:R,isPositioned:q,middlewareData:K}=dL({strategy:"fixed",placement:Z,whileElementsMounted:(...nt)=>tL(...nt,{animationFrame:w==="always"}),elements:{reference:N.anchor},middleware:[hL({mainAxis:i+H,alignmentAxis:c}),h&&mL({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?pL():void 0,...fe}),h&&gL({...fe}),vL({...fe,apply:({elements:nt,rects:Qe,availableWidth:Et,availableHeight:oe})=>{const{width:Me,height:Ke}=Qe.reference,qe=nt.floating.style;qe.setProperty("--radix-popper-available-width",`${Et}px`),qe.setProperty("--radix-popper-available-height",`${oe}px`),qe.setProperty("--radix-popper-anchor-width",`${Me}px`),qe.setProperty("--radix-popper-anchor-height",`${Ke}px`)}}),k&&bL({element:k,padding:d}),TL({arrowWidth:P,arrowHeight:H}),x&&yL({strategy:"referenceHidden",...fe})]}),[X,G]=j1(R),O=nn(E);Ft(()=>{q&&(O==null||O())},[q,O]);const M=(ee=K.arrow)==null?void 0:ee.x,$=(Q=K.arrow)==null?void 0:Q.y,Y=((ae=K.arrow)==null?void 0:ae.centerOffset)!==0,[B,ne]=v.useState();return Ft(()=>{C&&ne(window.getComputedStyle(C).zIndex)},[C]),f.jsx("div",{ref:pe.setFloating,"data-radix-popper-content-wrapper":"",style:{...ge,transform:q?ge.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:B,"--radix-popper-transform-origin":[(se=K.transformOrigin)==null?void 0:se.x,(Ee=K.transformOrigin)==null?void 0:Ee.y].join(" "),...((je=K.hide)==null?void 0:je.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(SL,{scope:r,placedSide:X,onArrowChange:I,arrowX:M,arrowY:$,shouldHideArrow:Y,children:f.jsx(ke.div,{"data-side":X,"data-align":G,...S,ref:j,style:{...S.style,animation:q?void 0:"none"}})})})});C1.displayName=Kg;var N1="PopperArrow",CL={top:"bottom",right:"left",bottom:"top",left:"right"},T1=v.forwardRef(function(t,r){const{__scopePopper:s,...i}=t,l=EL(N1,s),c=CL[l.placedSide];return f.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[c]: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:f.jsx(wL,{...i,ref:r,style:{...i.style,display:"block"}})})});T1.displayName=N1;function NL(e){return e!==null}var TL=e=>({name:"transformOrigin",options:e,fn(t){var N,C,A;const{placement:r,rects:s,middlewareData:i}=t,c=((N=i.arrow)==null?void 0:N.centerOffset)!==0,d=c?0:e.arrowWidth,h=c?0:e.arrowHeight,[m,b]=j1(r),g={start:"0%",center:"50%",end:"100%"}[b],x=(((C=i.arrow)==null?void 0:C.x)??0)+d/2,w=(((A=i.arrow)==null?void 0:A.y)??0)+h/2;let E="",S="";return m==="bottom"?(E=c?g:`${x}px`,S=`${-h}px`):m==="top"?(E=c?g:`${x}px`,S=`${s.floating.height+h}px`):m==="right"?(E=`${-h}px`,S=c?g:`${w}px`):m==="left"&&(E=`${s.floating.width+h}px`,S=c?g:`${w}px`),{data:{x:E,y:S}}}});function j1(e){const[t,r="center"]=e.split("-");return[t,r]}var Wg=_1,Qd=E1,Yg=C1,Xg=T1,jL="Portal",ac=v.forwardRef((e,t)=>{var d;const{container:r,...s}=e,[i,l]=v.useState(!1);Ft(()=>l(!0),[]);const c=r||i&&((d=globalThis==null?void 0:globalThis.document)==null?void 0:d.body);return c?cS.createPortal(f.jsx(ke.div,{...s,ref:t}),c):null});ac.displayName=jL;function AL(e,t){return v.useReducer((r,s)=>t[r][s]??r,e)}var vn=e=>{const{present:t,children:r}=e,s=RL(t),i=typeof r=="function"?r({present:s.isPresent}):v.Children.only(r),l=Je(s.ref,kL(i));return typeof r=="function"||s.isPresent?v.cloneElement(i,{ref:l}):null};vn.displayName="Presence";function RL(e){const[t,r]=v.useState(),s=v.useRef(null),i=v.useRef(e),l=v.useRef("none"),c=e?"mounted":"unmounted",[d,h]=AL(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const m=Lu(s.current);l.current=d==="mounted"?m:"none"},[d]),Ft(()=>{const m=s.current,b=i.current;if(b!==e){const x=l.current,w=Lu(m);e?h("MOUNT"):w==="none"||(m==null?void 0:m.display)==="none"?h("UNMOUNT"):h(b&&x!==w?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,h]),Ft(()=>{if(t){let m;const b=t.ownerDocument.defaultView??window,g=w=>{const S=Lu(s.current).includes(CSS.escape(w.animationName));if(w.target===t&&S&&(h("ANIMATION_END"),!i.current)){const N=t.style.animationFillMode;t.style.animationFillMode="forwards",m=b.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=N)})}},x=w=>{w.target===t&&(l.current=Lu(s.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{b.clearTimeout(m),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:v.useCallback(m=>{s.current=m?getComputedStyle(m):null,r(m)},[])}}function Lu(e){return(e==null?void 0:e.animationName)||"none"}function kL(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var np="rovingFocusGroup.onEntryFocus",OL={bubbles:!1,cancelable:!0},sc="RovingFocusGroup",[Fp,A1,ML]=Ig(sc),[DL,Zd]=cr(sc,[ML]),[PL,LL]=DL(sc),R1=v.forwardRef((e,t)=>f.jsx(Fp.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(Fp.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(zL,{...e,ref:t})})}));R1.displayName=sc;var zL=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:s,loop:i=!1,dir:l,currentTabStopId:c,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:h,onEntryFocus:m,preventScrollOnEntryFocus:b=!1,...g}=e,x=v.useRef(null),w=Je(t,x),E=ec(l),[S,N]=ma({prop:c,defaultProp:d??null,onChange:h,caller:sc}),[C,A]=v.useState(!1),j=nn(m),k=A1(r),I=v.useRef(!1),[z,P]=v.useState(0);return v.useEffect(()=>{const H=x.current;if(H)return H.addEventListener(np,j),()=>H.removeEventListener(np,j)},[j]),f.jsx(PL,{scope:r,orientation:s,dir:E,loop:i,currentTabStopId:S,onItemFocus:v.useCallback(H=>N(H),[N]),onItemShiftTab:v.useCallback(()=>A(!0),[]),onFocusableItemAdd:v.useCallback(()=>P(H=>H+1),[]),onFocusableItemRemove:v.useCallback(()=>P(H=>H-1),[]),children:f.jsx(ke.div,{tabIndex:C||z===0?-1:0,"data-orientation":s,...g,ref:w,style:{outline:"none",...e.style},onMouseDown:ye(e.onMouseDown,()=>{I.current=!0}),onFocus:ye(e.onFocus,H=>{const Z=!I.current;if(H.target===H.currentTarget&&Z&&!C){const de=new CustomEvent(np,OL);if(H.currentTarget.dispatchEvent(de),!de.defaultPrevented){const ue=k().filter(R=>R.focusable),me=ue.find(R=>R.active),fe=ue.find(R=>R.id===S),ge=[me,fe,...ue].filter(Boolean).map(R=>R.ref.current);M1(ge,b)}}I.current=!1}),onBlur:ye(e.onBlur,()=>A(!1))})})}),k1="RovingFocusGroupItem",O1=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:s=!0,active:i=!1,tabStopId:l,children:c,...d}=e,h=dn(),m=l||h,b=LL(k1,r),g=b.currentTabStopId===m,x=A1(r),{onFocusableItemAdd:w,onFocusableItemRemove:E,currentTabStopId:S}=b;return v.useEffect(()=>{if(s)return w(),()=>E()},[s,w,E]),f.jsx(Fp.ItemSlot,{scope:r,id:m,focusable:s,active:i,children:f.jsx(ke.span,{tabIndex:g?0:-1,"data-orientation":b.orientation,...d,ref:t,onMouseDown:ye(e.onMouseDown,N=>{s?b.onItemFocus(m):N.preventDefault()}),onFocus:ye(e.onFocus,()=>b.onItemFocus(m)),onKeyDown:ye(e.onKeyDown,N=>{if(N.key==="Tab"&&N.shiftKey){b.onItemShiftTab();return}if(N.target!==N.currentTarget)return;const C=UL(N,b.orientation,b.dir);if(C!==void 0){if(N.metaKey||N.ctrlKey||N.altKey||N.shiftKey)return;N.preventDefault();let j=x().filter(k=>k.focusable).map(k=>k.ref.current);if(C==="last")j.reverse();else if(C==="prev"||C==="next"){C==="prev"&&j.reverse();const k=j.indexOf(N.currentTarget);j=b.loop?BL(j,k+1):j.slice(k+1)}setTimeout(()=>M1(j))}}),children:typeof c=="function"?c({isCurrentTabStop:g,hasTabStop:S!=null}):c})})});O1.displayName=k1;var IL={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function $L(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function UL(e,t,r){const s=$L(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return IL[s]}function M1(e,t=!1){const r=document.activeElement;for(const s of e)if(s===r||(s.focus({preventScroll:t}),document.activeElement!==r))return}function BL(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var D1=R1,P1=O1;function HL(e){const t=qL(e),r=v.forwardRef((s,i)=>{const{children:l,...c}=s,d=v.Children.toArray(l),h=d.find(GL);if(h){const m=h.props.children,b=d.map(g=>g===h?v.Children.count(m)>1?v.Children.only(null):v.isValidElement(m)?m.props.children:null:g);return f.jsx(t,{...c,ref:i,children:v.isValidElement(m)?v.cloneElement(m,void 0,b):null})}return f.jsx(t,{...c,ref:i,children:l})});return r.displayName=`${e}.Slot`,r}function qL(e){const t=v.forwardRef((r,s)=>{const{children:i,...l}=r;if(v.isValidElement(i)){const c=KL(i),d=FL(l,i.props);return i.type!==v.Fragment&&(d.ref=s?wn(s,c):c),v.cloneElement(i,d)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var VL=Symbol("radix.slottable");function GL(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===VL}function FL(e,t){const r={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?r[s]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(r[s]=i):s==="style"?r[s]={...i,...l}:s==="className"&&(r[s]=[i,l].filter(Boolean).join(" "))}return{...e,...r}}function KL(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var WL=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},$i=new WeakMap,zu=new WeakMap,Iu={},rp=0,L1=function(e){return e&&(e.host||L1(e.parentNode))},YL=function(e,t){return t.map(function(r){if(e.contains(r))return r;var s=L1(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})},XL=function(e,t,r,s){var i=YL(t,Array.isArray(e)?e:[e]);Iu[r]||(Iu[r]=new WeakMap);var l=Iu[r],c=[],d=new Set,h=new Set(i),m=function(g){!g||d.has(g)||(d.add(g),m(g.parentNode))};i.forEach(m);var b=function(g){!g||h.has(g)||Array.prototype.forEach.call(g.children,function(x){if(d.has(x))b(x);else try{var w=x.getAttribute(s),E=w!==null&&w!=="false",S=($i.get(x)||0)+1,N=(l.get(x)||0)+1;$i.set(x,S),l.set(x,N),c.push(x),S===1&&E&&zu.set(x,!0),N===1&&x.setAttribute(r,"true"),E||x.setAttribute(s,"true")}catch(C){console.error("aria-hidden: cannot operate on ",x,C)}})};return b(t),d.clear(),rp++,function(){c.forEach(function(g){var x=$i.get(g)-1,w=l.get(g)-1;$i.set(g,x),l.set(g,w),x||(zu.has(g)||g.removeAttribute(s),zu.delete(g)),w||g.removeAttribute(r)}),rp--,rp||($i=new WeakMap,$i=new WeakMap,zu=new WeakMap,Iu={})}},ef=function(e,t,r){r===void 0&&(r="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),i=WL(e);return i?(s.push.apply(s,Array.from(i.querySelectorAll("[aria-live], script"))),XL(s,i,r,"aria-hidden")):function(){return null}},nd="right-scroll-bar-position",rd="width-before-scroll-bar",JL="with-scroll-bars-hidden",QL="--removed-body-scroll-bar-size";function ap(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function ZL(e,t){var r=v.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(s){var i=r.value;i!==s&&(r.value=s,r.callback(s,i))}}}})[0];return r.callback=t,r.facade}var e4=typeof window<"u"?v.useLayoutEffect:v.useEffect,n_=new WeakMap;function t4(e,t){var r=ZL(null,function(s){return e.forEach(function(i){return ap(i,s)})});return e4(function(){var s=n_.get(r);if(s){var i=new Set(s),l=new Set(e),c=r.current;i.forEach(function(d){l.has(d)||ap(d,null)}),l.forEach(function(d){i.has(d)||ap(d,c)})}n_.set(r,e)},[e]),r}function n4(e){return e}function r4(e,t){t===void 0&&(t=n4);var r=[],s=!1,i={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 c=t(l,s);return r.push(c),function(){r=r.filter(function(d){return d!==c})}},assignSyncMedium:function(l){for(s=!0;r.length;){var c=r;r=[],c.forEach(l)}r={push:function(d){return l(d)},filter:function(){return r}}},assignMedium:function(l){s=!0;var c=[];if(r.length){var d=r;r=[],d.forEach(l),c=r}var h=function(){var b=c;c=[],b.forEach(l)},m=function(){return Promise.resolve().then(h)};m(),r={push:function(b){c.push(b),m()},filter:function(b){return c=c.filter(b),r}}}};return i}function a4(e){e===void 0&&(e={});var t=r4(null);return t.options=Dr({async:!0,ssr:!1},e),t}var z1=function(e){var t=e.sideCar,r=ho(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 v.createElement(s,Dr({},r))};z1.isSideCarExport=!0;function s4(e,t){return e.useMedium(t),z1}var I1=a4(),sp=function(){},tf=v.forwardRef(function(e,t){var r=v.useRef(null),s=v.useState({onScrollCapture:sp,onWheelCapture:sp,onTouchMoveCapture:sp}),i=s[0],l=s[1],c=e.forwardProps,d=e.children,h=e.className,m=e.removeScrollBar,b=e.enabled,g=e.shards,x=e.sideCar,w=e.noRelative,E=e.noIsolation,S=e.inert,N=e.allowPinchZoom,C=e.as,A=C===void 0?"div":C,j=e.gapMode,k=ho(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),I=x,z=t4([r,t]),P=Dr(Dr({},k),i);return v.createElement(v.Fragment,null,b&&v.createElement(I,{sideCar:I1,removeScrollBar:m,shards:g,noRelative:w,noIsolation:E,inert:S,setCallbacks:l,allowPinchZoom:!!N,lockRef:r,gapMode:j}),c?v.cloneElement(v.Children.only(d),Dr(Dr({},P),{ref:z})):v.createElement(A,Dr({},P,{className:h,ref:z}),d))});tf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};tf.classNames={fullWidth:rd,zeroRight:nd};var i4=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function o4(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=i4();return t&&e.setAttribute("nonce",t),e}function l4(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function c4(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var u4=function(){var e=0,t=null;return{add:function(r){e==0&&(t=o4())&&(l4(t,r),c4(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},d4=function(){var e=u4();return function(t,r){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},$1=function(){var e=d4(),t=function(r){var s=r.styles,i=r.dynamic;return e(s,i),null};return t},f4={left:0,top:0,right:0,gap:0},ip=function(e){return parseInt(e||"",10)||0},h4=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[ip(r),ip(s),ip(i)]},m4=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return f4;var t=h4(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])}},p4=$1(),to="data-scroll-locked",g4=function(e,t,r,s){var i=e.left,l=e.top,c=e.right,d=e.gap;return r===void 0&&(r="margin"),`
.`.concat(JL,` {
overflow: hidden `).concat(s,`;
padding-right: `).concat(d,"px ").concat(s,`;
}
body[`).concat(to,`] {
overflow: hidden `).concat(s,`;
overscroll-behavior: contain;
`).concat([t&&"position: relative ".concat(s,";"),r==="margin"&&`
padding-left: `.concat(i,`px;
padding-top: `).concat(l,`px;
padding-right: `).concat(c,`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(nd,` {
right: `).concat(d,"px ").concat(s,`;
}
.`).concat(rd,` {
margin-right: `).concat(d,"px ").concat(s,`;
}
.`).concat(nd," .").concat(nd,` {
right: 0 `).concat(s,`;
}
.`).concat(rd," .").concat(rd,` {
margin-right: 0 `).concat(s,`;
}
body[`).concat(to,`] {
`).concat(QL,": ").concat(d,`px;
}
`)},r_=function(){var e=parseInt(document.body.getAttribute(to)||"0",10);return isFinite(e)?e:0},v4=function(){v.useEffect(function(){return document.body.setAttribute(to,(r_()+1).toString()),function(){var e=r_()-1;e<=0?document.body.removeAttribute(to):document.body.setAttribute(to,e.toString())}},[])},y4=function(e){var t=e.noRelative,r=e.noImportant,s=e.gapMode,i=s===void 0?"margin":s;v4();var l=v.useMemo(function(){return m4(i)},[i]);return v.createElement(p4,{styles:g4(l,!t,i,r?"":"!important")})},Kp=!1;if(typeof window<"u")try{var $u=Object.defineProperty({},"passive",{get:function(){return Kp=!0,!0}});window.addEventListener("test",$u,$u),window.removeEventListener("test",$u,$u)}catch{Kp=!1}var Ui=Kp?{passive:!1}:!1,b4=function(e){return e.tagName==="TEXTAREA"},U1=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!b4(e)&&r[t]==="visible")},x4=function(e){return U1(e,"overflowY")},w4=function(e){return U1(e,"overflowX")},a_=function(e,t){var r=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var i=B1(e,s);if(i){var l=H1(e,s),c=l[1],d=l[2];if(c>d)return!0}s=s.parentNode}while(s&&s!==r.body);return!1},_4=function(e){var t=e.scrollTop,r=e.scrollHeight,s=e.clientHeight;return[t,r,s]},S4=function(e){var t=e.scrollLeft,r=e.scrollWidth,s=e.clientWidth;return[t,r,s]},B1=function(e,t){return e==="v"?x4(t):w4(t)},H1=function(e,t){return e==="v"?_4(t):S4(t)},E4=function(e,t){return e==="h"&&t==="rtl"?-1:1},C4=function(e,t,r,s,i){var l=E4(e,window.getComputedStyle(t).direction),c=l*s,d=r.target,h=t.contains(d),m=!1,b=c>0,g=0,x=0;do{if(!d)break;var w=H1(e,d),E=w[0],S=w[1],N=w[2],C=S-N-l*E;(E||C)&&B1(e,d)&&(g+=C,x+=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(x)<1)&&(m=!0),m},Uu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},s_=function(e){return[e.deltaX,e.deltaY]},i_=function(e){return e&&"current"in e?e.current:e},N4=function(e,t){return e[0]===t[0]&&e[1]===t[1]},T4=function(e){return`
.block-interactivity-`.concat(e,` {pointer-events: none;}
.allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},j4=0,Bi=[];function A4(e){var t=v.useRef([]),r=v.useRef([0,0]),s=v.useRef(),i=v.useState(j4++)[0],l=v.useState($1)[0],c=v.useRef(e);v.useEffect(function(){c.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var S=n2([e.lockRef.current],(e.shards||[]).map(i_),!0).filter(Boolean);return S.forEach(function(N){return N.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(N){return N.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var d=v.useCallback(function(S,N){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!c.current.allowPinchZoom;var C=Uu(S),A=r.current,j="deltaX"in S?S.deltaX:A[0]-C[0],k="deltaY"in S?S.deltaY:A[1]-C[1],I,z=S.target,P=Math.abs(j)>Math.abs(k)?"h":"v";if("touches"in S&&P==="h"&&z.type==="range")return!1;var H=window.getSelection(),Z=H&&H.anchorNode,de=Z?Z===z||Z.contains(z):!1;if(de)return!1;var ue=a_(P,z);if(!ue)return!0;if(ue?I=P:(I=P==="v"?"h":"v",ue=a_(P,z)),!ue)return!1;if(!s.current&&"changedTouches"in S&&(j||k)&&(s.current=I),!I)return!0;var me=s.current||I;return C4(me,N,S,me==="h"?j:k)},[]),h=v.useCallback(function(S){var N=S;if(!(!Bi.length||Bi[Bi.length-1]!==l)){var C="deltaY"in N?s_(N):Uu(N),A=t.current.filter(function(I){return I.name===N.type&&(I.target===N.target||N.target===I.shadowParent)&&N4(I.delta,C)})[0];if(A&&A.should){N.cancelable&&N.preventDefault();return}if(!A){var j=(c.current.shards||[]).map(i_).filter(Boolean).filter(function(I){return I.contains(N.target)}),k=j.length>0?d(N,j[0]):!c.current.noIsolation;k&&N.cancelable&&N.preventDefault()}}},[]),m=v.useCallback(function(S,N,C,A){var j={name:S,delta:N,target:C,should:A,shadowParent:R4(C)};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(k){return k!==j})},1)},[]),b=v.useCallback(function(S){r.current=Uu(S),s.current=void 0},[]),g=v.useCallback(function(S){m(S.type,s_(S),S.target,d(S,e.lockRef.current))},[]),x=v.useCallback(function(S){m(S.type,Uu(S),S.target,d(S,e.lockRef.current))},[]);v.useEffect(function(){return Bi.push(l),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:x}),document.addEventListener("wheel",h,Ui),document.addEventListener("touchmove",h,Ui),document.addEventListener("touchstart",b,Ui),function(){Bi=Bi.filter(function(S){return S!==l}),document.removeEventListener("wheel",h,Ui),document.removeEventListener("touchmove",h,Ui),document.removeEventListener("touchstart",b,Ui)}},[]);var w=e.removeScrollBar,E=e.inert;return v.createElement(v.Fragment,null,E?v.createElement(l,{styles:T4(i)}):null,w?v.createElement(y4,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function R4(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const k4=s4(I1,A4);var ic=v.forwardRef(function(e,t){return v.createElement(tf,Dr({},e,{ref:t,sideCar:k4}))});ic.classNames=tf.classNames;var Wp=["Enter"," "],O4=["ArrowDown","PageUp","Home"],q1=["ArrowUp","PageDown","End"],M4=[...O4,...q1],D4={ltr:[...Wp,"ArrowRight"],rtl:[...Wp,"ArrowLeft"]},P4={ltr:["ArrowLeft"],rtl:["ArrowRight"]},oc="Menu",[ql,L4,z4]=Ig(oc),[Ks,V1]=cr(oc,[z4,vo,Zd]),nf=vo(),G1=Zd(),[I4,Ws]=Ks(oc),[$4,lc]=Ks(oc),F1=e=>{const{__scopeMenu:t,open:r=!1,children:s,dir:i,onOpenChange:l,modal:c=!0}=e,d=nf(t),[h,m]=v.useState(null),b=v.useRef(!1),g=nn(l),x=ec(i);return v.useEffect(()=>{const w=()=>{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",w,{capture:!0}),()=>{document.removeEventListener("keydown",w,{capture:!0}),document.removeEventListener("pointerdown",E,{capture:!0}),document.removeEventListener("pointermove",E,{capture:!0})}},[]),f.jsx(Wg,{...d,children:f.jsx(I4,{scope:t,open:r,onOpenChange:g,content:h,onContentChange:m,children:f.jsx($4,{scope:t,onClose:v.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:b,dir:x,modal:c,children:s})})})};F1.displayName=oc;var U4="MenuAnchor",Jg=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,i=nf(r);return f.jsx(Qd,{...i,...s,ref:t})});Jg.displayName=U4;var Qg="MenuPortal",[B4,K1]=Ks(Qg,{forceMount:void 0}),W1=e=>{const{__scopeMenu:t,forceMount:r,children:s,container:i}=e,l=Ws(Qg,t);return f.jsx(B4,{scope:t,forceMount:r,children:f.jsx(vn,{present:r||l.open,children:f.jsx(ac,{asChild:!0,container:i,children:s})})})};W1.displayName=Qg;var or="MenuContent",[H4,Zg]=Ks(or),Y1=v.forwardRef((e,t)=>{const r=K1(or,e.__scopeMenu),{forceMount:s=r.forceMount,...i}=e,l=Ws(or,e.__scopeMenu),c=lc(or,e.__scopeMenu);return f.jsx(ql.Provider,{scope:e.__scopeMenu,children:f.jsx(vn,{present:s||l.open,children:f.jsx(ql.Slot,{scope:e.__scopeMenu,children:c.modal?f.jsx(q4,{...i,ref:t}):f.jsx(V4,{...i,ref:t})})})})}),q4=v.forwardRef((e,t)=>{const r=Ws(or,e.__scopeMenu),s=v.useRef(null),i=Je(t,s);return v.useEffect(()=>{const l=s.current;if(l)return ef(l)},[]),f.jsx(ev,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ye(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),V4=v.forwardRef((e,t)=>{const r=Ws(or,e.__scopeMenu);return f.jsx(ev,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),G4=HL("MenuContent.ScrollLock"),ev=v.forwardRef((e,t)=>{const{__scopeMenu:r,loop:s=!1,trapFocus:i,onOpenAutoFocus:l,onCloseAutoFocus:c,disableOutsidePointerEvents:d,onEntryFocus:h,onEscapeKeyDown:m,onPointerDownOutside:b,onFocusOutside:g,onInteractOutside:x,onDismiss:w,disableOutsideScroll:E,...S}=e,N=Ws(or,r),C=lc(or,r),A=nf(r),j=G1(r),k=L4(r),[I,z]=v.useState(null),P=v.useRef(null),H=Je(t,P,N.onContentChange),Z=v.useRef(0),de=v.useRef(""),ue=v.useRef(0),me=v.useRef(null),fe=v.useRef("right"),pe=v.useRef(0),ge=E?ic:v.Fragment,R=E?{as:G4,allowPinchZoom:!0}:void 0,q=X=>{var ee,Q;const G=de.current+X,O=k().filter(ae=>!ae.disabled),M=document.activeElement,$=(ee=O.find(ae=>ae.ref.current===M))==null?void 0:ee.textValue,Y=O.map(ae=>ae.textValue),B=rz(Y,G,$),ne=(Q=O.find(ae=>ae.textValue===B))==null?void 0:Q.ref.current;(function ae(se){de.current=se,window.clearTimeout(Z.current),se!==""&&(Z.current=window.setTimeout(()=>ae(""),1e3))})(G),ne&&setTimeout(()=>ne.focus())};v.useEffect(()=>()=>window.clearTimeout(Z.current),[]),Kd();const K=v.useCallback(X=>{var O,M;return fe.current===((O=me.current)==null?void 0:O.side)&&sz(X,(M=me.current)==null?void 0:M.area)},[]);return f.jsx(H4,{scope:r,searchRef:de,onItemEnter:v.useCallback(X=>{K(X)&&X.preventDefault()},[K]),onItemLeave:v.useCallback(X=>{var G;K(X)||((G=P.current)==null||G.focus(),z(null))},[K]),onTriggerLeave:v.useCallback(X=>{K(X)&&X.preventDefault()},[K]),pointerGraceTimerRef:ue,onPointerGraceIntentChange:v.useCallback(X=>{me.current=X},[]),children:f.jsx(ge,{...R,children:f.jsx(nc,{asChild:!0,trapped:i,onMountAutoFocus:ye(l,X=>{var G;X.preventDefault(),(G=P.current)==null||G.focus({preventScroll:!0})}),onUnmountAutoFocus:c,children:f.jsx(tc,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:m,onPointerDownOutside:b,onFocusOutside:g,onInteractOutside:x,onDismiss:w,children:f.jsx(D1,{asChild:!0,...j,dir:C.dir,orientation:"vertical",loop:s,currentTabStopId:I,onCurrentTabStopIdChange:z,onEntryFocus:ye(h,X=>{C.isUsingKeyboardRef.current||X.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(Yg,{role:"menu","aria-orientation":"vertical","data-state":dE(N.open),"data-radix-menu-content":"",dir:C.dir,...A,...S,ref:H,style:{outline:"none",...S.style},onKeyDown:ye(S.onKeyDown,X=>{const O=X.target.closest("[data-radix-menu-content]")===X.currentTarget,M=X.ctrlKey||X.altKey||X.metaKey,$=X.key.length===1;O&&(X.key==="Tab"&&X.preventDefault(),!M&&$&&q(X.key));const Y=P.current;if(X.target!==Y||!M4.includes(X.key))return;X.preventDefault();const ne=k().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);q1.includes(X.key)&&ne.reverse(),tz(ne)}),onBlur:ye(e.onBlur,X=>{X.currentTarget.contains(X.target)||(window.clearTimeout(Z.current),de.current="")}),onPointerMove:ye(e.onPointerMove,Vl(X=>{const G=X.target,O=pe.current!==X.clientX;if(X.currentTarget.contains(G)&&O){const M=X.clientX>pe.current?"right":"left";fe.current=M,pe.current=X.clientX}}))})})})})})})});Y1.displayName=or;var F4="MenuGroup",tv=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return f.jsx(ke.div,{role:"group",...s,ref:t})});tv.displayName=F4;var K4="MenuLabel",X1=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return f.jsx(ke.div,{...s,ref:t})});X1.displayName=K4;var Td="MenuItem",o_="menu.itemSelect",rf=v.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:s,...i}=e,l=v.useRef(null),c=lc(Td,e.__scopeMenu),d=Zg(Td,e.__scopeMenu),h=Je(t,l),m=v.useRef(!1),b=()=>{const g=l.current;if(!r&&g){const x=new CustomEvent(o_,{bubbles:!0,cancelable:!0});g.addEventListener(o_,w=>s==null?void 0:s(w),{once:!0}),a1(g,x),x.defaultPrevented?m.current=!1:c.onClose()}};return f.jsx(J1,{...i,ref:h,disabled:r,onClick:ye(e.onClick,b),onPointerDown:g=>{var x;(x=e.onPointerDown)==null||x.call(e,g),m.current=!0},onPointerUp:ye(e.onPointerUp,g=>{var x;m.current||(x=g.currentTarget)==null||x.click()}),onKeyDown:ye(e.onKeyDown,g=>{const x=d.searchRef.current!=="";r||x&&g.key===" "||Wp.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});rf.displayName=Td;var J1=v.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:s=!1,textValue:i,...l}=e,c=Zg(Td,r),d=G1(r),h=v.useRef(null),m=Je(t,h),[b,g]=v.useState(!1),[x,w]=v.useState("");return v.useEffect(()=>{const E=h.current;E&&w((E.textContent??"").trim())},[l.children]),f.jsx(ql.ItemSlot,{scope:r,disabled:s,textValue:i??x,children:f.jsx(P1,{asChild:!0,...d,focusable:!s,children:f.jsx(ke.div,{role:"menuitem","data-highlighted":b?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...l,ref:m,onPointerMove:ye(e.onPointerMove,Vl(E=>{s?c.onItemLeave(E):(c.onItemEnter(E),E.defaultPrevented||E.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ye(e.onPointerLeave,Vl(E=>c.onItemLeave(E))),onFocus:ye(e.onFocus,()=>g(!0)),onBlur:ye(e.onBlur,()=>g(!1))})})})}),W4="MenuCheckboxItem",Q1=v.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:s,...i}=e;return f.jsx(rE,{scope:e.__scopeMenu,checked:r,children:f.jsx(rf,{role:"menuitemcheckbox","aria-checked":jd(r)?"mixed":r,...i,ref:t,"data-state":rv(r),onSelect:ye(i.onSelect,()=>s==null?void 0:s(jd(r)?!0:!r),{checkForDefaultPrevented:!1})})})});Q1.displayName=W4;var Z1="MenuRadioGroup",[Y4,X4]=Ks(Z1,{value:void 0,onValueChange:()=>{}}),eE=v.forwardRef((e,t)=>{const{value:r,onValueChange:s,...i}=e,l=nn(s);return f.jsx(Y4,{scope:e.__scopeMenu,value:r,onValueChange:l,children:f.jsx(tv,{...i,ref:t})})});eE.displayName=Z1;var tE="MenuRadioItem",nE=v.forwardRef((e,t)=>{const{value:r,...s}=e,i=X4(tE,e.__scopeMenu),l=r===i.value;return f.jsx(rE,{scope:e.__scopeMenu,checked:l,children:f.jsx(rf,{role:"menuitemradio","aria-checked":l,...s,ref:t,"data-state":rv(l),onSelect:ye(s.onSelect,()=>{var c;return(c=i.onValueChange)==null?void 0:c.call(i,r)},{checkForDefaultPrevented:!1})})})});nE.displayName=tE;var nv="MenuItemIndicator",[rE,J4]=Ks(nv,{checked:!1}),aE=v.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:s,...i}=e,l=J4(nv,r);return f.jsx(vn,{present:s||jd(l.checked)||l.checked===!0,children:f.jsx(ke.span,{...i,ref:t,"data-state":rv(l.checked)})})});aE.displayName=nv;var Q4="MenuSeparator",sE=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return f.jsx(ke.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});sE.displayName=Q4;var Z4="MenuArrow",iE=v.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,i=nf(r);return f.jsx(Xg,{...i,...s,ref:t})});iE.displayName=Z4;var ez="MenuSub",[S8,oE]=Ks(ez),_l="MenuSubTrigger",lE=v.forwardRef((e,t)=>{const r=Ws(_l,e.__scopeMenu),s=lc(_l,e.__scopeMenu),i=oE(_l,e.__scopeMenu),l=Zg(_l,e.__scopeMenu),c=v.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:h}=l,m={__scopeMenu:e.__scopeMenu},b=v.useCallback(()=>{c.current&&window.clearTimeout(c.current),c.current=null},[]);return v.useEffect(()=>b,[b]),v.useEffect(()=>{const g=d.current;return()=>{window.clearTimeout(g),h(null)}},[d,h]),f.jsx(Jg,{asChild:!0,...m,children:f.jsx(J1,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":dE(r.open),...e,ref:wn(t,i.onTriggerChange),onClick:g=>{var x;(x=e.onClick)==null||x.call(e,g),!(e.disabled||g.defaultPrevented)&&(g.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ye(e.onPointerMove,Vl(g=>{l.onItemEnter(g),!g.defaultPrevented&&!e.disabled&&!r.open&&!c.current&&(l.onPointerGraceIntentChange(null),c.current=window.setTimeout(()=>{r.onOpenChange(!0),b()},100))})),onPointerLeave:ye(e.onPointerLeave,Vl(g=>{var w,E;b();const x=(w=r.content)==null?void 0:w.getBoundingClientRect();if(x){const S=(E=r.content)==null?void 0:E.dataset.side,N=S==="right",C=N?-5:5,A=x[N?"left":"right"],j=x[N?"right":"left"];l.onPointerGraceIntentChange({area:[{x:g.clientX+C,y:g.clientY},{x:A,y:x.top},{x:j,y:x.top},{x:j,y:x.bottom},{x:A,y:x.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:ye(e.onKeyDown,g=>{var w;const x=l.searchRef.current!=="";e.disabled||x&&g.key===" "||D4[s.dir].includes(g.key)&&(r.onOpenChange(!0),(w=r.content)==null||w.focus(),g.preventDefault())})})})});lE.displayName=_l;var cE="MenuSubContent",uE=v.forwardRef((e,t)=>{const r=K1(or,e.__scopeMenu),{forceMount:s=r.forceMount,...i}=e,l=Ws(or,e.__scopeMenu),c=lc(or,e.__scopeMenu),d=oE(cE,e.__scopeMenu),h=v.useRef(null),m=Je(t,h);return f.jsx(ql.Provider,{scope:e.__scopeMenu,children:f.jsx(vn,{present:s||l.open,children:f.jsx(ql.Slot,{scope:e.__scopeMenu,children:f.jsx(ev,{id:d.contentId,"aria-labelledby":d.triggerId,...i,ref:m,align:"start",side:c.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:b=>{var g;c.isUsingKeyboardRef.current&&((g=h.current)==null||g.focus()),b.preventDefault()},onCloseAutoFocus:b=>b.preventDefault(),onFocusOutside:ye(e.onFocusOutside,b=>{b.target!==d.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:ye(e.onEscapeKeyDown,b=>{c.onClose(),b.preventDefault()}),onKeyDown:ye(e.onKeyDown,b=>{var w;const g=b.currentTarget.contains(b.target),x=P4[c.dir].includes(b.key);g&&x&&(l.onOpenChange(!1),(w=d.trigger)==null||w.focus(),b.preventDefault())})})})})})});uE.displayName=cE;function dE(e){return e?"open":"closed"}function jd(e){return e==="indeterminate"}function rv(e){return jd(e)?"indeterminate":e?"checked":"unchecked"}function tz(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function nz(e,t){return e.map((r,s)=>e[(t+s)%e.length])}function rz(e,t,r){const i=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,l=r?e.indexOf(r):-1;let c=nz(e,Math.max(l,0));i.length===1&&(c=c.filter(m=>m!==r));const h=c.find(m=>m.toLowerCase().startsWith(i.toLowerCase()));return h!==r?h:void 0}function az(e,t){const{x:r,y:s}=e;let i=!1;for(let l=0,c=t.length-1;l<t.length;c=l++){const d=t[l],h=t[c],m=d.x,b=d.y,g=h.x,x=h.y;b>s!=x>s&&r<(g-m)*(s-b)/(x-b)+m&&(i=!i)}return i}function sz(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return az(r,t)}function Vl(e){return t=>t.pointerType==="mouse"?e(t):void 0}var iz=F1,oz=Jg,lz=W1,cz=Y1,uz=tv,dz=X1,fz=rf,hz=Q1,mz=eE,pz=nE,gz=aE,vz=sE,yz=iE,bz=lE,xz=uE,af="DropdownMenu",[wz]=cr(af,[V1]),_n=V1(),[_z,fE]=wz(af),hE=e=>{const{__scopeDropdownMenu:t,children:r,dir:s,open:i,defaultOpen:l,onOpenChange:c,modal:d=!0}=e,h=_n(t),m=v.useRef(null),[b,g]=ma({prop:i,defaultProp:l??!1,onChange:c,caller:af});return f.jsx(_z,{scope:t,triggerId:dn(),triggerRef:m,contentId:dn(),open:b,onOpenChange:g,onOpenToggle:v.useCallback(()=>g(x=>!x),[g]),modal:d,children:f.jsx(iz,{...h,open:b,onOpenChange:g,dir:s,modal:d,children:r})})};hE.displayName=af;var mE="DropdownMenuTrigger",pE=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:s=!1,...i}=e,l=fE(mE,r),c=_n(r);return f.jsx(oz,{asChild:!0,...c,children:f.jsx(ke.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,...i,ref:wn(t,l.triggerRef),onPointerDown:ye(e.onPointerDown,d=>{!s&&d.button===0&&d.ctrlKey===!1&&(l.onOpenToggle(),l.open||d.preventDefault())}),onKeyDown:ye(e.onKeyDown,d=>{s||(["Enter"," "].includes(d.key)&&l.onOpenToggle(),d.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})});pE.displayName=mE;var Sz="DropdownMenuPortal",gE=e=>{const{__scopeDropdownMenu:t,...r}=e,s=_n(t);return f.jsx(lz,{...s,...r})};gE.displayName=Sz;var vE="DropdownMenuContent",yE=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=fE(vE,r),l=_n(r),c=v.useRef(!1);return f.jsx(cz,{id:i.contentId,"aria-labelledby":i.triggerId,...l,...s,ref:t,onCloseAutoFocus:ye(e.onCloseAutoFocus,d=>{var h;c.current||(h=i.triggerRef.current)==null||h.focus(),c.current=!1,d.preventDefault()}),onInteractOutside:ye(e.onInteractOutside,d=>{const h=d.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0,b=h.button===2||m;(!i.modal||b)&&(c.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)"}})});yE.displayName=vE;var Ez="DropdownMenuGroup",Cz=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=_n(r);return f.jsx(uz,{...i,...s,ref:t})});Cz.displayName=Ez;var Nz="DropdownMenuLabel",bE=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=_n(r);return f.jsx(dz,{...i,...s,ref:t})});bE.displayName=Nz;var Tz="DropdownMenuItem",xE=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=_n(r);return f.jsx(fz,{...i,...s,ref:t})});xE.displayName=Tz;var jz="DropdownMenuCheckboxItem",wE=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=_n(r);return f.jsx(hz,{...i,...s,ref:t})});wE.displayName=jz;var Az="DropdownMenuRadioGroup",Rz=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=_n(r);return f.jsx(mz,{...i,...s,ref:t})});Rz.displayName=Az;var kz="DropdownMenuRadioItem",_E=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=_n(r);return f.jsx(pz,{...i,...s,ref:t})});_E.displayName=kz;var Oz="DropdownMenuItemIndicator",SE=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=_n(r);return f.jsx(gz,{...i,...s,ref:t})});SE.displayName=Oz;var Mz="DropdownMenuSeparator",EE=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=_n(r);return f.jsx(vz,{...i,...s,ref:t})});EE.displayName=Mz;var Dz="DropdownMenuArrow",Pz=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=_n(r);return f.jsx(yz,{...i,...s,ref:t})});Pz.displayName=Dz;var Lz="DropdownMenuSubTrigger",CE=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=_n(r);return f.jsx(bz,{...i,...s,ref:t})});CE.displayName=Lz;var zz="DropdownMenuSubContent",NE=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,i=_n(r);return f.jsx(xz,{...i,...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)"}})});NE.displayName=zz;var Iz=hE,$z=pE,Uz=gE,TE=yE,jE=bE,AE=xE,RE=wE,kE=_E,OE=SE,ME=EE,DE=CE,PE=NE;const Bz=Iz,Hz=$z,qz=v.forwardRef(({className:e,inset:t,children:r,...s},i)=>f.jsxs(DE,{ref:i,className:xe("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,f.jsx(Fd,{className:"ml-auto"})]}));qz.displayName=DE.displayName;const Vz=v.forwardRef(({className:e,...t},r)=>f.jsx(PE,{ref:r,className:xe("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}));Vz.displayName=PE.displayName;const LE=v.forwardRef(({className:e,sideOffset:t=4,...r},s)=>f.jsx(Uz,{children:f.jsx(TE,{ref:s,sideOffset:t,className:xe("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})}));LE.displayName=TE.displayName;const zE=v.forwardRef(({className:e,inset:t,...r},s)=>f.jsx(AE,{ref:s,className:xe("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}));zE.displayName=AE.displayName;const Gz=v.forwardRef(({className:e,children:t,checked:r,...s},i)=>f.jsxs(RE,{ref:i,className:xe("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:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(OE,{children:f.jsx(ha,{className:"h-4 w-4"})})}),t]}));Gz.displayName=RE.displayName;const Fz=v.forwardRef(({className:e,children:t,...r},s)=>f.jsxs(kE,{ref:s,className:xe("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:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(OE,{children:f.jsx(z5,{className:"h-2 w-2 fill-current"})})}),t]}));Fz.displayName=kE.displayName;const Kz=v.forwardRef(({className:e,inset:t,...r},s)=>f.jsx(jE,{ref:s,className:xe("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));Kz.displayName=jE.displayName;const IE=v.forwardRef(({className:e,...t},r)=>f.jsx(ME,{ref:r,className:xe("-mx-1 my-1 h-px bg-muted",e),...t}));IE.displayName=ME.displayName;function Wz(e,t=[]){let r=[];function s(l,c){const d=v.createContext(c);d.displayName=l+"Context";const h=r.length;r=[...r,c];const m=g=>{var C;const{scope:x,children:w,...E}=g,S=((C=x==null?void 0:x[e])==null?void 0:C[h])||d,N=v.useMemo(()=>E,Object.values(E));return f.jsx(S.Provider,{value:N,children:w})};m.displayName=l+"Provider";function b(g,x){var S;const w=((S=x==null?void 0:x[e])==null?void 0:S[h])||d,E=v.useContext(w);if(E)return E;if(c!==void 0)return c;throw new Error(`\`${g}\` must be used within \`${l}\``)}return[m,b]}const i=()=>{const l=r.map(c=>v.createContext(c));return function(d){const h=(d==null?void 0:d[e])||l;return v.useMemo(()=>({[`__scope${e}`]:{...d,[e]:h}}),[d,h])}};return i.scopeName=e,[s,Yz(i,...t)]}function Yz(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(l){const c=s.reduce((d,{useScope:h,scopeName:m})=>{const g=h(l)[`__scope${m}`];return{...d,...g}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return r.scopeName=t.scopeName,r}var Xz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],av=Xz.reduce((e,t)=>{const r=Gd(`Primitive.${t}`),s=v.forwardRef((i,l)=>{const{asChild:c,...d}=i,h=c?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(h,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),op={exports:{}},lp={};/**
* @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 l_;function Jz(){if(l_)return lp;l_=1;var e=Id();function t(g,x){return g===x&&(g!==0||1/g===1/x)||g!==g&&x!==x}var r=typeof Object.is=="function"?Object.is:t,s=e.useState,i=e.useEffect,l=e.useLayoutEffect,c=e.useDebugValue;function d(g,x){var w=x(),E=s({inst:{value:w,getSnapshot:x}}),S=E[0].inst,N=E[1];return l(function(){S.value=w,S.getSnapshot=x,h(S)&&N({inst:S})},[g,w,x]),i(function(){return h(S)&&N({inst:S}),g(function(){h(S)&&N({inst:S})})},[g]),c(w),w}function h(g){var x=g.getSnapshot;g=g.value;try{var w=x();return!r(g,w)}catch{return!0}}function m(g,x){return x()}var b=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:d;return lp.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:b,lp}var c_;function Qz(){return c_||(c_=1,op.exports=Jz()),op.exports}var Zz=Qz();function eI(){return Zz.useSyncExternalStore(tI,()=>!0,()=>!1)}function tI(){return()=>{}}var sv="Avatar",[nI]=Wz(sv),[rI,$E]=nI(sv),UE=v.forwardRef((e,t)=>{const{__scopeAvatar:r,...s}=e,[i,l]=v.useState("idle");return f.jsx(rI,{scope:r,imageLoadingStatus:i,onImageLoadingStatusChange:l,children:f.jsx(av.span,{...s,ref:t})})});UE.displayName=sv;var BE="AvatarImage",HE=v.forwardRef((e,t)=>{const{__scopeAvatar:r,src:s,onLoadingStatusChange:i=()=>{},...l}=e,c=$E(BE,r),d=aI(s,l),h=nn(m=>{i(m),c.onImageLoadingStatusChange(m)});return Ft(()=>{d!=="idle"&&h(d)},[d,h]),d==="loaded"?f.jsx(av.img,{...l,ref:t,src:s}):null});HE.displayName=BE;var qE="AvatarFallback",VE=v.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:s,...i}=e,l=$E(qE,r),[c,d]=v.useState(s===void 0);return v.useEffect(()=>{if(s!==void 0){const h=window.setTimeout(()=>d(!0),s);return()=>window.clearTimeout(h)}},[s]),c&&l.imageLoadingStatus!=="loaded"?f.jsx(av.span,{...i,ref:t}):null});VE.displayName=qE;function u_(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function aI(e,{referrerPolicy:t,crossOrigin:r}){const s=eI(),i=v.useRef(null),l=s?(i.current||(i.current=new window.Image),i.current):null,[c,d]=v.useState(()=>u_(l,e));return Ft(()=>{d(u_(l,e))},[l,e]),Ft(()=>{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]),c}var GE=UE,FE=HE,KE=VE;const WE=v.forwardRef(({className:e,...t},r)=>f.jsx(GE,{ref:r,className:xe("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));WE.displayName=GE.displayName;const YE=v.forwardRef(({className:e,...t},r)=>f.jsx(FE,{ref:r,className:xe("aspect-square h-full w-full",e),...t}));YE.displayName=FE.displayName;const XE=v.forwardRef(({className:e,...t},r)=>f.jsx(KE,{ref:r,className:xe("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));XE.displayName=KE.displayName;const sI=Rg("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 xn({className:e,variant:t,...r}){return f.jsx("div",{className:xe(sI({variant:t}),e),...r})}const iI=["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(),iv={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",WMC:"Willy"},JE=Object.keys(iv).sort(),oI=["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"],lI=["Aprobado","No aprobado","Stand by","Aprobado /no ejecutado","Pre aprobado","On going","Sin respuesta"],Yp=[{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"}],cI=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"];function QE(e){var t;return((t=Yp.find(r=>r.id===e))==null?void 0:t.hex)??Yp[0].hex}function uI({project:e,onClick:t,onTimeClick:r,showInternalAmount:s=!1}){const i=!!e.status,l=Number(e.monto),c=s&&e.monto!==null&&Number.isFinite(l)&&l>0,d=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),t())};return f.jsxs("div",{"data-cdc-project-id":e.id,"data-cdc-project-country":e.bu,"data-cdc-project-name":e.nombre||"Sin título",role:"button",tabIndex:0,onClick:t,onKeyDown:d,className:xe("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",i&&"opacity-65 hover:opacity-90"),style:{boxShadow:i?"0 1px 2px oklch(0.5 0.02 280 / 0.04)":"var(--shadow-soft)"},onMouseEnter:h=>{i||(h.currentTarget.style.boxShadow="var(--shadow-hover)")},onMouseLeave:h=>{h.currentTarget.style.boxShadow=i?"0 1px 2px oklch(0.5 0.02 280 / 0.04)":"var(--shadow-soft)"},children:[f.jsx("div",{className:"min-h-14 rounded-t-2xl px-4 py-3",style:{backgroundColor:i?"#9AA0A6":QE(e.color)},children:f.jsx("h3",{className:"text-white font-semibold text-sm leading-snug line-clamp-2 drop-shadow-sm",children:e.nombre||"Sin título"})}),f.jsxs("div",{className:"p-4 space-y-2.5",children:[f.jsx(Bu,{icon:f.jsx(_d,{className:"w-3.5 h-3.5"}),label:"Cliente",value:e.cliente}),f.jsx(Bu,{icon:f.jsx(_d,{className:"w-3.5 h-3.5"}),label:"Marca",value:e.marca}),f.jsx(Bu,{icon:f.jsx(wd,{className:"w-3.5 h-3.5"}),label:"País",value:e.bu}),f.jsx(Bu,{icon:f.jsx(r1,{className:"w-3.5 h-3.5"}),label:"Solicita",value:e.solicitante}),f.jsxs("div",{className:"flex items-center justify-between pt-2 mt-2 border-t border-border/70",children:[f.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[r&&f.jsxs("button",{type:"button",onClick:h=>{h.stopPropagation(),r()},onKeyDown:h=>h.stopPropagation(),className:"inline-flex h-7 items-center gap-1 rounded-full border border-border bg-card px-2.5 font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:"Agregar o ver tiempo dedicado",children:[f.jsx(jl,{className:"h-3.5 w-3.5"}),"Tiempo"]}),e.propuestaLinks.length>0&&f.jsxs("span",{className:"flex items-center gap-1",title:"Propuestas",children:[f.jsx(l3,{className:"w-3 h-3"})," ",e.propuestaLinks.length]}),e.afLinks.length>0&&f.jsxs("span",{className:"flex items-center gap-1",title:"Artes finales",children:[f.jsx(F5,{className:"w-3 h-3"})," AF·",e.afLinks.length]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[c&&f.jsx("span",{className:"text-[11px] font-semibold tabular-nums text-foreground",title:"Monto interno del proyecto",children:dI(l)}),e.status&&f.jsxs(xn,{variant:"secondary",className:xe("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"&&f.jsx(t1,{className:"w-2.5 h-2.5 mr-0.5"}),e.status]})]})]})]})]})}function dI(e){return`$${e.toLocaleString("en-US",{minimumFractionDigits:Number.isInteger(e)?0:2,maximumFractionDigits:2})}`}function Bu({icon:e,label:t,value:r}){return f.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[f.jsx("span",{className:"text-muted-foreground mt-0.5 flex-shrink-0",children:e}),f.jsx("span",{className:"text-muted-foreground w-14 flex-shrink-0",children:t}),f.jsx("span",{className:"text-foreground font-medium truncate",children:r||"—"})]})}function fI(e){const t=hI(e),r=v.forwardRef((s,i)=>{const{children:l,...c}=s,d=v.Children.toArray(l),h=d.find(pI);if(h){const m=h.props.children,b=d.map(g=>g===h?v.Children.count(m)>1?v.Children.only(null):v.isValidElement(m)?m.props.children:null:g);return f.jsx(t,{...c,ref:i,children:v.isValidElement(m)?v.cloneElement(m,void 0,b):null})}return f.jsx(t,{...c,ref:i,children:l})});return r.displayName=`${e}.Slot`,r}function hI(e){const t=v.forwardRef((r,s)=>{const{children:i,...l}=r;if(v.isValidElement(i)){const c=vI(i),d=gI(l,i.props);return i.type!==v.Fragment&&(d.ref=s?wn(s,c):c),v.cloneElement(i,d)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var mI=Symbol("radix.slottable");function pI(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===mI}function gI(e,t){const r={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?r[s]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(r[s]=i):s==="style"?r[s]={...i,...l}:s==="className"&&(r[s]=[i,l].filter(Boolean).join(" "))}return{...e,...r}}function vI(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var sf="Dialog",[ZE]=cr(sf),[yI,Er]=ZE(sf),eC=e=>{const{__scopeDialog:t,children:r,open:s,defaultOpen:i,onOpenChange:l,modal:c=!0}=e,d=v.useRef(null),h=v.useRef(null),[m,b]=ma({prop:s,defaultProp:i??!1,onChange:l,caller:sf});return f.jsx(yI,{scope:t,triggerRef:d,contentRef:h,contentId:dn(),titleId:dn(),descriptionId:dn(),open:m,onOpenChange:b,onOpenToggle:v.useCallback(()=>b(g=>!g),[b]),modal:c,children:r})};eC.displayName=sf;var tC="DialogTrigger",bI=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,i=Er(tC,r),l=Je(t,i.triggerRef);return f.jsx(ke.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":cv(i.open),...s,ref:l,onClick:ye(e.onClick,i.onOpenToggle)})});bI.displayName=tC;var ov="DialogPortal",[xI,nC]=ZE(ov,{forceMount:void 0}),rC=e=>{const{__scopeDialog:t,forceMount:r,children:s,container:i}=e,l=Er(ov,t);return f.jsx(xI,{scope:t,forceMount:r,children:v.Children.map(s,c=>f.jsx(vn,{present:r||l.open,children:f.jsx(ac,{asChild:!0,container:i,children:c})}))})};rC.displayName=ov;var Ad="DialogOverlay",aC=v.forwardRef((e,t)=>{const r=nC(Ad,e.__scopeDialog),{forceMount:s=r.forceMount,...i}=e,l=Er(Ad,e.__scopeDialog);return l.modal?f.jsx(vn,{present:s||l.open,children:f.jsx(_I,{...i,ref:t})}):null});aC.displayName=Ad;var wI=fI("DialogOverlay.RemoveScroll"),_I=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,i=Er(Ad,r);return f.jsx(ic,{as:wI,allowPinchZoom:!0,shards:[i.contentRef],children:f.jsx(ke.div,{"data-state":cv(i.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),Hs="DialogContent",sC=v.forwardRef((e,t)=>{const r=nC(Hs,e.__scopeDialog),{forceMount:s=r.forceMount,...i}=e,l=Er(Hs,e.__scopeDialog);return f.jsx(vn,{present:s||l.open,children:l.modal?f.jsx(SI,{...i,ref:t}):f.jsx(EI,{...i,ref:t})})});sC.displayName=Hs;var SI=v.forwardRef((e,t)=>{const r=Er(Hs,e.__scopeDialog),s=v.useRef(null),i=Je(t,r.contentRef,s);return v.useEffect(()=>{const l=s.current;if(l)return ef(l)},[]),f.jsx(iC,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ye(e.onCloseAutoFocus,l=>{var c;l.preventDefault(),(c=r.triggerRef.current)==null||c.focus()}),onPointerDownOutside:ye(e.onPointerDownOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0;(c.button===2||d)&&l.preventDefault()}),onFocusOutside:ye(e.onFocusOutside,l=>l.preventDefault())})}),EI=v.forwardRef((e,t)=>{const r=Er(Hs,e.__scopeDialog),s=v.useRef(!1),i=v.useRef(!1);return f.jsx(iC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var c,d;(c=e.onCloseAutoFocus)==null||c.call(e,l),l.defaultPrevented||(s.current||(d=r.triggerRef.current)==null||d.focus(),l.preventDefault()),s.current=!1,i.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"&&(i.current=!0));const c=l.target;((m=r.triggerRef.current)==null?void 0:m.contains(c))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&i.current&&l.preventDefault()}})}),iC=v.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:l,...c}=e,d=Er(Hs,r),h=v.useRef(null),m=Je(t,h);return Kd(),f.jsxs(f.Fragment,{children:[f.jsx(nc,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:l,children:f.jsx(tc,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":cv(d.open),...c,ref:m,onDismiss:()=>d.onOpenChange(!1)})}),f.jsxs(f.Fragment,{children:[f.jsx(CI,{titleId:d.titleId}),f.jsx(TI,{contentRef:h,descriptionId:d.descriptionId})]})]})}),lv="DialogTitle",oC=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,i=Er(lv,r);return f.jsx(ke.h2,{id:i.titleId,...s,ref:t})});oC.displayName=lv;var lC="DialogDescription",cC=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,i=Er(lC,r);return f.jsx(ke.p,{id:i.descriptionId,...s,ref:t})});cC.displayName=lC;var uC="DialogClose",dC=v.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,i=Er(uC,r);return f.jsx(ke.button,{type:"button",...s,ref:t,onClick:ye(e.onClick,()=>i.onOpenChange(!1))})});dC.displayName=uC;function cv(e){return e?"open":"closed"}var fC="DialogTitleWarning",[E8,hC]=P3(fC,{contentName:Hs,titleName:lv,docsSlug:"dialog"}),CI=({titleId:e})=>{const t=hC(fC),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 v.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},NI="DialogDescriptionWarning",TI=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${hC(NI).contentName}}.`;return v.useEffect(()=>{var l;const i=(l=e.current)==null?void 0:l.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},mC=eC,pC=rC,uv=aC,dv=sC,gC=oC,vC=cC,jI=dC;const cc=mC,AI=pC,yC=v.forwardRef(({className:e,...t},r)=>f.jsx(uv,{ref:r,className:xe("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}));yC.displayName=uv.displayName;const yo=v.forwardRef(({className:e,children:t,...r},s)=>f.jsxs(AI,{children:[f.jsx(yC,{}),f.jsxs(dv,{ref:s,className:xe("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,f.jsxs(jI,{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:[f.jsx(Bl,{className:"h-4 w-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));yo.displayName=dv.displayName;const bo=({className:e,...t})=>f.jsx("div",{className:xe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});bo.displayName="DialogHeader";const of=({className:e,...t})=>f.jsx("div",{className:xe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});of.displayName="DialogFooter";const xo=v.forwardRef(({className:e,...t},r)=>f.jsx(gC,{ref:r,className:xe("text-lg font-semibold leading-none tracking-tight",e),...t}));xo.displayName=gC.displayName;const wo=v.forwardRef(({className:e,...t},r)=>f.jsx(vC,{ref:r,className:xe("text-sm text-muted-foreground",e),...t}));wo.displayName=vC.displayName;var RI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],kI=RI.reduce((e,t)=>{const r=Gd(`Primitive.${t}`),s=v.forwardRef((i,l)=>{const{asChild:c,...d}=i,h=c?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(h,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),OI="Label",bC=v.forwardRef((e,t)=>f.jsx(kI.label,{...e,ref:t,onMouseDown:r=>{var i;r.target.closest("button, input, select, textarea")||((i=e.onMouseDown)==null||i.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));bC.displayName=OI;var xC=bC;const MI=Rg("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),He=v.forwardRef(({className:e,...t},r)=>f.jsx(xC,{ref:r,className:xe(MI(),e),...t}));He.displayName=xC.displayName;const da=v.forwardRef(({className:e,...t},r)=>f.jsx("textarea",{className:xe("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}));da.displayName="Textarea";function fv(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var lf="Checkbox",[DI]=cr(lf),[PI,hv]=DI(lf);function LI(e){const{__scopeCheckbox:t,checked:r,children:s,defaultChecked:i,disabled:l,form:c,name:d,onCheckedChange:h,required:m,value:b="on",internal_do_not_use_render:g}=e,[x,w]=ma({prop:r,defaultProp:i??!1,onChange:h,caller:lf}),[E,S]=v.useState(null),[N,C]=v.useState(null),A=v.useRef(!1),j=E?!!c||!!E.closest("form"):!0,k={checked:x,disabled:l,setChecked:w,control:E,setControl:S,name:d,form:c,value:b,hasConsumerStoppedPropagationRef:A,required:m,defaultChecked:ns(i)?!1:i,isFormControl:j,bubbleInput:N,setBubbleInput:C};return f.jsx(PI,{scope:t,...k,children:zI(g)?g(k):s})}var wC="CheckboxTrigger",_C=v.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...s},i)=>{const{control:l,value:c,disabled:d,checked:h,required:m,setControl:b,setChecked:g,hasConsumerStoppedPropagationRef:x,isFormControl:w,bubbleInput:E}=hv(wC,e),S=Je(i,b),N=v.useRef(h);return v.useEffect(()=>{const C=l==null?void 0:l.form;if(C){const A=()=>g(N.current);return C.addEventListener("reset",A),()=>C.removeEventListener("reset",A)}},[l,g]),f.jsx(ke.button,{type:"button",role:"checkbox","aria-checked":ns(h)?"mixed":h,"aria-required":m,"data-state":TC(h),"data-disabled":d?"":void 0,disabled:d,value:c,...s,ref:S,onKeyDown:ye(t,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:ye(r,C=>{g(A=>ns(A)?!0:!A),E&&w&&(x.current=C.isPropagationStopped(),x.current||C.stopPropagation())})})});_C.displayName=wC;var mv=v.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:s,checked:i,defaultChecked:l,required:c,disabled:d,value:h,onCheckedChange:m,form:b,...g}=e;return f.jsx(LI,{__scopeCheckbox:r,checked:i,defaultChecked:l,disabled:d,required:c,onCheckedChange:m,name:s,form:b,value:h,internal_do_not_use_render:({isFormControl:x})=>f.jsxs(f.Fragment,{children:[f.jsx(_C,{...g,ref:t,__scopeCheckbox:r}),x&&f.jsx(NC,{__scopeCheckbox:r})]})})});mv.displayName=lf;var SC="CheckboxIndicator",EC=v.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:s,...i}=e,l=hv(SC,r);return f.jsx(vn,{present:s||ns(l.checked)||l.checked===!0,children:f.jsx(ke.span,{"data-state":TC(l.checked),"data-disabled":l.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});EC.displayName=SC;var CC="CheckboxBubbleInput",NC=v.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:s,hasConsumerStoppedPropagationRef:i,checked:l,defaultChecked:c,required:d,disabled:h,name:m,value:b,form:g,bubbleInput:x,setBubbleInput:w}=hv(CC,e),E=Je(r,w),S=fv(l),N=Gg(s);v.useEffect(()=>{const A=x;if(!A)return;const j=window.HTMLInputElement.prototype,I=Object.getOwnPropertyDescriptor(j,"checked").set,z=!i.current;if(S!==l&&I){const P=new Event("click",{bubbles:z});A.indeterminate=ns(l),I.call(A,ns(l)?!1:l),A.dispatchEvent(P)}},[x,S,l,i]);const C=v.useRef(ns(l)?!1:l);return f.jsx(ke.input,{type:"checkbox","aria-hidden":!0,defaultChecked:c??C.current,required:d,disabled:h,name:m,value:b,form:g,...t,tabIndex:-1,ref:E,style:{...t.style,...N,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});NC.displayName=CC;function zI(e){return typeof e=="function"}function ns(e){return e==="indeterminate"}function TC(e){return ns(e)?"indeterminate":e?"checked":"unchecked"}const jC=v.forwardRef(({className:e,...t},r)=>f.jsx(mv,{ref:r,className:xe("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:f.jsx(EC,{className:xe("grid place-content-center text-current"),children:f.jsx(ha,{className:"h-4 w-4"})})}));jC.displayName=mv.displayName;function Xp(e,[t,r]){return Math.min(r,Math.max(t,e))}function II(e){const t=$I(e),r=v.forwardRef((s,i)=>{const{children:l,...c}=s,d=v.Children.toArray(l),h=d.find(BI);if(h){const m=h.props.children,b=d.map(g=>g===h?v.Children.count(m)>1?v.Children.only(null):v.isValidElement(m)?m.props.children:null:g);return f.jsx(t,{...c,ref:i,children:v.isValidElement(m)?v.cloneElement(m,void 0,b):null})}return f.jsx(t,{...c,ref:i,children:l})});return r.displayName=`${e}.Slot`,r}function $I(e){const t=v.forwardRef((r,s)=>{const{children:i,...l}=r;if(v.isValidElement(i)){const c=qI(i),d=HI(l,i.props);return i.type!==v.Fragment&&(d.ref=s?wn(s,c):c),v.cloneElement(i,d)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var UI=Symbol("radix.slottable");function BI(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===UI}function HI(e,t){const r={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?r[s]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(r[s]=i):s==="style"?r[s]={...i,...l}:s==="className"&&(r[s]=[i,l].filter(Boolean).join(" "))}return{...e,...r}}function qI(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var AC=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"}),VI="VisuallyHidden",GI=v.forwardRef((e,t)=>f.jsx(ke.span,{...e,ref:t,style:{...AC,...e.style}}));GI.displayName=VI;var FI=[" ","Enter","ArrowUp","ArrowDown"],KI=[" ","Enter"],qs="Select",[cf,uf,WI]=Ig(qs),[_o]=cr(qs,[WI,vo]),df=vo(),[YI,os]=_o(qs),[XI,JI]=_o(qs),RC=e=>{const{__scopeSelect:t,children:r,open:s,defaultOpen:i,onOpenChange:l,value:c,defaultValue:d,onValueChange:h,dir:m,name:b,autoComplete:g,disabled:x,required:w,form:E}=e,S=df(t),[N,C]=v.useState(null),[A,j]=v.useState(null),[k,I]=v.useState(!1),z=ec(m),[P,H]=ma({prop:s,defaultProp:i??!1,onChange:l,caller:qs}),[Z,de]=ma({prop:c,defaultProp:d,onChange:h,caller:qs}),ue=v.useRef(null),me=N?E||!!N.closest("form"):!0,[fe,pe]=v.useState(new Set),ge=Array.from(fe).map(R=>R.props.value).join(";");return f.jsx(Wg,{...S,children:f.jsxs(YI,{required:w,scope:t,trigger:N,onTriggerChange:C,valueNode:A,onValueNodeChange:j,valueNodeHasChildren:k,onValueNodeHasChildrenChange:I,contentId:dn(),value:Z,onValueChange:de,open:P,onOpenChange:H,dir:z,triggerPointerDownPosRef:ue,disabled:x,children:[f.jsx(cf.Provider,{scope:t,children:f.jsx(XI,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(R=>{pe(q=>new Set(q).add(R))},[]),onNativeOptionRemove:v.useCallback(R=>{pe(q=>{const K=new Set(q);return K.delete(R),K})},[]),children:r})}),me?f.jsxs(eN,{"aria-hidden":!0,required:w,tabIndex:-1,name:b,autoComplete:g,value:Z,onChange:R=>de(R.target.value),disabled:x,form:E,children:[Z===void 0?f.jsx("option",{value:""}):null,Array.from(fe)]},ge):null]})})};RC.displayName=qs;var kC="SelectTrigger",OC=v.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:s=!1,...i}=e,l=df(r),c=os(kC,r),d=c.disabled||s,h=Je(t,c.onTriggerChange),m=uf(r),b=v.useRef("touch"),[g,x,w]=nN(S=>{const N=m().filter(j=>!j.disabled),C=N.find(j=>j.value===c.value),A=rN(N,S,C);A!==void 0&&c.onValueChange(A.value)}),E=S=>{d||(c.onOpenChange(!0),w()),S&&(c.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return f.jsx(Qd,{asChild:!0,...l,children:f.jsx(ke.button,{type:"button",role:"combobox","aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":tN(c.value)?"":void 0,...i,ref:h,onClick:ye(i.onClick,S=>{S.currentTarget.focus(),b.current!=="mouse"&&E(S)}),onPointerDown:ye(i.onPointerDown,S=>{b.current=S.pointerType;const N=S.target;N.hasPointerCapture(S.pointerId)&&N.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(E(S),S.preventDefault())}),onKeyDown:ye(i.onKeyDown,S=>{const N=g.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&x(S.key),!(N&&S.key===" ")&&FI.includes(S.key)&&(E(),S.preventDefault())})})})});OC.displayName=kC;var MC="SelectValue",DC=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:i,children:l,placeholder:c="",...d}=e,h=os(MC,r),{onValueNodeHasChildrenChange:m}=h,b=l!==void 0,g=Je(t,h.onValueNodeChange);return Ft(()=>{m(b)},[m,b]),f.jsx(ke.span,{...d,ref:g,style:{pointerEvents:"none"},children:tN(h.value)?f.jsx(f.Fragment,{children:c}):l})});DC.displayName=MC;var QI="SelectIcon",PC=v.forwardRef((e,t)=>{const{__scopeSelect:r,children:s,...i}=e;return f.jsx(ke.span,{"aria-hidden":!0,...i,ref:t,children:s||"▼"})});PC.displayName=QI;var ZI="SelectPortal",LC=e=>f.jsx(ac,{asChild:!0,...e});LC.displayName=ZI;var Vs="SelectContent",zC=v.forwardRef((e,t)=>{const r=os(Vs,e.__scopeSelect),[s,i]=v.useState();if(Ft(()=>{i(new DocumentFragment)},[]),!r.open){const l=s;return l?Ql.createPortal(f.jsx(IC,{scope:e.__scopeSelect,children:f.jsx(cf.Slot,{scope:e.__scopeSelect,children:f.jsx("div",{children:e.children})})}),l):null}return f.jsx($C,{...e,ref:t})});zC.displayName=Vs;var gr=10,[IC,ls]=_o(Vs),e$="SelectContentImpl",t$=II("SelectContent.RemoveScroll"),$C=v.forwardRef((e,t)=>{const{__scopeSelect:r,position:s="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:l,onPointerDownOutside:c,side:d,sideOffset:h,align:m,alignOffset:b,arrowPadding:g,collisionBoundary:x,collisionPadding:w,sticky:E,hideWhenDetached:S,avoidCollisions:N,...C}=e,A=os(Vs,r),[j,k]=v.useState(null),[I,z]=v.useState(null),P=Je(t,ee=>k(ee)),[H,Z]=v.useState(null),[de,ue]=v.useState(null),me=uf(r),[fe,pe]=v.useState(!1),ge=v.useRef(!1);v.useEffect(()=>{if(j)return ef(j)},[j]),Kd();const R=v.useCallback(ee=>{const[Q,...ae]=me().map(je=>je.ref.current),[se]=ae.slice(-1),Ee=document.activeElement;for(const je of ee)if(je===Ee||(je==null||je.scrollIntoView({block:"nearest"}),je===Q&&I&&(I.scrollTop=0),je===se&&I&&(I.scrollTop=I.scrollHeight),je==null||je.focus(),document.activeElement!==Ee))return},[me,I]),q=v.useCallback(()=>R([H,j]),[R,H,j]);v.useEffect(()=>{fe&&q()},[fe,q]);const{onOpenChange:K,triggerPointerDownPosRef:X}=A;v.useEffect(()=>{if(j){let ee={x:0,y:0};const Q=se=>{var Ee,je;ee={x:Math.abs(Math.round(se.pageX)-(((Ee=X.current)==null?void 0:Ee.x)??0)),y:Math.abs(Math.round(se.pageY)-(((je=X.current)==null?void 0:je.y)??0))}},ae=se=>{ee.x<=10&&ee.y<=10?se.preventDefault():j.contains(se.target)||K(!1),document.removeEventListener("pointermove",Q),X.current=null};return X.current!==null&&(document.addEventListener("pointermove",Q),document.addEventListener("pointerup",ae,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Q),document.removeEventListener("pointerup",ae,{capture:!0})}}},[j,K,X]),v.useEffect(()=>{const ee=()=>K(!1);return window.addEventListener("blur",ee),window.addEventListener("resize",ee),()=>{window.removeEventListener("blur",ee),window.removeEventListener("resize",ee)}},[K]);const[G,O]=nN(ee=>{const Q=me().filter(Ee=>!Ee.disabled),ae=Q.find(Ee=>Ee.ref.current===document.activeElement),se=rN(Q,ee,ae);se&&setTimeout(()=>se.ref.current.focus())}),M=v.useCallback((ee,Q,ae)=>{const se=!ge.current&&!ae;(A.value!==void 0&&A.value===Q||se)&&(Z(ee),se&&(ge.current=!0))},[A.value]),$=v.useCallback(()=>j==null?void 0:j.focus(),[j]),Y=v.useCallback((ee,Q,ae)=>{const se=!ge.current&&!ae;(A.value!==void 0&&A.value===Q||se)&&ue(ee)},[A.value]),B=s==="popper"?Jp:UC,ne=B===Jp?{side:d,sideOffset:h,align:m,alignOffset:b,arrowPadding:g,collisionBoundary:x,collisionPadding:w,sticky:E,hideWhenDetached:S,avoidCollisions:N}:{};return f.jsx(IC,{scope:r,content:j,viewport:I,onViewportChange:z,itemRefCallback:M,selectedItem:H,onItemLeave:$,itemTextRefCallback:Y,focusSelectedItem:q,selectedItemText:de,position:s,isPositioned:fe,searchRef:G,children:f.jsx(ic,{as:t$,allowPinchZoom:!0,children:f.jsx(nc,{asChild:!0,trapped:A.open,onMountAutoFocus:ee=>{ee.preventDefault()},onUnmountAutoFocus:ye(i,ee=>{var Q;(Q=A.trigger)==null||Q.focus({preventScroll:!0}),ee.preventDefault()}),children:f.jsx(tc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:ee=>ee.preventDefault(),onDismiss:()=>A.onOpenChange(!1),children:f.jsx(B,{role:"listbox",id:A.contentId,"data-state":A.open?"open":"closed",dir:A.dir,onContextMenu:ee=>ee.preventDefault(),...C,...ne,onPlaced:()=>pe(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:ye(C.onKeyDown,ee=>{const Q=ee.ctrlKey||ee.altKey||ee.metaKey;if(ee.key==="Tab"&&ee.preventDefault(),!Q&&ee.key.length===1&&O(ee.key),["ArrowUp","ArrowDown","Home","End"].includes(ee.key)){let se=me().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);if(["ArrowUp","End"].includes(ee.key)&&(se=se.slice().reverse()),["ArrowUp","ArrowDown"].includes(ee.key)){const Ee=ee.target,je=se.indexOf(Ee);se=se.slice(je+1)}setTimeout(()=>R(se)),ee.preventDefault()}})})})})})})});$C.displayName=e$;var n$="SelectItemAlignedPosition",UC=v.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:s,...i}=e,l=os(Vs,r),c=ls(Vs,r),[d,h]=v.useState(null),[m,b]=v.useState(null),g=Je(t,P=>b(P)),x=uf(r),w=v.useRef(!1),E=v.useRef(!0),{viewport:S,selectedItem:N,selectedItemText:C,focusSelectedItem:A}=c,j=v.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&m&&S&&N&&C){const P=l.trigger.getBoundingClientRect(),H=m.getBoundingClientRect(),Z=l.valueNode.getBoundingClientRect(),de=C.getBoundingClientRect();if(l.dir!=="rtl"){const Ee=de.left-H.left,je=Z.left-Ee,nt=P.left-je,Qe=P.width+nt,Et=Math.max(Qe,H.width),oe=window.innerWidth-gr,Me=Xp(je,[gr,Math.max(gr,oe-Et)]);d.style.minWidth=Qe+"px",d.style.left=Me+"px"}else{const Ee=H.right-de.right,je=window.innerWidth-Z.right-Ee,nt=window.innerWidth-P.right-je,Qe=P.width+nt,Et=Math.max(Qe,H.width),oe=window.innerWidth-gr,Me=Xp(je,[gr,Math.max(gr,oe-Et)]);d.style.minWidth=Qe+"px",d.style.right=Me+"px"}const ue=x(),me=window.innerHeight-gr*2,fe=S.scrollHeight,pe=window.getComputedStyle(m),ge=parseInt(pe.borderTopWidth,10),R=parseInt(pe.paddingTop,10),q=parseInt(pe.borderBottomWidth,10),K=parseInt(pe.paddingBottom,10),X=ge+R+fe+K+q,G=Math.min(N.offsetHeight*5,X),O=window.getComputedStyle(S),M=parseInt(O.paddingTop,10),$=parseInt(O.paddingBottom,10),Y=P.top+P.height/2-gr,B=me-Y,ne=N.offsetHeight/2,ee=N.offsetTop+ne,Q=ge+R+ee,ae=X-Q;if(Q<=Y){const Ee=ue.length>0&&N===ue[ue.length-1].ref.current;d.style.bottom="0px";const je=m.clientHeight-S.offsetTop-S.offsetHeight,nt=Math.max(B,ne+(Ee?$:0)+je+q),Qe=Q+nt;d.style.height=Qe+"px"}else{const Ee=ue.length>0&&N===ue[0].ref.current;d.style.top="0px";const nt=Math.max(Y,ge+S.offsetTop+(Ee?M:0)+ne)+ae;d.style.height=nt+"px",S.scrollTop=Q-Y+S.offsetTop}d.style.margin=`${gr}px 0`,d.style.minHeight=G+"px",d.style.maxHeight=me+"px",s==null||s(),requestAnimationFrame(()=>w.current=!0)}},[x,l.trigger,l.valueNode,d,m,S,N,C,l.dir,s]);Ft(()=>j(),[j]);const[k,I]=v.useState();Ft(()=>{m&&I(window.getComputedStyle(m).zIndex)},[m]);const z=v.useCallback(P=>{P&&E.current===!0&&(j(),A==null||A(),E.current=!1)},[j,A]);return f.jsx(a$,{scope:r,contentWrapper:d,shouldExpandOnScrollRef:w,onScrollButtonChange:z,children:f.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:f.jsx(ke.div,{...i,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});UC.displayName=n$;var r$="SelectPopperPosition",Jp=v.forwardRef((e,t)=>{const{__scopeSelect:r,align:s="start",collisionPadding:i=gr,...l}=e,c=df(r);return f.jsx(Yg,{...c,...l,ref:t,align:s,collisionPadding:i,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)"}})});Jp.displayName=r$;var[a$,pv]=_o(Vs,{}),Qp="SelectViewport",BC=v.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:s,...i}=e,l=ls(Qp,r),c=pv(Qp,r),d=Je(t,l.onViewportChange),h=v.useRef(0);return f.jsxs(f.Fragment,{children:[f.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}),f.jsx(cf.Slot,{scope:r,children:f.jsx(ke.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:ye(i.onScroll,m=>{const b=m.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:x}=c;if(x!=null&&x.current&&g){const w=Math.abs(h.current-b.scrollTop);if(w>0){const E=window.innerHeight-gr*2,S=parseFloat(g.style.minHeight),N=parseFloat(g.style.height),C=Math.max(S,N);if(C<E){const A=C+w,j=Math.min(E,A),k=A-j;g.style.height=j+"px",g.style.bottom==="0px"&&(b.scrollTop=k>0?k:0,g.style.justifyContent="flex-end")}}}h.current=b.scrollTop})})})]})});BC.displayName=Qp;var HC="SelectGroup",[s$,i$]=_o(HC),o$=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,i=dn();return f.jsx(s$,{scope:r,id:i,children:f.jsx(ke.div,{role:"group","aria-labelledby":i,...s,ref:t})})});o$.displayName=HC;var qC="SelectLabel",VC=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,i=i$(qC,r);return f.jsx(ke.div,{id:i.id,...s,ref:t})});VC.displayName=qC;var Rd="SelectItem",[l$,GC]=_o(Rd),FC=v.forwardRef((e,t)=>{const{__scopeSelect:r,value:s,disabled:i=!1,textValue:l,...c}=e,d=os(Rd,r),h=ls(Rd,r),m=d.value===s,[b,g]=v.useState(l??""),[x,w]=v.useState(!1),E=Je(t,A=>{var j;return(j=h.itemRefCallback)==null?void 0:j.call(h,A,s,i)}),S=dn(),N=v.useRef("touch"),C=()=>{i||(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 f.jsx(l$,{scope:r,value:s,disabled:i,textId:S,isSelected:m,onItemTextChange:v.useCallback(A=>{g(j=>j||((A==null?void 0:A.textContent)??"").trim())},[]),children:f.jsx(cf.ItemSlot,{scope:r,value:s,disabled:i,textValue:b,children:f.jsx(ke.div,{role:"option","aria-labelledby":S,"data-highlighted":x?"":void 0,"aria-selected":m&&x,"data-state":m?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...c,ref:E,onFocus:ye(c.onFocus,()=>w(!0)),onBlur:ye(c.onBlur,()=>w(!1)),onClick:ye(c.onClick,()=>{N.current!=="mouse"&&C()}),onPointerUp:ye(c.onPointerUp,()=>{N.current==="mouse"&&C()}),onPointerDown:ye(c.onPointerDown,A=>{N.current=A.pointerType}),onPointerMove:ye(c.onPointerMove,A=>{var j;N.current=A.pointerType,i?(j=h.onItemLeave)==null||j.call(h):N.current==="mouse"&&A.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ye(c.onPointerLeave,A=>{var j;A.currentTarget===document.activeElement&&((j=h.onItemLeave)==null||j.call(h))}),onKeyDown:ye(c.onKeyDown,A=>{var k;((k=h.searchRef)==null?void 0:k.current)!==""&&A.key===" "||(KI.includes(A.key)&&C(),A.key===" "&&A.preventDefault())})})})})});FC.displayName=Rd;var Sl="SelectItemText",KC=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:i,...l}=e,c=os(Sl,r),d=ls(Sl,r),h=GC(Sl,r),m=JI(Sl,r),[b,g]=v.useState(null),x=Je(t,C=>g(C),h.onItemTextChange,C=>{var A;return(A=d.itemTextRefCallback)==null?void 0:A.call(d,C,h.value,h.disabled)}),w=b==null?void 0:b.textContent,E=v.useMemo(()=>f.jsx("option",{value:h.value,disabled:h.disabled,children:w},h.value),[h.disabled,h.value,w]),{onNativeOptionAdd:S,onNativeOptionRemove:N}=m;return Ft(()=>(S(E),()=>N(E)),[S,N,E]),f.jsxs(f.Fragment,{children:[f.jsx(ke.span,{id:h.textId,...l,ref:x}),h.isSelected&&c.valueNode&&!c.valueNodeHasChildren?Ql.createPortal(l.children,c.valueNode):null]})});KC.displayName=Sl;var WC="SelectItemIndicator",YC=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return GC(WC,r).isSelected?f.jsx(ke.span,{"aria-hidden":!0,...s,ref:t}):null});YC.displayName=WC;var Zp="SelectScrollUpButton",XC=v.forwardRef((e,t)=>{const r=ls(Zp,e.__scopeSelect),s=pv(Zp,e.__scopeSelect),[i,l]=v.useState(!1),c=Je(t,s.onScrollButtonChange);return Ft(()=>{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]),i?f.jsx(QC,{...e,ref:c,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=r;d&&h&&(d.scrollTop=d.scrollTop-h.offsetHeight)}}):null});XC.displayName=Zp;var eg="SelectScrollDownButton",JC=v.forwardRef((e,t)=>{const r=ls(eg,e.__scopeSelect),s=pv(eg,e.__scopeSelect),[i,l]=v.useState(!1),c=Je(t,s.onScrollButtonChange);return Ft(()=>{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]),i?f.jsx(QC,{...e,ref:c,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=r;d&&h&&(d.scrollTop=d.scrollTop+h.offsetHeight)}}):null});JC.displayName=eg;var QC=v.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:s,...i}=e,l=ls("SelectScrollButton",r),c=v.useRef(null),d=uf(r),h=v.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return v.useEffect(()=>()=>h(),[h]),Ft(()=>{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]),f.jsx(ke.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:ye(i.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(s,50))}),onPointerMove:ye(i.onPointerMove,()=>{var m;(m=l.onItemLeave)==null||m.call(l),c.current===null&&(c.current=window.setInterval(s,50))}),onPointerLeave:ye(i.onPointerLeave,()=>{h()})})}),c$="SelectSeparator",ZC=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return f.jsx(ke.div,{"aria-hidden":!0,...s,ref:t})});ZC.displayName=c$;var tg="SelectArrow",u$=v.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,i=df(r),l=os(tg,r),c=ls(tg,r);return l.open&&c.position==="popper"?f.jsx(Xg,{...i,...s,ref:t}):null});u$.displayName=tg;var d$="SelectBubbleInput",eN=v.forwardRef(({__scopeSelect:e,value:t,...r},s)=>{const i=v.useRef(null),l=Je(s,i),c=fv(t);return v.useEffect(()=>{const d=i.current;if(!d)return;const h=window.HTMLSelectElement.prototype,b=Object.getOwnPropertyDescriptor(h,"value").set;if(c!==t&&b){const g=new Event("change",{bubbles:!0});b.call(d,t),d.dispatchEvent(g)}},[c,t]),f.jsx(ke.select,{...r,style:{...AC,...r.style},ref:l,defaultValue:t})});eN.displayName=d$;function tN(e){return e===""||e===void 0}function nN(e){const t=nn(e),r=v.useRef(""),s=v.useRef(0),i=v.useCallback(c=>{const d=r.current+c;t(d),(function h(m){r.current=m,window.clearTimeout(s.current),m!==""&&(s.current=window.setTimeout(()=>h(""),1e3))})(d)},[t]),l=v.useCallback(()=>{r.current="",window.clearTimeout(s.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(s.current),[]),[r,i,l]}function rN(e,t,r){const i=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,l=r?e.indexOf(r):-1;let c=f$(e,Math.max(l,0));i.length===1&&(c=c.filter(m=>m!==r));const h=c.find(m=>m.textValue.toLowerCase().startsWith(i.toLowerCase()));return h!==r?h:void 0}function f$(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var h$=RC,aN=OC,m$=DC,p$=PC,g$=LC,sN=zC,v$=BC,iN=VC,oN=FC,y$=KC,b$=YC,lN=XC,cN=JC,uN=ZC;const x$=h$,w$=m$,dN=v.forwardRef(({className:e,children:t,...r},s)=>f.jsxs(aN,{ref:s,className:xe("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,f.jsx(p$,{asChild:!0,children:f.jsx(Dg,{className:"h-4 w-4 opacity-50"})})]}));dN.displayName=aN.displayName;const fN=v.forwardRef(({className:e,...t},r)=>f.jsx(lN,{ref:r,className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:f.jsx(A5,{className:"h-4 w-4"})}));fN.displayName=lN.displayName;const hN=v.forwardRef(({className:e,...t},r)=>f.jsx(cN,{ref:r,className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:f.jsx(Dg,{className:"h-4 w-4"})}));hN.displayName=cN.displayName;const mN=v.forwardRef(({className:e,children:t,position:r="popper",...s},i)=>f.jsx(g$,{children:f.jsxs(sN,{ref:i,className:xe("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:[f.jsx(fN,{}),f.jsx(v$,{className:xe("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),f.jsx(hN,{})]})}));mN.displayName=sN.displayName;const _$=v.forwardRef(({className:e,...t},r)=>f.jsx(iN,{ref:r,className:xe("px-2 py-1.5 text-sm font-semibold",e),...t}));_$.displayName=iN.displayName;const ng=v.forwardRef(({className:e,children:t,...r},s)=>f.jsxs(oN,{ref:s,className:xe("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:[f.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(b$,{children:f.jsx(ha,{className:"h-4 w-4"})})}),f.jsx(y$,{children:t})]}));ng.displayName=oN.displayName;const S$=v.forwardRef(({className:e,...t},r)=>f.jsx(uN,{ref:r,className:xe("-mx-1 my-1 h-px bg-muted",e),...t}));S$.displayName=uN.displayName;var E$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],C$=E$.reduce((e,t)=>{const r=Gd(`Primitive.${t}`),s=v.forwardRef((i,l)=>{const{asChild:c,...d}=i,h=c?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(h,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),N$="Separator",d_="horizontal",T$=["horizontal","vertical"],pN=v.forwardRef((e,t)=>{const{decorative:r,orientation:s=d_,...i}=e,l=j$(s)?s:d_,d=r?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return f.jsx(C$.div,{"data-orientation":l,...d,...i,ref:t})});pN.displayName=N$;function j$(e){return T$.includes(e)}var gN=pN;const zs=v.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...s},i)=>f.jsx(gN,{ref:i,decorative:r,orientation:t,className:xe("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...s}));zs.displayName=gN.displayName;function A$({value:e,onChange:t}){return f.jsx("div",{className:"flex flex-wrap gap-2",children:Yp.map(r=>f.jsx("button",{type:"button",onClick:()=>t(r.id),title:r.name,className:xe("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&&f.jsx(ha,{className:"w-4 h-4 text-white drop-shadow"})},r.id))})}function f_({label:e,prefix:t,links:r,onChange:s,readOnly:i,emptyText:l}){const[c,d]=v.useState(""),h=()=>{const g=c.trim();g&&(s([...r,g]),d(""))},m=(g,x)=>s(r.map((w,E)=>E===g?x:w)),b=g=>s(r.filter((x,w)=>w!==g));return f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("span",{className:"text-sm font-medium text-foreground",children:[e," ",t&&f.jsxs("span",{className:"text-xs text-muted-foreground font-normal",children:["(",t,")"]})]}),f.jsx("span",{className:"text-xs text-muted-foreground",children:r.length})]}),r.length===0&&f.jsx("p",{className:"text-xs text-muted-foreground italic px-1",children:l??"Sin links aún"}),f.jsx("div",{className:"space-y-1.5",children:r.map((g,x)=>f.jsxs("div",{className:"group flex items-center gap-1.5",children:[f.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??"·",x+1]}),i?f.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:[f.jsx(u3,{className:"w-3.5 h-3.5 flex-shrink-0"}),f.jsx("span",{className:"truncate",children:g}),f.jsx(n1,{className:"w-3 h-3 flex-shrink-0 opacity-60"})]}):f.jsxs(f.Fragment,{children:[f.jsx(ft,{value:g,onChange:w=>m(x,w.target.value),placeholder:"https://…",className:"h-9 text-sm"}),f.jsx($e,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>b(x),children:f.jsx(Bl,{className:"w-4 h-4"})})]})]},x))}),!i&&f.jsxs("div",{className:"flex gap-1.5 pt-1",children:[f.jsx(ft,{value:c,onChange:g=>d(g.target.value),onKeyDown:g=>g.key==="Enter"&&(g.preventDefault(),h()),placeholder:"Pegar link y Enter",className:"h-9 text-sm"}),f.jsxs($e,{type:"button",variant:"outline",size:"sm",onClick:h,className:"h-9",children:[f.jsx(ua,{className:"w-4 h-4 mr-1"})," Añadir"]})]})]})}var h_=1,R$=.9,k$=.8,O$=.17,cp=.1,up=.999,M$=.9999,D$=.99,P$=/[\\\/_+.#"@\[\(\{&]/,L$=/[\\\/_+.#"@\[\(\{&]/g,z$=/[\s-]/,vN=/[\s-]/g;function rg(e,t,r,s,i,l,c){if(l===t.length)return i===e.length?h_:D$;var d=`${i},${l}`;if(c[d]!==void 0)return c[d];for(var h=s.charAt(l),m=r.indexOf(h,i),b=0,g,x,w,E;m>=0;)g=rg(e,t,r,s,m+1,l+1,c),g>b&&(m===i?g*=h_:P$.test(e.charAt(m-1))?(g*=k$,w=e.slice(i,m-1).match(L$),w&&i>0&&(g*=Math.pow(up,w.length))):z$.test(e.charAt(m-1))?(g*=R$,E=e.slice(i,m-1).match(vN),E&&i>0&&(g*=Math.pow(up,E.length))):(g*=O$,i>0&&(g*=Math.pow(up,m-i))),e.charAt(m)!==t.charAt(l)&&(g*=M$)),(g<cp&&r.charAt(m-1)===s.charAt(l+1)||s.charAt(l+1)===s.charAt(l)&&r.charAt(m-1)!==s.charAt(l))&&(x=rg(e,t,r,s,m+1,l+2,c),x*cp>g&&(g=x*cp)),g>b&&(b=g),m=r.indexOf(h,m+1);return c[d]=b,b}function m_(e){return e.toLowerCase().replace(vN," ")}function I$(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,rg(e,t,m_(e),m_(t),0,0,{})}var vl='[cmdk-group=""]',dp='[cmdk-group-items=""]',$$='[cmdk-group-heading=""]',yN='[cmdk-item=""]',p_=`${yN}:not([aria-disabled="true"])`,ag="cmdk-item-select",Yi="data-value",U$=(e,t,r)=>I$(e,t,r),bN=v.createContext(void 0),uc=()=>v.useContext(bN),xN=v.createContext(void 0),gv=()=>v.useContext(xN),wN=v.createContext(void 0),_N=v.forwardRef((e,t)=>{let r=Xi(()=>{var M,$;return{search:"",value:($=(M=e.value)!=null?M:e.defaultValue)!=null?$:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=Xi(()=>new Set),i=Xi(()=>new Map),l=Xi(()=>new Map),c=Xi(()=>new Set),d=SN(e),{label:h,children:m,value:b,onValueChange:g,filter:x,shouldFilter:w,loop:E,disablePointerSelection:S=!1,vimBindings:N=!0,...C}=e,A=dn(),j=dn(),k=dn(),I=v.useRef(null),z=J$();Gs(()=>{if(b!==void 0){let M=b.trim();r.current.value=M,P.emit()}},[b]),Gs(()=>{z(6,fe)},[]);let P=v.useMemo(()=>({subscribe:M=>(c.current.add(M),()=>c.current.delete(M)),snapshot:()=>r.current,setState:(M,$,Y)=>{var B,ne,ee,Q;if(!Object.is(r.current[M],$)){if(r.current[M]=$,M==="search")me(),de(),z(1,ue);else if(M==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ae=document.getElementById(k);ae?ae.focus():(B=document.getElementById(A))==null||B.focus()}if(z(7,()=>{var ae;r.current.selectedItemId=(ae=pe())==null?void 0:ae.id,P.emit()}),Y||z(5,fe),((ne=d.current)==null?void 0:ne.value)!==void 0){let ae=$??"";(Q=(ee=d.current).onValueChange)==null||Q.call(ee,ae);return}}P.emit()}},emit:()=>{c.current.forEach(M=>M())}}),[]),H=v.useMemo(()=>({value:(M,$,Y)=>{var B;$!==((B=l.current.get(M))==null?void 0:B.value)&&(l.current.set(M,{value:$,keywords:Y}),r.current.filtered.items.set(M,Z($,Y)),z(2,()=>{de(),P.emit()}))},item:(M,$)=>(s.current.add(M),$&&(i.current.has($)?i.current.get($).add(M):i.current.set($,new Set([M]))),z(3,()=>{me(),de(),r.current.value||ue(),P.emit()}),()=>{l.current.delete(M),s.current.delete(M),r.current.filtered.items.delete(M);let Y=pe();z(4,()=>{me(),(Y==null?void 0:Y.getAttribute("id"))===M&&ue(),P.emit()})}),group:M=>(i.current.has(M)||i.current.set(M,new Set),()=>{l.current.delete(M),i.current.delete(M)}),filter:()=>d.current.shouldFilter,label:h||e["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:A,inputId:k,labelId:j,listInnerRef:I}),[]);function Z(M,$){var Y,B;let ne=(B=(Y=d.current)==null?void 0:Y.filter)!=null?B:U$;return M?ne(M,r.current.search,$):0}function de(){if(!r.current.search||d.current.shouldFilter===!1)return;let M=r.current.filtered.items,$=[];r.current.filtered.groups.forEach(B=>{let ne=i.current.get(B),ee=0;ne.forEach(Q=>{let ae=M.get(Q);ee=Math.max(ae,ee)}),$.push([B,ee])});let Y=I.current;ge().sort((B,ne)=>{var ee,Q;let ae=B.getAttribute("id"),se=ne.getAttribute("id");return((ee=M.get(se))!=null?ee:0)-((Q=M.get(ae))!=null?Q:0)}).forEach(B=>{let ne=B.closest(dp);ne?ne.appendChild(B.parentElement===ne?B:B.closest(`${dp} > *`)):Y.appendChild(B.parentElement===Y?B:B.closest(`${dp} > *`))}),$.sort((B,ne)=>ne[1]-B[1]).forEach(B=>{var ne;let ee=(ne=I.current)==null?void 0:ne.querySelector(`${vl}[${Yi}="${encodeURIComponent(B[0])}"]`);ee==null||ee.parentElement.appendChild(ee)})}function ue(){let M=ge().find(Y=>Y.getAttribute("aria-disabled")!=="true"),$=M==null?void 0:M.getAttribute(Yi);P.setState("value",$||void 0)}function me(){var M,$,Y,B;if(!r.current.search||d.current.shouldFilter===!1){r.current.filtered.count=s.current.size;return}r.current.filtered.groups=new Set;let ne=0;for(let ee of s.current){let Q=($=(M=l.current.get(ee))==null?void 0:M.value)!=null?$:"",ae=(B=(Y=l.current.get(ee))==null?void 0:Y.keywords)!=null?B:[],se=Z(Q,ae);r.current.filtered.items.set(ee,se),se>0&&ne++}for(let[ee,Q]of i.current)for(let ae of Q)if(r.current.filtered.items.get(ae)>0){r.current.filtered.groups.add(ee);break}r.current.filtered.count=ne}function fe(){var M,$,Y;let B=pe();B&&(((M=B.parentElement)==null?void 0:M.firstChild)===B&&((Y=($=B.closest(vl))==null?void 0:$.querySelector($$))==null||Y.scrollIntoView({block:"nearest"})),B.scrollIntoView({block:"nearest"}))}function pe(){var M;return(M=I.current)==null?void 0:M.querySelector(`${yN}[aria-selected="true"]`)}function ge(){var M;return Array.from(((M=I.current)==null?void 0:M.querySelectorAll(p_))||[])}function R(M){let $=ge()[M];$&&P.setState("value",$.getAttribute(Yi))}function q(M){var $;let Y=pe(),B=ge(),ne=B.findIndex(Q=>Q===Y),ee=B[ne+M];($=d.current)!=null&&$.loop&&(ee=ne+M<0?B[B.length-1]:ne+M===B.length?B[0]:B[ne+M]),ee&&P.setState("value",ee.getAttribute(Yi))}function K(M){let $=pe(),Y=$==null?void 0:$.closest(vl),B;for(;Y&&!B;)Y=M>0?Y$(Y,vl):X$(Y,vl),B=Y==null?void 0:Y.querySelector(p_);B?P.setState("value",B.getAttribute(Yi)):q(M)}let X=()=>R(ge().length-1),G=M=>{M.preventDefault(),M.metaKey?X():M.altKey?K(1):q(1)},O=M=>{M.preventDefault(),M.metaKey?R(0):M.altKey?K(-1):q(-1)};return v.createElement(ke.div,{ref:t,tabIndex:-1,...C,"cmdk-root":"",onKeyDown:M=>{var $;($=C.onKeyDown)==null||$.call(C,M);let Y=M.nativeEvent.isComposing||M.keyCode===229;if(!(M.defaultPrevented||Y))switch(M.key){case"n":case"j":{N&&M.ctrlKey&&G(M);break}case"ArrowDown":{G(M);break}case"p":case"k":{N&&M.ctrlKey&&O(M);break}case"ArrowUp":{O(M);break}case"Home":{M.preventDefault(),R(0);break}case"End":{M.preventDefault(),X();break}case"Enter":{M.preventDefault();let B=pe();if(B){let ne=new Event(ag);B.dispatchEvent(ne)}}}}},v.createElement("label",{"cmdk-label":"",htmlFor:H.inputId,id:H.labelId,style:Z$},h),ff(e,M=>v.createElement(xN.Provider,{value:P},v.createElement(bN.Provider,{value:H},M))))}),B$=v.forwardRef((e,t)=>{var r,s;let i=dn(),l=v.useRef(null),c=v.useContext(wN),d=uc(),h=SN(e),m=(s=(r=h.current)==null?void 0:r.forceMount)!=null?s:c==null?void 0:c.forceMount;Gs(()=>{if(!m)return d.item(i,c==null?void 0:c.id)},[m]);let b=EN(i,l,[e.value,e.children,l],e.keywords),g=gv(),x=ss(z=>z.value&&z.value===b.current),w=ss(z=>m||d.filter()===!1?!0:z.search?z.filtered.items.get(i)>0:!0);v.useEffect(()=>{let z=l.current;if(!(!z||e.disabled))return z.addEventListener(ag,E),()=>z.removeEventListener(ag,E)},[w,e.onSelect,e.disabled]);function E(){var z,P;S(),(P=(z=h.current).onSelect)==null||P.call(z,b.current)}function S(){g.setState("value",b.current,!0)}if(!w)return null;let{disabled:N,value:C,onSelect:A,forceMount:j,keywords:k,...I}=e;return v.createElement(ke.div,{ref:wn(l,t),...I,id:i,"cmdk-item":"",role:"option","aria-disabled":!!N,"aria-selected":!!x,"data-disabled":!!N,"data-selected":!!x,onPointerMove:N||d.getDisablePointerSelection()?void 0:S,onClick:N?void 0:E},e.children)}),H$=v.forwardRef((e,t)=>{let{heading:r,children:s,forceMount:i,...l}=e,c=dn(),d=v.useRef(null),h=v.useRef(null),m=dn(),b=uc(),g=ss(w=>i||b.filter()===!1?!0:w.search?w.filtered.groups.has(c):!0);Gs(()=>b.group(c),[]),EN(c,d,[e.value,e.heading,h]);let x=v.useMemo(()=>({id:c,forceMount:i}),[i]);return v.createElement(ke.div,{ref:wn(d,t),...l,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},r&&v.createElement("div",{ref:h,"cmdk-group-heading":"","aria-hidden":!0,id:m},r),ff(e,w=>v.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?m:void 0},v.createElement(wN.Provider,{value:x},w))))}),q$=v.forwardRef((e,t)=>{let{alwaysRender:r,...s}=e,i=v.useRef(null),l=ss(c=>!c.search);return!r&&!l?null:v.createElement(ke.div,{ref:wn(i,t),...s,"cmdk-separator":"",role:"separator"})}),V$=v.forwardRef((e,t)=>{let{onValueChange:r,...s}=e,i=e.value!=null,l=gv(),c=ss(m=>m.search),d=ss(m=>m.selectedItemId),h=uc();return v.useEffect(()=>{e.value!=null&&l.setState("search",e.value)},[e.value]),v.createElement(ke.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:i?e.value:c,onChange:m=>{i||l.setState("search",m.target.value),r==null||r(m.target.value)}})}),G$=v.forwardRef((e,t)=>{let{children:r,label:s="Suggestions",...i}=e,l=v.useRef(null),c=v.useRef(null),d=ss(m=>m.selectedItemId),h=uc();return v.useEffect(()=>{if(c.current&&l.current){let m=c.current,b=l.current,g,x=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let w=m.offsetHeight;b.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return x.observe(m),()=>{cancelAnimationFrame(g),x.unobserve(m)}}},[]),v.createElement(ke.div,{ref:wn(l,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":s,id:h.listId},ff(e,m=>v.createElement("div",{ref:wn(c,h.listInnerRef),"cmdk-list-sizer":""},m)))}),F$=v.forwardRef((e,t)=>{let{open:r,onOpenChange:s,overlayClassName:i,contentClassName:l,container:c,...d}=e;return v.createElement(mC,{open:r,onOpenChange:s},v.createElement(pC,{container:c},v.createElement(uv,{"cmdk-overlay":"",className:i}),v.createElement(dv,{"aria-label":e.label,"cmdk-dialog":"",className:l},v.createElement(_N,{ref:t,...d}))))}),K$=v.forwardRef((e,t)=>ss(r=>r.filtered.count===0)?v.createElement(ke.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),W$=v.forwardRef((e,t)=>{let{progress:r,children:s,label:i="Loading...",...l}=e;return v.createElement(ke.div,{ref:t,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},ff(e,c=>v.createElement("div",{"aria-hidden":!0},c)))}),In=Object.assign(_N,{List:G$,Item:B$,Input:V$,Group:H$,Separator:q$,Dialog:F$,Empty:K$,Loading:W$});function Y$(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function X$(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function SN(e){let t=v.useRef(e);return Gs(()=>{t.current=e}),t}var Gs=typeof window>"u"?v.useEffect:v.useLayoutEffect;function Xi(e){let t=v.useRef();return t.current===void 0&&(t.current=e()),t}function ss(e){let t=gv(),r=()=>e(t.snapshot());return v.useSyncExternalStore(t.subscribe,r,r)}function EN(e,t,r,s=[]){let i=v.useRef(),l=uc();return Gs(()=>{var c;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():i.current}})(),h=s.map(m=>m.trim());l.value(e,d,h),(c=t.current)==null||c.setAttribute(Yi,d),i.current=d}),i}var J$=()=>{let[e,t]=v.useState(),r=Xi(()=>new Map);return Gs(()=>{r.current.forEach(s=>s()),r.current=new Map},[e]),(s,i)=>{r.current.set(s,i),t({})}};function Q$(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function ff({asChild:e,children:t},r){return e&&v.isValidElement(t)?v.cloneElement(Q$(t),{ref:t.ref},r(t.props.children)):r(t)}var Z$={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const vv=v.forwardRef(({className:e,...t},r)=>f.jsx(In,{ref:r,className:xe("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));vv.displayName=In.displayName;const yv=v.forwardRef(({className:e,...t},r)=>f.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[f.jsx(Ul,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),f.jsx(In.Input,{ref:r,className:xe("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})]}));yv.displayName=In.Input.displayName;const bv=v.forwardRef(({className:e,...t},r)=>f.jsx(In.List,{ref:r,className:xe("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));bv.displayName=In.List.displayName;const xv=v.forwardRef((e,t)=>f.jsx(In.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));xv.displayName=In.Empty.displayName;const wv=v.forwardRef(({className:e,...t},r)=>f.jsx(In.Group,{ref:r,className:xe("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}));wv.displayName=In.Group.displayName;const CN=v.forwardRef(({className:e,...t},r)=>f.jsx(In.Separator,{ref:r,className:xe("-mx-1 h-px bg-border",e),...t}));CN.displayName=In.Separator.displayName;const kd=v.forwardRef(({className:e,...t},r)=>f.jsx(In.Item,{ref:r,className:xe("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}));kd.displayName=In.Item.displayName;function eU(e){const t=tU(e),r=v.forwardRef((s,i)=>{const{children:l,...c}=s,d=v.Children.toArray(l),h=d.find(rU);if(h){const m=h.props.children,b=d.map(g=>g===h?v.Children.count(m)>1?v.Children.only(null):v.isValidElement(m)?m.props.children:null:g);return f.jsx(t,{...c,ref:i,children:v.isValidElement(m)?v.cloneElement(m,void 0,b):null})}return f.jsx(t,{...c,ref:i,children:l})});return r.displayName=`${e}.Slot`,r}function tU(e){const t=v.forwardRef((r,s)=>{const{children:i,...l}=r;if(v.isValidElement(i)){const c=sU(i),d=aU(l,i.props);return i.type!==v.Fragment&&(d.ref=s?wn(s,c):c),v.cloneElement(i,d)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var nU=Symbol("radix.slottable");function rU(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===nU}function aU(e,t){const r={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?r[s]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(r[s]=i):s==="style"?r[s]={...i,...l}:s==="className"&&(r[s]=[i,l].filter(Boolean).join(" "))}return{...e,...r}}function sU(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var hf="Popover",[NN]=cr(hf,[vo]),dc=vo(),[iU,cs]=NN(hf),TN=e=>{const{__scopePopover:t,children:r,open:s,defaultOpen:i,onOpenChange:l,modal:c=!1}=e,d=dc(t),h=v.useRef(null),[m,b]=v.useState(!1),[g,x]=ma({prop:s,defaultProp:i??!1,onChange:l,caller:hf});return f.jsx(Wg,{...d,children:f.jsx(iU,{scope:t,contentId:dn(),triggerRef:h,open:g,onOpenChange:x,onOpenToggle:v.useCallback(()=>x(w=>!w),[x]),hasCustomAnchor:m,onCustomAnchorAdd:v.useCallback(()=>b(!0),[]),onCustomAnchorRemove:v.useCallback(()=>b(!1),[]),modal:c,children:r})})};TN.displayName=hf;var jN="PopoverAnchor",oU=v.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,i=cs(jN,r),l=dc(r),{onCustomAnchorAdd:c,onCustomAnchorRemove:d}=i;return v.useEffect(()=>(c(),()=>d()),[c,d]),f.jsx(Qd,{...l,...s,ref:t})});oU.displayName=jN;var AN="PopoverTrigger",RN=v.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,i=cs(AN,r),l=dc(r),c=Je(t,i.triggerRef),d=f.jsx(ke.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":PN(i.open),...s,ref:c,onClick:ye(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?d:f.jsx(Qd,{asChild:!0,...l,children:d})});RN.displayName=AN;var _v="PopoverPortal",[lU,cU]=NN(_v,{forceMount:void 0}),kN=e=>{const{__scopePopover:t,forceMount:r,children:s,container:i}=e,l=cs(_v,t);return f.jsx(lU,{scope:t,forceMount:r,children:f.jsx(vn,{present:r||l.open,children:f.jsx(ac,{asChild:!0,container:i,children:s})})})};kN.displayName=_v;var io="PopoverContent",ON=v.forwardRef((e,t)=>{const r=cU(io,e.__scopePopover),{forceMount:s=r.forceMount,...i}=e,l=cs(io,e.__scopePopover);return f.jsx(vn,{present:s||l.open,children:l.modal?f.jsx(dU,{...i,ref:t}):f.jsx(fU,{...i,ref:t})})});ON.displayName=io;var uU=eU("PopoverContent.RemoveScroll"),dU=v.forwardRef((e,t)=>{const r=cs(io,e.__scopePopover),s=v.useRef(null),i=Je(t,s),l=v.useRef(!1);return v.useEffect(()=>{const c=s.current;if(c)return ef(c)},[]),f.jsx(ic,{as:uU,allowPinchZoom:!0,children:f.jsx(MN,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ye(e.onCloseAutoFocus,c=>{var d;c.preventDefault(),l.current||(d=r.triggerRef.current)==null||d.focus()}),onPointerDownOutside:ye(e.onPointerDownOutside,c=>{const d=c.detail.originalEvent,h=d.button===0&&d.ctrlKey===!0,m=d.button===2||h;l.current=m},{checkForDefaultPrevented:!1}),onFocusOutside:ye(e.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1})})})}),fU=v.forwardRef((e,t)=>{const r=cs(io,e.__scopePopover),s=v.useRef(!1),i=v.useRef(!1);return f.jsx(MN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var c,d;(c=e.onCloseAutoFocus)==null||c.call(e,l),l.defaultPrevented||(s.current||(d=r.triggerRef.current)==null||d.focus(),l.preventDefault()),s.current=!1,i.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"&&(i.current=!0));const c=l.target;((m=r.triggerRef.current)==null?void 0:m.contains(c))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&i.current&&l.preventDefault()}})}),MN=v.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:b,...g}=e,x=cs(io,r),w=dc(r);return Kd(),f.jsx(nc,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:l,children:f.jsx(tc,{asChild:!0,disableOutsidePointerEvents:c,onInteractOutside:b,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:m,onDismiss:()=>x.onOpenChange(!1),children:f.jsx(Yg,{"data-state":PN(x.open),role:"dialog",id:x.contentId,...w,...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)"}})})})}),DN="PopoverClose",hU=v.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,i=cs(DN,r);return f.jsx(ke.button,{type:"button",...s,ref:t,onClick:ye(e.onClick,()=>i.onOpenChange(!1))})});hU.displayName=DN;var mU="PopoverArrow",pU=v.forwardRef((e,t)=>{const{__scopePopover:r,...s}=e,i=dc(r);return f.jsx(Xg,{...i,...s,ref:t})});pU.displayName=mU;function PN(e){return e?"open":"closed"}var gU=TN,vU=RN,yU=kN,LN=ON;const zN=gU,IN=vU,Sv=v.forwardRef(({className:e,align:t="center",sideOffset:r=4,...s},i)=>f.jsx(yU,{children:f.jsx(LN,{ref:i,align:t,sideOffset:r,className:xe("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})}));Sv.displayName=LN.displayName;const bU=new RegExp("[\\u0000-\\u001F\\u007F-\\u009F\\u00AD\\u061C\\u180E\\u200B-\\u200F\\u202A-\\u202E\\u2060-\\u206F\\uFEFF]","g");function $N(e){return String(e||"").replace(bU,"").replace(/\u00A0/g," ").replace(/\s+/g," ").trim()}function Re(e){return $N(e).normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function Jt(e){const t=$N(e),r=Re(t);return["republica dominicana","rep dominicana","rep dom","rep dom lizbeth","dominicana"].includes(r)?"Republica Dominicana":t}function tt(e){const t=new Map;for(const r of e){const s=Jt(r);if(!s)continue;const i=Re(s);i&&(t.has(i)||t.set(i,s))}return Array.from(t.values())}function g_(e,t){const r=tt(e),s=Jt(t);if(!s)return r;const i=Re(s);return r.some(c=>Re(c)===i)?r:[s,...r]}function xU(e){e.preventDefault(),e.stopPropagation(),e.currentTarget.scrollTop+=e.deltaY}function xr({value:e,options:t,onValueChange:r,placeholder:s="Seleccionar…",searchPlaceholder:i="Buscar…",emptyText:l="No hay resultados.",disabled:c=!1,clearLabel:d}){const[h,m]=v.useState(!1),b=v.useMemo(()=>{const x=new Map;for(const w of tt(t)){const E=Jt(w),S=Re(E);!S||x.has(S)||x.set(S,E)}return Array.from(x.values())},[t]),g=v.useMemo(()=>{const x=Re(e);return b.find(w=>Re(w)===x)??e},[b,e]);return f.jsxs(zN,{open:h,onOpenChange:m,children:[f.jsx(IN,{asChild:!0,children:f.jsxs($e,{type:"button",variant:"outline",role:"combobox","aria-expanded":h,disabled:c,className:xe("h-10 w-full justify-between rounded-md border-border bg-background px-3 font-normal hover:bg-background",!g&&"text-muted-foreground"),children:[f.jsx("span",{className:"truncate",children:g||s}),f.jsx(e1,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),f.jsx(Sv,{align:"start",className:"w-[min(92vw,560px)] min-w-[var(--radix-popover-trigger-width)] p-0",children:f.jsxs(vv,{children:[f.jsx(yv,{placeholder:i}),f.jsxs(bv,{className:"overscroll-contain",onWheel:xU,children:[f.jsx(xv,{children:l}),f.jsxs(wv,{children:[d&&f.jsxs(f.Fragment,{children:[f.jsxs(kd,{value:`__clear_${d}`,onSelect:()=>{r(""),m(!1)},children:[f.jsx(ha,{className:xe("mr-2 h-4 w-4",e?"opacity-0":"opacity-100")}),f.jsx("span",{className:"whitespace-normal break-words font-medium",children:d})]},"__clear__"),b.length>0&&f.jsx(CN,{className:"my-1"})]}),b.map(x=>f.jsxs(kd,{value:`${Re(x)} ${x}`,onSelect:()=>{r(x),m(!1)},children:[f.jsx(ha,{className:xe("mr-2 h-4 w-4",Re(e)===Re(x)?"opacity-100":"opacity-0")}),f.jsx("span",{className:"whitespace-normal break-words leading-snug",children:x})]},Re(x)))]})]})]})})]})}function wU(e){e.preventDefault(),e.stopPropagation(),e.currentTarget.scrollTop+=e.deltaY}function v_(e){return tt(e.map(t=>Jt(t)).filter(Boolean))}function sg({values:e,options:t,onValuesChange:r,placeholder:s="Seleccionar…",searchPlaceholder:i="Buscar…",emptyText:l="No hay resultados.",disabled:c=!1,summaryLabel:d="opciones seleccionadas"}){const[h,m]=v.useState(!1),b=v.useMemo(()=>v_(e),[e]),g=v.useMemo(()=>new Set(b.map(C=>Re(C))),[b]),x=v.useMemo(()=>tt([...t,...b].map(C=>Jt(C))),[t,b]),w=v.useMemo(()=>b.length===0?"":b.length<=2?b.join(", "):`${b.length} ${d}`,[b,d]),E=C=>{r(v_(C))},S=C=>{const A=Jt(C),j=Re(A);if(g.has(j)){E(b.filter(k=>Re(k)!==j));return}E([...b,A])},N=C=>{const A=Re(C);E(b.filter(j=>Re(j)!==A))};return f.jsxs("div",{className:"space-y-2",children:[f.jsxs(zN,{open:h,onOpenChange:m,children:[f.jsx(IN,{asChild:!0,children:f.jsxs($e,{type:"button",variant:"outline",role:"combobox","aria-expanded":h,disabled:c,className:xe("min-h-10 w-full justify-between rounded-md border-border bg-background px-3 font-normal hover:bg-background",!w&&"text-muted-foreground"),children:[f.jsx("span",{className:"truncate text-left",children:w||s}),f.jsx(e1,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),f.jsx(Sv,{align:"start",className:"w-[var(--radix-popover-trigger-width)] p-0",children:f.jsxs(vv,{children:[f.jsx(yv,{placeholder:i}),f.jsxs(bv,{className:"overscroll-contain",onWheel:wU,children:[f.jsx(xv,{children:l}),f.jsx(wv,{children:x.map(C=>{const A=g.has(Re(C));return f.jsxs(kd,{value:C,onSelect:()=>S(C),children:[f.jsx(ha,{className:xe("mr-2 h-4 w-4",A?"opacity-100":"opacity-0")}),f.jsx("span",{className:"truncate",children:C})]},C)})})]})]})})]}),b.length>0&&f.jsx("div",{className:"flex flex-wrap gap-1.5",children:b.map(C=>f.jsxs(xn,{variant:"secondary",className:"gap-1 rounded-full px-2 py-0.5",children:[f.jsx("span",{className:"max-w-[190px] truncate",children:C}),f.jsx("button",{type:"button",onClick:()=>N(C),className:"rounded-full text-muted-foreground transition-colors hover:text-foreground","aria-label":`Quitar ${C}`,children:f.jsx(Bl,{className:"h-3 w-3"})})]},C))})]})}const _U="design_final_art",SU="adaptation_final_art",Pn="reference",EU="wmc",CU="wmc_fixed",NU="fixed";function be(e,t,r,s,i,l){return{id:e,label:t,reference:r,min:s,max:i,hint:l}}function Dn({designHour:e="35 - 50",adaptationHour:t="30",design:r,adaptation:s}){const i=[{id:_U,label:"Diseño + Entregable Arte Final",shortLabel:"Diseño + AF",hourReference:e,levels:r}];return s!=null&&s.length&&i.push({id:SU,label:"Adaptación Arte Final",shortLabel:"Adaptación AF",hourReference:t,levels:s}),i}function sr({id:e,service:t,amount:r,description:s,equivalent:i,observations:l}){const c=[s,i?`Equivalencia CDC: ${i}.`:"",l].filter(Boolean).join(" ");return{id:e,section:EU,category:"Walmart Connect",service:t,notes:c,workTypes:[{id:CU,label:"Tarifa fija WMC",shortLabel:"WMC",hourReference:"35 - 80",levels:[be(NU,"Precio fijo",`${r} USD`,r,r,l)]}]}}const Al=[{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:Dn({design:[be("basic","Básico","50 - 80",50,80),be("intermediate","Intermedio","100 - 150",100,150),be("advanced","Avanzado","150 - 300",150,300)],adaptation:[be("basic","Básico","30 - 50",30,50),be("intermediate","Intermedio","60 - 80",60,80),be("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:Dn({design:[be("basic","Básico","320 - 500",320,500),be("intermediate","Intermedio","500 - 700",500,700),be("advanced","Avanzado","800 - 1000",800,1e3)],adaptation:[be("basic","Básico","200 - 350",200,350),be("intermediate","Intermedio","350 - 550",350,550),be("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:Dn({design:[be("basic","6m² aprox","250 - 350",250,350),be("intermediate","Más 10m²","400 - 650",400,650),be("advanced","Más de 20m²","700 - 1100",700,1100)],adaptation:[be("basic","6m² aprox","100 - 150",100,150),be("intermediate","Más 10m²","200 - 300",200,300),be("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:Dn({design:[be("basic","Básico","300 - 400",300,400),be("intermediate","Intermedio","450 - 650",450,650),be("advanced","Avanzado","700 - 1000",700,1e3)],adaptation:[be("basic","Básico","200 - 300",200,300),be("intermediate","Intermedio","300 - 400",300,400),be("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:Dn({design:[be("project","Precio único","1000 - 1500",1e3,1500)],adaptation:[be("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:Dn({design:[be("project","Precio único","1500 - 3000",1500,3e3)],adaptation:[be("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:Dn({design:[be("project","Precio único","700 - 1000",700,1e3)],adaptation:[be("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:Dn({design:[be("project","Precio único","1000 - 1500",1e3,1500)],adaptation:[be("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:Dn({design:[be("basic","Básico","200 - 400",200,400),be("intermediate","Intermedio","400 - 600",400,600),be("advanced","Avanzado","600 - 800",600,800)],adaptation:[be("basic","Básico","50 - 100",50,100),be("intermediate","Intermedio","100 - 150",100,150),be("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:Dn({design:[be("basic","Básico","30 - 60",30,60),be("intermediate","Intermedio","60 - 90",60,90),be("advanced","Avanzado","90 - 120",90,120)],adaptation:[be("basic","Básico","15 - 30",15,30),be("intermediate","Intermedio","30 - 60",30,60),be("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:Pn,label:"Diseño web",shortLabel:"Web",hourReference:"35 - 50",levels:[be("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:Pn,label:"Diseño web",shortLabel:"Web",hourReference:"35 - 50",levels:[be("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:Pn,label:"Diseño web",shortLabel:"Web",hourReference:"36 - 50",levels:[be("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:Dn({design:[be("basic","Básico","20 - 40",20,40),be("intermediate","Intermedio","50 - 100",50,100),be("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:Dn({designHour:"35 - 50",design:[be("basic","Básico","100 - 250",100,250),be("intermediate","Intermedio","250 - 500",250,500),be("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:Dn({designHour:"1 - 25",design:[be("basic","Básico","100",100,100),be("intermediate","Intermedio","100 - 200",100,200),be("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:Dn({designHour:"1 - 50",design:[be("basic","Básico","100",100,100),be("intermediate","Intermedio","100 - 150",100,150),be("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:Pn,label:"Referencia manual",shortLabel:"Manual",levels:[be("base","Diseño base","20 base",20,20),be("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:Pn,label:"Tarifa fija",shortLabel:"Fija",levels:[be("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:Pn,label:"Tarifa fija",shortLabel:"Fija",levels:[be("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:Pn,label:"Tarifa fija",shortLabel:"Fija",levels:[be("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:Pn,label:"Tarifa fija",shortLabel:"Fija",levels:[be("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:Pn,label:"Tarifa fija",shortLabel:"Fija",levels:[be("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:Pn,label:"Tarifa fija",shortLabel:"Fija",levels:[be("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:Pn,label:"Tarifa fija o por hora",shortLabel:"Referencia",levels:[be("project","Por proyecto","1500 - 3000",1500,3e3),be("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:Pn,label:"Por hora",shortLabel:"Hora",levels:[be("hour","Por hora","50 - 150 por hora",50,150)]}]},sr({id:"wmc-uniformes",service:"Uniformes",amount:80,description:"Uniforme completo para personal de impulso en piso (playera/top, jogger, falda, chaleco), con 4 variantes de diseño exploradas.",equivalent:"Materiales de PDV estándar y otros materiales básicos > Uniformes",observations:"Incluye diseño en alta resolución y 3 rondas de cambios."}),sr({id:"wmc-uniformes-supervisor",service:"Uniformes Supervisor",amount:100,description:"Uniforme para supervisor de piso (polo, chumpa/track jacket, camisa formal), con 3 variantes de diseño exploradas.",equivalent:"Materiales de PDV estándar y otros materiales básicos > Uniformes",observations:"Incluye diseño en alta resolución y 3 rondas de cambios."}),sr({id:"wmc-glorificador-mano",service:"Glorificador de mano",amount:150,description:"Exhibidor portátil pequeño para presentar el producto: bandeja iluminada, aro LED, estuche o base acrílica.",equivalent:"Stands, Muebles y Exhibidores > Estándar (Displays básicos)",observations:"Incluye diseño 3D, troqueles y 3 rondas de cambios."}),sr({id:"wmc-carritos-intervenidos",service:"Carritos intervenidos",amount:200,description:"Vinil o calcomanía de marca aplicada a la canasta y al mango del carrito de compras.",equivalent:"Materiales de PDV estándar y otros materiales básicos (análogo a Backings/Rompetráficos)",observations:"Pieza análoga a material gráfico estándar aplicado sobre una superficie existente."}),sr({id:"wmc-dummies-exhibicion",service:"Dummies de exhibición",amount:200,description:"Réplica escultórica a gran escala de pasta y cepillo dental como punto focal decorativo o táctil.",equivalent:"Proyectos especiales > Diseño de muebles / proyectos con planos y troqueles desde cero",observations:"Requiere diseño estructural y visualización 3D; no es solo arte de impresión."}),sr({id:"wmc-photobooth",service:"Photobooth",amount:200,description:"Estructura tipo arco con iluminación LED y espacio fotográfico de marca para activaciones.",equivalent:"Proyectos especiales > Diseño de Stands Creativos para ferias o eventos",observations:"Estructura autoportante con iluminación, ambientación y 4 rondas de cambios."}),sr({id:"wmc-play-station",service:"Play Station",amount:200,description:"Kiosco interactivo con pantalla táctil y mecánica de juego.",equivalent:"Proyectos especiales > Diseño de muebles / proyectos especiales",observations:"Incluye diseño de mueble e interfaz gráfica; el desarrollo funcional del juego se cotiza aparte."}),sr({id:"wmc-isla-wm",service:"Isla WM",amount:150,description:"Mueble isla completo multinivel con iluminación, gráficos y espacio de exhibición de la línea completa de producto.",equivalent:"Proyectos especiales > Diseño de Stands Creativos para ferias o eventos",observations:"Mayor escala y complejidad estructural dentro del set de piezas."}),sr({id:"wmc-exhibicion-especial",service:"Exhibición Especial",amount:250,description:"Propuesta de muebles de exhibición.",equivalent:"Proyectos especiales > Diseño de muebles con planos y troqueles desde cero",observations:"Costo de referencia por concepto; las variantes adicionales se cobran como adicionales."}),sr({id:"wmc-punta-gondola",service:"Punta de góndola",amount:250,description:"Cabecera de góndola personalizada con iluminación, gráficos y espacio para producto.",equivalent:"Proyectos especiales > Diseño de muebles con planos y troqueles desde cero",observations:"Costo de referencia por concepto; las variantes adicionales se cobran como adicionales."}),sr({id:"wmc-estacion-prueba-producto",service:"Estación para prueba de producto",amount:200,description:"Carrito móvil con lavamanos funcional, grifo y desagüe para pruebas de producto en piso.",equivalent:"Proyectos especiales > Diseño de Stands Creativos para ferias o eventos",observations:"La complejidad funcional puede requerir una cotización especial fuera del tarifario estándar."}),sr({id:"wmc-arco-entrada",service:"Arco de entrada",amount:200,description:"Estructura de entrada de tienda a gran formato con iluminación, efecto de niebla y gráficos de marca.",equivalent:"Proyectos especiales > Diseño de Stands Creativos para ferias o eventos",observations:"La instalación en sitio se cotiza aparte."})];function ig(e){return e?e.reference:""}function Hu(e){return e&&typeof e.min=="number"&&typeof e.max=="number"?String((e.min===e.max,e.min)):""}const oo="tablero_cdc_tariff_catalog",og="Referencia",UN="Precio único";let Ja={rows:lg(Al),catalog:Al,source:"fallback",loading:!1,error:null},no=!1,ad=[],fp=0;function hp(){ad.forEach(e=>e())}function y_(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const t=Number(e.trim());if(Number.isFinite(t))return t}return null}function Rl(e){return String(e||"").trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function Ev(e,t,r){return[e,t,r].map(Rl).filter(Boolean).join("__")}function BN(e){const t=String(e.section||"grafico").trim().toLowerCase()||"grafico",r=String(e.category||"").trim(),s=String(e.service||"").trim(),i=String(e.catalog_item_id||Rl(`${t}-${r}-${s}`)).trim(),l=String(e.work_type_label||og).trim(),c=String(e.level_label||UN).trim(),d=String(e.work_type_id||Rl(l)||Pn).trim(),h=String(e.level_id||Rl(c)||"project").trim();return{id:String(e.id||Ev(i,d,h)).trim(),catalog_item_id:i,section:t,category:r,service:s,notes:String(e.notes||"").trim(),work_type_id:d,work_type_label:l,work_type_short_label:String(e.work_type_short_label||l).trim(),hour_reference:String(e.hour_reference||"").trim(),level_id:h,level_label:c,reference:String(e.reference||"").trim(),reference_min:y_(e.reference_min),reference_max:y_(e.reference_max),level_hint:String(e.level_hint||"").trim(),sort_order:Number(e.sort_order||0),is_active:e.is_active!==!1,managed_by:String(e.managed_by||"sheet").trim()||"sheet",created_at:typeof e.created_at=="string"?e.created_at:null,updated_at:typeof e.updated_at=="string"?e.updated_at:null}}function TU(e){const t=new Map,r=new Map,s=e.filter(i=>i.is_active).sort((i,l)=>i.sort_order-l.sort_order||i.category.localeCompare(l.category));for(const i of s){const l=i.catalog_item_id||Rl(`${i.section}-${i.category}-${i.service}`);let c=t.get(l);c||(c={id:l,section:i.section,category:i.category,service:i.service,notes:i.notes,workTypes:[]},t.set(l,c),r.set(l,new Map));const d=i.work_type_id||Pn,h=r.get(l);let m=h.get(d);m||(m={id:d,label:i.work_type_label||og,shortLabel:i.work_type_short_label||i.work_type_label||og,hourReference:i.hour_reference||void 0,levels:[]},h.set(d,m),c.workTypes.push(m));const b={id:i.level_id||"project",label:i.level_label||UN,reference:i.reference||"",min:i.reference_min??void 0,max:i.reference_max??void 0,hint:i.level_hint||void 0};m.levels.some(g=>g.id===b.id)||m.levels.push(b)}return Array.from(t.values())}function lg(e){const t=[];return e.forEach((r,s)=>{r.workTypes.forEach((i,l)=>{i.levels.forEach((c,d)=>{t.push({id:Ev(r.id,i.id,c.id),catalog_item_id:r.id,section:r.section,category:r.category,service:r.service,notes:r.notes||"",work_type_id:i.id,work_type_label:i.label,work_type_short_label:i.shortLabel,hour_reference:i.hourReference||"",level_id:c.id,level_label:c.label,reference:c.reference,reference_min:c.min??null,reference_max:c.max??null,level_hint:c.hint||"",sort_order:s*1e3+l*100+d,is_active:!0,managed_by:"system"})})})}),t}function HN(e){return Ev(e.catalog_item_id,e.work_type_id,e.level_id)}function jU(e){const t=e instanceof Error?e.message:String(e||"");return t.includes(oo)||t.includes("Could not find the table")||t.includes("relation")||t.includes("does not exist")}async function Od(e=!1){if(no&&!e)return Ja;const t=fp+=1;Ja={...Ja,loading:!0,error:null},hp();try{const r=await Te.from(oo).select("id, catalog_item_id, section, category, service, notes, work_type_id, work_type_label, work_type_short_label, hour_reference, level_id, level_label, reference, reference_min, reference_max, level_hint, sort_order, is_active, managed_by, created_at, updated_at").order("sort_order",{ascending:!0}).order("category",{ascending:!0});let s=r.data,i=r.error;if(i&&String(i.message||"").includes("managed_by")){const b=await Te.from(oo).select("id, catalog_item_id, section, category, service, notes, work_type_id, work_type_label, work_type_short_label, hour_reference, level_id, level_label, reference, reference_min, reference_max, level_hint, sort_order, is_active, created_at, updated_at").order("sort_order",{ascending:!0}).order("category",{ascending:!0});s=b.data,i=b.error}if(i)throw i;const l=(s||[]).map(b=>BN(b)),c=lg(Al),d=new Map;c.forEach(b=>d.set(b.id,b)),l.forEach(b=>d.set(b.id,b));const h=Array.from(d.values()).sort((b,g)=>b.sort_order-g.sort_order||b.category.localeCompare(g.category)),m=TU(h);t===fp&&(Ja={rows:h,catalog:m,source:l.length?"supabase":"fallback",loading:!1,error:l.length?null:"La tabla del tarifario está vacía. Se está usando el tarifario base de la app como respaldo."},no=!0,hp())}catch(r){const s=r instanceof Error?r.message:String(r||""),i=jU(r)?"Falta crear la tabla tablero_cdc_tariff_catalog en Supabase. Se está usando el tarifario base de la app como respaldo.":s||"No se pudo cargar el tarifario dinámico.";t===fp&&(Ja={rows:lg(Al),catalog:Al,source:"fallback",loading:!1,error:i},no=!0,hp())}return Ja}async function AU(e,t){const r=BN(e),s=r.id||HN(r);if(t!=null&&t.catalog_item_id&&(t.category!==r.category||t.service!==r.service||t.notes!==r.notes)){const{error:c}=await Te.from(oo).update({category:r.category,service:r.service,notes:r.notes,managed_by:"app"}).eq("catalog_item_id",t.catalog_item_id);if(c)throw c}const{error:i}=await Te.from(oo).upsert({id:s,catalog_item_id:r.catalog_item_id,section:r.section,category:r.category,service:r.service,notes:r.notes,work_type_id:r.work_type_id,work_type_label:r.work_type_label,work_type_short_label:r.work_type_short_label,hour_reference:r.hour_reference,level_id:r.level_id,level_label:r.level_label,reference:r.reference,reference_min:r.reference_min,reference_max:r.reference_max,level_hint:r.level_hint,sort_order:r.sort_order,is_active:r.is_active,managed_by:"app"},{onConflict:"id"});if(i)throw i;return no=!1,Od(!0)}async function RU(e,t){const{error:r}=await Te.from(oo).update({is_active:t,managed_by:"app"}).eq("id",e.id);if(r)throw r;no=!1,await Od(!0)}function qN(){const[,e]=v.useState(0);return v.useEffect(()=>{const t=()=>e(r=>r+1);return ad.push(t),!no&&!Ja.loading&&Od(),()=>{ad=ad.filter(r=>r!==t)}},[]),{...Ja,refresh:Od}}const mf="tablero_cdc_tariff_sections",cg=[{id:"grafico",name:"Tarifario Gráfico CDC",scope:"general",clientName:"",pricingMode:"guided",allowManual:!0,description:"Diseño gráfico, artes finales, adaptaciones y materiales de punto de venta.",sortOrder:10,isActive:!0},{id:"estrategia",name:"Estrategia y Creatividad",scope:"general",clientName:"",pricingMode:"guided",allowManual:!0,description:"Servicios de estrategia, conceptualización y creatividad.",sortOrder:20,isActive:!0},{id:"wmc",name:"Tarifario Walmart Connect",scope:"client",clientName:"Walmart Connect WMC",pricingMode:"fixed_multi",allowManual:!0,description:"Piezas de precio fijo que aparecen únicamente para Walmart Connect WMC.",sortOrder:100,isActive:!0}];let Qa={sections:cg,loading:!1,error:null,source:"fallback"},ro=!1,sd=[],mp=0;function pp(){sd.forEach(e=>e())}function Xa(e){return String(e||"").trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,70)}function VN(e,t,r=""){const s=Xa(e==="client"&&r||t)||"seccion",i=Date.now().toString(36).slice(-5);return`${e==="client"?"cliente":"general"}-${s}-${i}`}function kU(e){const t=e.scope==="client"?"client":"general",r=e.pricing_mode==="fixed_multi"?"fixed_multi":"guided";return{id:String(e.id||"").trim(),name:String(e.name||"Sección sin nombre").trim(),scope:t,clientName:String(e.client_name||"").trim(),pricingMode:r,allowManual:e.allow_manual!==!1,description:String(e.description||"").trim(),sortOrder:Number(e.sort_order||0),isActive:e.is_active!==!1,createdAt:e.created_at||null,updatedAt:e.updated_at||null}}function OU(e){const t=e instanceof Error?e.message:String(e||"");return t.includes(mf)||t.includes("Could not find the table")||t.includes("does not exist")||t.includes("relation")}async function Md(e=!1){if(ro&&!e)return Qa;const t=mp+=1;Qa={...Qa,loading:!0,error:null},pp();try{const{data:r,error:s}=await Te.from(mf).select("id, name, scope, client_name, pricing_mode, allow_manual, description, sort_order, is_active, created_at, updated_at").order("sort_order",{ascending:!0}).order("name",{ascending:!0});if(s)throw s;const i=(r||[]).map(kU),l=new Map(cg.map(d=>[d.id,d]));i.forEach(d=>l.set(d.id,d));const c=Array.from(l.values()).sort((d,h)=>d.sortOrder-h.sortOrder||d.name.localeCompare(h.name));t===mp&&(Qa={sections:c,loading:!1,error:i.length?null:"La tabla de secciones está vacía. Se muestran las secciones base como respaldo.",source:i.length?"supabase":"fallback"},ro=!0,pp())}catch(r){const s=r instanceof Error?r.message:String(r||"");t===mp&&(Qa={sections:cg,loading:!1,error:OU(r)?"Falta ejecutar el SQL del módulo de tarifario. Se muestran las secciones base como respaldo.":s||"No se pudieron cargar las secciones del tarifario.",source:"fallback"},ro=!0,pp())}return Qa}async function MU(e){const t=e.name.trim(),r=e.scope==="client"?e.clientName.trim():"";if(!t)throw new Error("Escribe el nombre de la sección.");if(e.scope==="client"&&!r)throw new Error("Selecciona el cliente del tarifario especial.");const{error:s}=await Te.from(mf).upsert({id:e.id,name:t,scope:e.scope,client_name:r,pricing_mode:e.scope==="client"?"fixed_multi":"guided",allow_manual:e.allowManual,description:e.description.trim(),sort_order:Number(e.sortOrder||0),is_active:e.isActive},{onConflict:"id"});if(s)throw s;return ro=!1,Md(!0)}async function DU(e,t){const{error:r}=await Te.from(mf).update({is_active:t}).eq("id",e.id);if(r)throw r;return ro=!1,Md(!0)}function GN(){const[,e]=v.useState(0);return v.useEffect(()=>{const t=()=>e(r=>r+1);return sd.push(t),!ro&&!Qa.loading&&Md(),()=>{sd=sd.filter(r=>r!==t)}},[]),{...Qa,refresh:Md}}function qu(e){const t=Number(e.replace(/,/g,"").trim());return Number.isFinite(t)?t:0}function yl(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(e||0)}function PU(e){return(e==null?void 0:e.workTypes[0])||null}function b_(e){return(e==null?void 0:e.levels[0])||null}function gp(e){return e.trim()}function FN(e){const t=e.workTypes[0]||null,r=(t==null?void 0:t.levels[0])||null;return{workType:t,level:r}}function id(e){const{level:t}=FN(e),r=Number((t==null?void 0:t.min)??(t==null?void 0:t.max)??0);return Number.isFinite(r)?r:0}function KN(e,t){return t.id==="wmc"&&e.source==="tariff"&&(Re(e.workType)===Re("Tarifa fija WMC")||Re(e.category)===Re("Walmart Connect"))}function vp(e,t){return e.source!=="tariff"?!1:e.tariffSectionId?e.tariffSectionId===t.id:KN(e,t)}function LU(e,t){const{workType:r,level:s}=FN(e),i=id(e);return!r||!s||i<=0?null:{source:"tariff",category:t.name,serviceName:e.service,workType:`Tarifa fija · ${t.name}`,complexityLevel:"Precio fijo",referenceLabel:ig(s),referenceMin:i,referenceMax:i,amount:i,description:e.notes||"",tariffSectionId:t.id,tariffCatalogId:e.id}}function zU({client:e,items:t,onChange:r,loading:s,error:i}){const[l,c]=v.useState("grafico"),[d,h]=v.useState(""),[m,b]=v.useState(""),[g,x]=v.useState(""),[w,E]=v.useState(""),[S,N]=v.useState(""),[C,A]=v.useState(""),[j,k]=v.useState(""),[I,z]=v.useState(""),{catalog:P,loading:H,error:Z}=qN(),{sections:de,loading:ue,error:me}=GN(),fe=v.useMemo(()=>de.filter(oe=>oe.isActive&&oe.scope==="general"&&oe.pricingMode==="guided"),[de]),pe=v.useMemo(()=>{const oe=Re(e);return oe?de.filter(Me=>Me.isActive&&Me.scope==="client"&&Me.pricingMode==="fixed_multi"&&Re(Me.clientName)===oe):[]},[e,de]),ge=pe.length>0,R=fe.find(oe=>oe.id===l)||fe[0]||null;v.useEffect(()=>{!R&&fe.length?c(fe[0].id):R&&R.id!==l&&c(R.id)},[R,fe,l]);const q=v.useMemo(()=>P.filter(oe=>oe.section===(R==null?void 0:R.id)).map(oe=>`${oe.category} · ${oe.service}`),[R==null?void 0:R.id,P]),K=v.useMemo(()=>P.find(oe=>oe.section===(R==null?void 0:R.id)&&`${oe.category} · ${oe.service}`===d)||null,[R==null?void 0:R.id,d,P]),X=v.useMemo(()=>K&&K.workTypes.find(oe=>oe.id===m)||null,[K,m]),G=v.useMemo(()=>X&&X.levels.find(oe=>oe.id===g)||null,[X,g]),O=t.reduce((oe,Me)=>oe+Number(Me.amount||0),0),M=()=>{h(""),b(""),x(""),E(""),N("")},$=oe=>{var Ke;const Me=fe.find(qe=>qe.name===oe);c((Me==null?void 0:Me.id)||((Ke=fe[0])==null?void 0:Ke.id)||""),M()},Y=oe=>{h(oe);const Me=P.find(_t=>_t.section===(R==null?void 0:R.id)&&`${_t.category} · ${_t.service}`===oe),Ke=PU(Me),qe=b_(Ke);b((Ke==null?void 0:Ke.id)||""),x((qe==null?void 0:qe.id)||""),E(Hu(qe)),N("")},B=oe=>{if(!K)return;const Me=K.workTypes.find(qe=>qe.label===oe),Ke=b_(Me);b((Me==null?void 0:Me.id)||""),x((Ke==null?void 0:Ke.id)||""),E(Hu(Ke))},ne=oe=>{if(!X)return;const Me=X.levels.find(Ke=>Ke.label===oe);x((Me==null?void 0:Me.id)||""),E(Hu(Me))},ee=()=>{if(!K||!X||!G||!R)return;const oe=qu(w);oe<=0||(r([...t,{source:"tariff",category:K.category,serviceName:K.service,workType:X.label,complexityLevel:G.label,referenceLabel:ig(G),referenceMin:G.min??null,referenceMax:G.max??null,amount:oe,description:gp(S),tariffSectionId:R.id,tariffCatalogId:K.id}]),N(""),E(Hu(G)))},Q=(oe,Me)=>{const Ke=P.filter(Be=>Be.section===oe.id&&id(Be)>0),qe=t.filter(Be=>vp(Be,oe)),_t=new Map(qe.map(Be=>[Re(Be.serviceName),Be])),Ge=new Map(Ke.map(Be=>[Re(Be.service),Be])),ct=Me.map(Be=>{const ce=Re(Be);return _t.get(ce)||(Ge.get(ce)?LU(Ge.get(ce),oe):null)}).filter(Be=>!!Be),zt=t.filter(Be=>!vp(Be,oe));r([...zt,...ct])},ae=pe[0]||null,se=!ge||pe.some(oe=>oe.allowManual),Ee=()=>{const oe=qu(I),Me=(ae==null?void 0:ae.name)||"Otros",Ke=gp(C)||(ae?`Propuesta general ${ae.clientName}`:"Otros / costo manual");oe<=0||(r([...t,{source:"manual",category:Me,serviceName:Ke,workType:"Manual",complexityLevel:"",referenceLabel:"Monto manual",referenceMin:null,referenceMax:null,amount:oe,description:gp(j),tariffSectionId:ae==null?void 0:ae.id}]),A(""),k(""),z(""))},je=oe=>{r(t.filter((Me,Ke)=>Ke!==oe))},nt=(X==null?void 0:X.label)||"",Qe=(G==null?void 0:G.label)||"",Et=i||Z||me;return f.jsxs("div",{className:"md:col-span-2 rounded-2xl border border-border bg-muted/20 p-4",children:[f.jsxs("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[f.jsxs("div",{className:"flex items-start gap-2.5",children:[f.jsx("span",{className:"mt-0.5 flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 text-primary",children:f.jsx(v5,{className:"h-4 w-4"})}),f.jsxs("div",{children:[f.jsx("h3",{className:"text-sm font-semibold",children:"Tarifario / Estimación interna"}),f.jsx("p",{className:"text-xs text-muted-foreground",children:ge?`Este cliente tiene ${pe.length===1?"un tarifario especial":"tarifarios especiales"}. Selecciona piezas o agrega un costo manual.`:"Agrega costos del tarifario general o montos manuales. El total se guarda automáticamente como monto interno del proyecto."})]})]}),f.jsxs("div",{className:"flex w-full flex-shrink-0 items-center justify-between gap-3 rounded-xl border border-primary/20 bg-card px-3 py-2 shadow-sm sm:w-auto",children:[f.jsx("span",{className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:f.jsx(Bp,{className:"h-4 w-4"})}),f.jsxs("div",{className:"min-w-0",children:[f.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Total estimado"}),f.jsx("p",{className:"mt-1 whitespace-nowrap text-lg font-semibold leading-none tabular-nums text-primary",children:yl(O)})]})]})]}),Et&&f.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:[f.jsx(n3,{className:"mt-0.5 h-3.5 w-3.5 flex-shrink-0"}),f.jsx("span",{children:Et})]}),(s||H||ue)&&f.jsx("div",{className:"mb-3 rounded-xl border border-border bg-card px-3 py-2 text-xs text-muted-foreground",children:s?"Cargando costos guardados…":"Cargando tarifario…"}),f.jsxs("div",{className:"space-y-4",children:[ge?pe.map(oe=>{const Me=P.filter(Ge=>Ge.section===oe.id&&id(Ge)>0),Ke=t.filter(Ge=>vp(Ge,oe)),qe=Ke.map(Ge=>Ge.serviceName),_t=Ke.reduce((Ge,ct)=>Ge+Number(ct.amount||0),0);return f.jsxs("div",{className:"space-y-4 rounded-xl border border-primary/20 bg-card p-4",children:[f.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[f.jsxs("div",{children:[f.jsx("p",{className:"text-sm font-medium",children:oe.name}),f.jsx("p",{className:"text-xs text-muted-foreground",children:oe.description||"Selecciona una o varias piezas. Cada pieza se carga una sola vez con su monto fijo."})]}),f.jsx(xn,{className:"w-fit",children:oe.clientName})]}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Piezas a cotizar"}),f.jsx(sg,{values:qe,options:Me.map(Ge=>Ge.service),onValuesChange:Ge=>Q(oe,Ge),placeholder:"Seleccionar una o varias piezas…",searchPlaceholder:"Buscar pieza…",emptyText:"No se encontró esa pieza en este tarifario.",disabled:H||Me.length===0,summaryLabel:"piezas seleccionadas"})]}),f.jsxs("div",{className:"rounded-xl border border-dashed border-border bg-muted/30 p-3",children:[f.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[f.jsx("p",{className:"text-xs font-medium text-foreground",children:"Piezas y montos fijos"}),f.jsxs("p",{className:"text-xs font-semibold text-primary",children:["Subtotal: ",yl(_t)]})]}),Me.length===0?f.jsx("p",{className:"text-xs text-muted-foreground",children:"Este tarifario todavía no tiene piezas activas. Agrégalas desde el módulo Tarifario."}):f.jsx("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2",children:Me.map(Ge=>{const ct=qe.some(zt=>Re(zt)===Re(Ge.service));return f.jsxs("div",{className:xe("flex items-center justify-between gap-3 rounded-lg border px-2.5 py-2 text-xs",ct?"border-primary/30 bg-primary/10 text-foreground":"border-border bg-card text-muted-foreground"),children:[f.jsx("span",{className:"min-w-0 truncate",children:Ge.service}),f.jsx("span",{className:"flex-shrink-0 font-semibold text-foreground",children:yl(id(Ge))})]},Ge.id)})})]})]},oe.id)}):f.jsxs("div",{className:"space-y-4 rounded-xl border border-border bg-card p-4",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{children:[f.jsx("p",{className:"text-sm font-medium",children:"Agregar desde tarifario general"}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"Referencia flexible. El usuario autorizado decide el monto final."})]}),f.jsx(xn,{variant:"secondary",children:"Tarifario"})]}),f.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Sección"}),f.jsx(xr,{value:(R==null?void 0:R.name)||"",options:fe.map(oe=>oe.name),onValueChange:$,placeholder:"Seleccionar sección…",searchPlaceholder:"Buscar sección…",emptyText:"No hay secciones generales activas."})]}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Ítem a cobrar"}),f.jsx(xr,{value:d,options:q,onValueChange:Y,placeholder:"Seleccionar ítem…",searchPlaceholder:"Buscar ítem…",emptyText:"No se encontró ese ítem.",disabled:!R})]}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Tipo de trabajo"}),f.jsx(xr,{value:nt,options:(K==null?void 0:K.workTypes.map(oe=>oe.label))||[],onValueChange:B,placeholder:"Seleccionar tipo…",searchPlaceholder:"Buscar tipo…",disabled:!K})]}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Nivel / referencia"}),f.jsx(xr,{value:Qe,options:(X==null?void 0:X.levels.map(oe=>oe.label))||[],onValueChange:ne,placeholder:"Seleccionar nivel…",searchPlaceholder:"Buscar nivel…",disabled:!X})]})]}),K&&X&&G&&f.jsxs("div",{className:"rounded-xl border border-dashed border-border bg-muted/40 px-3 py-2 text-xs text-muted-foreground",children:[f.jsxs("p",{children:[f.jsx("span",{className:"font-medium text-foreground",children:"Referencia:"})," ",ig(G)," USD",X.hourReference?` · Hora hombre ref.: ${X.hourReference}`:""]}),K.notes&&f.jsx("p",{className:"mt-1",children:K.notes}),G.hint&&f.jsx("p",{className:"mt-1",children:G.hint})]}),f.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-[220px_minmax(0,1fr)]",children:[f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Monto final"}),f.jsx(ft,{type:"number",min:"0",step:"0.01",value:w,onChange:oe=>E(oe.target.value),placeholder:"0.00",disabled:!G})]}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Observación"}),f.jsx(da,{value:S,onChange:oe=>N(oe.target.value),placeholder:"Ej: más rondas de cambios, piezas adicionales, complejidad especial…",disabled:!G,rows:5,className:"min-h-[132px] resize-y"})]})]}),f.jsx("div",{className:"flex justify-end",children:f.jsxs($e,{type:"button",onClick:ee,disabled:!K||!X||!G||qu(w)<=0,className:"gap-1.5 rounded-full",children:[f.jsx(ua,{className:"h-4 w-4"}),"Agregar tarifa"]})})]}),se&&f.jsxs("div",{className:"space-y-4 rounded-xl border border-border bg-card p-4",children:[f.jsxs("div",{children:[f.jsx("p",{className:"text-sm font-medium",children:ae?`Agregar propuesta o costo manual para ${ae.clientName}`:"Agregar costo manual"}),f.jsx("p",{className:"text-xs text-muted-foreground",children:ae?"Para propuestas generales, proyectos por concepto o casos no contemplados por pieza.":"Para otros, adicionales o casos fuera del tarifario."})]}),f.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-[minmax(0,1fr)_220px]",children:[f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Nombre"}),f.jsx(ft,{value:C,onChange:oe=>A(oe.target.value),placeholder:ae?`Ej: Propuesta general ${ae.clientName}`:"Ej: Piezas adicionales"})]}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Monto"}),f.jsx(ft,{type:"number",min:"0",step:"0.01",value:I,onChange:oe=>z(oe.target.value),placeholder:"0.00"})]})]}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Descripción"}),f.jsx(da,{value:j,onChange:oe=>k(oe.target.value),placeholder:ae?"Ej: Compendio cotizado por proyecto, no por piezas.":"Ej: Cliente pidió piezas adicionales fuera del paquete.",rows:4,className:"min-h-[110px] resize-y"})]}),f.jsx("div",{className:"flex justify-end",children:f.jsxs($e,{type:"button",variant:"outline",onClick:Ee,disabled:qu(I)<=0,className:"w-full gap-1.5 rounded-full sm:w-auto sm:min-w-[240px]",children:[f.jsx(ua,{className:"h-4 w-4"}),"Agregar costo manual"]})})]})]}),f.jsx(zs,{className:"my-4"}),f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsx("p",{className:"text-sm font-medium",children:"Costos agregados"}),f.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.length," línea(s)"]})]}),t.length===0?f.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. Usa el tarifario disponible o agrega un monto manual."}):f.jsxs("div",{className:"space-y-2",children:[t.map((oe,Me)=>{const Ke=de.find(Ge=>Ge.id===oe.tariffSectionId&&Ge.scope==="client"),qe=!Ke&&pe.find(Ge=>KN(oe,Ge)),_t=Ke||qe;return f.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:[f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(xn,{variant:oe.source==="manual"?"outline":"secondary",children:oe.source==="manual"?"Manual":_t?_t.clientName:"Tarifario"}),f.jsx("p",{className:"text-sm font-medium",children:oe.serviceName})]}),f.jsxs("div",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[oe.category&&f.jsx("span",{children:oe.category}),oe.workType&&f.jsx("span",{children:oe.workType}),oe.complexityLevel&&f.jsx("span",{children:oe.complexityLevel}),oe.referenceLabel&&f.jsxs("span",{children:["Ref.: ",oe.referenceLabel]})]}),oe.description&&f.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:oe.description})]}),f.jsxs("div",{className:"flex items-center justify-between gap-3 sm:flex-col sm:items-end",children:[f.jsx("p",{className:"text-sm font-semibold text-foreground",children:yl(Number(oe.amount||0))}),f.jsxs($e,{type:"button",variant:"ghost",size:"sm",onClick:()=>je(Me),className:xe("h-8 rounded-full px-2 text-muted-foreground hover:text-destructive"),children:[f.jsx(zg,{className:"mr-1 h-3.5 w-3.5"}),"Quitar"]})]})]},`${oe.source}-${oe.serviceName}-${Me}`)}),f.jsxs("div",{className:"flex items-center justify-end gap-2 rounded-xl bg-primary/10 px-3 py-2 text-primary",children:[f.jsx(Bp,{className:"h-4 w-4"}),f.jsxs("span",{className:"text-sm font-semibold",children:["Total interno estimado: ",yl(O)]})]})]})]})]})}const Ps={clientes:iI,marcas:oI,bus:JE,buCm:iv,status:[...lI]};let od=[],ug=Ps,Gl=!1,WN=!1,Cv=null,kl=null,Is=null,Vu=0;function dg(){od.forEach(e=>e())}function Os(e){return tt(e)}function IU(e){const t=new Map(JE.map(r=>[Re(r),r]));return tt(e).map(r=>t.get(Re(r))||null).filter(r=>!!r)}function $U(e){return String(e||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim()}function UU(e){const t=$U(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 BU(e){return Jt(String(e.label||e.value||""))}function HU(e){const t=[],r=[],s=[],i=[],l={...iv};for(const c of e){if(c.is_active===!1)continue;const d=UU(c.category),h=BU(c),m=Jt(String(c.value||""));if(!(!h&&!m)&&(d==="client"&&t.push(h||m),d==="brand"&&r.push(h||m),d==="country"&&s.push(h||m),d==="status"&&i.push(h||m),d==="country_manager"&&m)){const b=h||m;b&&b!==m&&(l[m]=b)}}return{clientes:t.length?Os(t):Os(Ps.clientes),marcas:r.length?Os(r):Os(Ps.marcas),bus:s.length?IU([...Ps.bus,...s]):Os(Ps.bus),buCm:l,status:i.length?Os(i):Os(Ps.status)}}function qU(e){Cv=e,dg()}async function fg(){Gl=!0,qU(null),dg();try{const{data:e,error:t}=await Te.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;ug=HU(e||[]),WN=!0}catch(e){console.error("Error cargando listas desde Supabase:",e),Cv=e instanceof Error?e.message:"No se pudieron cargar los desplegables desde Supabase.",ug=Ps}finally{Gl=!1,dg()}}function VU(){Is&&clearTimeout(Is),Is=setTimeout(()=>{Is=null,Gl||fg()},350)}function GU(){kl||(kl=Te.channel("tablero-cdc-app-lists").on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_app_lists"},()=>VU()).subscribe(e=>{(e==="CHANNEL_ERROR"||e==="TIMED_OUT")&&console.warn("Supabase Realtime no pudo suscribirse a tablero_cdc_app_lists:",e)}))}function FU(){Is&&(clearTimeout(Is),Is=null),kl&&(Te.removeChannel(kl),kl=null)}function pf(){const[,e]=v.useState(0);return v.useEffect(()=>{const t=()=>e(r=>r+1);return od.push(t),Vu+=1,GU(),!WN&&!Gl&&fg(),()=>{od=od.filter(r=>r!==t),Vu=Math.max(0,Vu-1),Vu===0&&FU()}},[]),{lists:ug,loading:Gl,error:Cv,refresh:fg}}const KU={cr:"Costa Rica","costa rica":"Costa Rica",costarica:"Costa Rica",gt:"Guatemala",gua:"Guatemala",guate:"Guatemala",guatemala:"Guatemala",hn:"Honduras",honduras:"Honduras",ni:"Nicaragua",nicaragua:"Nicaragua",sv:"El Salvador",es:"El Salvador","el salvador":"El Salvador",elsalvador:"El Salvador",pa:"Panama",pty:"Panama",panama:"Panama",rd:"Republica Dominicana",repdom:"Republica Dominicana","republica dominicana":"Republica Dominicana",republicadominicana:"Republica Dominicana",do:"Republica Dominicana",mx:"Mexico",mexico:"Mexico",pr:"Puerto Rico","puerto rico":"Puerto Rico",puertorico:"Puerto Rico",co:"Colombia",colombia:"Colombia",jm:"Jamaica",jamaica:"Jamaica",tt:"Trinidad",trinidad:"Trinidad",ve:"Venezuela",venezuela:"Venezuela",latam:"Latam",wmc:"WMC"},WU=[[/(^|[_\-\s])cr([_\-\s]|$)/i,"Costa Rica"],[/(^|[_\-\s])(gt|gua|guate)([_\-\s]|$)/i,"Guatemala"],[/(^|[_\-\s])hn([_\-\s]|$)/i,"Honduras"],[/(^|[_\-\s])ni([_\-\s]|$)/i,"Nicaragua"],[/(^|[_\-\s])(sv|es)([_\-\s]|$)/i,"El Salvador"],[/(^|[_\-\s])(pa|pty|panama)([_\-\s]|$)/i,"Panama"],[/(^|[_\-\s])(rd|repdom|do)([_\-\s]|$)/i,"Republica Dominicana"],[/(^|[_\-\s])mx([_\-\s]|$)/i,"Mexico"],[/(^|[_\-\s])pr([_\-\s]|$)/i,"Puerto Rico"],[/(^|[_\-\s])co([_\-\s]|$)/i,"Colombia"],[/(^|[_\-\s])jm([_\-\s]|$)/i,"Jamaica"],[/(^|[_\-\s])tt([_\-\s]|$)/i,"Trinidad"],[/(^|[_\-\s])ve([_\-\s]|$)/i,"Venezuela"],[/(^|[_\-\s])latam([_\-\s]|$)/i,"Latam"],[/(^|[_\-\s])wmc([_\-\s]|$)/i,"WMC"]];function lo(e){return Jt(String(e??""))}function x_(e,t,r=[]){const s=lo(t);if(!s)return;const i=r.find(l=>Re(l)===Re(s));e.push(i||s)}function YN(e,t,r){const s=lo(t),i=Re(s);i&&r.forEach(l=>{const c=Re(l);c&&(i===c||i.includes(c))&&e.push(l)})}function gf(e,t=[]){const r=lo(e);if(!r)return[];const s=[];return YN(s,r,t),r.split(/[,;|/]+/).map(i=>lo(i)).filter(Boolean).forEach(i=>x_(s,i,t)),s.length===0&&x_(s,r,t),tt(s)}function hg(e,t=[]){const r=lo(e);if(!r)return[];const s=[];return YN(s,r,t),r.split(/[,;|/]+/).map(i=>lo(i)).filter(Boolean).forEach(i=>{const l=KU[Re(i)],c=t.find(d=>Re(d)===Re(i));l?s.push(l):c&&s.push(c)}),WU.forEach(([i,l])=>{i.test(r)&&s.push(l)}),tt(s)}function XN(e,t=[]){const r=[...hg(e.bu,t),...hg(e.nombre,t)],s=Re(e.cliente),i=Re(e.nombre);return(s.includes("walmartconnect")||s.includes("wmc")||i.includes("wmc"))&&r.push("WMC"),tt(r)}function JN(e,t=[]){return gf(e.marca,t)}function QN(e,t=[]){return gf(e.cliente,t)}function ZN(e,t=[]){return gf(e.cm,t)}function Gu(e,t){const r=Re(t);return r?e.some(s=>{const i=Re(s);return i===r||i.includes(r)||r.includes(i)}):!0}function eT(e,t,r={}){if(t.country){const s=XN(e,r.countries||[]);if(!Gu(s,t.country))return!1}if(t.brand){const s=JN(e,r.brands||[]);if(!Gu(s,t.brand))return!1}if(t.client){const s=QN(e,r.clients||[]);if(!Gu(s,t.client))return!1}if(t.cm){const s=ZN(e,r.cms||[]);if(!Gu(s,t.cm))return!1}return!0}function YU(e,t=[]){return tt(e.flatMap(r=>hg(r,t)))}function yp(e,t=[]){return tt(e.flatMap(r=>gf(r,t)))}function tT(e,t={}){return{countries:tt(e.flatMap(r=>XN(r,t.countries||[]))),brands:tt(e.flatMap(r=>JN(r,t.brands||[]))),clients:tt(e.flatMap(r=>QN(r,t.clients||[]))),cms:tt(e.flatMap(r=>ZN(r,t.cms||[])))}}function nT(e){return!!(e.country||e.brand||e.client||e.cm)}const rT="blue",vf="Activo",oa={tab:"todos",search:"",page:1,pageSize:24,country:"",brand:"",client:"",cm:""};let ld=[],va=[],Dd=0,aT={countries:[],brands:[],clients:[],cms:[]},Fl=!1,sT=!1,Nv=null,Ol=null,$s=null,Fu=0,zn={...oa},zr=0,Ku=0;function Kl(){ld.forEach(e=>e())}function Pd(e,t=""){return typeof e=="string"?e:t}function XU(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function JU(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 QU(e,t){return Pd(e.legacy_month,"")||Pd(e.mes,"")||t.toLocaleString("es-DO",{month:"long"})}function ZU(e,t){return JU(e.legacy_year,XU(e.anio,t.getFullYear()))}function eB(e){return!e||e===vf?"":e}function tB(e){return e&&e.trim()?e:vf}function iT(e){return{tab:(e==null?void 0:e.tab)??zn.tab??oa.tab,search:String((e==null?void 0:e.search)??zn.search??oa.search).trim(),page:Math.max(1,Math.floor(Number((e==null?void 0:e.page)??zn.page??oa.page))),pageSize:Math.max(1,Math.min(100,Math.floor(Number((e==null?void 0:e.pageSize)??zn.pageSize??oa.pageSize)))),country:String((e==null?void 0:e.country)??zn.country??oa.country).trim(),brand:String((e==null?void 0:e.brand)??zn.brand??oa.brand).trim(),client:String((e==null?void 0:e.client)??zn.client??oa.client).trim(),cm:String((e==null?void 0:e.cm)??zn.cm??oa.cm).trim()}}function yf(e){const t=e.extra_data||{},r=e.project_links||[],s=r.filter(d=>d.link_type==="proposal").map(d=>d.url||"").filter(Boolean),i=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(),c=Number.isFinite(l)?new Date(l):new Date;return{id:e.id,nombre:e.title||"",color:Pd(t.color,rT),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:i,status:eB(e.status),monto:e.internal_amount==null?null:Number(e.internal_amount),mes:QU(t,c),anio:ZU(t,c),createdAt:Number.isFinite(l)?l:Date.now(),extraData:t}}function nB(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 oT(e){const t=e.created_at?new Date(e.created_at).getTime():Date.now(),r=e.updated_at?new Date(e.updated_at).getTime():t,s=Number(e.duration_minutes??0);return{id:e.id,projectId:e.project_id,country:e.country||"",taskName:e.task_name||"",durationMinutes:Number.isFinite(s)?Math.max(0,s):0,workDate:e.work_date||new Date().toISOString().slice(0,10),notes:e.notes||"",actorName:e.created_by_name||e.created_by_email||"Usuario CDC",actorEmail:e.created_by_email||"",createdAt:Number.isFinite(t)?t:Date.now(),updatedAt:Number.isFinite(r)?r:Date.now()}}function w_(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),i=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(i)?i:null,amount:Number.isFinite(r)?r:0,description:e.description||"",tariffSectionId:e.tariff_section_id||"",tariffCatalogId:e.tariff_catalog_id||"",createdAt:Number.isFinite(t)?t:Date.now()}}function Tv(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 __(e){return e&&e.trim()?e:vf}function Wu(e,t,r){return`${e} ${e===1?t:r}`}function S_(e){return Array.isArray(e)?e.map(t=>String(t||"").trim()).filter(Boolean).join(" | "):String(e??"").trim()}function Wa(e,t,r,s,i){const l=S_(r),c=S_(s);if(l!==c){if(i!=null&&i.privateValue){e.push(`${t} actualizado.`);return}e.push(`${t}: ${l||"—"}${c||"—"}`)}}function rB(e,t,r){const s=[];return Wa(s,"Nombre",e.nombre,t.nombre),Wa(s,"Cliente",e.cliente,t.cliente),Wa(s,"Marca",e.marca,t.marca),Wa(s,"País/BU",e.bu,t.bu),Wa(s,"CM",e.cm,t.cm),Wa(s,"Solicitado por",e.solicitante,t.solicitante),Wa(s,"Estatus",__(e.status),__(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: ${Wu(e.propuestaLinks.length,"link","links")}${Wu(t.propuestaLinks.length,"link","links")}.`),e.afLinks.join("|")!==t.afLinks.join("|")&&s.push(`Links de artes finales: ${Wu(e.afLinks.length,"link","links")}${Wu(t.afLinks.length,"link","links")}.`),r&&Number(e.monto??0)!==Number(t.monto??0)&&Wa(s,"Monto interno",e.monto,t.monto,{privateValue:!0}),s}async function bf(){const{data:e,error:t}=await Te.auth.getUser();if(t||!e.user)throw new Error("No hay una sesión activa de Supabase.");return e.user}async function lT(){return(await bf()).id}async function aB(){return(await Ag()).role==="director_creativo"}async function cT(){return(await Ag()).canManageInternalPricing}async function sB(){return(await Ag()).canDeleteProjects}function uT(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:tB(e.status),internal_amount:e.monto??null,brief_link:e.briefLink,extra_data:{...t,color:e.color??Pd(t.color,rT),mes:e.mes,anio:e.anio}}}function iB(e,t){const r=t.propuestaLinks.map(i=>i.trim()).filter(Boolean).map((i,l)=>({project_id:e,link_type:"proposal",url:i,label:`Propuesta ${l+1}`})),s=t.afLinks.map(i=>i.trim()).filter(Boolean).map((i,l)=>({project_id:e,link_type:"final_art",url:i,label:`AF ${l+1}`}));return[...r,...s]}function dT(e){va=e,Kl()}function ts(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 oB(e){return{countries:ts(e.map(t=>t.bu)),brands:ts(e.map(t=>t.marca)),clients:ts(e.map(t=>t.cliente)),cms:ts(e.map(t=>t.cm))}}function br(e){Nv=e,Kl()}function fT(e){va.some(r=>r.id===e.id)&&dT(va.map(r=>r.id===e.id?e:r))}function lB(e){va.some(t=>t.id===e)&&(dT(va.filter(t=>t.id!==e)),Dd=Math.max(0,Dd-1),Kl())}function cB(){return"https://agenteit.digitalcompass.agency/webhook/tablero-cdc-sync-proyecto".trim()||""}async function xf(e,t){const r=cB();if(!r)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."};const s=new AbortController,i=window.setTimeout(()=>s.abort(),15e3);try{const l=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project_id:e,action:t,source:"tablero-cdc",sent_at:new Date().toISOString()}),signal:s.signal});if(!l.ok){const c=await l.text().catch(()=>""),d=c||`${l.status} ${l.statusText}`.trim();return console.warn("El proyecto se guardó en Supabase, pero n8n no respondió correctamente.",{status:l.status,statusText:l.statusText,errorText:c}),{sheetSyncStatus:"failed",sheetSyncMessage:t==="delete"?`No se pudo eliminar el proyecto del Google Sheet: ${d}`:`Proyecto guardado, pero el Sheet no se pudo sincronizar: ${d}`}}return{sheetSyncStatus:"synced",sheetSyncMessage:t==="delete"?"Proyecto eliminado del Google Sheet.":"Proyecto guardado y sincronizado con el Google Sheet."}}catch(l){const c=l instanceof DOMException&&l.name==="AbortError";return console.warn("El proyecto se guardó en Supabase, pero no se pudo sincronizar con Google Sheet.",l),{sheetSyncStatus:c?"timeout":"failed",sheetSyncMessage:c?t==="delete"?"n8n tardó demasiado en responder. No se eliminó el proyecto para evitar inconsistencias.":"Proyecto guardado, pero n8n tardó demasiado en responder. Revisa el workflow si el Sheet no se actualizó.":t==="delete"?"No se pudo eliminar el proyecto del Google Sheet. No se eliminó el proyecto para evitar inconsistencias.":"Proyecto guardado, pero no se pudo sincronizar con Google Sheet."}}finally{window.clearTimeout(i)}}function E_(){$s&&clearTimeout($s),$s=setTimeout(()=>{$s=null,!Fl&&zr===0&&Us(zn)},350)}function uB(){Ol||(Ol=Te.channel("tablero-cdc-projects").on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_projects"},()=>E_()).on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_project_links"},()=>E_()).subscribe(e=>{(e==="CHANNEL_ERROR"||e==="TIMED_OUT")&&console.warn("Supabase Realtime no pudo suscribirse a proyectos:",e)}))}function dB(){$s&&(clearTimeout($s),$s=null),Ol&&(Te.removeChannel(Ol),Ol=null)}async function hT(e,t){const r=iB(e,t);try{const{error:l}=await Te.rpc("tablero_cdc_replace_project_links",{p_project_id:e,p_links:r.map(({link_type:c,url:d,label:h})=>({link_type:c,url:d,label:h}))});if(l)throw l;return}catch(l){if(!xB(l))throw l;console.warn("RPC tablero_cdc_replace_project_links no existe todavía. Usando reemplazo de links por delete+insert.",l)}const{error:s}=await Te.from("tablero_cdc_project_links").delete().eq("project_id",e);if(s)throw s;if(r.length===0)return;const{error:i}=await Te.from("tablero_cdc_project_links").insert(r);if(i)throw i}function mT(e){const t=String((e==null?void 0:e.message)||"");return t.includes("tariff_section_id")||t.includes("tariff_catalog_id")||t.includes("schema cache")}async function pT(e,t){if(!Array.isArray(t))return;const{error:r}=await Te.from("tablero_cdc_project_pricing_items").delete().eq("project_id",e);if(r)throw r;const s=t.map((d,h)=>({item:d,index:h})).filter(({item:d})=>Number.isFinite(Number(d.amount))&&Number(d.amount)>0).map(({item:d,index:h})=>({project_id:e,source:d.source,category:d.category||"",service_name:d.serviceName||"Costo manual",work_type:d.workType||"",complexity_level:d.complexityLevel||"",reference_label:d.referenceLabel||"",reference_min:d.referenceMin??null,reference_max:d.referenceMax??null,amount:Number(d.amount),description:d.description||"",tariff_section_id:d.tariffSectionId||null,tariff_catalog_id:d.tariffCatalogId||null,sort_order:h}));if(s.length===0)return;const i=await Te.from("tablero_cdc_project_pricing_items").insert(s);if(!i.error)return;if(!mT(i.error))throw i.error;const l=s.map(({tariff_section_id:d,tariff_catalog_id:h,...m})=>m),c=await Te.from("tablero_cdc_project_pricing_items").insert(l);if(c.error)throw c.error}async function fB(e){const r=await Te.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, tariff_section_id, tariff_catalog_id, created_at").eq("project_id",e).order("sort_order",{ascending:!0}).order("created_at",{ascending:!0});if(!r.error)return(r.data||[]).map(w_);if(!mT(r.error))throw r.error;const s=await Te.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(s.error)throw s.error;return(s.data||[]).map(w_)}async function C_(e,t=20,r=0){const s=Math.max(1,Math.min(50,Math.floor(t))),i=Math.max(0,Math.floor(r)),{data:l,error:c}=await Te.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(i,i+s-1);if(c)throw c;return(l||[]).map(nB)}const bp=500;async function hB(e){const t=String(e||"").trim();if(!t)return[];const r=[];let s=0;for(;;){const{data:i,error:l}=await Te.from("tablero_cdc_project_time_entries").select("id, project_id, country, task_name, duration_minutes, work_date, notes, created_by_name, created_by_email, created_at, updated_at").eq("project_id",t).order("work_date",{ascending:!1}).order("created_at",{ascending:!1}).range(s,s+bp-1);if(l)throw l;const c=i||[];if(r.push(...c),c.length<bp)break;s+=bp}return r.map(oT)}async function mB(e,t){const r=String(e||"").trim(),s=String(t.country||"").trim(),i=String(t.taskName||"").trim(),l=Math.round(Number(t.durationMinutes||0)),c=String(t.workDate||"").trim(),d=String(t.notes||"").trim();if(!r)throw new Error("No se encontró el proyecto.");if(!s)throw new Error("Selecciona el país.");if(!i)throw new Error("Escribe la tarea realizada.");if(!Number.isFinite(l)||l<=0)throw new Error("La duración debe ser mayor que 0 minutos.");if(!/^\d{4}-\d{2}-\d{2}$/.test(c))throw new Error("Selecciona una fecha válida.");const h=await bf(),m=Tv(h),b=h.email||"",{data:g,error:x}=await Te.from("tablero_cdc_project_time_entries").insert({project_id:r,country:s,task_name:i,duration_minutes:l,work_date:c,notes:d,created_by:h.id,created_by_email:b||null,created_by_name:m}).select("id, project_id, country, task_name, duration_minutes, work_date, notes, created_by_name, created_by_email, created_at, updated_at").single();if(x)throw x;return oT(g)}async function pB(e){const t=String(e||"").trim();if(!t)throw new Error("No se encontró el registro de tiempo.");const{error:r}=await Te.from("tablero_cdc_project_time_entries").delete().eq("id",t);if(r)throw r}function gB(e,t,r,s){const i=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`[${i}] ${l}:
${e}`}async function vB(e,t,r,s,i,l){const{data:c,error:d}=await Te.from("tablero_cdc_projects").select("description").eq("id",e).single();if(d)throw d;const h=String((c==null?void 0:c.description)||"").trim(),m=gB(t,r,s,l),b=h?`${h}
${m}`:m,{error:g}=await Te.from("tablero_cdc_projects").update({description:b,updated_by:i}).eq("id",e);if(g)throw g;const x=va.find(w=>w.id===e);return x&&fT({...x,comentarios:b}),b}async function yB(e,t){const r=t.trim();if(!r)throw new Error("Escribe una nota antes de agregarla al historial.");const s=await bf(),i=Tv(s),l=s.email||"",c=new Date,{error:d}=await Te.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:i});if(d)throw d;const h=await vB(e,r,i,l,s.id,c),m=await xf(e,"update");return{comments:h,...m}}async function gT(e,t,r,s="",i=!1){try{const l=await bf(),c=Tv(l),{error:d}=await Te.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:c});if(d)throw d}catch(l){if(console.warn("No se pudo registrar la actividad del proyecto:",l),i)throw l instanceof Error?l:new Error("No se pudo registrar la actividad del proyecto.")}}function vT(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 jv(e){return e instanceof Error?e.message:e&&typeof e=="object"&&"message"in e?String(e.message||""):String(e||"")}function bB(e){const t=jv(e);return t.includes("tablero_cdc_get_projects_paginated")||t.includes("Could not find the function")}function xB(e){const t=jv(e);return t.includes("tablero_cdc_replace_project_links")||t.includes("Could not find the function")}function wB(e){const t=jv(e);return t.includes("tablero_cdc_get_pricing_summary")||t.includes("Could not find the function")}function El(e){return e.replace(/[%_]/g,"\\$&").replace(/,/g," ")}function Av(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",vf));const s=t.search.trim();if(s){const l=`%${El(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}`)}return r}function yT(e,t){let r=Av(e,t);if(t.country){const s=`%${El(t.country)}%`;r=r.or(`country.ilike.${s}`)}if(t.brand){const s=`%${El(t.brand)}%`;r=r.or(`brand.ilike.${s}`)}if(t.client){const s=`%${El(t.client)}%`;r=r.or(`client.ilike.${s}`)}if(t.cm){const s=`%${El(t.cm)}%`;r=r.or(`country_manager.ilike.${s}`)}return r}async function _B(e,t){const r=(e.page-1)*e.pageSize,s=r+e.pageSize-1;let i=Te.from("tablero_cdc_projects").select(vT(t),{count:"exact"}).order("created_at",{ascending:!1});i=yT(i,e);const{data:l,error:c,count:d}=await i.range(r,s);if(c)throw c;const h=(l||[]).map(m=>yf(m));return{projects:h,totalProjects:d??0,filterOptions:oB(h)}}async function SB(e,t){let s=0,i=null;const l=[];for(;i===null||s<i;){let b=Te.from("tablero_cdc_projects").select(vT(t),{count:"exact"}).order("created_at",{ascending:!1});b=Av(b,e);const{data:g,error:x,count:w}=await b.range(s,s+1e3-1);if(x)throw x;i===null&&(i=w??(g||[]).length);const E=(g||[]).map(S=>yf(S));if(l.push(...E),E.length<1e3)break;s+=1e3}const c=tT(l),d=l.filter(b=>eT(b,e,c)),h=(e.page-1)*e.pageSize,m=h+e.pageSize;return{projects:d.slice(h,m),totalProjects:d.length,filterOptions:c}}async function EB(e){var l,c,d,h;const{data:t,error:r}=await Te.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||{},i=Array.isArray(s.projects)?s.projects:[];return{totalProjects:Number(s.total_count||0),projects:i.map(m=>yf(m)),filterOptions:{countries:ts((l=s.filter_options)==null?void 0:l.countries),brands:ts((c=s.filter_options)==null?void 0:c.brands),clients:ts((d=s.filter_options)==null?void 0:d.clients),cms:ts((h=s.filter_options)==null?void 0:h.cms)}}}async function Us(e){const t=iT(e),r=Ku+=1;zn=t,Fl=!0,br(null),Kl();try{const s=await cT();let i;if(nT(t)||s)i=await SB(t,s);else try{i=await EB(t)}catch(l){if(!bB(l))throw l;console.warn("RPC tablero_cdc_get_projects_paginated no existe todavía. Usando consulta directa como respaldo temporal.",l),i=await _B(t,s)}if(r!==Ku)return;Dd=i.totalProjects,va=i.projects,aT=i.filterOptions,sT=!0}catch(s){if(r!==Ku)return;console.error("Error cargando proyectos desde Supabase:",s),Nv=s instanceof Error?s.message:"No se pudieron cargar los proyectos desde Supabase."}finally{r===Ku&&(Fl=!1,Kl())}}async function CB(e){br(null),zr+=1;try{const t=await lT(),r={...uT(e),created_by:t,updated_by:t},{data:s,error:i}=await Te.from("tablero_cdc_projects").insert(r).select("id").single();if(i)throw br(i.message),i;await hT(s.id,e),await pT(s.id,e.pricingItems),await gT(s.id,"created","Proyecto creado",`${e.nombre||"Proyecto sin título"} quedó registrado en el tablero.`);const l=await xf(s.id,"create");return await Us(zn),{projectId:s.id,...l}}finally{zr=Math.max(0,zr-1)}}async function NB(e,t){br(null),zr+=1;try{const r=await lT(),s=await aB(),i=await cT(),l=va.find(x=>x.id===e);if(!l){const x="No se encontró el proyecto en la página actual. Recarga el tablero antes de guardar para evitar sobrescribir datos.";throw br(x),new Error(x)}const c={...l,...t},d=uT(c),h=s?{...d,updated_by:r}:i?{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 Te.from("tablero_cdc_projects").update(h).eq("id",e);if(m)throw br(m.message),m;fT(c),await hT(e,c),i&&await pT(e,t.pricingItems);const b=rB(l,c,i);b.length>0&&await gT(e,"updated","Proyecto actualizado",b.slice(0,8).join(`
`));const g=await xf(e,"update");return await Us(zn),{projectId:e,...g}}finally{zr=Math.max(0,zr-1)}}async function TB(e){br(null),zr+=1;try{if(!await sB()){const l="No tienes permiso para eliminar proyectos.";throw br(l),new Error(l)}const r=await xf(e,"delete");if(r.sheetSyncStatus!=="synced"){const l=r.sheetSyncMessage||"No se pudo eliminar el proyecto del Google Sheet.";throw br(l),new Error(l)}const{error:s}=await Te.from("tablero_cdc_project_links").delete().eq("project_id",e);if(s)throw br(s.message),s;const{error:i}=await Te.from("tablero_cdc_projects").delete().eq("id",e);if(i)throw br(i.message),i;lB(e),await Us(zn)}finally{zr=Math.max(0,zr-1)}}async function jB(e){const{data:t,error:r}=await Te.rpc("tablero_cdc_get_pricing_summary",{p_tab:e.tab,p_search:e.search,p_country:e.country||"",p_brand:e.brand||"",p_client:e.client||"",p_cm:e.cm||""});if(r)throw r;const s=t||{},i=Number(s.total_amount||0),l=Number(s.project_count||0);return{totalAmount:Number.isFinite(i)?i:0,projectCount:Number.isFinite(l)?l:0,loadedAt:Date.now()}}async function AB(e){let r=0,s=null,i=0;for(;s===null||r<s;){let l=Te.from("tablero_cdc_projects").select("id, internal_amount",{count:"exact"}).order("created_at",{ascending:!1});l=yT(l,e);const{data:c,error:d,count:h}=await l.range(r,r+1e3-1);if(d)throw d;s===null&&(s=h??(c||[]).length);const m=c||[];if(m.forEach(b=>{const g=Number(b.internal_amount??0);Number.isFinite(g)&&g>0&&(i+=g)}),m.length<1e3)break;r+=1e3}return{totalAmount:i,projectCount:s??0,loadedAt:Date.now()}}async function RB(e){let r=0,s=null;const i=[];for(;s===null||r<s;){let h=Te.from("tablero_cdc_projects").select("id, title, client, brand, country, requested_by, country_manager, description, status, internal_amount, brief_link, created_at, extra_data",{count:"exact"}).order("created_at",{ascending:!1});h=Av(h,e);const{data:m,error:b,count:g}=await h.range(r,r+1e3-1);if(b)throw b;s===null&&(s=g??(m||[]).length);const x=(m||[]).map(w=>yf(w));if(i.push(...x),x.length<1e3)break;r+=1e3}const l=tT(i),c=i.filter(h=>eT(h,e,l));return{totalAmount:c.reduce((h,m)=>{const b=Number(m.monto??0);return Number.isFinite(b)&&b>0?h+b:h},0),projectCount:c.length,loadedAt:Date.now()}}async function N_(e){const t=iT({...e,page:1,pageSize:1e3});if(nT(t))return RB(t);try{return await jB(t)}catch(r){if(!wB(r))throw r;return console.warn("RPC tablero_cdc_get_pricing_summary no existe todavía. Usando suma directa como respaldo temporal.",r),AB(t)}}function kB(e,t){const[r,s]=v.useState({totalAmount:0,projectCount:0,loadedAt:null}),[i,l]=v.useState(!1),[c,d]=v.useState(null),h=e.tab,m=e.search,b=e.country,g=e.brand,x=e.client,w=e.cm;return v.useEffect(()=>{if(!t){s({totalAmount:0,projectCount:0,loadedAt:null}),d(null),l(!1);return}let E=!1;return l(!0),d(null),N_({tab:h,search:m,country:b,brand:g,client:x,cm:w,page:1,pageSize:1e3}).then(S=>{E||s(S)}).catch(S=>{E||(console.error("No se pudo calcular el total tarifado filtrado:",S),d(S instanceof Error?S.message:"No se pudo calcular el total tarifado filtrado."))}).finally(()=>{E||l(!1)}),()=>{E=!0}},[t,h,m,b,g,x,w]),{summary:r,loading:i,error:c,refresh:()=>N_(e).then(E=>(s(E),E))}}function bT(e){const[,t]=v.useState(0),r=e==null?void 0:e.tab,s=e==null?void 0:e.search,i=e==null?void 0:e.page,l=e==null?void 0:e.pageSize,c=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 v.useEffect(()=>{const b=()=>t(g=>g+1);return ld.push(b),Fu+=1,uB(),()=>{ld=ld.filter(g=>g!==b),Fu=Math.max(0,Fu-1),Fu===0&&dB()}},[]),v.useEffect(()=>{if(r&&i&&l){Us({tab:r,search:s??"",page:i,pageSize:l,country:c??"",brand:d??"",client:h??"",cm:m??""});return}!sT&&!Fl&&Us()},[r,s,i,l,c,d,h,m]),{projects:va,totalProjects:Dd,filterOptions:aT,loading:Fl,error:Nv,refresh:()=>Us(e??zn),add:CB,update:NB,remove:TB}}function OB(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 MB=e=>{switch(e){case"success":return LB;case"info":return IB;case"warning":return zB;case"error":return $B;default:return null}},DB=Array(12).fill(0),PB=({visible:e,className:t})=>he.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},he.createElement("div",{className:"sonner-spinner"},DB.map((r,s)=>he.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),LB=he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},he.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"})),zB=he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},he.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"})),IB=he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},he.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"})),$B=he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},he.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"})),UB=he.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"},he.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),he.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),BB=()=>{const[e,t]=he.useState(document.hidden);return he.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let mg=1;class HB{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,...i}=t,l=typeof(t==null?void 0:t.id)=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:mg++,c=this.toasts.find(h=>h.id===l),d=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),c?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,...i,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 i=Promise.resolve(t instanceof Function?t():t);let l=s!==void 0,c;const d=i.then(async m=>{if(c=["resolve",m],he.isValidElement(m))l=!1,this.create({id:s,type:"default",message:m});else if(VB(m)&&!m.ok){l=!1;const g=typeof r.error=="function"?await r.error(`HTTP error! status: ${m.status}`):r.error,x=typeof r.description=="function"?await r.description(`HTTP error! status: ${m.status}`):r.description,E=typeof g=="object"&&!he.isValidElement(g)?g:{message:g};this.create({id:s,type:"error",description:x,...E})}else if(m instanceof Error){l=!1;const g=typeof r.error=="function"?await r.error(m):r.error,x=typeof r.description=="function"?await r.description(m):r.description,E=typeof g=="object"&&!he.isValidElement(g)?g:{message:g};this.create({id:s,type:"error",description:x,...E})}else if(r.success!==void 0){l=!1;const g=typeof r.success=="function"?await r.success(m):r.success,x=typeof r.description=="function"?await r.description(m):r.description,E=typeof g=="object"&&!he.isValidElement(g)?g:{message:g};this.create({id:s,type:"success",description:x,...E})}}).catch(async m=>{if(c=["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,w=typeof b=="object"&&!he.isValidElement(b)?b:{message:b};this.create({id:s,type:"error",description:g,...w})}}).finally(()=>{l&&(this.dismiss(s),s=void 0),r.finally==null||r.finally.call(r)}),h=()=>new Promise((m,b)=>d.then(()=>c[0]==="reject"?b(c[1]):m(c[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)||mg++;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 Ln=new HB,qB=(e,t)=>{const r=(t==null?void 0:t.id)||mg++;return Ln.addToast({title:e,...t,id:r}),r},VB=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",GB=qB,FB=()=>Ln.toasts,KB=()=>Ln.getActiveToasts(),bt=Object.assign(GB,{success:Ln.success,info:Ln.info,warning:Ln.warning,error:Ln.error,custom:Ln.custom,message:Ln.message,promise:Ln.promise,dismiss:Ln.dismiss,loading:Ln.loading},{getHistory:FB,getToasts:KB});OB("[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 Yu(e){return e.label!==void 0}const WB=3,YB="24px",XB="16px",T_=4e3,JB=356,QB=14,ZB=45,e6=200;function kr(...e){return e.filter(Boolean).join(" ")}function t6(e){const[t,r]=e.split("-"),s=[];return t&&s.push(t),r&&s.push(r),s}const n6=e=>{var t,r,s,i,l,c,d,h,m;const{invert:b,toast:g,unstyled:x,interacting:w,setHeights:E,visibleToasts:S,heights:N,index:C,toasts:A,expanded:j,removeToast:k,defaultRichColors:I,closeButton:z,style:P,cancelButtonStyle:H,actionButtonStyle:Z,className:de="",descriptionClassName:ue="",duration:me,position:fe,gap:pe,expandByDefault:ge,classNames:R,icons:q,closeButtonAriaLabel:K="Close toast"}=e,[X,G]=he.useState(null),[O,M]=he.useState(null),[$,Y]=he.useState(!1),[B,ne]=he.useState(!1),[ee,Q]=he.useState(!1),[ae,se]=he.useState(!1),[Ee,je]=he.useState(!1),[nt,Qe]=he.useState(0),[Et,oe]=he.useState(0),Me=he.useRef(g.duration||me||T_),Ke=he.useRef(null),qe=he.useRef(null),_t=C===0,Ge=C+1<=S,ct=g.type,zt=g.dismissible!==!1,Be=g.className||"",ce=g.descriptionClassName||"",Le=he.useMemo(()=>N.findIndex(De=>De.toastId===g.id)||0,[N,g.id]),ut=he.useMemo(()=>{var De;return(De=g.closeButton)!=null?De:z},[g.closeButton,z]),fn=he.useMemo(()=>g.duration||me||T_,[g.duration,me]),Ot=he.useRef(0),Kt=he.useRef(0),Qt=he.useRef(0),yn=he.useRef(null),[hn,Ct]=fe.split("-"),Wt=he.useMemo(()=>N.reduce((De,pt,Ut)=>Ut>=Le?De:De+pt.height,0),[N,Le]),At=BB(),Oe=g.invert||b,Mt=ct==="loading";Kt.current=he.useMemo(()=>Le*pe+Wt,[Le,Wt]),he.useEffect(()=>{Me.current=fn},[fn]),he.useEffect(()=>{Y(!0)},[]),he.useEffect(()=>{const De=qe.current;if(De){const pt=De.getBoundingClientRect().height;return oe(pt),E(Ut=>[{toastId:g.id,height:pt,position:g.position},...Ut]),()=>E(Ut=>Ut.filter(mn=>mn.toastId!==g.id))}},[E,g.id]),he.useLayoutEffect(()=>{if(!$)return;const De=qe.current,pt=De.style.height;De.style.height="auto";const Ut=De.getBoundingClientRect().height;De.style.height=pt,oe(Ut),E(mn=>mn.find(Rt=>Rt.toastId===g.id)?mn.map(Rt=>Rt.toastId===g.id?{...Rt,height:Ut}:Rt):[{toastId:g.id,height:Ut,position:g.position},...mn])},[$,g.title,g.description,E,g.id,g.jsx,g.action,g.cancel]);const xt=he.useCallback(()=>{ne(!0),Qe(Kt.current),E(De=>De.filter(pt=>pt.toastId!==g.id)),setTimeout(()=>{k(g)},e6)},[g,k,E,Kt]);he.useEffect(()=>{if(g.promise&&ct==="loading"||g.duration===1/0||g.type==="loading")return;let De;return j||w||At?(()=>{if(Qt.current<Ot.current){const mn=new Date().getTime()-Ot.current;Me.current=Me.current-mn}Qt.current=new Date().getTime()})():(()=>{Me.current!==1/0&&(Ot.current=new Date().getTime(),De=setTimeout(()=>{g.onAutoClose==null||g.onAutoClose.call(g,g),xt()},Me.current))})(),()=>clearTimeout(De)},[j,w,g,ct,At,xt]),he.useEffect(()=>{g.delete&&(xt(),g.onDismiss==null||g.onDismiss.call(g,g))},[xt,g.delete]);function le(){var De;if(q!=null&&q.loading){var pt;return he.createElement("div",{className:kr(R==null?void 0:R.loader,g==null||(pt=g.classNames)==null?void 0:pt.loader,"sonner-loader"),"data-visible":ct==="loading"},q.loading)}return he.createElement(PB,{className:kr(R==null?void 0:R.loader,g==null||(De=g.classNames)==null?void 0:De.loader),visible:ct==="loading"})}const Ne=g.icon||(q==null?void 0:q[ct])||MB(ct);var Ye,st;return he.createElement("li",{tabIndex:0,ref:qe,className:kr(de,Be,R==null?void 0:R.toast,g==null||(t=g.classNames)==null?void 0:t.toast,R==null?void 0:R.default,R==null?void 0:R[ct],g==null||(r=g.classNames)==null?void 0:r[ct]),"data-sonner-toast":"","data-rich-colors":(Ye=g.richColors)!=null?Ye:I,"data-styled":!(g.jsx||g.unstyled||x),"data-mounted":$,"data-promise":!!g.promise,"data-swiped":Ee,"data-removed":B,"data-visible":Ge,"data-y-position":hn,"data-x-position":Ct,"data-index":C,"data-front":_t,"data-swiping":ee,"data-dismissible":zt,"data-type":ct,"data-invert":Oe,"data-swipe-out":ae,"data-swipe-direction":O,"data-expanded":!!(j||ge&&$),"data-testid":g.testId,style:{"--index":C,"--toasts-before":C,"--z-index":A.length-C,"--offset":`${B?nt:Kt.current}px`,"--initial-height":ge?"auto":`${Et}px`,...P,...g.style},onDragEnd:()=>{Q(!1),G(null),yn.current=null},onPointerDown:De=>{De.button!==2&&(Mt||!zt||(Ke.current=new Date,Qe(Kt.current),De.target.setPointerCapture(De.pointerId),De.target.tagName!=="BUTTON"&&(Q(!0),yn.current={x:De.clientX,y:De.clientY})))},onPointerUp:()=>{var De,pt,Ut;if(ae||!zt)return;yn.current=null;const mn=Number(((De=qe.current)==null?void 0:De.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),_a=Number(((pt=qe.current)==null?void 0:pt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Rt=new Date().getTime()-((Ut=Ke.current)==null?void 0:Ut.getTime()),Sn=X==="x"?mn:_a,us=Math.abs(Sn)/Rt;if(Math.abs(Sn)>=ZB||us>.11){Qe(Kt.current),g.onDismiss==null||g.onDismiss.call(g,g),M(X==="x"?mn>0?"right":"left":_a>0?"down":"up"),xt(),se(!0);return}else{var En,Cn;(En=qe.current)==null||En.style.setProperty("--swipe-amount-x","0px"),(Cn=qe.current)==null||Cn.style.setProperty("--swipe-amount-y","0px")}je(!1),Q(!1),G(null)},onPointerMove:De=>{var pt,Ut,mn;if(!yn.current||!zt||((pt=window.getSelection())==null?void 0:pt.toString().length)>0)return;const Rt=De.clientY-yn.current.y,Sn=De.clientX-yn.current.x;var us;const En=(us=e.swipeDirections)!=null?us:t6(fe);!X&&(Math.abs(Sn)>1||Math.abs(Rt)>1)&&G(Math.abs(Sn)>Math.abs(Rt)?"x":"y");let Cn={x:0,y:0};const Ys=dr=>1/(1.5+Math.abs(dr)/20);if(X==="y"){if(En.includes("top")||En.includes("bottom"))if(En.includes("top")&&Rt<0||En.includes("bottom")&&Rt>0)Cn.y=Rt;else{const dr=Rt*Ys(Rt);Cn.y=Math.abs(dr)<Math.abs(Rt)?dr:Rt}}else if(X==="x"&&(En.includes("left")||En.includes("right")))if(En.includes("left")&&Sn<0||En.includes("right")&&Sn>0)Cn.x=Sn;else{const dr=Sn*Ys(Sn);Cn.x=Math.abs(dr)<Math.abs(Sn)?dr:Sn}(Math.abs(Cn.x)>0||Math.abs(Cn.y)>0)&&je(!0),(Ut=qe.current)==null||Ut.style.setProperty("--swipe-amount-x",`${Cn.x}px`),(mn=qe.current)==null||mn.style.setProperty("--swipe-amount-y",`${Cn.y}px`)}},ut&&!g.jsx&&ct!=="loading"?he.createElement("button",{"aria-label":K,"data-disabled":Mt,"data-close-button":!0,onClick:Mt||!zt?()=>{}:()=>{xt(),g.onDismiss==null||g.onDismiss.call(g,g)},className:kr(R==null?void 0:R.closeButton,g==null||(s=g.classNames)==null?void 0:s.closeButton)},(st=q==null?void 0:q.close)!=null?st:UB):null,(ct||g.icon||g.promise)&&g.icon!==null&&((q==null?void 0:q[ct])!==null||g.icon)?he.createElement("div",{"data-icon":"",className:kr(R==null?void 0:R.icon,g==null||(i=g.classNames)==null?void 0:i.icon)},g.promise||g.type==="loading"&&!g.icon?g.icon||le():null,g.type!=="loading"?Ne:null):null,he.createElement("div",{"data-content":"",className:kr(R==null?void 0:R.content,g==null||(l=g.classNames)==null?void 0:l.content)},he.createElement("div",{"data-title":"",className:kr(R==null?void 0:R.title,g==null||(c=g.classNames)==null?void 0:c.title)},g.jsx?g.jsx:typeof g.title=="function"?g.title():g.title),g.description?he.createElement("div",{"data-description":"",className:kr(ue,ce,R==null?void 0:R.description,g==null||(d=g.classNames)==null?void 0:d.description)},typeof g.description=="function"?g.description():g.description):null),he.isValidElement(g.cancel)?g.cancel:g.cancel&&Yu(g.cancel)?he.createElement("button",{"data-button":!0,"data-cancel":!0,style:g.cancelButtonStyle||H,onClick:De=>{Yu(g.cancel)&&zt&&(g.cancel.onClick==null||g.cancel.onClick.call(g.cancel,De),xt())},className:kr(R==null?void 0:R.cancelButton,g==null||(h=g.classNames)==null?void 0:h.cancelButton)},g.cancel.label):null,he.isValidElement(g.action)?g.action:g.action&&Yu(g.action)?he.createElement("button",{"data-button":!0,"data-action":!0,style:g.actionButtonStyle||Z,onClick:De=>{Yu(g.action)&&(g.action.onClick==null||g.action.onClick.call(g.action,De),!De.defaultPrevented&&xt())},className:kr(R==null?void 0:R.actionButton,g==null||(m=g.classNames)==null?void 0:m.actionButton)},g.action.label):null)};function j_(){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 r6(e,t){const r={};return[e,t].forEach((s,i)=>{const l=i===1,c=l?"--mobile-offset":"--offset",d=l?XB:YB;function h(m){["top","right","bottom","left"].forEach(b=>{r[`${c}-${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[`${c}-${m}`]=d:r[`${c}-${m}`]=typeof s[m]=="number"?`${s[m]}px`:s[m]}):h(d)}),r}const a6=he.forwardRef(function(t,r){const{id:s,invert:i,position:l="bottom-right",hotkey:c=["altKey","KeyT"],expand:d,closeButton:h,className:m,offset:b,mobileOffset:g,theme:x="light",richColors:w,duration:E,style:S,visibleToasts:N=WB,toastOptions:C,dir:A=j_(),gap:j=QB,icons:k,containerAriaLabel:I="Notifications"}=t,[z,P]=he.useState([]),H=he.useMemo(()=>s?z.filter($=>$.toasterId===s):z.filter($=>!$.toasterId),[z,s]),Z=he.useMemo(()=>Array.from(new Set([l].concat(H.filter($=>$.position).map($=>$.position)))),[H,l]),[de,ue]=he.useState([]),[me,fe]=he.useState(!1),[pe,ge]=he.useState(!1),[R,q]=he.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),K=he.useRef(null),X=c.join("+").replace(/Key/g,"").replace(/Digit/g,""),G=he.useRef(null),O=he.useRef(!1),M=he.useCallback($=>{P(Y=>{var B;return(B=Y.find(ne=>ne.id===$.id))!=null&&B.delete||Ln.dismiss($.id),Y.filter(({id:ne})=>ne!==$.id)})},[]);return he.useEffect(()=>Ln.subscribe($=>{if($.dismiss){requestAnimationFrame(()=>{P(Y=>Y.map(B=>B.id===$.id?{...B,delete:!0}:B))});return}setTimeout(()=>{cS.flushSync(()=>{P(Y=>{const B=Y.findIndex(ne=>ne.id===$.id);return B!==-1?[...Y.slice(0,B),{...Y[B],...$},...Y.slice(B+1)]:[$,...Y]})})})}),[z]),he.useEffect(()=>{if(x!=="system"){q(x);return}if(x==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?q("dark"):q("light")),typeof window>"u")return;const $=window.matchMedia("(prefers-color-scheme: dark)");try{$.addEventListener("change",({matches:Y})=>{q(Y?"dark":"light")})}catch{$.addListener(({matches:B})=>{try{q(B?"dark":"light")}catch(ne){console.error(ne)}})}},[x]),he.useEffect(()=>{z.length<=1&&fe(!1)},[z]),he.useEffect(()=>{const $=Y=>{var B;if(c.every(Q=>Y[Q]||Y.code===Q)){var ee;fe(!0),(ee=K.current)==null||ee.focus()}Y.code==="Escape"&&(document.activeElement===K.current||(B=K.current)!=null&&B.contains(document.activeElement))&&fe(!1)};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[c]),he.useEffect(()=>{if(K.current)return()=>{G.current&&(G.current.focus({preventScroll:!0}),G.current=null,O.current=!1)}},[K.current]),he.createElement("section",{ref:r,"aria-label":`${I} ${X}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},Z.map(($,Y)=>{var B;const[ne,ee]=$.split("-");return H.length?he.createElement("ol",{key:$,dir:A==="auto"?j_():A,tabIndex:-1,ref:K,className:m,"data-sonner-toaster":!0,"data-sonner-theme":R,"data-y-position":ne,"data-x-position":ee,style:{"--front-toast-height":`${((B=de[0])==null?void 0:B.height)||0}px`,"--width":`${JB}px`,"--gap":`${j}px`,...S,...r6(b,g)},onBlur:Q=>{O.current&&!Q.currentTarget.contains(Q.relatedTarget)&&(O.current=!1,G.current&&(G.current.focus({preventScroll:!0}),G.current=null))},onFocus:Q=>{Q.target instanceof HTMLElement&&Q.target.dataset.dismissible==="false"||O.current||(O.current=!0,G.current=Q.relatedTarget)},onMouseEnter:()=>fe(!0),onMouseMove:()=>fe(!0),onMouseLeave:()=>{pe||fe(!1)},onDragEnd:()=>fe(!1),onPointerDown:Q=>{Q.target instanceof HTMLElement&&Q.target.dataset.dismissible==="false"||ge(!0)},onPointerUp:()=>ge(!1)},H.filter(Q=>!Q.position&&Y===0||Q.position===$).map((Q,ae)=>{var se,Ee;return he.createElement(n6,{key:Q.id,icons:k,index:ae,toast:Q,defaultRichColors:w,duration:(se=C==null?void 0:C.duration)!=null?se:E,className:C==null?void 0:C.className,descriptionClassName:C==null?void 0:C.descriptionClassName,invert:i,visibleToasts:N,closeButton:(Ee=C==null?void 0:C.closeButton)!=null?Ee:h,interacting:pe,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:M,toasts:H.filter(je=>je.position==Q.position),heights:de.filter(je=>je.position==Q.position),setHeights:ue,expandByDefault:d,gap:j,expanded:me,swipeDirections:t.swipeDirections})})):null}))}),s6="Walmart Connect WMC",i6=new Set(["wmc"]),Hi=15;function o6(e){return new Intl.DateTimeFormat("es-DO",{day:"2-digit",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(e))}function l6(e){return e.split(`
`).map(t=>t.trim()).filter(Boolean)}function pg(e){return e.reduce((t,r)=>t+Number(r.amount||0),0)}function c6(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,tariffSectionId:t.tariffSectionId,tariffCatalogId:t.tariffCatalogId}))}function u6(e,t){if(!t.length||e==null)return!1;const r=Number(e);if(!Number.isFinite(r)||r<=0)return!1;const s=pg(t);return Math.abs(r-s)>.01}function d6(e,t=[]){const r=Jt(e);if(!r)return[];const s=new Map(tt(t).map(h=>[Re(h),h])),i=s.get(Re(r));if(i)return[i];const l=r.split(/[,;]/).map(h=>Jt(h)).filter(Boolean);if(l.length<=1)return tt([i||r]);const c=[];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(", "),x=s.get(Re(g));if(x){h=x,m=b;break}}c.push(h||l[d]),d=m}return tt(c)}function f6(e){return tt(e.map(t=>Jt(t)).filter(Boolean)).join(", ")}function h6(e,t=[]){const r=Jt(e);if(!r)return[];const s=new Map(tt(t).map(c=>[Re(c),c])),i=s.get(Re(r));if(i)return[i];const l=r.split(/[,;]/).map(c=>Jt(c)).filter(Boolean);return l.length<=1?tt([i||r]):tt(l.map(c=>s.get(Re(c))||c))}function m6(e){return tt(e.map(t=>Jt(t)).filter(Boolean)).join(", ")}function Xu(e){return Re(e)===Re(s6)}const A_=()=>{const e=new Date;return{nombre:"",color:"blue",cliente:"",bu:"",cm:"",marca:"",solicitante:"",comentarios:"",briefLink:"",propuestaLinks:[],afLinks:[],status:"",monto:null,mes:cI[e.getMonth()],anio:e.getFullYear()}};function p6({open:e,onOpenChange:t,project:r,onDelete:s,deleting:i=!1}){const{add:l,update:c}=bT(),{lists:d,loading:h,error:m,refresh:b}=pf(),{isGerardo:g,canDeleteProjects:x,canManageInternalPricing:w}=Vd(),E=!!r,[S,N]=v.useState(A_()),[C,A]=v.useState([]),[j,k]=v.useState(!1),[I,z]=v.useState(""),[P,H]=v.useState(null),[Z,de]=v.useState(null),[ue,me]=v.useState([]),[fe,pe]=v.useState(!1),[ge,R]=v.useState(null),[q,K]=v.useState(""),[X,G]=v.useState(!1),[O,M]=v.useState(!1),[$,Y]=v.useState(!1),[B,ne]=v.useState([]),[ee,Q]=v.useState(!1),[ae,se]=v.useState(null),[Ee,je]=v.useState(!1),nt=v.useRef(!1),Qe=d6(S.marca,d.marcas),Et=h6(S.bu,d.bus),oe=tt(g_(d.clientes,S.cliente)),Me=tt([...d.marcas,...Qe]),Ke=tt([...d.bus,...Et]),qe=tt(g_(d.status,S.status)),_t=Ke.filter(le=>{const Ne=Re(le);return!i6.has(Ne)&&Ne.includes(Re(I))}),Ge=pg(B);v.useEffect(()=>{if(de(null),H(null),r){const{id:le,createdAt:Ne,...Ye}=r,st=Jt(Ye.bu);N({...Ye,bu:st}),A(st?[st]:[]),z(""),me([]),G(!1),R(null),K(""),ne([]),se(null),je(!1)}else e&&(N(A_()),A([]),z(""),me([]),G(!1),R(null),K(""),ne([]),se(null),je(!1))},[r,e]);const ct=v.useCallback(async()=>{if(r!=null&&r.id)try{pe(!0),R(null);const le=await C_(r.id,Hi+1);me(le.slice(0,Hi)),G(le.length>Hi)}catch(le){console.warn("No se pudo cargar el historial del proyecto:",le),R("No se pudo cargar el historial. Revisa que el SQL de actividad esté ejecutado en Supabase."),me([]),G(!1)}finally{pe(!1)}},[r==null?void 0:r.id]),zt=v.useCallback(async()=>{if(!(!(r!=null&&r.id)||O||!X))try{M(!0),R(null);const le=await C_(r.id,Hi+1,ue.length);me(Ne=>[...Ne,...le.slice(0,Hi)]),G(le.length>Hi)}catch(le){console.warn("No se pudo cargar más historial del proyecto:",le),R("No se pudo cargar más actividad. Inténtalo nuevamente.")}finally{M(!1)}},[X,ue.length,O,r==null?void 0:r.id]);v.useEffect(()=>{!e||!(r!=null&&r.id)||ct()},[e,r==null?void 0:r.id,ct]),v.useEffect(()=>{if(!e||!(r!=null&&r.id)||!w)return;let le=!1;return(async()=>{try{Q(!0),se(null);const Ye=await fB(r.id),st=c6(Ye);le||(je(u6(r.monto,st)),ne(st))}catch(Ye){console.warn("No se pudo cargar el tarifario del proyecto:",Ye),le||(ne([]),se("No se pudieron cargar los costos guardados. Revisa que el SQL del tarifario esté ejecutado en Supabase."))}finally{le||Q(!1)}})(),()=>{le=!0}},[w,e,r==null?void 0:r.id,r==null?void 0:r.monto]);const Be=(le,Ne)=>N(Ye=>({...Ye,[le]:Ne})),ce=le=>{je(!1),ne(le);const Ne=Number(pg(le).toFixed(2));N(Ye=>Ye.monto===Ne?Ye:{...Ye,monto:Ne})};v.useEffect(()=>{if(!w||!B.length||Ee)return;const le=Number(Ge.toFixed(2));N(Ne=>Ne.monto===le?Ne:{...Ne,monto:le})},[w,Ee,B.length,Ge]);const Le=le=>{const Ne=d.buCm[le];if(Ne)return Ne;const Ye=Re(le),st=Object.entries(d.buCm).find(([De])=>Re(De)===Ye);return(st==null?void 0:st[1])??""},ut=le=>{const Ne=tt(le.map(st=>Jt(st)).filter(Boolean)),Ye=tt(Ne.map(Le).filter(Boolean));N(st=>({...st,bu:m6(Ne),cm:Ye.join(", ")}))},fn=le=>{const Ne=Jt(le);N(Ye=>({...Ye,cliente:Ne,...Xu(Ne)&&!E?{bu:"",cm:""}:Ye.cliente&&Xu(Ye.cliente)?{bu:"",cm:""}:{}})),Xu(Ne)||(A([]),z(""))},Ot=!E&&Xu(S.cliente),Kt=Ot?C:Et,Qt=!E&&Kt.length>1,yn=(le,Ne)=>{const Ye=Jt(le);A(st=>Ne?tt([...st,Ye]):st.filter(De=>Re(De)!==Re(Ye)))},hn=C.map(le=>({country:le,manager:Le(le)})),Ct=Et.map(le=>({country:le,manager:Le(le)})),Wt=S.nombre.trim()&&S.cliente&&S.marca&&S.solicitante.trim()&&(Ot?C.length>0:Et.length>0),At=le=>{if(le.sheetSyncStatus==="synced"){bt.success(E?"Proyecto actualizado":"Proyecto creado",{description:"Se guardó y se sincronizó con el Google Sheet."});return}if(le.sheetSyncStatus==="skipped"){bt.success(E?"Proyecto actualizado":"Proyecto creado",{description:"Se guardó. La sincronización con Google Sheet no está configurada."});return}bt.warning("Proyecto guardado con aviso",{description:le.sheetSyncMessage})},Oe=async()=>{if(!(!(r!=null&&r.id)||!q.trim()||$))try{Y(!0);const le=await yB(r.id,q);Be("comentarios",le.comments),K(""),await ct(),le.sheetSyncStatus==="synced"?bt.success("Comentario agregado al historial",{description:"También se actualizó la columna Comentarios del Google Sheet."}):le.sheetSyncStatus==="skipped"?bt.success("Comentario agregado al historial",{description:"Se guardó como comentario interno. La sincronización con Sheet no está configurada."}):bt.warning("Comentario agregado con aviso",{description:le.sheetSyncMessage})}catch(le){console.error("Error agregando comentario al historial:",le);const Ne=le instanceof Error?le.message:"No se pudo agregar el comentario al historial.";bt.error("No se pudo agregar el comentario",{description:Ne})}finally{Y(!1)}},Mt=async()=>{if(!Wt||j||nt.current)return;nt.current=!0;const le=g?S:w?{...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(k(!0),de(null),H("Guardando y sincronizando con Google Sheet…"),Qt){const Ne=Kt,Ye=[];for(const[De,pt]of Ne.entries()){H(`Guardando país ${De+1} de ${Ne.length}: ${pt}`);const Ut={...le,bu:pt,cm:Le(pt),id:crypto.randomUUID(),createdAt:Date.now()+De};Ye.push(await l({...Ut,pricingItems:w?B:void 0}))}const st=Ye.filter(De=>De.sheetSyncStatus!=="synced");st.length===0?bt.success("Proyectos multipaís creados",{description:`Se crearon ${Ne.length} proyectos y ${Ne.length} filas en Google Sheet. El total de la estimación interna se aplicó por país.`}):bt.warning("Proyectos multipaís creados con aviso",{description:`${st.length} de ${Ne.length} sincronizaciones con Google Sheet requieren revisión.`})}else{const Ne=E&&r?await c(r.id,{...le,pricingItems:w?B:void 0}):await l({...le,id:crypto.randomUUID(),createdAt:Date.now(),pricingItems:w?B:void 0});At(Ne)}t(!1)}catch(Ne){console.error("Error guardando proyecto:",Ne);const Ye=Ne instanceof Error?Ne.message:"No se pudo guardar el proyecto. Revisa los permisos o intenta de nuevo.";de(Ye),bt.error("No se pudo guardar el proyecto",{description:Ye})}finally{nt.current=!1,k(!1),H(null)}},xt=!!S.status;return f.jsx(cc,{open:e,onOpenChange:le=>{j||nt.current||t(le)},children:f.jsxs(yo,{className:"max-w-3xl max-h-[92vh] overflow-y-auto p-0 gap-0",children:[f.jsx("div",{className:"h-2.5 w-full rounded-t-lg",style:{backgroundColor:QE(S.color)}}),f.jsxs("div",{className:"px-7 pt-6 pb-7",children:[f.jsx(bo,{className:"space-y-3",children:f.jsx("div",{className:"flex items-start justify-between gap-4",children:f.jsxs("div",{className:"flex-1",children:[f.jsx(xo,{className:"text-2xl tracking-tight",children:E?S.nombre||"Sin título":"Nuevo proyecto"}),f.jsxs(wo,{className:"mt-1 flex items-center gap-2 text-xs",children:[f.jsx(S5,{className:"w-3.5 h-3.5"}),S.mes," · ",S.anio,xt&&f.jsx(xn,{variant:"secondary",className:"ml-2",children:"Cerrado"})]})]})})}),f.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5 mt-6",children:[f.jsxs("div",{className:"md:col-span-2 space-y-1.5",children:[f.jsxs(He,{children:["Nombre del proyecto ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(ft,{value:S.nombre,onChange:le=>Be("nombre",le.target.value),placeholder:"Ej: Promoción Día de las Madres",className:"h-10"})]}),f.jsxs("div",{className:"md:col-span-2 space-y-2",children:[f.jsx(He,{children:"Etiqueta de color"}),f.jsx(A$,{value:S.color,onChange:le=>Be("color",le)})]}),f.jsx(zs,{className:"md:col-span-2 my-1"}),(h||m)&&f.jsxs("div",{className:xe("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:[f.jsx("span",{className:"flex items-center gap-2",children:h?f.jsxs(f.Fragment,{children:[f.jsx(gn,{className:"h-3.5 w-3.5 animate-spin"}),"Cargando listas…"]}):f.jsxs(f.Fragment,{children:[f.jsx(xd,{className:"h-3.5 w-3.5"}),"No se pudieron cargar las listas. Se usaron opciones locales."]})}),m&&f.jsx("button",{type:"button",onClick:()=>void b(),className:"font-medium text-amber-950 underline-offset-4 hover:underline",children:"Reintentar"})]}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsxs(He,{children:["Cliente ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(xr,{value:S.cliente,options:oe,onValueChange:fn,placeholder:"Seleccionar…",searchPlaceholder:"Buscar cliente…",emptyText:"No se encontró ese cliente."})]}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsxs(He,{children:["Marca ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(sg,{values:Qe,options:Me,onValuesChange:le=>Be("marca",f6(le)),placeholder:"Seleccionar una o varias marcas…",searchPlaceholder:"Buscar marca…",emptyText:"No se encontró esa marca.",summaryLabel:"marcas seleccionadas"})]}),Ot?f.jsxs("div",{className:"md:col-span-2 space-y-2 rounded-xl border border-primary/20 bg-primary/5 p-3",children:[f.jsxs("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between",children:[f.jsxs(He,{children:["BU Solicita (Países) ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsxs("span",{className:"text-xs font-medium text-primary",children:[C.length," seleccionado(s)"]})]}),f.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."}),f.jsxs("div",{className:"relative",children:[f.jsx(Ul,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),f.jsx(ft,{value:I,onChange:le=>z(le.target.value),placeholder:"Buscar país…",className:"h-9 pl-9 bg-card"})]}),f.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:_t.map(le=>{const Ne=C.some(st=>Re(st)===Re(le)),Ye=Le(le);return f.jsxs("label",{className:xe("flex cursor-pointer items-start gap-2 rounded-lg border bg-card px-3 py-2 text-sm transition-colors",Ne?"border-primary/50 bg-primary/10":"border-border hover:bg-muted/40"),children:[f.jsx(jC,{checked:Ne,onCheckedChange:st=>yn(le,st===!0),className:"mt-0.5"}),f.jsxs("span",{className:"leading-tight",children:[f.jsx("span",{className:"block font-medium",children:le}),f.jsxs("span",{className:"text-xs text-muted-foreground",children:["CM: ",Ye||"—"]})]})]},le)})})]}):f.jsxs("div",{className:"md:col-span-2 space-y-1.5",children:[f.jsxs(He,{children:["BU Solicita (Países) ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(sg,{values:Et,options:Ke,onValuesChange:ut,placeholder:"Seleccionar uno o varios países…",searchPlaceholder:"Buscar país…",emptyText:"No se encontró ese país.",summaryLabel:"países seleccionados"}),f.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."})]}),f.jsxs("div",{className:xe("space-y-1.5",Ot&&"md:col-span-2"),children:[f.jsxs(He,{className:"flex items-center gap-1.5",children:["Country Manager ",f.jsx("span",{className:"text-xs text-muted-foreground",children:"(automático)"})]}),Ot?f.jsx("div",{className:"min-h-10 rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:hn.length===0?f.jsx("span",{className:"text-muted-foreground",children:"Selecciona uno o más países."}):f.jsx("div",{className:"flex flex-wrap gap-1.5",children:hn.map(({country:le,manager:Ne})=>f.jsxs(xn,{variant:"secondary",className:"font-normal",children:[le,": ",Ne||"—"]},le))})}):f.jsx("div",{className:"min-h-10 rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:Ct.length===0?f.jsx("span",{className:"text-muted-foreground",children:"Selecciona uno o más países."}):f.jsx("div",{className:"flex flex-wrap gap-1.5",children:Ct.map(({country:le,manager:Ne})=>f.jsxs(xn,{variant:"secondary",className:"font-normal",children:[le,": ",Ne||"—"]},le))})})]}),Qt&&w&&f.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 total de la estimación interna se aplicará por cada país. La app no divide el monto automáticamente."}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsxs(He,{children:["Solicitado por ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(ft,{value:S.solicitante,onChange:le=>Be("solicitante",le.target.value),placeholder:"Nombre de quien solicita",className:"h-10"})]}),f.jsx(g6,{isEdit:E,items:ue,loading:fe,error:ge,note:q,hasMore:X,loadingMore:O,addingNote:$,onNoteChange:K,onAddNote:Oe,onRefresh:ct,onLoadMore:zt}),f.jsx(zs,{className:"md:col-span-2 my-1"}),f.jsxs("div",{className:"md:col-span-2 space-y-1.5",children:[f.jsxs(He,{children:["Link del Brief"," ",f.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"(carpeta de Fulgencio)"})]}),f.jsx(ft,{value:S.briefLink,onChange:le=>Be("briefLink",le.target.value),placeholder:"https://drive.google.com/…",className:"h-10"})]}),f.jsx("div",{className:"md:col-span-2",children:f.jsx(f_,{label:"Links de Propuestas",links:S.propuestaLinks,onChange:le=>Be("propuestaLinks",le),emptyText:"Aún no hay propuestas. Pega tantos links como necesites."})}),f.jsx("div",{className:"md:col-span-2",children:f.jsx(f_,{label:"Links de Artes Finales",prefix:"AF",links:S.afLinks,onChange:le=>Be("afLinks",le),emptyText:"Aún no hay artes finales."})}),f.jsx(zs,{className:"md:col-span-2 my-1"}),w&&f.jsx(zU,{client:S.cliente,items:B,onChange:ce,loading:ee,error:ae}),f.jsx(zs,{className:"md:col-span-2 my-1"}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsxs(He,{className:"flex items-center gap-1.5 pl-1",children:["Estatus",!g&&f.jsx(m3,{className:"w-3 h-3 text-muted-foreground"})]}),g?f.jsxs(x$,{value:S.status||"_none",onValueChange:le=>Be("status",le==="_none"?"":le),children:[f.jsx(dN,{className:"h-10",children:f.jsx(w$,{placeholder:"Sin estatus"})}),f.jsxs(mN,{children:[f.jsx(ng,{value:"_none",children:"Sin estatus"}),qe.map(le=>f.jsx(ng,{value:le,children:le},le))]})]}):f.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&&f.jsx("p",{className:"pl-1 text-[11px] text-muted-foreground",children:"Solo el Director Creativo puede cambiar el estatus."})]})]}),(Z||P)&&f.jsxs("div",{className:xe("mt-5 flex items-start gap-2 rounded-xl border px-3 py-2 text-sm",Z?"border-destructive/30 bg-destructive/5 text-destructive":"border-primary/20 bg-primary/5 text-primary"),children:[Z?f.jsx(xd,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}):f.jsx(gn,{className:"mt-0.5 h-4 w-4 flex-shrink-0 animate-spin"}),f.jsx("span",{children:Z||P})]})]}),f.jsx(of,{className:"px-7 py-4 border-t bg-muted/30 rounded-b-lg sm:justify-between",children:f.jsxs("div",{className:"flex w-full flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[f.jsx("div",{children:E&&r&&x&&s&&f.jsxs($e,{type:"button",variant:"destructive",onClick:()=>s(r),disabled:j||i,className:"gap-1.5 rounded-full",children:[i?f.jsx(gn,{className:"h-4 w-4 animate-spin"}):f.jsx(zg,{className:"h-4 w-4"}),i?"Eliminando…":"Eliminar proyecto"]})}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsx($e,{variant:"ghost",onClick:()=>{j||nt.current||t(!1)},disabled:j||i,children:"Cancelar"}),f.jsxs($e,{onClick:Mt,disabled:!Wt||j||i,children:[j&&f.jsx(gn,{className:"mr-1.5 h-4 w-4 animate-spin"}),j?"Guardando…":E?"Guardar cambios":Qt?"Crear proyectos":"Crear proyecto"]})]})]})})]})})}function g6({isEdit:e,items:t,loading:r,error:s,note:i,hasMore:l,loadingMore:c,addingNote:d,onNoteChange:h,onAddNote:m,onRefresh:b,onLoadMore:g}){return f.jsxs("div",{className:"md:col-span-2 rounded-2xl border border-border bg-muted/20 p-4",children:[f.jsxs("div",{className:"mb-3 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[f.jsxs("div",{className:"flex items-start gap-2.5",children:[f.jsx("span",{className:"mt-0.5 flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 text-primary",children:f.jsx(Q5,{className:"h-4 w-4"})}),f.jsxs("div",{children:[f.jsx("h3",{className:"text-sm font-semibold",children:"Actividad del proyecto"}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"Comentarios y movimientos recientes con fecha."})]})]}),e&&f.jsxs($e,{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?f.jsx(gn,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):null,"Actualizar"]})]}),e?f.jsxs("div",{className:"space-y-3",children:[f.jsxs("div",{className:"rounded-xl border border-border bg-card p-3",children:[f.jsx(He,{className:"text-xs font-medium",children:"Agregar comentario o solicitud adicional"}),f.jsxs("div",{className:"mt-2 flex flex-col gap-2 sm:flex-row",children:[f.jsx(da,{value:i,onChange:x=>h(x.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"}),f.jsxs($e,{type:"button",onClick:()=>void m(),disabled:!i.trim()||d,className:"gap-1.5 rounded-full sm:self-end",children:[d?f.jsx(gn,{className:"h-4 w-4 animate-spin"}):f.jsx(b3,{className:"h-4 w-4"}),"Agregar"]})]})]}),s&&f.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:[f.jsx(xd,{className:"mt-0.5 h-3.5 w-3.5 flex-shrink-0"}),f.jsx("span",{children:s})]}),r&&t.length===0?f.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:[f.jsx(gn,{className:"h-4 w-4 animate-spin"}),"Cargando actividad…"]}):t.length===0?f.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í."}):f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center justify-between gap-3 px-0.5 text-[11px] text-muted-foreground",children:[f.jsx("span",{children:"Mostrando los movimientos más recientes."}),f.jsxs("span",{children:[t.length," visibles"]})]}),f.jsx("div",{className:"max-h-[440px] space-y-2 overflow-y-auto pr-1",children:t.map(x=>{const w=l6(x.description);return f.jsxs("div",{className:"rounded-xl border border-border bg-card px-3 py-3 shadow-sm",children:[f.jsxs("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-start sm:justify-between",children:[f.jsxs("div",{children:[f.jsx("p",{className:"text-sm font-medium",children:x.title}),f.jsxs("p",{className:"text-xs text-muted-foreground",children:[x.actorName,x.actorEmail?` · ${x.actorEmail}`:""]})]}),f.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[f.jsx(jl,{className:"h-3.5 w-3.5"}),o6(x.createdAt)]})]}),w.length>0&&f.jsx("div",{className:"mt-2 space-y-1 text-sm text-muted-foreground",children:w.map(E=>f.jsx("p",{children:E},E))})]},x.id)})}),l&&f.jsx("div",{className:"flex justify-center pt-1",children:f.jsxs($e,{type:"button",variant:"outline",size:"sm",onClick:()=>void g(),disabled:c,className:"rounded-full",children:[c?f.jsx(gn,{className:"mr-1.5 h-4 w-4 animate-spin"}):null,c?"Cargando…":"Cargar más"]})})]})]}):f.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 qi=10;function R_(){const e=new Date,t=e.getTimezoneOffset()*6e4;return new Date(e.getTime()-t).toISOString().slice(0,10)}function v6(e){return tt(String(e||"").split(",").map(t=>t.trim()).filter(Boolean))}function Qi(e,t=!1){const r=Math.max(0,Math.round(Number(e||0))),s=Math.floor(r/60),i=r%60;return t?s&&i?`${s} h ${i} min`:s?`${s} h`:`${i} min`:s&&i?`${s} ${s===1?"hora":"horas"} ${i} min`:s?`${s} ${s===1?"hora":"horas"}`:`${i} min`}function y6(e){if(!e)return"—";const t=new Date(`${e}T12:00:00`);return Number.isFinite(t.getTime())?new Intl.DateTimeFormat("es-DO",{day:"2-digit",month:"short",year:"numeric"}).format(t):e}function b6(e){return new Intl.DateTimeFormat("es-DO",{day:"2-digit",month:"short",hour:"numeric",minute:"2-digit"}).format(new Date(e))}function k_(e,t){const r=new Map;for(const s of e){const i=t(s).trim()||"Sin especificar",l=Re(i)||i.toLowerCase(),c=r.get(l);c?c.minutes+=s.durationMinutes:r.set(l,{key:l,label:i,minutes:s.durationMinutes})}return[...r.values()].sort((s,i)=>i.minutes-s.minutes||s.label.localeCompare(i.label,"es"))}function O_(e){const r=(e instanceof Error?e.message:String(e||"")).toLowerCase();return r.includes("tablero_cdc_project_time_entries")||r.includes("relation")||r.includes("schema cache")}function x6({open:e,onOpenChange:t,project:r}){const{lists:s}=pf(),[i,l]=v.useState([]),[c,d]=v.useState(!1),[h,m]=v.useState(!1),[b,g]=v.useState(null),[x,w]=v.useState(null),[E,S]=v.useState(""),[N,C]=v.useState(""),[A,j]=v.useState(""),[k,I]=v.useState(""),[z,P]=v.useState(R_()),[H,Z]=v.useState(""),[de,ue]=v.useState(1),me=v.useMemo(()=>v6((r==null?void 0:r.bu)||""),[r==null?void 0:r.bu]),fe=v.useMemo(()=>tt([...me,...s.bus,E]),[E,s.bus,me]),pe=v.useMemo(()=>i.reduce((se,Ee)=>se+Ee.durationMinutes,0),[i]),ge=v.useMemo(()=>k_(i,se=>se.country),[i]),R=v.useMemo(()=>k_(i,se=>se.taskName),[i]),q=v.useMemo(()=>tt(i.map(se=>se.taskName)).slice(0,8),[i]),K=Math.max(1,Math.ceil(i.length/qi)),X=Math.min(de,K),G=(X-1)*qi,O=i.slice(G,G+qi),M=i.length===0?0:G+1,$=Math.min(G+qi,i.length),Y=v.useCallback(async()=>{if(r!=null&&r.id)try{d(!0),w(null);const se=await hB(r.id);l(se)}catch(se){console.error("No se pudo cargar el tiempo del proyecto:",se),l([]),w(O_(se)?"El módulo de tiempo todavía no está instalado en Supabase. Ejecuta supabase_project_time_entries.sql.":se instanceof Error?se.message:"No se pudo cargar el desglose de tiempo.")}finally{d(!1)}},[r==null?void 0:r.id]);v.useEffect(()=>{!e||!(r!=null&&r.id)||(S(me[0]||""),C(""),j(""),I(""),P(R_()),Z(""),ue(1),Y())},[Y,e,r==null?void 0:r.id,me]),v.useEffect(()=>{de>K&&ue(K)},[de,K]);const B=Math.max(0,Math.floor(Number(A||0)))*60+Math.max(0,Math.floor(Number(k||0))),ne=Number.isFinite(B)&&B>0,ee=!!(E.trim()&&N.trim()&&z&&ne),Q=async()=>{if(!(!(r!=null&&r.id)||!ee||h))try{m(!0),w(null);const se=await mB(r.id,{country:E,taskName:N,durationMinutes:B,workDate:z,notes:H});l(Ee=>[se,...Ee]),C(""),j(""),I(""),Z(""),ue(1),bt.success("Tiempo registrado",{description:`${Qi(se.durationMinutes,!0)} · ${se.country} · ${se.taskName}`})}catch(se){console.error("No se pudo registrar el tiempo:",se);const Ee=O_(se)?"Ejecuta supabase_project_time_entries.sql en Supabase antes de usar este módulo.":se instanceof Error?se.message:"No se pudo registrar el tiempo.";w(Ee),bt.error("No se pudo registrar el tiempo",{description:Ee})}finally{m(!1)}},ae=async se=>{if(window.confirm(`¿Eliminar este registro de ${Qi(se.durationMinutes,!0)} para “${se.taskName}”?`))try{g(se.id),await pB(se.id),l(je=>je.filter(nt=>nt.id!==se.id)),bt.success("Registro de tiempo eliminado")}catch(je){console.error("No se pudo eliminar el registro de tiempo:",je),bt.error("No se pudo eliminar",{description:je instanceof Error?je.message:"Intenta nuevamente."})}finally{g(null)}};return f.jsx(cc,{open:e,onOpenChange:t,children:f.jsxs(yo,{className:"max-h-[92vh] max-w-5xl overflow-y-auto p-0 gap-0",children:[f.jsx("div",{className:"border-b border-border bg-muted/20 px-6 py-5 sm:px-7",children:f.jsx(bo,{children:f.jsxs("div",{className:"flex items-start gap-3",children:[f.jsx("span",{className:"mt-0.5 flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-2xl bg-primary/10 text-primary",children:f.jsx(jl,{className:"h-5 w-5"})}),f.jsxs("div",{className:"min-w-0",children:[f.jsx(xo,{className:"text-xl tracking-tight",children:"Tiempo dedicado"}),f.jsxs(wo,{className:"mt-1",children:["Desglose por país y tarea para ",f.jsx("span",{className:"font-medium text-foreground",children:(r==null?void 0:r.nombre)||"este proyecto"}),"."]})]})]})})}),f.jsxs("div",{className:"space-y-6 px-6 py-6 sm:px-7",children:[f.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[f.jsx(xp,{icon:f.jsx(jl,{className:"h-4 w-4"}),label:"Total dedicado",value:Qi(pe,!0)}),f.jsx(xp,{icon:f.jsx(wd,{className:"h-4 w-4"}),label:"Países con tiempo",value:String(ge.length)}),f.jsx(xp,{icon:f.jsx(Lw,{className:"h-4 w-4"}),label:"Tareas registradas",value:String(R.length)})]}),f.jsxs("section",{className:"rounded-2xl border border-border bg-card p-4 sm:p-5",children:[f.jsxs("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[f.jsxs("div",{children:[f.jsx("h3",{className:"text-sm font-semibold",children:"Agregar tiempo"}),f.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Cada registro queda asociado a este proyecto y al usuario que lo agrega."})]}),f.jsxs($e,{type:"button",variant:"ghost",size:"sm",className:"h-8 self-start rounded-full px-2.5 text-xs text-muted-foreground",onClick:()=>void Y(),disabled:c,children:[c?f.jsx(gn,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):f.jsx(Lg,{className:"mr-1.5 h-3.5 w-3.5"}),"Actualizar"]})]}),f.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-12",children:[f.jsxs("div",{className:"space-y-1.5 md:col-span-4",children:[f.jsx(He,{children:"País"}),f.jsx(xr,{value:E,options:fe,onValueChange:S,placeholder:"Seleccionar país…",searchPlaceholder:"Buscar país…",emptyText:"No se encontró ese país."})]}),f.jsxs("div",{className:"space-y-1.5 md:col-span-4",children:[f.jsx(He,{children:"Tarea"}),f.jsx(ft,{value:N,onChange:se=>C(se.target.value),placeholder:"Ej: Diseño, adaptación, reunión…",className:"h-10",maxLength:160})]}),f.jsxs("div",{className:"space-y-1.5 md:col-span-2",children:[f.jsx(He,{children:"Horas"}),f.jsx(ft,{type:"number",min:0,step:1,inputMode:"numeric",value:A,onChange:se=>j(se.target.value),placeholder:"0",className:"h-10"})]}),f.jsxs("div",{className:"space-y-1.5 md:col-span-2",children:[f.jsx(He,{children:"Minutos"}),f.jsx(ft,{type:"number",min:0,max:59,step:1,inputMode:"numeric",value:k,onChange:se=>{const Ee=se.target.value;if(Ee===""){I("");return}I(String(Math.min(59,Math.max(0,Math.floor(Number(Ee)||0)))))},placeholder:"0",className:"h-10"})]}),f.jsxs("div",{className:"space-y-1.5 md:col-span-4",children:[f.jsx(He,{children:"Fecha"}),f.jsx(ft,{type:"date",value:z,onChange:se=>P(se.target.value),className:"h-10"})]}),f.jsxs("div",{className:"space-y-1.5 md:col-span-8",children:[f.jsxs(He,{children:["Nota ",f.jsx("span",{className:"font-normal text-muted-foreground",children:"(opcional)"})]}),f.jsx(da,{value:H,onChange:se=>Z(se.target.value),placeholder:"Detalle breve de lo realizado…",rows:2,maxLength:600,className:"min-h-[64px] resize-none"})]})]}),q.length>0&&f.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-1.5",children:[f.jsx("span",{className:"mr-1 text-[11px] text-muted-foreground",children:"Tareas recientes:"}),q.map(se=>f.jsx("button",{type:"button",onClick:()=>C(se),className:"rounded-full border border-border bg-muted/30 px-2.5 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:se},se))]}),f.jsxs("div",{className:"mt-4 flex flex-col gap-2 border-t border-border/70 pt-4 sm:flex-row sm:items-center sm:justify-between",children:[f.jsxs("p",{className:"text-xs text-muted-foreground",children:["Duración a registrar: ",f.jsx("span",{className:"font-semibold text-foreground",children:Qi(B,!0)})]}),f.jsxs($e,{type:"button",onClick:()=>void Q(),disabled:!ee||h||c,className:"gap-1.5 rounded-full",children:[h?f.jsx(gn,{className:"h-4 w-4 animate-spin"}):f.jsx(ua,{className:"h-4 w-4"}),h?"Guardando…":"Agregar registro"]})]}),x&&f.jsx("div",{className:"mt-4 rounded-xl border border-destructive/20 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:x})]}),f.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:[f.jsx(M_,{icon:f.jsx(wd,{className:"h-4 w-4"}),title:"Desglose por país",rows:ge,totalMinutes:pe,emptyText:"Aún no hay países con tiempo registrado."}),f.jsx(M_,{icon:f.jsx(Lw,{className:"h-4 w-4"}),title:"Desglose por tarea",rows:R,totalMinutes:pe,emptyText:"Aún no hay tareas con tiempo registrado."})]}),f.jsxs("section",{className:"overflow-hidden rounded-2xl border border-border bg-card",children:[f.jsxs("div",{className:"flex flex-col gap-2 border-b border-border bg-muted/20 px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[f.jsxs("div",{children:[f.jsx("h3",{className:"text-sm font-semibold",children:"Registros detallados"}),f.jsx("p",{className:"text-xs text-muted-foreground",children:i.length===0?"Sin registros todavía.":`Mostrando ${M}-${$} de ${i.length}.`})]}),i.length>qi&&f.jsxs("span",{className:"text-xs text-muted-foreground",children:["Página ",X," de ",K]})]}),c&&i.length===0?f.jsxs("div",{className:"flex items-center justify-center gap-2 px-4 py-12 text-sm text-muted-foreground",children:[f.jsx(gn,{className:"h-4 w-4 animate-spin"}),"Cargando tiempo…"]}):i.length===0?f.jsxs("div",{className:"px-4 py-10 text-center",children:[f.jsx(jl,{className:"mx-auto h-8 w-8 text-muted-foreground/40"}),f.jsx("p",{className:"mt-2 text-sm font-medium",children:"Aún no hay tiempo registrado"}),f.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Agrega el primer registro usando el formulario de arriba."})]}):f.jsx("div",{className:"divide-y divide-border/70",children:O.map(se=>f.jsx(w6,{entry:se,deleting:b===se.id,onDelete:()=>void ae(se)},se.id))}),i.length>qi&&f.jsxs("div",{className:"flex items-center justify-between border-t border-border bg-muted/10 px-4 py-3",children:[f.jsxs($e,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1 rounded-full",disabled:X<=1,onClick:()=>ue(se=>Math.max(1,se-1)),children:[f.jsx(Pg,{className:"h-3.5 w-3.5"}),"Anterior"]}),f.jsxs("span",{className:"text-xs text-muted-foreground",children:[X," / ",K]}),f.jsxs($e,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1 rounded-full",disabled:X>=K,onClick:()=>ue(se=>Math.min(K,se+1)),children:["Siguiente",f.jsx(Fd,{className:"h-3.5 w-3.5"})]})]})]})]})]})})}function xp({icon:e,label:t,value:r}){return f.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-border bg-card px-4 py-3.5 shadow-sm",children:[f.jsx("span",{className:"flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:e}),f.jsxs("div",{className:"min-w-0",children:[f.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:t}),f.jsx("p",{className:"mt-0.5 truncate text-lg font-semibold tabular-nums text-foreground",children:r})]})]})}function M_({icon:e,title:t,rows:r,totalMinutes:s,emptyText:i}){return f.jsxs("section",{className:"rounded-2xl border border-border bg-card p-4",children:[f.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[f.jsx("span",{className:"text-primary",children:e}),f.jsx("h3",{className:"text-sm font-semibold",children:t})]}),r.length===0?f.jsx("p",{className:"rounded-xl border border-dashed border-border bg-muted/20 px-3 py-5 text-center text-xs text-muted-foreground",children:i}):f.jsx("div",{className:"space-y-3",children:r.map(l=>{const c=s>0?l.minutes/s*100:0;return f.jsxs("div",{children:[f.jsxs("div",{className:"mb-1 flex items-center justify-between gap-3 text-xs",children:[f.jsx("span",{className:"min-w-0 truncate font-medium text-foreground",title:l.label,children:l.label}),f.jsx("span",{className:"flex-shrink-0 font-semibold tabular-nums text-foreground",children:Qi(l.minutes,!0)})]}),f.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:f.jsx("div",{className:"h-full rounded-full bg-primary/70 transition-[width]",style:{width:`${Math.max(2,Math.min(100,c))}%`}})})]},l.key)})})]})}function w6({entry:e,deleting:t,onDelete:r}){return f.jsxs("div",{className:"grid grid-cols-1 gap-3 px-4 py-4 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start",children:[f.jsxs("div",{className:"min-w-0",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx("span",{className:"font-medium text-sm text-foreground",children:e.taskName}),f.jsx(xn,{variant:"secondary",className:"h-5 px-1.5 text-[10px] font-normal",children:e.country}),f.jsx("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-xs font-semibold tabular-nums text-primary",children:Qi(e.durationMinutes,!0)})]}),e.notes&&f.jsx("p",{className:"mt-1.5 whitespace-pre-wrap text-xs leading-relaxed text-muted-foreground",children:e.notes}),f.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground",children:[f.jsxs("span",{className:"inline-flex items-center gap-1",children:[f.jsx(w5,{className:"h-3 w-3"}),y6(e.workDate)]}),f.jsxs("span",{className:"inline-flex items-center gap-1",title:e.actorEmail||e.actorName,children:[f.jsx(O3,{className:"h-3 w-3"}),e.actorName]}),f.jsxs("span",{children:["Registrado ",b6(e.createdAt)]})]})]}),f.jsx($e,{type:"button",variant:"ghost",size:"icon",onClick:r,disabled:t,className:xe("h-8 w-8 justify-self-end rounded-full text-muted-foreground hover:bg-destructive/10 hover:text-destructive",t&&"text-destructive"),title:"Eliminar registro",children:t?f.jsx(gn,{className:"h-4 w-4 animate-spin"}):f.jsx(zg,{className:"h-4 w-4"})})]})}function cd(e){const t=e.trim();return/^https?:\/\//i.test(t)?t:""}function D_(e){const t=cd(e);t&&window.open(t,"_blank","noopener,noreferrer")}function P_(e){return!e||!Number.isFinite(e)?"—":new Intl.DateTimeFormat("es-DO",{day:"2-digit",month:"short",year:"numeric"}).format(new Date(e))}function _6({item:e,mode:t,busy:r=!1,onApprove:s,onReject:i}){const l=t==="rejected",c=cd(e.documentLink)||cd(e.briefLink),d=cd(e.briefLink);return f.jsxs("article",{className:xe("overflow-hidden rounded-2xl border bg-card shadow-sm transition-shadow hover:shadow-md",l?"border-red-200/70":"border-amber-200/80"),children:[f.jsx("div",{className:xe("flex min-h-14 items-start justify-between gap-3 px-4 py-3",l?"bg-red-50":"bg-amber-50"),children:f.jsxs("div",{className:"min-w-0",children:[f.jsx("div",{className:"mb-1.5 flex flex-wrap items-center gap-1.5",children:f.jsx(xn,{variant:"secondary",className:xe("h-5 px-2 text-[10px] font-semibold",l?"bg-red-100 text-red-800 hover:bg-red-100":"bg-amber-100 text-amber-900 hover:bg-amber-100"),children:l?"Rechazado":"Nuevo · CDC Brief"})}),f.jsx("h3",{className:"line-clamp-2 text-sm font-semibold leading-snug text-foreground",children:e.title||"Brief sin título"})]})}),f.jsxs("div",{className:"space-y-3 p-4",children:[f.jsxs("div",{className:"space-y-2.5",children:[f.jsx(bl,{icon:f.jsx(_d,{className:"h-3.5 w-3.5"}),label:"Cliente",value:e.client}),f.jsx(bl,{icon:f.jsx(_d,{className:"h-3.5 w-3.5"}),label:"Marca",value:e.brand}),f.jsx(bl,{icon:f.jsx(wd,{className:"h-3.5 w-3.5"}),label:"País",value:e.country}),f.jsx(bl,{icon:f.jsx(r1,{className:"h-3.5 w-3.5"}),label:"Solicita",value:e.requestedBy}),f.jsx(bl,{icon:f.jsx(b5,{className:"h-3.5 w-3.5"}),label:"Creado",value:P_(e.sourceCreatedAt)})]}),(e.requestType||e.deliverableType||e.deliveryDate)&&f.jsxs("div",{className:"rounded-xl border border-border/70 bg-muted/20 px-3 py-2.5 text-xs",children:[e.requestType&&f.jsxs("p",{children:[f.jsx("span",{className:"text-muted-foreground",children:"Requerimiento:"})," ",f.jsx("span",{className:"font-medium text-foreground",children:e.requestType})]}),e.deliverableType&&f.jsxs("p",{className:e.requestType?"mt-1":"",children:[f.jsx("span",{className:"text-muted-foreground",children:"Entregable:"})," ",f.jsx("span",{className:"font-medium text-foreground",children:e.deliverableType})]}),e.deliveryDate&&f.jsxs("p",{className:e.requestType||e.deliverableType?"mt-1":"",children:[f.jsx("span",{className:"text-muted-foreground",children:"Entrega:"})," ",f.jsx("span",{className:"font-medium text-foreground",children:e.deliveryDate})]})]}),e.summary&&f.jsx("p",{className:"line-clamp-4 text-xs leading-relaxed text-muted-foreground",children:e.summary}),l&&(e.reviewedByName||e.reviewedAt)&&f.jsxs("div",{className:"rounded-xl border border-red-100 bg-red-50/60 px-3 py-2 text-[11px] text-red-800",children:["Revisado",e.reviewedByName?` por ${e.reviewedByName}`:"",e.reviewedAt?` · ${P_(e.reviewedAt)}`:"",e.rejectionReason?` · ${e.rejectionReason}`:""]}),f.jsxs("div",{className:"flex flex-wrap gap-2 border-t border-border/70 pt-3",children:[f.jsxs($e,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1.5 rounded-full px-3 text-xs",disabled:!c||r,onClick:()=>D_(c),children:[f.jsx(n1,{className:"h-3.5 w-3.5"}),"Ver brief"]}),d&&d!==c&&f.jsxs($e,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1.5 rounded-full px-3 text-xs",disabled:r,onClick:()=>D_(d),children:[f.jsx(X5,{className:"h-3.5 w-3.5"}),"Carpeta"]}),f.jsxs("div",{className:"ml-auto flex gap-2",children:[!l&&f.jsxs($e,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1.5 rounded-full border-red-200 px-3 text-xs text-red-700 hover:bg-red-50 hover:text-red-800",disabled:r||!i,onClick:i,children:[f.jsx(P5,{className:"h-3.5 w-3.5"}),"No aprobar"]}),f.jsxs($e,{type:"button",size:"sm",className:"h-8 gap-1.5 rounded-full px-3 text-xs",disabled:r||!s,onClick:s,children:[f.jsx(t1,{className:"h-3.5 w-3.5"}),r?"Procesando…":"Aprobar"]})]})]})]})]})}function bl({icon:e,label:t,value:r}){return f.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[f.jsx("span",{className:"mt-0.5 flex-shrink-0 text-muted-foreground",children:e}),f.jsx("span",{className:"w-14 flex-shrink-0 text-muted-foreground",children:t}),f.jsx("span",{className:"truncate font-medium text-foreground",children:r||"—"})]})}function wp(e,t=Date.now()){if(!e)return t;const r=new Date(e).getTime();return Number.isFinite(r)?r:t}function S6(e){const t=wp(e.created_at);return{id:e.id,briefId:e.brief_id||"",sourceCreatedAt:wp(e.source_created_at,t),title:e.title||"",client:e.client||"",brand:e.brand||"",country:e.country||"",requestedBy:e.requested_by||"",requestedByEmail:e.requested_by_email||"",deliveryDate:e.delivery_date||"",briefLink:e.brief_link||"",documentLink:e.document_link||"",summary:e.summary||"",requestType:e.request_type||"",deliverableType:e.deliverable_type||"",reviewStatus:e.review_status==="approved"?"approved":e.review_status==="rejected"?"rejected":"new",rejectionReason:e.rejection_reason||"",approvedProjectId:e.approved_project_id||"",reviewedByName:e.reviewed_by_name||"",reviewedByEmail:e.reviewed_by_email||"",reviewedAt:e.reviewed_at?wp(e.reviewed_at):null,createdAt:t}}function E6(e){return e.trim().replace(/[%_,]/g," ").replace(/\s+/g," ")}function C6(){return"https://agenteit.digitalcompass.agency/webhook/tablero-cdc-sync-proyecto".trim()||""}async function N6(e){const t=C6();if(!t)return{sheetSyncStatus:"skipped",sheetSyncMessage:"Proyecto aprobado y creado en Supabase. No hay webhook configurado para sincronizar Google Sheet."};const r=new AbortController,s=window.setTimeout(()=>r.abort(),15e3);try{const i=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project_id:e,action:"create",source:"tablero-cdc-brief-review",sent_at:new Date().toISOString()}),signal:r.signal});return i.ok?{sheetSyncStatus:"synced",sheetSyncMessage:"Brief aprobado, proyecto Activo creado y Google Sheet sincronizado."}:{sheetSyncStatus:"failed",sheetSyncMessage:`El proyecto quedó Activo en el Tablero, pero el Sheet no se pudo sincronizar: ${await i.text().catch(()=>"")||`${i.status} ${i.statusText}`.trim()}`}}catch(i){const l=i instanceof DOMException&&i.name==="AbortError";return{sheetSyncStatus:l?"timeout":"failed",sheetSyncMessage:l?"El proyecto quedó Activo en el Tablero, pero n8n tardó demasiado en responder. Revisa el Sheet si fuera necesario.":"El proyecto quedó Activo en el Tablero, pero no se pudo sincronizar con Google Sheet."}}finally{window.clearTimeout(s)}}function T6({status:e,search:t,page:r,pageSize:s,enabled:i=!0}){const[l,c]=v.useState([]),[d,h]=v.useState(0),[m,b]=v.useState(!1),[g,x]=v.useState(null),w=v.useRef(0),E=v.useMemo(()=>E6(t),[t]),S=v.useCallback(async()=>{if(!i)return;const A=w.current+=1;b(!0),x(null);try{const j=Math.max(0,(r-1)*s),k=j+s-1;let I=Te.from("tablero_cdc_brief_inbox").select("id, brief_id, source_created_at, title, client, brand, country, requested_by, requested_by_email, delivery_date, brief_link, document_link, summary, request_type, deliverable_type, review_status, rejection_reason, approved_project_id, reviewed_by_name, reviewed_by_email, reviewed_at, created_at",{count:"exact"}).eq("review_status",e).order("created_at",{ascending:!1});if(E){const Z=`%${E}%`;I=I.or(`title.ilike.${Z},client.ilike.${Z},brand.ilike.${Z},country.ilike.${Z},requested_by.ilike.${Z},requested_by_email.ilike.${Z},request_type.ilike.${Z},deliverable_type.ilike.${Z},summary.ilike.${Z}`)}const{data:z,error:P,count:H}=await I.range(j,k);if(P)throw P;if(A!==w.current)return;c((z||[]).map(S6)),h(H??0)}catch(j){if(A!==w.current)return;console.error("Error cargando bandeja de CDC Brief:",j),x(j instanceof Error?j.message:"No se pudieron cargar los briefs pendientes de revisión."),c([]),h(0)}finally{A===w.current&&b(!1)}},[i,E,r,s,e]);v.useEffect(()=>{i&&S()},[i,S]),v.useEffect(()=>{if(!i)return;let A=null;const j=Te.channel(`tablero-cdc-brief-inbox-${e}`).on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_brief_inbox"},()=>{A&&clearTimeout(A),A=setTimeout(()=>void S(),300)}).subscribe(k=>{(k==="CHANNEL_ERROR"||k==="TIMED_OUT")&&console.warn("Supabase Realtime no pudo suscribirse a tablero_cdc_brief_inbox:",k)});return()=>{A&&clearTimeout(A),Te.removeChannel(j)}},[i,S,e]);const N=v.useCallback(async A=>{const{data:j,error:k}=await Te.rpc("tablero_cdc_approve_brief",{p_inbox_id:A});if(k)throw k;const z=String((j||{}).project_id||"").trim();if(!z)throw new Error("Supabase aprobó el brief, pero no devolvió el Project ID.");const P=await N6(z);return await S(),{projectId:z,...P}},[S]),C=v.useCallback(async(A,j="")=>{const{data:k,error:I}=await Te.rpc("tablero_cdc_reject_brief",{p_inbox_id:A,p_reason:j.trim()||null});if(I)throw I;if((k||{}).ok===!1)throw new Error("Supabase no pudo mover el brief a Rechazados.");await S()},[S]);return{items:l,totalItems:d,loading:m,error:g,refresh:S,approve:N,reject:C}}function j6(e=!0){const[t,r]=v.useState(0),[s,i]=v.useState(!1),[l,c]=v.useState(null),d=v.useRef(0),h=v.useCallback(async()=>{if(!e){r(0);return}const b=d.current+=1;i(!0);try{const{data:g,error:x}=await Te.rpc("tablero_cdc_get_unseen_brief_count");if(x)throw x;if(b!==d.current)return;const w=Number(g??0);r(Number.isFinite(w)&&w>0?w:0),c(null)}catch(g){if(b!==d.current)return;console.error("Error cargando notificaciones de briefs nuevos:",g),c(g instanceof Error?g.message:"No se pudo actualizar el contador de briefs nuevos.")}finally{b===d.current&&i(!1)}},[e]),m=v.useCallback(async()=>{if(!e)return 0;r(0);try{const{data:b,error:g}=await Te.rpc("tablero_cdc_mark_briefs_seen");if(g)throw g;const w=Number((b||{}).unseen_count??0),E=Number.isFinite(w)&&w>0?w:0;return r(E),c(null),E}catch(b){throw await h(),b}},[e,h]);return v.useEffect(()=>{if(!e){r(0);return}h()},[e,h]),v.useEffect(()=>{if(!e)return;let b=null;const g=()=>{b&&clearTimeout(b),b=setTimeout(()=>void h(),250)},x=Te.channel("tablero-cdc-brief-unread-counter").on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_brief_inbox"},g).subscribe(N=>{(N==="CHANNEL_ERROR"||N==="TIMED_OUT")&&console.warn("Supabase Realtime no pudo actualizar el contador de briefs:",N)}),w=window.setInterval(()=>{document.visibilityState==="visible"&&h()},3e4),E=()=>void h(),S=()=>{document.visibilityState==="visible"&&h()};return window.addEventListener("focus",E),document.addEventListener("visibilitychange",S),()=>{b&&clearTimeout(b),window.clearInterval(w),window.removeEventListener("focus",E),document.removeEventListener("visibilitychange",S),Te.removeChannel(x)}},[e,h]),{unreadCount:t,loading:s,error:l,refresh:h,markAllSeen:m}}const xT="pricing_summary_public";function wT(e){var t;return!!((t=e==null?void 0:e.value)!=null&&t.enabled)}async function A6(){const{data:e,error:t}=await Te.from("tablero_cdc_app_settings").select("key, value").eq("key",xT).maybeSingle();if(t)throw t;return wT(e)}async function R6(e){const{error:t}=await Te.rpc("tablero_cdc_set_pricing_summary_public",{p_enabled:e});if(t)throw t}function k6(e=!0){const[t,r]=v.useState(!1),[s,i]=v.useState(e),[l,c]=v.useState(!1),[d,h]=v.useState(null),m=v.useCallback(async()=>{if(!e)return!1;i(!0),h(null);try{const g=await A6();return r(g),g}catch(g){return console.error("No se pudo leer la visibilidad del total tarifado:",g),h(g instanceof Error?g.message:"No se pudo leer la visibilidad del total tarifado."),!1}finally{i(!1)}},[e]),b=v.useCallback(async g=>{c(!0),h(null);try{return await R6(g),r(g),g}catch(x){throw console.error("No se pudo actualizar la visibilidad del total tarifado:",x),h(x instanceof Error?x.message:"No se pudo actualizar la visibilidad del total tarifado."),x}finally{c(!1)}},[]);return v.useEffect(()=>{m()},[m]),v.useEffect(()=>{if(!e)return;const g=Te.channel("tablero-cdc-pricing-summary-visibility").on("postgres_changes",{event:"*",schema:"public",table:"tablero_cdc_app_settings",filter:`key=eq.${xT}`},x=>{const w=x.new||x.old;r(wT(w))}).subscribe();return()=>{Te.removeChannel(g)}},[e]),{isPublic:t,loading:s,saving:l,error:d,refresh:m,setPublicVisibility:b}}function O6(e,t){return v.useReducer((r,s)=>t[r][s]??r,e)}var Rv="ScrollArea",[_T]=cr(Rv),[M6,ur]=_T(Rv),ST=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:s="hover",dir:i,scrollHideDelay:l=600,...c}=e,[d,h]=v.useState(null),[m,b]=v.useState(null),[g,x]=v.useState(null),[w,E]=v.useState(null),[S,N]=v.useState(null),[C,A]=v.useState(0),[j,k]=v.useState(0),[I,z]=v.useState(!1),[P,H]=v.useState(!1),Z=Je(t,ue=>h(ue)),de=ec(i);return f.jsx(M6,{scope:r,type:s,dir:de,scrollHideDelay:l,scrollArea:d,viewport:m,onViewportChange:b,content:g,onContentChange:x,scrollbarX:w,onScrollbarXChange:E,scrollbarXEnabled:I,onScrollbarXEnabledChange:z,scrollbarY:S,onScrollbarYChange:N,scrollbarYEnabled:P,onScrollbarYEnabledChange:H,onCornerWidthChange:A,onCornerHeightChange:k,children:f.jsx(ke.div,{dir:de,...c,ref:Z,style:{position:"relative","--radix-scroll-area-corner-width":C+"px","--radix-scroll-area-corner-height":j+"px",...e.style}})})});ST.displayName=Rv;var ET="ScrollAreaViewport",CT=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:s,nonce:i,...l}=e,c=ur(ET,r),d=v.useRef(null),h=Je(t,d,c.onViewportChange);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),f.jsx(ke.div,{"data-radix-scroll-area-viewport":"",...l,ref:h,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...e.style},children:f.jsx("div",{ref:c.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});CT.displayName=ET;var Ur="ScrollAreaScrollbar",kv=v.forwardRef((e,t)=>{const{forceMount:r,...s}=e,i=ur(Ur,e.__scopeScrollArea),{onScrollbarXEnabledChange:l,onScrollbarYEnabledChange:c}=i,d=e.orientation==="horizontal";return v.useEffect(()=>(d?l(!0):c(!0),()=>{d?l(!1):c(!1)}),[d,l,c]),i.type==="hover"?f.jsx(D6,{...s,ref:t,forceMount:r}):i.type==="scroll"?f.jsx(P6,{...s,ref:t,forceMount:r}):i.type==="auto"?f.jsx(NT,{...s,ref:t,forceMount:r}):i.type==="always"?f.jsx(Ov,{...s,ref:t}):null});kv.displayName=Ur;var D6=v.forwardRef((e,t)=>{const{forceMount:r,...s}=e,i=ur(Ur,e.__scopeScrollArea),[l,c]=v.useState(!1);return v.useEffect(()=>{const d=i.scrollArea;let h=0;if(d){const m=()=>{window.clearTimeout(h),c(!0)},b=()=>{h=window.setTimeout(()=>c(!1),i.scrollHideDelay)};return d.addEventListener("pointerenter",m),d.addEventListener("pointerleave",b),()=>{window.clearTimeout(h),d.removeEventListener("pointerenter",m),d.removeEventListener("pointerleave",b)}}},[i.scrollArea,i.scrollHideDelay]),f.jsx(vn,{present:r||l,children:f.jsx(NT,{"data-state":l?"visible":"hidden",...s,ref:t})})}),P6=v.forwardRef((e,t)=>{const{forceMount:r,...s}=e,i=ur(Ur,e.__scopeScrollArea),l=e.orientation==="horizontal",c=_f(()=>h("SCROLL_END"),100),[d,h]=O6("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return v.useEffect(()=>{if(d==="idle"){const m=window.setTimeout(()=>h("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(m)}},[d,i.scrollHideDelay,h]),v.useEffect(()=>{const m=i.viewport,b=l?"scrollLeft":"scrollTop";if(m){let g=m[b];const x=()=>{const w=m[b];g!==w&&(h("SCROLL"),c()),g=w};return m.addEventListener("scroll",x),()=>m.removeEventListener("scroll",x)}},[i.viewport,l,h,c]),f.jsx(vn,{present:r||d!=="hidden",children:f.jsx(Ov,{"data-state":d==="hidden"?"hidden":"visible",...s,ref:t,onPointerEnter:ye(e.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:ye(e.onPointerLeave,()=>h("POINTER_LEAVE"))})})}),NT=v.forwardRef((e,t)=>{const r=ur(Ur,e.__scopeScrollArea),{forceMount:s,...i}=e,[l,c]=v.useState(!1),d=e.orientation==="horizontal",h=_f(()=>{if(r.viewport){const m=r.viewport.offsetWidth<r.viewport.scrollWidth,b=r.viewport.offsetHeight<r.viewport.scrollHeight;c(d?m:b)}},10);return co(r.viewport,h),co(r.content,h),f.jsx(vn,{present:s||l,children:f.jsx(Ov,{"data-state":l?"visible":"hidden",...i,ref:t})})}),Ov=v.forwardRef((e,t)=>{const{orientation:r="vertical",...s}=e,i=ur(Ur,e.__scopeScrollArea),l=v.useRef(null),c=v.useRef(0),[d,h]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),m=kT(d.viewport,d.content),b={...s,sizes:d,onSizesChange:h,hasThumb:m>0&&m<1,onThumbChange:x=>l.current=x,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:x=>c.current=x};function g(x,w){return B6(x,c.current,d,w)}return r==="horizontal"?f.jsx(L6,{...b,ref:t,onThumbPositionChange:()=>{if(i.viewport&&l.current){const x=i.viewport.scrollLeft,w=L_(x,d,i.dir);l.current.style.transform=`translate3d(${w}px, 0, 0)`}},onWheelScroll:x=>{i.viewport&&(i.viewport.scrollLeft=x)},onDragScroll:x=>{i.viewport&&(i.viewport.scrollLeft=g(x,i.dir))}}):r==="vertical"?f.jsx(z6,{...b,ref:t,onThumbPositionChange:()=>{if(i.viewport&&l.current){const x=i.viewport.scrollTop,w=L_(x,d);l.current.style.transform=`translate3d(0, ${w}px, 0)`}},onWheelScroll:x=>{i.viewport&&(i.viewport.scrollTop=x)},onDragScroll:x=>{i.viewport&&(i.viewport.scrollTop=g(x))}}):null}),L6=v.forwardRef((e,t)=>{const{sizes:r,onSizesChange:s,...i}=e,l=ur(Ur,e.__scopeScrollArea),[c,d]=v.useState(),h=v.useRef(null),m=Je(t,h,l.onScrollbarXChange);return v.useEffect(()=>{h.current&&d(getComputedStyle(h.current))},[h]),f.jsx(jT,{"data-orientation":"horizontal",...i,ref:m,sizes:r,style:{bottom:0,left:l.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:l.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":wf(r)+"px",...e.style},onThumbPointerDown:b=>e.onThumbPointerDown(b.x),onDragScroll:b=>e.onDragScroll(b.x),onWheelScroll:(b,g)=>{if(l.viewport){const x=l.viewport.scrollLeft+b.deltaX;e.onWheelScroll(x),MT(x,g)&&b.preventDefault()}},onResize:()=>{h.current&&l.viewport&&c&&s({content:l.viewport.scrollWidth,viewport:l.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:zd(c.paddingLeft),paddingEnd:zd(c.paddingRight)}})}})}),z6=v.forwardRef((e,t)=>{const{sizes:r,onSizesChange:s,...i}=e,l=ur(Ur,e.__scopeScrollArea),[c,d]=v.useState(),h=v.useRef(null),m=Je(t,h,l.onScrollbarYChange);return v.useEffect(()=>{h.current&&d(getComputedStyle(h.current))},[h]),f.jsx(jT,{"data-orientation":"vertical",...i,ref:m,sizes:r,style:{top:0,right:l.dir==="ltr"?0:void 0,left:l.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":wf(r)+"px",...e.style},onThumbPointerDown:b=>e.onThumbPointerDown(b.y),onDragScroll:b=>e.onDragScroll(b.y),onWheelScroll:(b,g)=>{if(l.viewport){const x=l.viewport.scrollTop+b.deltaY;e.onWheelScroll(x),MT(x,g)&&b.preventDefault()}},onResize:()=>{h.current&&l.viewport&&c&&s({content:l.viewport.scrollHeight,viewport:l.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:zd(c.paddingTop),paddingEnd:zd(c.paddingBottom)}})}})}),[I6,TT]=_T(Ur),jT=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:s,hasThumb:i,onThumbChange:l,onThumbPointerUp:c,onThumbPointerDown:d,onThumbPositionChange:h,onDragScroll:m,onWheelScroll:b,onResize:g,...x}=e,w=ur(Ur,r),[E,S]=v.useState(null),N=Je(t,Z=>S(Z)),C=v.useRef(null),A=v.useRef(""),j=w.viewport,k=s.content-s.viewport,I=nn(b),z=nn(h),P=_f(g,10);function H(Z){if(C.current){const de=Z.clientX-C.current.left,ue=Z.clientY-C.current.top;m({x:de,y:ue})}}return v.useEffect(()=>{const Z=de=>{const ue=de.target;(E==null?void 0:E.contains(ue))&&I(de,k)};return document.addEventListener("wheel",Z,{passive:!1}),()=>document.removeEventListener("wheel",Z,{passive:!1})},[j,E,k,I]),v.useEffect(z,[s,z]),co(E,P),co(w.content,P),f.jsx(I6,{scope:r,scrollbar:E,hasThumb:i,onThumbChange:nn(l),onThumbPointerUp:nn(c),onThumbPositionChange:z,onThumbPointerDown:nn(d),children:f.jsx(ke.div,{...x,ref:N,style:{position:"absolute",...x.style},onPointerDown:ye(e.onPointerDown,Z=>{Z.button===0&&(Z.target.setPointerCapture(Z.pointerId),C.current=E.getBoundingClientRect(),A.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",w.viewport&&(w.viewport.style.scrollBehavior="auto"),H(Z))}),onPointerMove:ye(e.onPointerMove,H),onPointerUp:ye(e.onPointerUp,Z=>{const de=Z.target;de.hasPointerCapture(Z.pointerId)&&de.releasePointerCapture(Z.pointerId),document.body.style.webkitUserSelect=A.current,w.viewport&&(w.viewport.style.scrollBehavior=""),C.current=null})})})}),Ld="ScrollAreaThumb",AT=v.forwardRef((e,t)=>{const{forceMount:r,...s}=e,i=TT(Ld,e.__scopeScrollArea);return f.jsx(vn,{present:r||i.hasThumb,children:f.jsx($6,{ref:t,...s})})}),$6=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:s,...i}=e,l=ur(Ld,r),c=TT(Ld,r),{onThumbPositionChange:d}=c,h=Je(t,g=>c.onThumbChange(g)),m=v.useRef(void 0),b=_f(()=>{m.current&&(m.current(),m.current=void 0)},100);return v.useEffect(()=>{const g=l.viewport;if(g){const x=()=>{if(b(),!m.current){const w=H6(g,d);m.current=w,d()}};return d(),g.addEventListener("scroll",x),()=>g.removeEventListener("scroll",x)}},[l.viewport,b,d]),f.jsx(ke.div,{"data-state":c.hasThumb?"visible":"hidden",...i,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:ye(e.onPointerDownCapture,g=>{const w=g.target.getBoundingClientRect(),E=g.clientX-w.left,S=g.clientY-w.top;c.onThumbPointerDown({x:E,y:S})}),onPointerUp:ye(e.onPointerUp,c.onThumbPointerUp)})});AT.displayName=Ld;var Mv="ScrollAreaCorner",RT=v.forwardRef((e,t)=>{const r=ur(Mv,e.__scopeScrollArea),s=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&s?f.jsx(U6,{...e,ref:t}):null});RT.displayName=Mv;var U6=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,...s}=e,i=ur(Mv,r),[l,c]=v.useState(0),[d,h]=v.useState(0),m=!!(l&&d);return co(i.scrollbarX,()=>{var g;const b=((g=i.scrollbarX)==null?void 0:g.offsetHeight)||0;i.onCornerHeightChange(b),h(b)}),co(i.scrollbarY,()=>{var g;const b=((g=i.scrollbarY)==null?void 0:g.offsetWidth)||0;i.onCornerWidthChange(b),c(b)}),m?f.jsx(ke.div,{...s,ref:t,style:{width:l,height:d,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function zd(e){return e?parseInt(e,10):0}function kT(e,t){const r=e/t;return isNaN(r)?0:r}function wf(e){const t=kT(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=(e.scrollbar.size-r)*t;return Math.max(s,18)}function B6(e,t,r,s="ltr"){const i=wf(r),l=i/2,c=t||l,d=i-c,h=r.scrollbar.paddingStart+c,m=r.scrollbar.size-r.scrollbar.paddingEnd-d,b=r.content-r.viewport,g=s==="ltr"?[0,b]:[b*-1,0];return OT([h,m],g)(e)}function L_(e,t,r="ltr"){const s=wf(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,l=t.scrollbar.size-i,c=t.content-t.viewport,d=l-s,h=r==="ltr"?[0,c]:[c*-1,0],m=Xp(e,h);return OT([0,c],[0,d])(m)}function OT(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(r-e[0])}}function MT(e,t){return e>0&&e<t}var H6=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},s=0;return(function i(){const l={left:e.scrollLeft,top:e.scrollTop},c=r.left!==l.left,d=r.top!==l.top;(c||d)&&t(),r=l,s=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(s)};function _f(e,t){const r=nn(e),s=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(s.current),[]),v.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(r,t)},[r,t])}function co(e,t){const r=nn(t);Ft(()=>{let s=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(r)});return i.observe(e),()=>{window.cancelAnimationFrame(s),i.unobserve(e)}}},[e,r])}var DT=ST,q6=CT,V6=RT;const gg=v.forwardRef(({className:e,children:t,...r},s)=>f.jsxs(DT,{ref:s,className:xe("relative overflow-hidden",e),...r,children:[f.jsx(q6,{className:"h-full w-full rounded-[inherit]",children:t}),f.jsx(PT,{}),f.jsx(V6,{})]}));gg.displayName=DT.displayName;const PT=v.forwardRef(({className:e,orientation:t="vertical",...r},s)=>f.jsx(kv,{ref:s,orientation:t,className:xe("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:f.jsx(AT,{className:"relative flex-1 rounded-full bg-border"})}));PT.displayName=kv.displayName;var Sf="Switch",[G6]=cr(Sf),[F6,K6]=G6(Sf),LT=v.forwardRef((e,t)=>{const{__scopeSwitch:r,name:s,checked:i,defaultChecked:l,required:c,disabled:d,value:h="on",onCheckedChange:m,form:b,...g}=e,[x,w]=v.useState(null),E=Je(t,j=>w(j)),S=v.useRef(!1),N=x?b||!!x.closest("form"):!0,[C,A]=ma({prop:i,defaultProp:l??!1,onChange:m,caller:Sf});return f.jsxs(F6,{scope:r,checked:C,disabled:d,children:[f.jsx(ke.button,{type:"button",role:"switch","aria-checked":C,"aria-required":c,"data-state":UT(C),"data-disabled":d?"":void 0,disabled:d,value:h,...g,ref:E,onClick:ye(e.onClick,j=>{A(k=>!k),N&&(S.current=j.isPropagationStopped(),S.current||j.stopPropagation())})}),N&&f.jsx($T,{control:x,bubbles:!S.current,name:s,value:h,checked:C,required:c,disabled:d,form:b,style:{transform:"translateX(-100%)"}})]})});LT.displayName=Sf;var zT="SwitchThumb",IT=v.forwardRef((e,t)=>{const{__scopeSwitch:r,...s}=e,i=K6(zT,r);return f.jsx(ke.span,{"data-state":UT(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:t})});IT.displayName=zT;var W6="SwitchBubbleInput",$T=v.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:s=!0,...i},l)=>{const c=v.useRef(null),d=Je(c,l),h=fv(r),m=Gg(t);return v.useEffect(()=>{const b=c.current;if(!b)return;const g=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(g,"checked").set;if(h!==r&&w){const E=new Event("click",{bubbles:s});w.call(b,r),b.dispatchEvent(E)}},[h,r,s]),f.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:d,style:{...i.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});$T.displayName=W6;function UT(e){return e?"checked":"unchecked"}var BT=LT,Y6=IT;const Wl=v.forwardRef(({className:e,...t},r)=>f.jsx(BT,{className:xe("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:f.jsx(Y6,{className:xe("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Wl.displayName=BT.displayName;var Ef="Tabs",[X6]=cr(Ef,[Zd]),HT=Zd(),[J6,Dv]=X6(Ef),qT=v.forwardRef((e,t)=>{const{__scopeTabs:r,value:s,onValueChange:i,defaultValue:l,orientation:c="horizontal",dir:d,activationMode:h="automatic",...m}=e,b=ec(d),[g,x]=ma({prop:s,onChange:i,defaultProp:l??"",caller:Ef});return f.jsx(J6,{scope:r,baseId:dn(),value:g,onValueChange:x,orientation:c,dir:b,activationMode:h,children:f.jsx(ke.div,{dir:b,"data-orientation":c,...m,ref:t})})});qT.displayName=Ef;var VT="TabsList",GT=v.forwardRef((e,t)=>{const{__scopeTabs:r,loop:s=!0,...i}=e,l=Dv(VT,r),c=HT(r);return f.jsx(D1,{asChild:!0,...c,orientation:l.orientation,dir:l.dir,loop:s,children:f.jsx(ke.div,{role:"tablist","aria-orientation":l.orientation,...i,ref:t})})});GT.displayName=VT;var FT="TabsTrigger",KT=v.forwardRef((e,t)=>{const{__scopeTabs:r,value:s,disabled:i=!1,...l}=e,c=Dv(FT,r),d=HT(r),h=XT(c.baseId,s),m=JT(c.baseId,s),b=s===c.value;return f.jsx(P1,{asChild:!0,...d,focusable:!i,active:b,children:f.jsx(ke.button,{type:"button",role:"tab","aria-selected":b,"aria-controls":m,"data-state":b?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:h,...l,ref:t,onMouseDown:ye(e.onMouseDown,g=>{!i&&g.button===0&&g.ctrlKey===!1?c.onValueChange(s):g.preventDefault()}),onKeyDown:ye(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&c.onValueChange(s)}),onFocus:ye(e.onFocus,()=>{const g=c.activationMode!=="manual";!b&&!i&&g&&c.onValueChange(s)})})})});KT.displayName=FT;var WT="TabsContent",YT=v.forwardRef((e,t)=>{const{__scopeTabs:r,value:s,forceMount:i,children:l,...c}=e,d=Dv(WT,r),h=XT(d.baseId,s),m=JT(d.baseId,s),b=s===d.value,g=v.useRef(b);return v.useEffect(()=>{const x=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(x)},[]),f.jsx(vn,{present:i||b,children:({present:x})=>f.jsx(ke.div,{"data-state":b?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":h,hidden:!x,id:m,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:x&&l})})});YT.displayName=WT;function XT(e,t){return`${e}-trigger-${t}`}function JT(e,t){return`${e}-content-${t}`}var Q6=qT,QT=GT,ZT=KT,ej=YT;const Z6=Q6,tj=v.forwardRef(({className:e,...t},r)=>f.jsx(QT,{ref:r,className:xe("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));tj.displayName=QT.displayName;const vg=v.forwardRef(({className:e,...t},r)=>f.jsx(ZT,{ref:r,className:xe("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background cursor-pointer transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));vg.displayName=ZT.displayName;const e8=v.forwardRef(({className:e,...t},r)=>f.jsx(ej,{ref:r,className:xe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));e8.displayName=ej.displayName;const Vi=6,Ju=10;function _p(e){return e==null||!Number.isFinite(Number(e))?"—":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(Number(e))}function Sp(e){const t=Number(String(e||"").replace(/,/g,"").trim());return Number.isFinite(t)?t:null}function t8(e,t){return e==null&&t==null?"":e!=null&&t!=null&&e!==t?`${e} - ${t}`:String(e??t??"")}function n8(e,t){const r=t.reduce((i,l)=>Math.max(i,l.sortOrder),0),s=e==="client"?"Tarifario especial":"Nueva sección";return{id:VN(e,s),name:s,scope:e,clientName:"",pricingMode:e==="client"?"fixed_multi":"guided",allowManual:!0,description:"",sortOrder:r+10,isActive:!0}}function r8(e){return{id:e.id,name:e.name,scope:e.scope,clientName:e.clientName,pricingMode:e.pricingMode,allowManual:e.allowManual,description:e.description,sortOrder:e.sortOrder,isActive:e.isActive}}function a8(e,t){const s=t.filter(l=>l.section===e.id).reduce((l,c)=>Math.max(l,c.sort_order),0),i=e.scope==="client";return{id:"",catalog_item_id:"",section:e.id,category:i?e.name:"",service:"",notes:"",work_type_id:i?"special_fixed":"",work_type_label:i?"Tarifa fija":"",work_type_short_label:i?"Fijo":"",hour_reference:"",level_id:i?"fixed":"",level_label:i?"Precio fijo":"",reference:"",reference_min:null,reference_max:null,level_hint:"",sort_order:s+1,is_active:!0,managed_by:"app"}}function s8(e){return{id:e.id,catalog_item_id:e.catalog_item_id,section:e.section,category:e.category,service:e.service,notes:e.notes,work_type_id:e.work_type_id,work_type_label:e.work_type_label,work_type_short_label:e.work_type_short_label,hour_reference:e.hour_reference,level_id:e.level_id,level_label:e.level_label,reference:e.reference,reference_min:e.reference_min,reference_max:e.reference_max,level_hint:e.level_hint,sort_order:e.sort_order,is_active:e.is_active,managed_by:"app"}}function i8({open:e,onOpenChange:t}){const{lists:r}=pf(),{sections:s,loading:i,error:l,refresh:c}=GN(),{rows:d,loading:h,error:m,refresh:b}=qN(),[g,x]=v.useState("general"),[w,E]=v.useState(""),[S,N]=v.useState(""),[C,A]=v.useState(!1),[j,k]=v.useState(!1),[I,z]=v.useState(null),[P,H]=v.useState(null),[Z,de]=v.useState(!1),[ue,me]=v.useState(null),[fe,pe]=v.useState(null),[ge,R]=v.useState(!1),[q,K]=v.useState(!1),[X,G]=v.useState(null),[O,M]=v.useState(1),[$,Y]=v.useState(1),B=v.useMemo(()=>s.filter(ce=>ce.scope===g).sort((ce,Le)=>ce.isActive!==Le.isActive?ce.isActive?-1:1:ce.sortOrder-Le.sortOrder||ce.name.localeCompare(Le.name)),[g,s]),ne=Math.max(1,Math.ceil(B.length/Vi)),ee=v.useMemo(()=>{const ce=(O-1)*Vi;return B.slice(ce,ce+Vi)},[B,O]),Q=s.find(ce=>ce.id===w)||B[0]||null;v.useEffect(()=>{var ce;if(!Q&&B.length){E(B[0].id);return}Q&&Q.scope!==g&&E(((ce=B[0])==null?void 0:ce.id)||"")},[g,B,Q]),v.useEffect(()=>{e&&Promise.all([c(),b()])},[e,b,c]),v.useEffect(()=>{M(1)},[g]),v.useEffect(()=>{M(ce=>Math.min(ce,ne))},[ne]),v.useEffect(()=>{if(!w)return;const ce=B.findIndex(ut=>ut.id===w);if(ce<0)return;const Le=Math.floor(ce/Vi)+1;M(Le)},[B,w]);const ae=v.useMemo(()=>{if(!Q)return[];const ce=S.trim().toLowerCase();return d.filter(Le=>Le.section===Q.id).filter(Le=>C||Le.is_active).filter(Le=>ce?[Le.category,Le.service,Le.work_type_label,Le.level_label,Le.notes].join(" ").toLowerCase().includes(ce):!0).sort((Le,ut)=>Le.sort_order-ut.sort_order||Le.service.localeCompare(ut.service))},[d,S,Q,C]),se=Math.max(1,Math.ceil(ae.length/Ju)),Ee=v.useMemo(()=>{const ce=($-1)*Ju;return ae.slice(ce,ce+Ju)},[ae,$]);v.useEffect(()=>{Y(1)},[S,Q==null?void 0:Q.id,C]),v.useEffect(()=>{Y(ce=>Math.min(ce,se))},[se]);const je=d.filter(ce=>ce.is_active).length,nt=s.filter(ce=>ce.scope==="client"&&ce.isActive).length,Qe=ce=>{const Le=Math.min(Math.max(ce,1),ne);M(Le);const ut=B[(Le-1)*Vi];ut&&E(ut.id)},Et=ce=>{H(null),z(n8(ce,s)),k(!0)},oe=ce=>{H(ce),z(r8(ce)),k(!0)},Me=async()=>{if(!I)return;const ce=I.name.trim(),Le=I.scope==="client"?I.clientName.trim():"";if(!ce){bt.error("Escribe el nombre de la sección.");return}if(I.scope==="client"&&!Le){bt.error("Selecciona el cliente del tarifario especial.");return}R(!0);try{const ut={...I,id:(P==null?void 0:P.id)||VN(I.scope,ce,I.clientName),name:ce,clientName:Le,pricingMode:I.scope==="client"?"fixed_multi":"guided"};await MU(ut),x(ut.scope),E(ut.id),k(!1),bt.success(P?"Sección actualizada.":"Sección creada.")}catch(ut){console.error("Error guardando sección del tarifario:",ut),bt.error(ut instanceof Error?ut.message:"No se pudo guardar la sección.")}finally{R(!1)}},Ke=async ce=>{G(ce.id);try{await DU(ce,!ce.isActive),bt.success(ce.isActive?"Sección desactivada.":"Sección reactivada.")}catch(Le){console.error("Error cambiando estado de sección:",Le),bt.error("No se pudo cambiar el estado de la sección.")}finally{G(null)}},qe=()=>{Q&&(pe(null),me(a8(Q,d)),de(!0))},_t=ce=>{pe(ce),me(s8(ce)),de(!0)},Ge=async()=>{if(!ue||!Q)return;const ce=Q.scope==="client",Le=ue.service.trim(),ut=ce?Q.name:ue.category.trim(),fn=ue.notes.trim();if(!Le){bt.error(ce?"Escribe el nombre de la pieza.":"Escribe el servicio o ítem.");return}if(!ce&&!ut){bt.error("Escribe la categoría.");return}const Ot=ue.reference_min==null?null:Number(ue.reference_min),Kt=ue.reference_max==null?null:Number(ue.reference_max);if(ce&&(!Number.isFinite(Ot)||Number(Ot)<=0)){bt.error("El monto fijo debe ser mayor que cero.");return}if(Ot!=null&&Kt!=null&&Ot>Kt){bt.error("El monto mínimo no puede ser mayor que el máximo.");return}K(!0);try{const Qt=ce?null:d.find(xt=>xt.section===Q.id&&Xa(xt.category)===Xa(ut)&&Xa(xt.service)===Xa(Le)),yn=(fe==null?void 0:fe.catalog_item_id)||(Qt==null?void 0:Qt.catalog_item_id)||Xa(`${Q.id}-${ut}-${Le}`),hn=ce?"Tarifa fija":ue.work_type_label.trim()||"Referencia",Ct=ce?"Precio fijo":ue.level_label.trim()||"Precio único",Wt=(fe==null?void 0:fe.work_type_id)||Xa(hn)||"reference",At=(fe==null?void 0:fe.level_id)||Xa(Ct)||"project",Oe=ce?Number(Ot):null,Mt={...ue,id:(fe==null?void 0:fe.id)||HN({catalog_item_id:yn,work_type_id:Wt,level_id:At}),catalog_item_id:yn,section:Q.id,category:ut,service:Le,notes:fn,work_type_id:Wt,work_type_label:hn,work_type_short_label:ce?"Fijo":ue.work_type_short_label.trim()||hn,hour_reference:ce?"":ue.hour_reference.trim(),level_id:At,level_label:Ct,reference:ce?`${Oe} USD`:ue.reference.trim()||t8(Ot,Kt),reference_min:ce?Oe:Ot,reference_max:ce?Oe:Kt,level_hint:ce?"Monto fijo por pieza.":ue.level_hint.trim(),sort_order:Number(ue.sort_order||0),is_active:ue.is_active,managed_by:"app"};await AU(Mt,fe),de(!1),bt.success(fe?"Tarifa actualizada.":"Tarifa agregada.")}catch(Qt){console.error("Error guardando tarifa:",Qt),bt.error(Qt instanceof Error?Qt.message:"No se pudo guardar la tarifa.")}finally{K(!1)}},ct=async ce=>{G(ce.id);try{await RU(ce,!ce.is_active),bt.success(ce.is_active?"Tarifa desactivada.":"Tarifa reactivada.")}catch(Le){console.error("Error cambiando estado de tarifa:",Le),bt.error("No se pudo cambiar el estado de la tarifa.")}finally{G(null)}},zt=i||h,Be=l||m;return f.jsxs(f.Fragment,{children:[f.jsx(cc,{open:e,onOpenChange:t,children:f.jsx(yo,{className:"h-[90vh] max-h-[900px] w-[96vw] max-w-[1280px] overflow-hidden p-0",children:f.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[f.jsxs("div",{className:"border-b border-border px-6 py-5 pr-14",children:[f.jsx(bo,{children:f.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[f.jsxs("div",{children:[f.jsxs(xo,{className:"flex items-center gap-2 text-xl",children:[f.jsx(ZS,{className:"h-5 w-5 text-primary"}),"Administración del tarifario"]}),f.jsx(wo,{className:"mt-1 max-w-3xl",children:"Crea secciones generales, administra tarifas por cliente y edita los ítems que ya utiliza el equipo al cotizar proyectos."})]}),f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsxs($e,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>void Promise.all([c(),b()]),disabled:zt,children:[f.jsx(Lg,{className:xe("h-3.5 w-3.5",zt&&"animate-spin")}),"Actualizar"]}),f.jsxs($e,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>Et("client"),children:[f.jsx(Dw,{className:"h-3.5 w-3.5"}),"Tarifario por cliente"]}),f.jsxs($e,{type:"button",size:"sm",className:"gap-1.5",onClick:()=>Et("general"),children:[f.jsx(ua,{className:"h-3.5 w-3.5"}),"Sección general"]})]})]})}),f.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:grid-cols-3",children:[f.jsx(Ep,{icon:f.jsx(a3,{className:"h-4 w-4"}),label:"Secciones activas",value:s.filter(ce=>ce.isActive).length}),f.jsx(Ep,{icon:f.jsx(Dw,{className:"h-4 w-4"}),label:"Tarifarios por cliente",value:nt}),f.jsx(Ep,{icon:f.jsx(Pw,{className:"h-4 w-4"}),label:"Tarifas activas",value:je})]})]}),Be&&f.jsx("div",{className:"border-b border-amber-200 bg-amber-50 px-6 py-2 text-xs text-amber-900",children:Be}),f.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-1 lg:grid-cols-[310px_minmax(0,1fr)]",children:[f.jsxs("aside",{className:"flex min-h-0 flex-col border-b border-border bg-muted/20 lg:border-b-0 lg:border-r",children:[f.jsxs("div",{className:"space-y-3 p-4",children:[f.jsx(Z6,{value:g,onValueChange:ce=>x(ce),children:f.jsxs(tj,{className:"grid w-full grid-cols-2",children:[f.jsx(vg,{value:"general",children:"Generales"}),f.jsx(vg,{value:"client",children:"Por cliente"})]})}),f.jsx("p",{className:"text-xs text-muted-foreground",children:g==="general"?"Estas secciones aparecen para los clientes que no tienen un tarifario especial.":"Cada tarifario aparece únicamente al seleccionar el cliente asociado."})]}),f.jsx(gg,{className:"min-h-[220px] flex-1 px-3 pb-3",children:f.jsxs("div",{className:"space-y-2 pr-2",children:[ee.map(ce=>{const Le=ce.id===(Q==null?void 0:Q.id),ut=d.filter(fn=>fn.section===ce.id&&fn.is_active).length;return f.jsxs("button",{type:"button",onClick:()=>E(ce.id),className:xe("w-full rounded-xl border px-3 py-3 text-left transition-colors",Le?"border-primary/40 bg-primary/10":"border-border bg-card hover:bg-muted/50",!ce.isActive&&"opacity-60"),children:[f.jsxs("div",{className:"flex items-start justify-between gap-2",children:[f.jsxs("div",{className:"min-w-0",children:[f.jsx("p",{className:"truncate text-sm font-semibold",children:ce.name}),ce.scope==="client"&&f.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:ce.clientName})]}),f.jsx(xn,{variant:ce.isActive?"secondary":"outline",children:ce.isActive?"Activa":"Inactiva"})]}),f.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:[ut," tarifa(s) activa(s)"]})]},ce.id)}),B.length===0&&f.jsx("div",{className:"rounded-xl border border-dashed border-border bg-card px-3 py-5 text-center text-sm text-muted-foreground",children:"No hay secciones de este tipo."})]})}),f.jsx(z_,{currentPage:O,totalPages:ne,totalItems:B.length,pageSize:Vi,itemLabel:"secciones",onPageChange:Qe,compact:!0})]}),f.jsx("section",{className:"min-h-0",children:Q?f.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[f.jsx("div",{className:"border-b border-border px-5 py-4",children:f.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[f.jsxs("div",{children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx("h3",{className:"text-lg font-semibold",children:Q.name}),f.jsx(xn,{variant:Q.scope==="client"?"default":"secondary",children:Q.scope==="client"?"Por cliente":"General"}),!Q.isActive&&f.jsx(xn,{variant:"outline",children:"Inactiva"})]}),Q.scope==="client"&&f.jsxs("p",{className:"mt-1 text-sm text-primary",children:["Se muestra al seleccionar: ",Q.clientName]}),f.jsx("p",{className:"mt-1 max-w-3xl text-sm text-muted-foreground",children:Q.description||"Sin descripción."})]}),f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsxs($e,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>oe(Q),children:[f.jsx(N3,{className:"h-3.5 w-3.5"}),"Editar sección"]}),f.jsxs($e,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",onClick:()=>void Ke(Q),disabled:X===Q.id,children:[Q.isActive?f.jsx(Mw,{className:"h-3.5 w-3.5 rotate-180"}):f.jsx(Mw,{className:"h-3.5 w-3.5"}),Q.isActive?"Desactivar":"Reactivar"]}),f.jsxs($e,{type:"button",size:"sm",className:"gap-1.5",onClick:qe,children:[f.jsx(ua,{className:"h-3.5 w-3.5"}),Q.scope==="client"?"Nueva pieza":"Nueva tarifa"]})]})]})}),f.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-border px-5 py-3",children:[f.jsxs("div",{className:"relative min-w-[220px] flex-1",children:[f.jsx(Ul,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),f.jsx(ft,{value:S,onChange:ce=>N(ce.target.value),className:"pl-9",placeholder:"Buscar servicio, categoría o nivel…"})]}),f.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[f.jsx(Wl,{checked:C,onCheckedChange:A}),"Mostrar inactivas"]})]}),f.jsx(gg,{className:"min-h-0 flex-1",children:f.jsx("div",{className:"space-y-3 p-5",children:zt&&ae.length===0?f.jsxs("div",{className:"flex items-center justify-center gap-2 py-12 text-sm text-muted-foreground",children:[f.jsx(gn,{className:"h-4 w-4 animate-spin"})," Cargando tarifario…"]}):ae.length===0?f.jsxs("div",{className:"rounded-2xl border border-dashed border-border bg-muted/20 px-5 py-10 text-center",children:[f.jsx(Pw,{className:"mx-auto h-8 w-8 text-muted-foreground"}),f.jsx("p",{className:"mt-3 text-sm font-medium",children:"No hay tarifas para mostrar"}),f.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Agrega la primera tarifa de esta sección o activa “Mostrar inactivas”."}),f.jsxs($e,{className:"mt-4 gap-1.5",size:"sm",onClick:qe,children:[f.jsx(ua,{className:"h-3.5 w-3.5"})," Agregar tarifa"]})]}):Ee.map(ce=>f.jsx(o8,{row:ce,section:Q,busy:X===ce.id,onEdit:()=>_t(ce),onToggle:()=>void ct(ce)},ce.id))})}),f.jsx(z_,{currentPage:$,totalPages:se,totalItems:ae.length,pageSize:Ju,itemLabel:"tarifas",onPageChange:Y})]}):f.jsx("div",{className:"flex h-full items-center justify-center p-8 text-center text-sm text-muted-foreground",children:"Selecciona o crea una sección para comenzar."})})]})]})})}),f.jsx(l8,{open:j,onOpenChange:k,draft:I,onDraftChange:z,clients:r.clientes,editing:!!P,saving:ge,onSave:()=>void Me()}),f.jsx(c8,{open:Z,onOpenChange:de,section:Q,draft:ue,onDraftChange:me,editing:!!fe,saving:q,onSave:()=>void Ge()})]})}function z_({currentPage:e,totalPages:t,totalItems:r,pageSize:s,itemLabel:i,onPageChange:l,compact:c=!1}){const d=r===0?0:(e-1)*s+1,h=Math.min(e*s,r);return f.jsxs("div",{className:xe("flex items-center justify-between gap-3 border-t border-border bg-background/95 px-4 py-2.5",c&&"px-3"),children:[f.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[d,"",h," de ",r," ",i]}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[!c&&f.jsxs("span",{className:"mr-1 text-[11px] text-muted-foreground",children:["Página ",e," de ",t]}),f.jsx($e,{type:"button",variant:"outline",size:"icon",className:"h-7 w-7","aria-label":"Página anterior",onClick:()=>l(e-1),disabled:e<=1,children:f.jsx(Pg,{className:"h-3.5 w-3.5"})}),c&&f.jsxs("span",{className:"min-w-[42px] text-center text-[11px] text-muted-foreground",children:[e,"/",t]}),f.jsx($e,{type:"button",variant:"outline",size:"icon",className:"h-7 w-7","aria-label":"Página siguiente",onClick:()=>l(e+1),disabled:e>=t,children:f.jsx(Fd,{className:"h-3.5 w-3.5"})})]})]})}function Ep({icon:e,label:t,value:r}){return f.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-border bg-muted/20 px-3 py-2.5",children:[f.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/10 text-primary",children:e}),f.jsxs("div",{children:[f.jsx("p",{className:"text-lg font-semibold leading-none",children:r}),f.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:t})]})]})}function o8({row:e,section:t,busy:r,onEdit:s,onToggle:i}){const l=t.scope==="client",c=l?_p(e.reference_min??e.reference_max):e.reference||(e.reference_min!=null||e.reference_max!=null?`${_p(e.reference_min)} ${_p(e.reference_max)}`:"Sin monto de referencia");return f.jsx("div",{className:xe("rounded-2xl border border-border bg-card px-4 py-3 shadow-sm",!e.is_active&&"opacity-60"),children:f.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx("p",{className:"font-medium",children:e.service}),f.jsx(xn,{variant:e.is_active?"secondary":"outline",children:e.is_active?"Activa":"Inactiva"}),e.managed_by==="app"&&f.jsx(xn,{variant:"outline",children:"Gestionada en app"})]}),!l&&f.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:e.category}),f.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[!l&&f.jsx("span",{children:e.work_type_label}),!l&&f.jsx("span",{children:e.level_label}),f.jsx("span",{className:"font-semibold text-foreground",children:c}),f.jsxs("span",{children:["Orden: ",e.sort_order]})]}),e.notes&&f.jsx("p",{className:"mt-2 line-clamp-2 text-xs text-muted-foreground",children:e.notes})]}),f.jsxs("div",{className:"flex gap-2",children:[f.jsxs($e,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",onClick:s,children:[f.jsx(w3,{className:"h-3.5 w-3.5"})," Editar"]}),f.jsx($e,{type:"button",variant:"ghost",size:"sm",onClick:i,disabled:r,children:r?f.jsx(gn,{className:"h-3.5 w-3.5 animate-spin"}):e.is_active?"Desactivar":"Reactivar"})]})]})})}function l8({open:e,onOpenChange:t,draft:r,onDraftChange:s,clients:i,editing:l,saving:c,onSave:d}){if(!r)return null;const h=r.scope==="client";return f.jsx(cc,{open:e,onOpenChange:t,children:f.jsxs(yo,{className:"max-w-2xl",children:[f.jsxs(bo,{children:[f.jsx(xo,{children:l?"Editar sección":h?"Nuevo tarifario por cliente":"Nueva sección general"}),f.jsx(wo,{children:h?"El tarifario aparecerá automáticamente cuando se seleccione el cliente indicado.":"La sección aparecerá junto a las demás secciones del tarifario general."})]}),f.jsxs("div",{className:"grid grid-cols-1 gap-4 py-2 sm:grid-cols-2",children:[f.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[f.jsx(He,{children:"Nombre de la sección"}),f.jsx(ft,{value:r.name,onChange:m=>s({...r,name:m.target.value}),placeholder:h?"Ej: Tarifario PepsiCo":"Ej: Producción audiovisual"})]}),h&&f.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[f.jsx(He,{children:"Cliente asociado"}),f.jsx(xr,{value:r.clientName,options:i,onValueChange:m=>s({...r,clientName:m}),placeholder:"Seleccionar cliente…",searchPlaceholder:"Buscar cliente…",emptyText:"No se encontró ese cliente en las listas de la app."}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"El nombre debe coincidir con el cliente disponible en el formulario de proyectos."})]}),f.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[f.jsx(He,{children:"Descripción para el usuario"}),f.jsx(da,{value:r.description,onChange:m=>s({...r,description:m.target.value}),placeholder:"Explica brevemente qué incluye esta sección.",rows:3})]}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Orden"}),f.jsx(ft,{type:"number",min:"0",value:r.sortOrder,onChange:m=>s({...r,sortOrder:Number(m.target.value||0)})})]}),f.jsxs("div",{className:"flex flex-col justify-end gap-3 rounded-xl border border-border bg-muted/20 px-3 py-2.5",children:[f.jsxs("label",{className:"flex items-center justify-between gap-3 text-sm",children:[f.jsx("span",{children:"Sección activa"}),f.jsx(Wl,{checked:r.isActive,onCheckedChange:m=>s({...r,isActive:m})})]}),h&&f.jsxs("label",{className:"flex items-center justify-between gap-3 text-sm",children:[f.jsx("span",{children:"Permitir costo manual"}),f.jsx(Wl,{checked:r.allowManual,onCheckedChange:m=>s({...r,allowManual:m})})]})]})]}),f.jsxs(of,{children:[f.jsx($e,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancelar"}),f.jsxs($e,{type:"button",className:"gap-1.5",onClick:d,disabled:c,children:[c?f.jsx(gn,{className:"h-4 w-4 animate-spin"}):f.jsx(ha,{className:"h-4 w-4"}),"Guardar sección"]})]})]})})}function c8({open:e,onOpenChange:t,section:r,draft:s,onDraftChange:i,editing:l,saving:c,onSave:d}){if(!s||!r)return null;const h=r.scope==="client";return f.jsx(cc,{open:e,onOpenChange:t,children:f.jsxs(yo,{className:"max-h-[88vh] max-w-3xl overflow-y-auto",children:[f.jsxs(bo,{children:[f.jsx(xo,{children:l?h?"Editar pieza":"Editar tarifa":h?"Nueva pieza de precio fijo":"Nueva tarifa"}),f.jsxs(wo,{children:["Sección: ",r.name]})]}),h?f.jsxs("div",{className:"grid grid-cols-1 gap-4 py-2 sm:grid-cols-[minmax(0,1fr)_200px]",children:[f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Nombre de la pieza"}),f.jsx(ft,{value:s.service,onChange:m=>i({...s,service:m.target.value}),placeholder:"Ej: Photobooth"})]}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Monto fijo (USD)"}),f.jsx(ft,{type:"number",min:"0",step:"0.01",value:s.reference_min??"",onChange:m=>i({...s,reference_min:Sp(m.target.value)}),placeholder:"0.00"})]}),f.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[f.jsx(He,{children:"Descripción / incluye"}),f.jsx(da,{value:s.notes,onChange:m=>i({...s,notes:m.target.value}),placeholder:"Describe qué incluye esta pieza y cualquier observación importante.",rows:4})]})]}):f.jsxs("div",{className:"grid grid-cols-1 gap-4 py-2 sm:grid-cols-2",children:[f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Categoría"}),f.jsx(ft,{value:s.category,onChange:m=>i({...s,category:m.target.value}),placeholder:"Ej: Materiales de PDV"})]}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Servicio / ítem"}),f.jsx(ft,{value:s.service,onChange:m=>i({...s,service:m.target.value}),placeholder:"Ej: Diseño de roll up"})]}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Tipo de trabajo"}),f.jsx(ft,{value:s.work_type_label,onChange:m=>i({...s,work_type_label:m.target.value}),placeholder:"Ej: Diseño + Arte Final"})]}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Etiqueta corta"}),f.jsx(ft,{value:s.work_type_short_label,onChange:m=>i({...s,work_type_short_label:m.target.value}),placeholder:"Ej: Diseño"})]}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Nivel / referencia"}),f.jsx(ft,{value:s.level_label,onChange:m=>i({...s,level_label:m.target.value}),placeholder:"Ej: Básico"})]}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Hora hombre ref."}),f.jsx(ft,{value:s.hour_reference,onChange:m=>i({...s,hour_reference:m.target.value}),placeholder:"Ej: 35 - 50"})]}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Monto mínimo"}),f.jsx(ft,{type:"number",min:"0",step:"0.01",value:s.reference_min??"",onChange:m=>i({...s,reference_min:Sp(m.target.value)}),placeholder:"0.00"})]}),f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Monto máximo"}),f.jsx(ft,{type:"number",min:"0",step:"0.01",value:s.reference_max??"",onChange:m=>i({...s,reference_max:Sp(m.target.value)}),placeholder:"0.00"})]}),f.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[f.jsx(He,{children:"Referencia visible"}),f.jsx(ft,{value:s.reference,onChange:m=>i({...s,reference:m.target.value}),placeholder:"Ej: 100 - 150 USD (se genera automáticamente si se deja vacío)"})]}),f.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[f.jsx(He,{children:"Observaciones / incluye"}),f.jsx(da,{value:s.notes,onChange:m=>i({...s,notes:m.target.value}),placeholder:"Describe qué incluye el servicio.",rows:3})]}),f.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[f.jsx(He,{children:"Nota del nivel"}),f.jsx(da,{value:s.level_hint,onChange:m=>i({...s,level_hint:m.target.value}),placeholder:"Ej: Puede superar el rango si la complejidad lo requiere.",rows:2})]})]}),f.jsx(zs,{}),f.jsxs("div",{className:"grid grid-cols-1 gap-4 py-2 sm:grid-cols-2",children:[f.jsxs("div",{className:"space-y-1.5",children:[f.jsx(He,{children:"Orden"}),f.jsx(ft,{type:"number",min:"0",value:s.sort_order,onChange:m=>i({...s,sort_order:Number(m.target.value||0)})})]}),f.jsxs("label",{className:"flex items-center justify-between gap-3 rounded-xl border border-border bg-muted/20 px-3 py-2.5 text-sm",children:[f.jsx("span",{children:"Tarifa activa"}),f.jsx(Wl,{checked:s.is_active,onCheckedChange:m=>i({...s,is_active:m})})]})]}),f.jsxs(of,{children:[f.jsx($e,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancelar"}),f.jsxs($e,{type:"button",className:"gap-1.5",onClick:d,disabled:c,children:[c?f.jsx(gn,{className:"h-4 w-4 animate-spin"}):f.jsx(ha,{className:"h-4 w-4"}),"Guardar tarifa"]})]})]})})}const Ms=24,I_={country:"",brand:"",client:"",cm:""};function u8(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 d8(){const[e,t]=v.useState(!1),[r,s]=v.useState(null),[i,l]=v.useState(""),[c,d]=v.useState("todos"),[h,m]=v.useState(I_),[b,g]=v.useState({nuevos:1,todos:1,abiertos:1,cerrados:1,no_aprobados:1}),[x,w]=v.useState(null),[E,S]=v.useState(!1),[N,C]=v.useState(null),[A,j]=v.useState(null),k=c==="nuevos"||c==="no_aprobados",I=c==="no_aprobados"?"rejected":"new",z=k?"todos":c,P=b[c],{lists:H}=pf(),{projects:Z,totalProjects:de,filterOptions:ue,loading:me,error:fe,refresh:pe,remove:ge}=bT({tab:z,search:k?"":i,page:k?b[z]:P,pageSize:Ms,country:k?"":h.country,brand:k?"":h.brand,client:k?"":h.client,cm:k?"":h.cm}),R=T6({status:I,search:i,page:P,pageSize:Ms,enabled:k}),{user:q,isGerardo:K,canManageInternalPricing:X,canControlPricingSummary:G,canManageTariffCatalog:O,logout:M}=Vd(),$=j6(!!q),Y={tab:z,search:k?"":i,page:1,pageSize:Ms,country:k?"":h.country,brand:k?"":h.brand,client:k?"":h.client,cm:k?"":h.cm},{isPublic:B,loading:ne,saving:ee,error:Q,setPublicVisibility:ae}=k6(!!q),se=!k&&(G||B),{summary:Ee,loading:je,error:nt}=kB(Y,se),Qe=Object.values(H.buCm),Et=tt([...H.bus,...YU(ue.countries,H.bus),h.country]),oe=tt([...H.marcas,...yp(ue.brands,H.marcas),h.brand]),Me=tt([...H.clientes,...yp(ue.clients,H.clientes),h.client]),Ke=tt([...Qe,...yp(ue.cms,Qe),h.cm]),qe=Object.values(h).filter(Boolean).length,_t=k?R.totalItems:de,Ge=Math.max(1,Math.ceil(_t/Ms)),ct=Math.min(P,Ge),zt=(ct-1)*Ms,Be=_t===0?0:zt+1,ce=Math.min(zt+Ms,_t);v.useEffect(()=>{g(Oe=>({...Oe,[c]:1}))},[i,c,h.country,h.brand,h.client,h.cm]),v.useEffect(()=>{P>Ge&&g(Oe=>({...Oe,[c]:Ge}))},[P,c,Ge]),v.useEffect(()=>{c!=="nuevos"||!q||$.unreadCount<=0||$.markAllSeen().catch(Oe=>{console.error("Error marcando briefs como vistos:",Oe)})},[c,q==null?void 0:q.id,$.unreadCount,$.markAllSeen]);const Le=Oe=>{const Mt=Math.min(Math.max(Oe,1),Ge);Mt!==P&&(g(xt=>({...xt,[c]:Mt})),window.scrollTo({top:0,behavior:"smooth"}))},ut=(Oe,Mt)=>{m(xt=>({...xt,[Oe]:Mt}))},fn=()=>{m(I_)},Ot=()=>{s(null),t(!0)},Kt=Oe=>{s(Oe),t(!0)},Qt=async Oe=>{if(window.confirm(`¿Seguro que deseas eliminar el proyecto "${Oe.nombre||"Sin título"}"?
Esta acción eliminará el proyecto del tablero y del Google Sheet.`)){w(Oe.id);try{await ge(Oe.id),(r==null?void 0:r.id)===Oe.id&&(t(!1),s(null))}catch(xt){console.error("Error eliminando proyecto:",xt);const le=xt instanceof Error?xt.message:"No se pudo eliminar el proyecto. Revisa n8n, Supabase o permisos.";window.alert(le)}finally{w(null)}}},yn=async(Oe,Mt,xt=!1)=>{if(!(!window.confirm(xt?`¿Aprobar el brief rechazado "${Mt||"Sin título"}"?
Se recuperará de Rechazados, se creará como proyecto Activo y aparecerá en Todos y Activos.`:`¿Aprobar el brief "${Mt||"Sin título"}"?
Se creará como proyecto Activo y aparecerá en Todos y Activos.`)||A)){j(Oe);try{const Ne=await R.approve(Oe);await pe(),Ne.sheetSyncStatus==="synced"?window.alert("Brief aprobado. El proyecto quedó Activo y sincronizado con Google Sheet."):window.alert(Ne.sheetSyncMessage)}catch(Ne){console.error("Error aprobando brief:",Ne),window.alert(Ne instanceof Error?Ne.message:"No se pudo aprobar el brief. Revisa Supabase e intenta de nuevo.")}finally{j(null)}}},hn=async(Oe,Mt)=>{if(!(!window.confirm(`¿Mover el brief "${Mt||"Sin título"}" a Rechazados?
No se creará ningún proyecto en el tablero general.`)||A)){j(Oe);try{await R.reject(Oe)}catch(le){console.error("Error marcando brief como rechazado:",le),window.alert(le instanceof Error?le.message:"No se pudo mover el brief a Rechazados. Revisa Supabase e intenta de nuevo.")}finally{j(null)}}},Ct=(q==null?void 0:q.displayName)??(q==null?void 0:q.email)??"Usuario",Wt=K?"Jefe CDC":"Usuario CDC",At=u8(q==null?void 0:q.displayName,q==null?void 0:q.email);return f.jsxs("div",{className:"min-h-screen bg-background",children:[f.jsx("header",{className:"sticky top-0 z-30 bg-background/85 backdrop-blur-md border-b border-border",children:f.jsxs("div",{className:"max-w-[1400px] mx-auto px-6 py-3.5 flex items-center gap-4",children:[f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx(Mg,{size:"sm"}),f.jsx("div",{className:"h-7 w-px bg-border"}),f.jsx("h1",{className:"text-[15px] font-semibold tracking-tight text-[#4F758B]",children:"CDC Project Management"})]}),f.jsxs("div",{className:"flex-1 max-w-md ml-4 relative hidden md:block",children:[f.jsx(Ul,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),f.jsx(ft,{value:i,onChange:Oe=>l(Oe.target.value),placeholder:k?"Buscar brief, cliente, marca…":"Buscar proyecto, cliente, marca…",className:"pl-9 h-9 bg-muted/40 border-transparent focus-visible:bg-card focus-visible:border-border"})]}),f.jsx("div",{className:"flex-1 md:flex-none"}),f.jsxs(Bz,{children:[f.jsx(Hz,{asChild:!0,children:f.jsxs($e,{variant:"ghost",size:"sm",className:"gap-2 h-9 px-2.5",children:[f.jsxs(WE,{className:"w-7 h-7",children:[(q==null?void 0:q.photoURL)&&f.jsx(YE,{src:q.photoURL,alt:Ct,referrerPolicy:"no-referrer"}),f.jsx(XE,{className:K?"bg-primary text-primary-foreground text-xs":"bg-accent text-accent-foreground text-xs",children:At})]}),f.jsxs("div",{className:"text-left leading-tight hidden sm:block",children:[f.jsx("div",{className:"text-xs font-medium",children:Ct}),f.jsx("div",{className:"text-[10px] text-muted-foreground",children:Wt})]}),f.jsx(Dg,{className:"w-3.5 h-3.5 text-muted-foreground"})]})}),f.jsxs(LE,{align:"end",className:"w-52",children:[f.jsxs("div",{className:"px-3 py-2",children:[f.jsx("p",{className:"text-xs font-medium truncate",children:Ct}),f.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:q==null?void 0:q.email})]}),f.jsx(IE,{}),f.jsxs(zE,{onClick:M,className:"gap-2 text-destructive focus:text-destructive focus:bg-destructive/10 cursor-pointer",children:[f.jsx(g3,{className:"w-3.5 h-3.5"}),"Cerrar sesión"]})]})]}),O&&f.jsxs($e,{type:"button",variant:"outline",onClick:()=>S(!0),className:"gap-1.5 h-9 rounded-full px-4 shadow-sm",children:[f.jsx(ZS,{className:"w-4 h-4"})," Tarifario"]}),f.jsxs($e,{onClick:Ot,className:"gap-1.5 h-9 rounded-full px-4 shadow-sm",children:[f.jsx(ua,{className:"w-4 h-4"})," Nuevo"]})]})}),f.jsxs("div",{className:"max-w-[1400px] mx-auto px-6 pt-6 pb-3 space-y-3",children:[f.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[f.jsxs("div",{children:[f.jsx("h2",{className:"text-2xl font-semibold tracking-tight",children:c==="nuevos"?"Briefs por revisar":c==="no_aprobados"?"Briefs rechazados":"Proyectos"}),c==="nuevos"&&f.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Los briefs de CDC Brief llegan aquí antes de convertirse en proyectos Activos."}),c==="no_aprobados"&&f.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Briefs revisados que no se incorporaron al tablero general."})]}),f.jsx("div",{className:"flex items-center gap-2",children:f.jsx("div",{className:"inline-flex flex-wrap bg-muted/60 rounded-full p-1 text-xs",children:[["todos","Todos"],["abiertos","Activos"],["cerrados","Cerrados"],["nuevos","Nuevos"],["no_aprobados","Rechazados"]].map(([Oe,Mt])=>f.jsxs("button",{onClick:()=>d(Oe),className:`inline-flex items-center gap-1.5 px-3.5 py-1.5 rounded-full transition-colors font-medium ${c===Oe?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[f.jsx("span",{children:Mt}),Oe==="nuevos"&&$.unreadCount>0&&f.jsx("span",{className:"inline-flex min-w-[18px] h-[18px] items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-bold leading-none text-white shadow-sm","aria-label":`${$.unreadCount} briefs nuevos sin revisar`,children:$.unreadCount>99?"99+":$.unreadCount})]},Oe))})})]}),f.jsxs("div",{className:"relative md:hidden",children:[f.jsx(Ul,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),f.jsx(ft,{value:i,onChange:Oe=>l(Oe.target.value),placeholder:k?"Buscar brief, cliente, marca…":"Buscar proyecto, cliente, marca…",className:"pl-9 h-9 bg-muted/40 border-transparent focus-visible:bg-card focus-visible:border-border"})]}),!k&&f.jsx(m8,{filters:h,activeCount:qe,countryOptions:Et,brandOptions:oe,clientOptions:Me,cmOptions:Ke,onFilterChange:ut,onClear:fn}),se&&f.jsx(h8,{totalAmount:Ee.totalAmount,projectCount:Ee.projectCount,loading:je||ne,error:nt||Q,hasFilters:c!=="todos"||i.trim().length>0||qe>0,canControlVisibility:G,isPublic:B,visibilitySaving:ee,onToggleVisibility:()=>ae(!B).catch(()=>{})})]}),f.jsxs("main",{className:"max-w-[1400px] mx-auto px-6 pb-16",children:[(k?R.error:fe)&&f.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:[f.jsxs("span",{className:"flex items-start gap-2",children:[f.jsx(xd,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),f.jsxs("span",{children:[f.jsx("span",{className:"font-medium",children:k?"No se pudieron cargar los briefs.":"No se pudieron cargar los proyectos."})," ",k?R.error:fe]})]}),f.jsxs($e,{variant:"outline",size:"sm",onClick:()=>void(k?R.refresh():pe()),className:"gap-1.5",children:[f.jsx(Lg,{className:"h-3.5 w-3.5"})," Reintentar"]})]}),k?R.loading&&R.items.length===0?f.jsx($_,{}):R.items.length===0?f.jsx(v8,{mode:I,query:i}):f.jsx("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2 xl:grid-cols-3",children:R.items.map(Oe=>f.jsx(_6,{item:Oe,mode:I,busy:A===Oe.id,onApprove:()=>void yn(Oe.id,Oe.title,I==="rejected"),onReject:()=>void hn(Oe.id,Oe.title)},Oe.id))}):me&&Z.length===0?f.jsx($_,{}):Z.length===0?f.jsx(y8,{onNew:Ot,hasProjects:de>0||z!=="todos"||i.trim().length>0||qe>0,filter:z,query:i,activeAdvancedFilterCount:qe}):f.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Z.map(Oe=>f.jsx(uI,{project:Oe,onClick:()=>Kt(Oe),onTimeClick:()=>C(Oe),showInternalAmount:X},Oe.id))}),_t>Ms&&f.jsx(p8,{currentPage:ct,totalPages:Ge,visibleStart:Be,visibleEnd:ce,totalItems:_t,itemLabel:k?"briefs":"proyectos",onPageChange:Le})]}),f.jsx(p6,{open:e,onOpenChange:t,project:r,onDelete:Qt,deleting:!!r&&x===r.id}),f.jsx(x6,{open:!!N,onOpenChange:Oe=>{Oe||C(null)},project:N}),O&&f.jsx(i8,{open:E,onOpenChange:S})]})}function f8(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:2}).format(e||0)}function h8({totalAmount:e,projectCount:t,loading:r,error:s,hasFilters:i,canControlVisibility:l,isPublic:c,visibilitySaving:d,onToggleVisibility:h}){return f.jsx("div",{className:"rounded-2xl border border-primary/15 bg-primary/5 px-4 py-3 shadow-sm",children:f.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[f.jsxs("div",{className:"flex items-start gap-3",children:[f.jsx("span",{className:"mt-0.5 flex h-9 w-9 items-center justify-center rounded-xl bg-primary/10 text-primary",children:f.jsx(Bp,{className:"h-4 w-4"})}),f.jsxs("div",{children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:i?"Total tarifado filtrado":"Total tarifado global"}),f.jsx("span",{className:`rounded-full border px-2 py-0.5 text-[10px] font-medium ${c?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-primary/20 bg-card text-primary"}`,children:c?"Visible para todos":"Privado"})]}),f.jsx("p",{className:"mt-0.5 text-2xl font-semibold tracking-tight text-foreground",children:r?"Calculando…":f8(e)}),f.jsx("p",{className:"text-xs text-muted-foreground",children:s?`No se pudo calcular el total: ${s}`:`${t} proyecto(s) incluidos según los filtros actuales.`})]})]}),f.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center lg:justify-end",children:[f.jsx("div",{className:"rounded-full border border-primary/20 bg-card px-3 py-1 text-xs font-medium text-primary",children:i?"Según filtros activos":"Sin filtros aplicados"}),l&&f.jsxs($e,{type:"button",variant:c?"secondary":"outline",size:"sm",className:"gap-1.5 rounded-full",disabled:d,onClick:h,title:c?"Ocultar este total para los demás usuarios":"Mostrar este total temporalmente a todos los usuarios",children:[c?f.jsx(H5,{className:"h-3.5 w-3.5"}):f.jsx(V5,{className:"h-3.5 w-3.5"}),d?"Actualizando…":c?"Ocultar a todos":"Mostrar a todos"]})]})]})})}function m8({filters:e,activeCount:t,countryOptions:r,brandOptions:s,clientOptions:i,cmOptions:l,onFilterChange:c,onClear:d}){return f.jsx("div",{className:"rounded-2xl border border-border bg-card/70 px-3.5 py-3 shadow-sm",children:f.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center",children:[f.jsxs("div",{className:"flex items-center justify-between gap-3 lg:w-auto lg:min-w-[120px] lg:justify-start",children:[f.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[f.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 text-primary",children:f.jsx(j3,{className:"h-4 w-4"})}),f.jsx("span",{children:"Filtros"}),t>0&&f.jsx("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-semibold text-primary",children:t})]}),t>0&&f.jsxs($e,{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:[f.jsx(Bl,{className:"mr-1 h-3.5 w-3.5"}),"Limpiar"]})]}),f.jsxs("div",{className:"grid flex-1 grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-4",children:[f.jsx(xr,{value:e.country,options:r,onValueChange:h=>c("country",h),placeholder:"País: Todos",searchPlaceholder:"Buscar país…",emptyText:"No se encontró ese país.",clearLabel:"Todos"}),f.jsx(xr,{value:e.brand,options:s,onValueChange:h=>c("brand",h),placeholder:"Marca: Todas",searchPlaceholder:"Buscar marca…",emptyText:"No se encontró esa marca.",clearLabel:"Todas"}),f.jsx(xr,{value:e.client,options:i,onValueChange:h=>c("client",h),placeholder:"Cliente: Todos",searchPlaceholder:"Buscar cliente…",emptyText:"No se encontró ese cliente.",clearLabel:"Todos"}),f.jsx(xr,{value:e.cm,options:l,onValueChange:h=>c("cm",h),placeholder:"CM: Todos",searchPlaceholder:"Buscar CM…",emptyText:"No se encontró ese CM.",clearLabel:"Todos"})]}),f.jsxs($e,{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:[f.jsx(Bl,{className:"mr-1 h-3.5 w-3.5"}),"Limpiar"]})]})})}function p8({currentPage:e,totalPages:t,visibleStart:r,visibleEnd:s,totalItems:i,itemLabel:l="proyectos",onPageChange:c}){const d=g8(e,t);return f.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:[f.jsxs("p",{className:"text-xs text-muted-foreground",children:[f.jsxs("span",{className:"font-medium text-foreground",children:[r,"-",s]})," ","de ",f.jsx("span",{className:"font-medium text-foreground",children:i})," ",l]}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsxs($e,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1 rounded-full px-2.5",onClick:()=>c(e-1),disabled:e===1,children:[f.jsx(Pg,{className:"h-4 w-4"}),f.jsx("span",{className:"hidden sm:inline",children:"Anterior"})]}),f.jsx("div",{className:"flex items-center gap-1",children:d.map((h,m)=>h==="ellipsis"?f.jsx("span",{className:"flex h-8 w-8 items-center justify-center text-xs text-muted-foreground",children:"…"},`ellipsis-${m}`):f.jsx($e,{type:"button",variant:h===e?"default":"ghost",size:"sm",className:"h-8 w-8 rounded-full p-0 text-xs",onClick:()=>c(h),"aria-current":h===e?"page":void 0,children:h},h))}),f.jsxs($e,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1 rounded-full px-2.5",onClick:()=>c(e+1),disabled:e===t,children:[f.jsx("span",{className:"hidden sm:inline",children:"Siguiente"}),f.jsx(Fd,{className:"h-4 w-4"})]})]})]})}function g8(e,t){if(t<=7)return Array.from({length:t},(i,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(i=>i>=1&&i<=t).sort((i,l)=>i-l).reduce((i,l)=>{const c=i[i.length-1];return typeof c=="number"&&l-c>1&&i.push("ellipsis"),i.push(l),i},[])}function $_(){return f.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)=>f.jsxs("div",{className:"min-h-[230px] overflow-hidden rounded-2xl border border-border bg-card",children:[f.jsx("div",{className:"h-14 bg-muted animate-pulse"}),f.jsxs("div",{className:"space-y-3 p-4",children:[f.jsx("div",{className:"h-3 w-3/4 rounded-full bg-muted animate-pulse"}),f.jsx("div",{className:"h-3 w-2/3 rounded-full bg-muted animate-pulse"}),f.jsx("div",{className:"h-3 w-1/2 rounded-full bg-muted animate-pulse"}),f.jsx("div",{className:"mt-6 h-8 rounded-full bg-muted animate-pulse"})]})]},t))})}function v8({mode:e,query:t}){const r=t.trim().length>0,s=e==="rejected";return f.jsxs("div",{className:"rounded-2xl border border-dashed border-border bg-card/40 py-24 text-center",children:[f.jsx("div",{className:`mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-2xl ${s?"bg-red-50 text-red-600":"bg-amber-50 text-amber-700"}`,children:s?f.jsx(W5,{className:"h-6 w-6"}):f.jsx(e3,{className:"h-6 w-6"})}),f.jsx("h3",{className:"text-lg font-semibold",children:r?"No hay briefs que coincidan con la búsqueda":s?"No hay briefs rechazados":"No hay briefs pendientes"}),f.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:r?"Prueba con otro nombre, cliente, marca, país o solicitante.":s?"Los briefs que el equipo decida no convertir en proyecto aparecerán aquí.":"Cuando CDC Brief genere un nuevo brief, aparecerá aquí automáticamente para revisión."})]})}function y8({onNew:e,hasProjects:t,filter:r,query:s,activeAdvancedFilterCount:i}){const l=s.trim().length>0,c=i>0;let d="Tu tablero está vacío",h="Crea tu primer proyecto para que el equipo pueda darle seguimiento.";return t&&l&&c?(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&&c?(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."),f.jsxs("div",{className:"text-center py-24 rounded-2xl border border-dashed border-border bg-card/40",children:[f.jsx("div",{className:"w-14 h-14 rounded-2xl bg-primary/10 mx-auto flex items-center justify-center mb-4",children:f.jsx(i3,{className:"w-6 h-6 text-primary"})}),f.jsx("h3",{className:"text-lg font-semibold",children:d}),f.jsx("p",{className:"text-sm text-muted-foreground mt-1 max-w-sm mx-auto",children:h}),!t&&f.jsxs($e,{onClick:e,className:"mt-5 gap-1.5 rounded-full",children:[f.jsx(ua,{className:"w-4 h-4"})," Crear proyecto"]})]})}const b8=({...e})=>f.jsx(a6,{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 x8 extends v.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?f.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background px-4",children:f.jsxs("div",{className:"max-w-md text-center",children:[f.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground",children:"Ocurrió un error al cargar el tablero."}),f.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Intenta recargar la página."}),f.jsx("div",{className:"mt-6",children:f.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 w8(){const{user:e,loading:t}=Vd();return t&&!e?f.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:f.jsxs("div",{className:"flex flex-col items-center gap-3",children:[f.jsx("div",{className:"animate-pulse",children:f.jsx(Mg,{showWordmark:!1})}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Cargando tablero…"})]})}):e?f.jsx(wk,{children:f.jsx(aS,{path:"/*",element:f.jsx(d8,{})})}):f.jsx(o5,{})}function _8(){return f.jsx(x8,{children:f.jsx(iD,{children:f.jsxs(Gk,{basename:"/tablero-cdc/",children:[f.jsx(w8,{}),f.jsx(b8,{richColors:!0,position:"top-right"})]})})})}_R.createRoot(document.getElementById("root")).render(f.jsx(v.StrictMode,{children:f.jsx(_8,{})}));