index-MuBercVK.js 1017 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. var iI=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ise=iI((Ar,Or)=>{function oI(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in e)){const l=Object.getOwnPropertyDescriptor(a,i);l&&Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>a[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"]'))a(i);new MutationObserver(i=>{for(const l of i)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&a(u)}).observe(document,{childList:!0,subtree:!0});function n(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 a(i){if(i.ep)return;i.ep=!0;const l=n(i);fetch(i.href,l)}})();var Af=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ml(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $g={exports:{}},Qc={};var HN;function lI(){if(HN)return Qc;HN=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,i,l){var u=null;if(l!==void 0&&(u=""+l),i.key!==void 0&&(u=""+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:a,key:u,ref:i!==void 0?i:null,props:l}}return Qc.Fragment=t,Qc.jsx=n,Qc.jsxs=n,Qc}var UN;function cI(){return UN||(UN=1,$g.exports=lI()),$g.exports}var o=cI(),Gg={exports:{}},vt={};var VN;function uI(){if(VN)return vt;VN=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),b=Symbol.iterator;function w(B){return B===null||typeof B!="object"?null:(B=b&&B[b]||B["@@iterator"],typeof B=="function"?B:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function N(B,G,X){this.props=B,this.context=G,this.refs=C,this.updater=X||j}N.prototype.isReactComponent={},N.prototype.setState=function(B,G){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,G,"setState")},N.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function _(){}_.prototype=N.prototype;function T(B,G,X){this.props=B,this.context=G,this.refs=C,this.updater=X||j}var R=T.prototype=new _;R.constructor=T,S(R,N.prototype),R.isPureReactComponent=!0;var D=Array.isArray;function L(){}var k={H:null,A:null,T:null,S:null},P=Object.prototype.hasOwnProperty;function U(B,G,X){var oe=X.ref;return{$$typeof:e,type:B,key:G,ref:oe!==void 0?oe:null,props:X}}function J(B,G){return U(B.type,G,B.props)}function $(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function W(B){var G={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(X){return G[X]})}var fe=/\/+/g;function we(B,G){return typeof B=="object"&&B!==null&&B.key!=null?W(""+B.key):G.toString(36)}function Ce(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(L,L):(B.status="pending",B.then(function(G){B.status==="pending"&&(B.status="fulfilled",B.value=G)},function(G){B.status==="pending"&&(B.status="rejected",B.reason=G)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function I(B,G,X,oe,me){var Z=typeof B;(Z==="undefined"||Z==="boolean")&&(B=null);var ne=!1;if(B===null)ne=!0;else switch(Z){case"bigint":case"string":case"number":ne=!0;break;case"object":switch(B.$$typeof){case e:case t:ne=!0;break;case v:return ne=B._init,I(ne(B._payload),G,X,oe,me)}}if(ne)return me=me(B),ne=oe===""?"."+we(B,0):oe,D(me)?(X="",ne!=null&&(X=ne.replace(fe,"$&/")+"/"),I(me,G,X,"",function(je){return je})):me!=null&&($(me)&&(me=J(me,X+(me.key==null||B&&B.key===me.key?"":(""+me.key).replace(fe,"$&/")+"/")+ne)),G.push(me)),1;ne=0;var he=oe===""?".":oe+":";if(D(B))for(var Ee=0;Ee<B.length;Ee++)oe=B[Ee],Z=he+we(oe,Ee),ne+=I(oe,G,X,Z,me);else if(Ee=w(B),typeof Ee=="function")for(B=Ee.call(B),Ee=0;!(oe=B.next()).done;)oe=oe.value,Z=he+we(oe,Ee++),ne+=I(oe,G,X,Z,me);else if(Z==="object"){if(typeof B.then=="function")return I(Ce(B),G,X,oe,me);throw G=String(B),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return ne}function V(B,G,X){if(B==null)return B;var oe=[],me=0;return I(B,oe,"","",function(Z){return G.call(X,Z,me++)}),oe}function H(B){if(B._status===-1){var G=B._result;G=G(),G.then(function(X){(B._status===0||B._status===-1)&&(B._status=1,B._result=X)},function(X){(B._status===0||B._status===-1)&&(B._status=2,B._result=X)}),B._status===-1&&(B._status=0,B._result=G)}if(B._status===1)return B._result.default;throw B._result}var be=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},_e={map:V,forEach:function(B,G,X){V(B,function(){G.apply(this,arguments)},X)},count:function(B){var G=0;return V(B,function(){G++}),G},toArray:function(B){return V(B,function(G){return G})||[]},only:function(B){if(!$(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return vt.Activity=m,vt.Children=_e,vt.Component=N,vt.Fragment=n,vt.Profiler=i,vt.PureComponent=T,vt.StrictMode=a,vt.Suspense=h,vt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=k,vt.__COMPILER_RUNTIME={__proto__:null,c:function(B){return k.H.useMemoCache(B)}},vt.cache=function(B){return function(){return B.apply(null,arguments)}},vt.cacheSignal=function(){return null},vt.cloneElement=function(B,G,X){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var oe=S({},B.props),me=B.key;if(G!=null)for(Z in G.key!==void 0&&(me=""+G.key),G)!P.call(G,Z)||Z==="key"||Z==="__self"||Z==="__source"||Z==="ref"&&G.ref===void 0||(oe[Z]=G[Z]);var Z=arguments.length-2;if(Z===1)oe.children=X;else if(1<Z){for(var ne=Array(Z),he=0;he<Z;he++)ne[he]=arguments[he+2];oe.children=ne}return U(B.type,me,oe)},vt.createContext=function(B){return B={$$typeof:u,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:l,_context:B},B},vt.createElement=function(B,G,X){var oe,me={},Z=null;if(G!=null)for(oe in G.key!==void 0&&(Z=""+G.key),G)P.call(G,oe)&&oe!=="key"&&oe!=="__self"&&oe!=="__source"&&(me[oe]=G[oe]);var ne=arguments.length-2;if(ne===1)me.children=X;else if(1<ne){for(var he=Array(ne),Ee=0;Ee<ne;Ee++)he[Ee]=arguments[Ee+2];me.children=he}if(B&&B.defaultProps)for(oe in ne=B.defaultProps,ne)me[oe]===void 0&&(me[oe]=ne[oe]);return U(B,Z,me)},vt.createRef=function(){return{current:null}},vt.forwardRef=function(B){return{$$typeof:d,render:B}},vt.isValidElement=$,vt.lazy=function(B){return{$$typeof:v,_payload:{_status:-1,_result:B},_init:H}},vt.memo=function(B,G){return{$$typeof:p,type:B,compare:G===void 0?null:G}},vt.startTransition=function(B){var G=k.T,X={};k.T=X;try{var oe=B(),me=k.S;me!==null&&me(X,oe),typeof oe=="object"&&oe!==null&&typeof oe.then=="function"&&oe.then(L,be)}catch(Z){be(Z)}finally{G!==null&&X.types!==null&&(G.types=X.types),k.T=G}},vt.unstable_useCacheRefresh=function(){return k.H.useCacheRefresh()},vt.use=function(B){return k.H.use(B)},vt.useActionState=function(B,G,X){return k.H.useActionState(B,G,X)},vt.useCallback=function(B,G){return k.H.useCallback(B,G)},vt.useContext=function(B){return k.H.useContext(B)},vt.useDebugValue=function(){},vt.useDeferredValue=function(B,G){return k.H.useDeferredValue(B,G)},vt.useEffect=function(B,G){return k.H.useEffect(B,G)},vt.useEffectEvent=function(B){return k.H.useEffectEvent(B)},vt.useId=function(){return k.H.useId()},vt.useImperativeHandle=function(B,G,X){return k.H.useImperativeHandle(B,G,X)},vt.useInsertionEffect=function(B,G){return k.H.useInsertionEffect(B,G)},vt.useLayoutEffect=function(B,G){return k.H.useLayoutEffect(B,G)},vt.useMemo=function(B,G){return k.H.useMemo(B,G)},vt.useOptimistic=function(B,G){return k.H.useOptimistic(B,G)},vt.useReducer=function(B,G,X){return k.H.useReducer(B,G,X)},vt.useRef=function(B){return k.H.useRef(B)},vt.useState=function(B){return k.H.useState(B)},vt.useSyncExternalStore=function(B,G,X){return k.H.useSyncExternalStore(B,G,X)},vt.useTransition=function(){return k.H.useTransition()},vt.version="19.2.3",vt}var qN;function io(){return qN||(qN=1,Gg.exports=uI()),Gg.exports}var g=io();const A=Ml(g),K0=oI({__proto__:null,default:A},[g]);var Kg={exports:{}},Zc={},Yg={exports:{}},Wg={};var $N;function dI(){return $N||($N=1,(function(e){function t(I,V){var H=I.length;I.push(V);e:for(;0<H;){var be=H-1>>>1,_e=I[be];if(0<i(_e,V))I[be]=V,I[H]=_e,H=be;else break e}}function n(I){return I.length===0?null:I[0]}function a(I){if(I.length===0)return null;var V=I[0],H=I.pop();if(H!==V){I[0]=H;e:for(var be=0,_e=I.length,B=_e>>>1;be<B;){var G=2*(be+1)-1,X=I[G],oe=G+1,me=I[oe];if(0>i(X,H))oe<_e&&0>i(me,X)?(I[be]=me,I[oe]=H,be=oe):(I[be]=X,I[G]=H,be=G);else if(oe<_e&&0>i(me,H))I[be]=me,I[oe]=H,be=oe;else break e}}return V}function i(I,V){var H=I.sortIndex-V.sortIndex;return H!==0?H:I.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var h=[],p=[],v=1,m=null,b=3,w=!1,j=!1,S=!1,C=!1,N=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function R(I){for(var V=n(p);V!==null;){if(V.callback===null)a(p);else if(V.startTime<=I)a(p),V.sortIndex=V.expirationTime,t(h,V);else break;V=n(p)}}function D(I){if(S=!1,R(I),!j)if(n(h)!==null)j=!0,L||(L=!0,W());else{var V=n(p);V!==null&&Ce(D,V.startTime-I)}}var L=!1,k=-1,P=5,U=-1;function J(){return C?!0:!(e.unstable_now()-U<P)}function $(){if(C=!1,L){var I=e.unstable_now();U=I;var V=!0;try{e:{j=!1,S&&(S=!1,_(k),k=-1),w=!0;var H=b;try{t:{for(R(I),m=n(h);m!==null&&!(m.expirationTime>I&&J());){var be=m.callback;if(typeof be=="function"){m.callback=null,b=m.priorityLevel;var _e=be(m.expirationTime<=I);if(I=e.unstable_now(),typeof _e=="function"){m.callback=_e,R(I),V=!0;break t}m===n(h)&&a(h),R(I)}else a(h);m=n(h)}if(m!==null)V=!0;else{var B=n(p);B!==null&&Ce(D,B.startTime-I),V=!1}}break e}finally{m=null,b=H,w=!1}V=void 0}}finally{V?W():L=!1}}}var W;if(typeof T=="function")W=function(){T($)};else if(typeof MessageChannel<"u"){var fe=new MessageChannel,we=fe.port2;fe.port1.onmessage=$,W=function(){we.postMessage(null)}}else W=function(){N($,0)};function Ce(I,V){k=N(function(){I(e.unstable_now())},V)}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(I){I.callback=null},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(I){switch(b){case 1:case 2:case 3:var V=3;break;default:V=b}var H=b;b=V;try{return I()}finally{b=H}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(I,V){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var H=b;b=I;try{return V()}finally{b=H}},e.unstable_scheduleCallback=function(I,V,H){var be=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?be+H:be):H=be,I){case 1:var _e=-1;break;case 2:_e=250;break;case 5:_e=1073741823;break;case 4:_e=1e4;break;default:_e=5e3}return _e=H+_e,I={id:v++,callback:V,priorityLevel:I,startTime:H,expirationTime:_e,sortIndex:-1},H>be?(I.sortIndex=H,t(p,I),n(h)===null&&I===n(p)&&(S?(_(k),k=-1):S=!0,Ce(D,H-be))):(I.sortIndex=_e,t(h,I),j||w||(j=!0,L||(L=!0,W()))),I},e.unstable_shouldYield=J,e.unstable_wrapCallback=function(I){var V=b;return function(){var H=b;b=V;try{return I.apply(this,arguments)}finally{b=H}}}})(Wg)),Wg}var GN;function fI(){return GN||(GN=1,Yg.exports=dI()),Yg.exports}var Xg={exports:{}},Wn={};var KN;function hI(){if(KN)return Wn;KN=1;var e=io();function t(h){var p="https://react.dev/errors/"+h;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)p+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+h+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function l(h,p,v){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:m==null?null:""+m,children:h,containerInfo:p,implementation:v}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(h,p){if(h==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Wn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Wn.createPortal=function(h,p){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return l(h,p,null,v)},Wn.flushSync=function(h){var p=u.T,v=a.p;try{if(u.T=null,a.p=2,h)return h()}finally{u.T=p,a.p=v,a.d.f()}},Wn.preconnect=function(h,p){typeof h=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,a.d.C(h,p))},Wn.prefetchDNS=function(h){typeof h=="string"&&a.d.D(h)},Wn.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var v=p.as,m=d(v,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,w=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;v==="style"?a.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:m,integrity:b,fetchPriority:w}):v==="script"&&a.d.X(h,{crossOrigin:m,integrity:b,fetchPriority:w,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Wn.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var v=d(p.as,p.crossOrigin);a.d.M(h,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&a.d.M(h)},Wn.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var v=p.as,m=d(v,p.crossOrigin);a.d.L(h,v,{crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Wn.preloadModule=function(h,p){if(typeof h=="string")if(p){var v=d(p.as,p.crossOrigin);a.d.m(h,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else a.d.m(h)},Wn.requestFormReset=function(h){a.d.r(h)},Wn.unstable_batchedUpdates=function(h,p){return h(p)},Wn.useFormState=function(h,p,v){return u.H.useFormState(h,p,v)},Wn.useFormStatus=function(){return u.H.useHostTransitionStatus()},Wn.version="19.2.3",Wn}var YN;function _O(){if(YN)return Xg.exports;YN=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(),Xg.exports=hI(),Xg.exports}var WN;function pI(){if(WN)return Zc;WN=1;var e=fI(),t=io(),n=_O();function a(r){var s="https://react.dev/errors/"+r;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)s+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+r+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function l(r){var s=r,c=r;if(r.alternate)for(;s.return;)s=s.return;else{r=s;do s=r,(s.flags&4098)!==0&&(c=s.return),r=s.return;while(r)}return s.tag===3?c:null}function u(r){if(r.tag===13){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function d(r){if(r.tag===31){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function h(r){if(l(r)!==r)throw Error(a(188))}function p(r){var s=r.alternate;if(!s){if(s=l(r),s===null)throw Error(a(188));return s!==r?null:r}for(var c=r,f=s;;){var x=c.return;if(x===null)break;var y=x.alternate;if(y===null){if(f=x.return,f!==null){c=f;continue}break}if(x.child===y.child){for(y=x.child;y;){if(y===c)return h(x),r;if(y===f)return h(x),s;y=y.sibling}throw Error(a(188))}if(c.return!==f.return)c=x,f=y;else{for(var E=!1,O=x.child;O;){if(O===c){E=!0,c=x,f=y;break}if(O===f){E=!0,f=x,c=y;break}O=O.sibling}if(!E){for(O=y.child;O;){if(O===c){E=!0,c=y,f=x;break}if(O===f){E=!0,f=y,c=x;break}O=O.sibling}if(!E)throw Error(a(189))}}if(c.alternate!==f)throw Error(a(190))}if(c.tag!==3)throw Error(a(188));return c.stateNode.current===c?r:s}function v(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r;for(r=r.child;r!==null;){if(s=v(r),s!==null)return s;r=r.sibling}return null}var m=Object.assign,b=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),T=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),J=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function W(r){return r===null||typeof r!="object"?null:(r=$&&r[$]||r["@@iterator"],typeof r=="function"?r:null)}var fe=Symbol.for("react.client.reference");function we(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===fe?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case S:return"Fragment";case N:return"Profiler";case C:return"StrictMode";case D:return"Suspense";case L:return"SuspenseList";case U:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case j:return"Portal";case T:return r.displayName||"Context";case _:return(r._context.displayName||"Context")+".Consumer";case R:var s=r.render;return r=r.displayName,r||(r=s.displayName||s.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case k:return s=r.displayName||null,s!==null?s:we(r.type)||"Memo";case P:s=r._payload,r=r._init;try{return we(r(s))}catch{}}return null}var Ce=Array.isArray,I=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H={pending:!1,data:null,method:null,action:null},be=[],_e=-1;function B(r){return{current:r}}function G(r){0>_e||(r.current=be[_e],be[_e]=null,_e--)}function X(r,s){_e++,be[_e]=r.current,r.current=s}var oe=B(null),me=B(null),Z=B(null),ne=B(null);function he(r,s){switch(X(Z,s),X(me,r),X(oe,null),s.nodeType){case 9:case 11:r=(r=s.documentElement)&&(r=r.namespaceURI)?uN(r):0;break;default:if(r=s.tagName,s=s.namespaceURI)s=uN(s),r=dN(s,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}G(oe),X(oe,r)}function Ee(){G(oe),G(me),G(Z)}function je(r){r.memoizedState!==null&&X(ne,r);var s=oe.current,c=dN(s,r.type);s!==c&&(X(me,r),X(oe,c))}function ke(r){me.current===r&&(G(oe),G(me)),ne.current===r&&(G(ne),Kc._currentValue=H)}var le,Fe;function Ge(r){if(le===void 0)try{throw Error()}catch(c){var s=c.stack.trim().match(/\n( *(at )?)/);le=s&&s[1]||"",Fe=-1<c.stack.indexOf(`
  2. at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
  3. `+le+r+Fe}var He=!1;function at(r,s){if(!r||He)return"";He=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(s){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(ce){var ie=ce}Reflect.construct(r,[],ye)}else{try{ye.call()}catch(ce){ie=ce}r.call(ye.prototype)}}else{try{throw Error()}catch(ce){ie=ce}(ye=r())&&typeof ye.catch=="function"&&ye.catch(function(){})}}catch(ce){if(ce&&ie&&typeof ce.stack=="string")return[ce.stack,ie.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=f.DetermineComponentFrameRoot(),E=y[0],O=y[1];if(E&&O){var F=E.split(`
  4. `),ae=O.split(`
  5. `);for(x=f=0;f<F.length&&!F[f].includes("DetermineComponentFrameRoot");)f++;for(;x<ae.length&&!ae[x].includes("DetermineComponentFrameRoot");)x++;if(f===F.length||x===ae.length)for(f=F.length-1,x=ae.length-1;1<=f&&0<=x&&F[f]!==ae[x];)x--;for(;1<=f&&0<=x;f--,x--)if(F[f]!==ae[x]){if(f!==1||x!==1)do if(f--,x--,0>x||F[f]!==ae[x]){var pe=`
  6. `+F[f].replace(" at new "," at ");return r.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",r.displayName)),pe}while(1<=f&&0<=x);break}}}finally{He=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?Ge(c):""}function Ke(r,s){switch(r.tag){case 26:case 27:case 5:return Ge(r.type);case 16:return Ge("Lazy");case 13:return r.child!==s&&s!==null?Ge("Suspense Fallback"):Ge("Suspense");case 19:return Ge("SuspenseList");case 0:case 15:return at(r.type,!1);case 11:return at(r.type.render,!1);case 1:return at(r.type,!0);case 31:return Ge("Activity");default:return""}}function Mt(r){try{var s="",c=null;do s+=Ke(r,c),c=r,r=r.return;while(r);return s}catch(f){return`
  7. Error generating stack: `+f.message+`
  8. `+f.stack}}var St=Object.prototype.hasOwnProperty,_t=e.unstable_scheduleCallback,jt=e.unstable_cancelCallback,ot=e.unstable_shouldYield,lt=e.unstable_requestPaint,Ct=e.unstable_now,Vt=e.unstable_getCurrentPriorityLevel,Kt=e.unstable_ImmediatePriority,Wt=e.unstable_UserBlockingPriority,te=e.unstable_NormalPriority,Me=e.unstable_LowPriority,st=e.unstable_IdlePriority,nt=e.log,yt=e.unstable_setDisableYieldValue,gt=null,xt=null;function qt(r){if(typeof nt=="function"&&yt(r),xt&&typeof xt.setStrictMode=="function")try{xt.setStrictMode(gt,r)}catch{}}var ue=Math.clz32?Math.clz32:Qe,Oe=Math.log,Be=Math.LN2;function Qe(r){return r>>>=0,r===0?32:31-(Oe(r)/Be|0)|0}var Pe=256,Ze=262144,ft=4194304;function pt(r){var s=r&42;if(s!==0)return s;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function z(r,s,c){var f=r.pendingLanes;if(f===0)return 0;var x=0,y=r.suspendedLanes,E=r.pingedLanes;r=r.warmLanes;var O=f&134217727;return O!==0?(f=O&~y,f!==0?x=pt(f):(E&=O,E!==0?x=pt(E):c||(c=O&~r,c!==0&&(x=pt(c))))):(O=f&~y,O!==0?x=pt(O):E!==0?x=pt(E):c||(c=f&~r,c!==0&&(x=pt(c)))),x===0?0:s!==0&&s!==x&&(s&y)===0&&(y=x&-x,c=s&-s,y>=c||y===32&&(c&4194048)!==0)?s:x}function Se(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function Ae(r,s){switch(r){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 Re(){var r=ft;return ft<<=1,(ft&62914560)===0&&(ft=4194304),r}function M(r){for(var s=[],c=0;31>c;c++)s.push(r);return s}function ge(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Ne(r,s,c,f,x,y){var E=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var O=r.entanglements,F=r.expirationTimes,ae=r.hiddenUpdates;for(c=E&~c;0<c;){var pe=31-ue(c),ye=1<<pe;O[pe]=0,F[pe]=-1;var ie=ae[pe];if(ie!==null)for(ae[pe]=null,pe=0;pe<ie.length;pe++){var ce=ie[pe];ce!==null&&(ce.lane&=-536870913)}c&=~ye}f!==0&&mt(r,f,0),y!==0&&x===0&&r.tag!==0&&(r.suspendedLanes|=y&~(E&~s))}function mt(r,s,c){r.pendingLanes|=s,r.suspendedLanes&=~s;var f=31-ue(s);r.entangledLanes|=s,r.entanglements[f]=r.entanglements[f]|1073741824|c&261930}function Y(r,s){var c=r.entangledLanes|=s;for(r=r.entanglements;c;){var f=31-ue(c),x=1<<f;x&s|r[f]&s&&(r[f]|=s),c&=~x}}function xe(r,s){var c=s&-s;return c=(c&42)!==0?1:Le(c),(c&(r.suspendedLanes|s))!==0?0:c}function Le(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=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:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function Ie(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Ue(){var r=V.p;return r!==0?r:(r=window.event,r===void 0?32:PN(r.type))}function ut(r,s){var c=V.p;try{return V.p=r,s()}finally{V.p=c}}var Et=Math.random().toString(36).slice(2),Rt="__reactFiber$"+Et,it="__reactProps$"+Et,zt="__reactContainer$"+Et,Zn="__reactEvents$"+Et,Na="__reactListeners$"+Et,Ti="__reactHandles$"+Et,Ds="__reactResources$"+Et,Ka="__reactMarker$"+Et;function Jl(r){delete r[Rt],delete r[it],delete r[Zn],delete r[Na],delete r[Ti]}function Ya(r){var s=r[Rt];if(s)return s;for(var c=r.parentNode;c;){if(s=c[zt]||c[Rt]){if(c=s.alternate,s.child!==null||c!==null&&c.child!==null)for(r=xN(r);r!==null;){if(c=r[Rt])return c;r=xN(r)}return s}r=c,c=r.parentNode}return null}function Ps(r){if(r=r[Rt]||r[zt]){var s=r.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return r}return null}function ks(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r.stateNode;throw Error(a(33))}function Wa(r){var s=r[Ds];return s||(s=r[Ds]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function xn(r){r[Ka]=!0}var ec=new Set,tc={};function Xa(r,s){ir(r,s),ir(r+"Capture",s)}function ir(r,s){for(tc[r]=s,r=0;r<s.length;r++)ec.add(s[r])}var hd=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]*$"),pd={},md={};function gd(r){return St.call(md,r)?!0:St.call(pd,r)?!1:hd.test(r)?md[r]=!0:(pd[r]=!0,!1)}function Ls(r,s,c){if(gd(s))if(c===null)r.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":r.removeAttribute(s);return;case"boolean":var f=s.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){r.removeAttribute(s);return}}r.setAttribute(s,""+c)}}function Bs(r,s,c){if(c===null)r.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(s);return}r.setAttribute(s,""+c)}}function or(r,s,c,f){if(f===null)r.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(c);return}r.setAttributeNS(s,c,""+f)}}function tn(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function vd(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function nc(r,s,c){var f=Object.getOwnPropertyDescriptor(r.constructor.prototype,s);if(!r.hasOwnProperty(s)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var x=f.get,y=f.set;return Object.defineProperty(r,s,{configurable:!0,get:function(){return x.call(this)},set:function(E){c=""+E,y.call(this,E)}}),Object.defineProperty(r,s,{enumerable:f.enumerable}),{getValue:function(){return c},setValue:function(E){c=""+E},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function lr(r){if(!r._valueTracker){var s=vd(r)?"checked":"value";r._valueTracker=nc(r,s,""+r[s])}}function Qa(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var c=s.getValue(),f="";return r&&(f=vd(r)?r.checked?"true":"false":r.value),r=f,r!==c?(s.setValue(r),!0):!1}function Yn(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var xd=/[\n"\\]/g;function Jn(r){return r.replace(xd,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function rc(r,s,c,f,x,y,E,O){r.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?r.type=E:r.removeAttribute("type"),s!=null?E==="number"?(s===0&&r.value===""||r.value!=s)&&(r.value=""+tn(s)):r.value!==""+tn(s)&&(r.value=""+tn(s)):E!=="submit"&&E!=="reset"||r.removeAttribute("value"),s!=null?ac(r,E,tn(s)):c!=null?ac(r,E,tn(c)):f!=null&&r.removeAttribute("value"),x==null&&y!=null&&(r.defaultChecked=!!y),x!=null&&(r.checked=x&&typeof x!="function"&&typeof x!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?r.name=""+tn(O):r.removeAttribute("name")}function yd(r,s,c,f,x,y,E,O){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(r.type=y),s!=null||c!=null){if(!(y!=="submit"&&y!=="reset"||s!=null)){lr(r);return}c=c!=null?""+tn(c):"",s=s!=null?""+tn(s):c,O||s===r.value||(r.value=s),r.defaultValue=s}f=f??x,f=typeof f!="function"&&typeof f!="symbol"&&!!f,r.checked=O?r.checked:!!f,r.defaultChecked=!!f,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(r.name=E),lr(r)}function ac(r,s,c){s==="number"&&Yn(r.ownerDocument)===r||r.defaultValue===""+c||(r.defaultValue=""+c)}function Is(r,s,c,f){if(r=r.options,s){s={};for(var x=0;x<c.length;x++)s["$"+c[x]]=!0;for(c=0;c<r.length;c++)x=s.hasOwnProperty("$"+r[c].value),r[c].selected!==x&&(r[c].selected=x),x&&f&&(r[c].defaultSelected=!0)}else{for(c=""+tn(c),s=null,x=0;x<r.length;x++){if(r[x].value===c){r[x].selected=!0,f&&(r[x].defaultSelected=!0);return}s!==null||r[x].disabled||(s=r[x])}s!==null&&(s.selected=!0)}}function Ri(r,s,c){if(s!=null&&(s=""+tn(s),s!==r.value&&(r.value=s),c==null)){r.defaultValue!==s&&(r.defaultValue=s);return}r.defaultValue=c!=null?""+tn(c):""}function sc(r,s,c,f){if(s==null){if(f!=null){if(c!=null)throw Error(a(92));if(Ce(f)){if(1<f.length)throw Error(a(93));f=f[0]}c=f}c==null&&(c=""),s=c}c=tn(s),r.defaultValue=c,f=r.textContent,f===c&&f!==""&&f!==null&&(r.value=f),lr(r)}function _a(r,s){if(s){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=s;return}}r.textContent=s}var ic=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 bd(r,s,c){var f=s.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?f?r.setProperty(s,""):s==="float"?r.cssFloat="":r[s]="":f?r.setProperty(s,c):typeof c!="number"||c===0||ic.has(s)?s==="float"?r.cssFloat=c:r[s]=(""+c).trim():r[s]=c+"px"}function oc(r,s,c){if(s!=null&&typeof s!="object")throw Error(a(62));if(r=r.style,c!=null){for(var f in c)!c.hasOwnProperty(f)||s!=null&&s.hasOwnProperty(f)||(f.indexOf("--")===0?r.setProperty(f,""):f==="float"?r.cssFloat="":r[f]="");for(var x in s)f=s[x],s.hasOwnProperty(x)&&c[x]!==f&&bd(r,x,f)}else for(var y in s)s.hasOwnProperty(y)&&bd(r,y,s[y])}function ee(r){if(r.indexOf("-")===-1)return!1;switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Te=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"]]),Tt=/^[\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 Dt(r){return Tt.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Lt(){}var _n=null;function fn(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var an=null,ta=null;function lc(r){var s=Ps(r);if(s&&(r=s.stateNode)){var c=r[it]||null;e:switch(r=s.stateNode,s.type){case"input":if(rc(r,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),s=c.name,c.type==="radio"&&s!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Jn(""+s)+'"][type="radio"]'),s=0;s<c.length;s++){var f=c[s];if(f!==r&&f.form===r.form){var x=f[it]||null;if(!x)throw Error(a(90));rc(f,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(s=0;s<c.length;s++)f=c[s],f.form===r.form&&Qa(f)}break e;case"textarea":Ri(r,c.value,c.defaultValue);break e;case"select":s=c.value,s!=null&&Is(r,!!c.multiple,s,!1)}}}var cc=!1;function u1(r,s,c){if(cc)return r(s,c);cc=!0;try{var f=r(s);return f}finally{if(cc=!1,(an!==null||ta!==null)&&(lf(),an&&(s=an,r=ta,ta=an=null,lc(s),r)))for(s=0;s<r.length;s++)lc(r[s])}}function uc(r,s){var c=r.stateNode;if(c===null)return null;var f=c[it]||null;if(f===null)return null;c=f[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(r=r.type,f=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!f;break e;default:r=!1}if(r)return null;if(c&&typeof c!="function")throw Error(a(231,s,typeof c));return c}var Za=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$p=!1;if(Za)try{var dc={};Object.defineProperty(dc,"passive",{get:function(){$p=!0}}),window.addEventListener("test",dc,dc),window.removeEventListener("test",dc,dc)}catch{$p=!1}var zs=null,Gp=null,wd=null;function d1(){if(wd)return wd;var r,s=Gp,c=s.length,f,x="value"in zs?zs.value:zs.textContent,y=x.length;for(r=0;r<c&&s[r]===x[r];r++);var E=c-r;for(f=1;f<=E&&s[c-f]===x[y-f];f++);return wd=x.slice(r,1<f?1-f:void 0)}function Sd(r){var s=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&s===13&&(r=13)):r=s,r===10&&(r=13),32<=r||r===13?r:0}function jd(){return!0}function f1(){return!1}function cr(r){function s(c,f,x,y,E){this._reactName=c,this._targetInst=x,this.type=f,this.nativeEvent=y,this.target=E,this.currentTarget=null;for(var O in r)r.hasOwnProperty(O)&&(c=r[O],this[O]=c?c(y):y[O]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?jd:f1,this.isPropagationStopped=f1,this}return m(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=jd)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=jd)},persist:function(){},isPersistent:jd}),s}var Ai={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Cd=cr(Ai),fc=m({},Ai,{view:0,detail:0}),a4=cr(fc),Kp,Yp,hc,Nd=m({},fc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xp,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==hc&&(hc&&r.type==="mousemove"?(Kp=r.screenX-hc.screenX,Yp=r.screenY-hc.screenY):Yp=Kp=0,hc=r),Kp)},movementY:function(r){return"movementY"in r?r.movementY:Yp}}),h1=cr(Nd),s4=m({},Nd,{dataTransfer:0}),i4=cr(s4),o4=m({},fc,{relatedTarget:0}),Wp=cr(o4),l4=m({},Ai,{animationName:0,elapsedTime:0,pseudoElement:0}),c4=cr(l4),u4=m({},Ai,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),d4=cr(u4),f4=m({},Ai,{data:0}),p1=cr(f4),h4={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},p4={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"},m4={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function g4(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=m4[r])?!!s[r]:!1}function Xp(){return g4}var v4=m({},fc,{key:function(r){if(r.key){var s=h4[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=Sd(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?p4[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xp,charCode:function(r){return r.type==="keypress"?Sd(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Sd(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),x4=cr(v4),y4=m({},Nd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),m1=cr(y4),b4=m({},fc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xp}),w4=cr(b4),S4=m({},Ai,{propertyName:0,elapsedTime:0,pseudoElement:0}),j4=cr(S4),C4=m({},Nd,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),N4=cr(C4),_4=m({},Ai,{newState:0,oldState:0}),E4=cr(_4),T4=[9,13,27,32],Qp=Za&&"CompositionEvent"in window,pc=null;Za&&"documentMode"in document&&(pc=document.documentMode);var R4=Za&&"TextEvent"in window&&!pc,g1=Za&&(!Qp||pc&&8<pc&&11>=pc),v1=" ",x1=!1;function y1(r,s){switch(r){case"keyup":return T4.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function b1(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var go=!1;function A4(r,s){switch(r){case"compositionend":return b1(s);case"keypress":return s.which!==32?null:(x1=!0,v1);case"textInput":return r=s.data,r===v1&&x1?null:r;default:return null}}function O4(r,s){if(go)return r==="compositionend"||!Qp&&y1(r,s)?(r=d1(),wd=Gp=zs=null,go=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return g1&&s.locale!=="ko"?null:s.data;default:return null}}var M4={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 w1(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!M4[r.type]:s==="textarea"}function S1(r,s,c,f){an?ta?ta.push(f):ta=[f]:an=f,s=mf(s,"onChange"),0<s.length&&(c=new Cd("onChange","change",null,c,f),r.push({event:c,listeners:s}))}var mc=null,gc=null;function D4(r){aN(r,0)}function _d(r){var s=ks(r);if(Qa(s))return r}function j1(r,s){if(r==="change")return s}var C1=!1;if(Za){var Zp;if(Za){var Jp="oninput"in document;if(!Jp){var N1=document.createElement("div");N1.setAttribute("oninput","return;"),Jp=typeof N1.oninput=="function"}Zp=Jp}else Zp=!1;C1=Zp&&(!document.documentMode||9<document.documentMode)}function _1(){mc&&(mc.detachEvent("onpropertychange",E1),gc=mc=null)}function E1(r){if(r.propertyName==="value"&&_d(gc)){var s=[];S1(s,gc,r,fn(r)),u1(D4,s)}}function P4(r,s,c){r==="focusin"?(_1(),mc=s,gc=c,mc.attachEvent("onpropertychange",E1)):r==="focusout"&&_1()}function k4(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return _d(gc)}function L4(r,s){if(r==="click")return _d(s)}function B4(r,s){if(r==="input"||r==="change")return _d(s)}function I4(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var wr=typeof Object.is=="function"?Object.is:I4;function vc(r,s){if(wr(r,s))return!0;if(typeof r!="object"||r===null||typeof s!="object"||s===null)return!1;var c=Object.keys(r),f=Object.keys(s);if(c.length!==f.length)return!1;for(f=0;f<c.length;f++){var x=c[f];if(!St.call(s,x)||!wr(r[x],s[x]))return!1}return!0}function T1(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function R1(r,s){var c=T1(r);r=0;for(var f;c;){if(c.nodeType===3){if(f=r+c.textContent.length,r<=s&&f>=s)return{node:c,offset:s-r};r=f}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=T1(c)}}function A1(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?A1(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function O1(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=Yn(r.document);s instanceof r.HTMLIFrameElement;){try{var c=typeof s.contentWindow.location.href=="string"}catch{c=!1}if(c)r=s.contentWindow;else break;s=Yn(r.document)}return s}function em(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}var z4=Za&&"documentMode"in document&&11>=document.documentMode,vo=null,tm=null,xc=null,nm=!1;function M1(r,s,c){var f=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;nm||vo==null||vo!==Yn(f)||(f=vo,"selectionStart"in f&&em(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),xc&&vc(xc,f)||(xc=f,f=mf(tm,"onSelect"),0<f.length&&(s=new Cd("onSelect","select",null,s,c),r.push({event:s,listeners:f}),s.target=vo)))}function Oi(r,s){var c={};return c[r.toLowerCase()]=s.toLowerCase(),c["Webkit"+r]="webkit"+s,c["Moz"+r]="moz"+s,c}var xo={animationend:Oi("Animation","AnimationEnd"),animationiteration:Oi("Animation","AnimationIteration"),animationstart:Oi("Animation","AnimationStart"),transitionrun:Oi("Transition","TransitionRun"),transitionstart:Oi("Transition","TransitionStart"),transitioncancel:Oi("Transition","TransitionCancel"),transitionend:Oi("Transition","TransitionEnd")},rm={},D1={};Za&&(D1=document.createElement("div").style,"AnimationEvent"in window||(delete xo.animationend.animation,delete xo.animationiteration.animation,delete xo.animationstart.animation),"TransitionEvent"in window||delete xo.transitionend.transition);function Mi(r){if(rm[r])return rm[r];if(!xo[r])return r;var s=xo[r],c;for(c in s)if(s.hasOwnProperty(c)&&c in D1)return rm[r]=s[c];return r}var P1=Mi("animationend"),k1=Mi("animationiteration"),L1=Mi("animationstart"),F4=Mi("transitionrun"),H4=Mi("transitionstart"),U4=Mi("transitioncancel"),B1=Mi("transitionend"),I1=new Map,am="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(" ");am.push("scrollEnd");function na(r,s){I1.set(r,s),Xa(s,[r])}var Ed=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},Br=[],yo=0,sm=0;function Td(){for(var r=yo,s=sm=yo=0;s<r;){var c=Br[s];Br[s++]=null;var f=Br[s];Br[s++]=null;var x=Br[s];Br[s++]=null;var y=Br[s];if(Br[s++]=null,f!==null&&x!==null){var E=f.pending;E===null?x.next=x:(x.next=E.next,E.next=x),f.pending=x}y!==0&&z1(c,x,y)}}function Rd(r,s,c,f){Br[yo++]=r,Br[yo++]=s,Br[yo++]=c,Br[yo++]=f,sm|=f,r.lanes|=f,r=r.alternate,r!==null&&(r.lanes|=f)}function im(r,s,c,f){return Rd(r,s,c,f),Ad(r)}function Di(r,s){return Rd(r,null,null,s),Ad(r)}function z1(r,s,c){r.lanes|=c;var f=r.alternate;f!==null&&(f.lanes|=c);for(var x=!1,y=r.return;y!==null;)y.childLanes|=c,f=y.alternate,f!==null&&(f.childLanes|=c),y.tag===22&&(r=y.stateNode,r===null||r._visibility&1||(x=!0)),r=y,y=y.return;return r.tag===3?(y=r.stateNode,x&&s!==null&&(x=31-ue(c),r=y.hiddenUpdates,f=r[x],f===null?r[x]=[s]:f.push(s),s.lane=c|536870912),y):null}function Ad(r){if(50<Fc)throw Fc=0,mg=null,Error(a(185));for(var s=r.return;s!==null;)r=s,s=r.return;return r.tag===3?r.stateNode:null}var bo={};function V4(r,s,c,f){this.tag=r,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sr(r,s,c,f){return new V4(r,s,c,f)}function om(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Ja(r,s){var c=r.alternate;return c===null?(c=Sr(r.tag,s,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=s,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&65011712,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,s=r.dependencies,c.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c.refCleanup=r.refCleanup,c}function F1(r,s){r.flags&=65011714;var c=r.alternate;return c===null?(r.childLanes=0,r.lanes=s,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=c.childLanes,r.lanes=c.lanes,r.child=c.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=c.memoizedProps,r.memoizedState=c.memoizedState,r.updateQueue=c.updateQueue,r.type=c.type,s=c.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),r}function Od(r,s,c,f,x,y){var E=0;if(f=r,typeof r=="function")om(r)&&(E=1);else if(typeof r=="string")E=YB(r,c,oe.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case U:return r=Sr(31,c,s,x),r.elementType=U,r.lanes=y,r;case S:return Pi(c.children,x,y,s);case C:E=8,x|=24;break;case N:return r=Sr(12,c,s,x|2),r.elementType=N,r.lanes=y,r;case D:return r=Sr(13,c,s,x),r.elementType=D,r.lanes=y,r;case L:return r=Sr(19,c,s,x),r.elementType=L,r.lanes=y,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case T:E=10;break e;case _:E=9;break e;case R:E=11;break e;case k:E=14;break e;case P:E=16,f=null;break e}E=29,c=Error(a(130,r===null?"null":typeof r,"")),f=null}return s=Sr(E,c,s,x),s.elementType=r,s.type=f,s.lanes=y,s}function Pi(r,s,c,f){return r=Sr(7,r,f,s),r.lanes=c,r}function lm(r,s,c){return r=Sr(6,r,null,s),r.lanes=c,r}function H1(r){var s=Sr(18,null,null,0);return s.stateNode=r,s}function cm(r,s,c){return s=Sr(4,r.children!==null?r.children:[],r.key,s),s.lanes=c,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}var U1=new WeakMap;function Ir(r,s){if(typeof r=="object"&&r!==null){var c=U1.get(r);return c!==void 0?c:(s={value:r,source:s,stack:Mt(s)},U1.set(r,s),s)}return{value:r,source:s,stack:Mt(s)}}var wo=[],So=0,Md=null,yc=0,zr=[],Fr=0,Fs=null,Ea=1,Ta="";function es(r,s){wo[So++]=yc,wo[So++]=Md,Md=r,yc=s}function V1(r,s,c){zr[Fr++]=Ea,zr[Fr++]=Ta,zr[Fr++]=Fs,Fs=r;var f=Ea;r=Ta;var x=32-ue(f)-1;f&=~(1<<x),c+=1;var y=32-ue(s)+x;if(30<y){var E=x-x%5;y=(f&(1<<E)-1).toString(32),f>>=E,x-=E,Ea=1<<32-ue(s)+x|c<<x|f,Ta=y+r}else Ea=1<<y|c<<x|f,Ta=r}function um(r){r.return!==null&&(es(r,1),V1(r,1,0))}function dm(r){for(;r===Md;)Md=wo[--So],wo[So]=null,yc=wo[--So],wo[So]=null;for(;r===Fs;)Fs=zr[--Fr],zr[Fr]=null,Ta=zr[--Fr],zr[Fr]=null,Ea=zr[--Fr],zr[Fr]=null}function q1(r,s){zr[Fr++]=Ea,zr[Fr++]=Ta,zr[Fr++]=Fs,Ea=s.id,Ta=s.overflow,Fs=r}var Ln=null,sn=null,Ft=!1,Hs=null,Hr=!1,fm=Error(a(519));function Us(r){var s=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw bc(Ir(s,r)),fm}function $1(r){var s=r.stateNode,c=r.type,f=r.memoizedProps;switch(s[Rt]=r,s[it]=f,c){case"dialog":kt("cancel",s),kt("close",s);break;case"iframe":case"object":case"embed":kt("load",s);break;case"video":case"audio":for(c=0;c<Uc.length;c++)kt(Uc[c],s);break;case"source":kt("error",s);break;case"img":case"image":case"link":kt("error",s),kt("load",s);break;case"details":kt("toggle",s);break;case"input":kt("invalid",s),yd(s,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":kt("invalid",s);break;case"textarea":kt("invalid",s),sc(s,f.value,f.defaultValue,f.children)}c=f.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||s.textContent===""+c||f.suppressHydrationWarning===!0||lN(s.textContent,c)?(f.popover!=null&&(kt("beforetoggle",s),kt("toggle",s)),f.onScroll!=null&&kt("scroll",s),f.onScrollEnd!=null&&kt("scrollend",s),f.onClick!=null&&(s.onclick=Lt),s=!0):s=!1,s||Us(r,!0)}function G1(r){for(Ln=r.return;Ln;)switch(Ln.tag){case 5:case 31:case 13:Hr=!1;return;case 27:case 3:Hr=!0;return;default:Ln=Ln.return}}function jo(r){if(r!==Ln)return!1;if(!Ft)return G1(r),Ft=!0,!1;var s=r.tag,c;if((c=s!==3&&s!==27)&&((c=s===5)&&(c=r.type,c=!(c!=="form"&&c!=="button")||Ag(r.type,r.memoizedProps)),c=!c),c&&sn&&Us(r),G1(r),s===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));sn=vN(r)}else if(s===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));sn=vN(r)}else s===27?(s=sn,ni(r.type)?(r=kg,kg=null,sn=r):sn=s):sn=Ln?Vr(r.stateNode.nextSibling):null;return!0}function ki(){sn=Ln=null,Ft=!1}function hm(){var r=Hs;return r!==null&&(hr===null?hr=r:hr.push.apply(hr,r),Hs=null),r}function bc(r){Hs===null?Hs=[r]:Hs.push(r)}var pm=B(null),Li=null,ts=null;function Vs(r,s,c){X(pm,s._currentValue),s._currentValue=c}function ns(r){r._currentValue=pm.current,G(pm)}function mm(r,s,c){for(;r!==null;){var f=r.alternate;if((r.childLanes&s)!==s?(r.childLanes|=s,f!==null&&(f.childLanes|=s)):f!==null&&(f.childLanes&s)!==s&&(f.childLanes|=s),r===c)break;r=r.return}}function gm(r,s,c,f){var x=r.child;for(x!==null&&(x.return=r);x!==null;){var y=x.dependencies;if(y!==null){var E=x.child;y=y.firstContext;e:for(;y!==null;){var O=y;y=x;for(var F=0;F<s.length;F++)if(O.context===s[F]){y.lanes|=c,O=y.alternate,O!==null&&(O.lanes|=c),mm(y.return,c,r),f||(E=null);break e}y=O.next}}else if(x.tag===18){if(E=x.return,E===null)throw Error(a(341));E.lanes|=c,y=E.alternate,y!==null&&(y.lanes|=c),mm(E,c,r),E=null}else E=x.child;if(E!==null)E.return=x;else for(E=x;E!==null;){if(E===r){E=null;break}if(x=E.sibling,x!==null){x.return=E.return,E=x;break}E=E.return}x=E}}function Co(r,s,c,f){r=null;for(var x=s,y=!1;x!==null;){if(!y){if((x.flags&524288)!==0)y=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var E=x.alternate;if(E===null)throw Error(a(387));if(E=E.memoizedProps,E!==null){var O=x.type;wr(x.pendingProps.value,E.value)||(r!==null?r.push(O):r=[O])}}else if(x===ne.current){if(E=x.alternate,E===null)throw Error(a(387));E.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(r!==null?r.push(Kc):r=[Kc])}x=x.return}r!==null&&gm(s,r,c,f),s.flags|=262144}function Dd(r){for(r=r.firstContext;r!==null;){if(!wr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Bi(r){Li=r,ts=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Bn(r){return K1(Li,r)}function Pd(r,s){return Li===null&&Bi(r),K1(r,s)}function K1(r,s){var c=s._currentValue;if(s={context:s,memoizedValue:c,next:null},ts===null){if(r===null)throw Error(a(308));ts=s,r.dependencies={lanes:0,firstContext:s},r.flags|=524288}else ts=ts.next=s;return c}var q4=typeof AbortController<"u"?AbortController:function(){var r=[],s=this.signal={aborted:!1,addEventListener:function(c,f){r.push(f)}};this.abort=function(){s.aborted=!0,r.forEach(function(c){return c()})}},$4=e.unstable_scheduleCallback,G4=e.unstable_NormalPriority,wn={$$typeof:T,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function vm(){return{controller:new q4,data:new Map,refCount:0}}function wc(r){r.refCount--,r.refCount===0&&$4(G4,function(){r.controller.abort()})}var Sc=null,xm=0,No=0,_o=null;function K4(r,s){if(Sc===null){var c=Sc=[];xm=0,No=wg(),_o={status:"pending",value:void 0,then:function(f){c.push(f)}}}return xm++,s.then(Y1,Y1),s}function Y1(){if(--xm===0&&Sc!==null){_o!==null&&(_o.status="fulfilled");var r=Sc;Sc=null,No=0,_o=null;for(var s=0;s<r.length;s++)(0,r[s])()}}function Y4(r,s){var c=[],f={status:"pending",value:null,reason:null,then:function(x){c.push(x)}};return r.then(function(){f.status="fulfilled",f.value=s;for(var x=0;x<c.length;x++)(0,c[x])(s)},function(x){for(f.status="rejected",f.reason=x,x=0;x<c.length;x++)(0,c[x])(void 0)}),f}var W1=I.S;I.S=function(r,s){MC=Ct(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&K4(r,s),W1!==null&&W1(r,s)};var Ii=B(null);function ym(){var r=Ii.current;return r!==null?r:nn.pooledCache}function kd(r,s){s===null?X(Ii,Ii.current):X(Ii,s.pool)}function X1(){var r=ym();return r===null?null:{parent:wn._currentValue,pool:r}}var Eo=Error(a(460)),bm=Error(a(474)),Ld=Error(a(542)),Bd={then:function(){}};function Q1(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Z1(r,s,c){switch(c=r[c],c===void 0?r.push(s):c!==s&&(s.then(Lt,Lt),s=c),s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,ej(r),r;default:if(typeof s.status=="string")s.then(Lt,Lt);else{if(r=nn,r!==null&&100<r.shellSuspendCounter)throw Error(a(482));r=s,r.status="pending",r.then(function(f){if(s.status==="pending"){var x=s;x.status="fulfilled",x.value=f}},function(f){if(s.status==="pending"){var x=s;x.status="rejected",x.reason=f}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,ej(r),r}throw Fi=s,Eo}}function zi(r){try{var s=r._init;return s(r._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Fi=c,Eo):c}}var Fi=null;function J1(){if(Fi===null)throw Error(a(459));var r=Fi;return Fi=null,r}function ej(r){if(r===Eo||r===Ld)throw Error(a(483))}var To=null,jc=0;function Id(r){var s=jc;return jc+=1,To===null&&(To=[]),Z1(To,r,s)}function Cc(r,s){s=s.props.ref,r.ref=s!==void 0?s:null}function zd(r,s){throw s.$$typeof===b?Error(a(525)):(r=Object.prototype.toString.call(s),Error(a(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r)))}function tj(r){function s(Q,q){if(r){var re=Q.deletions;re===null?(Q.deletions=[q],Q.flags|=16):re.push(q)}}function c(Q,q){if(!r)return null;for(;q!==null;)s(Q,q),q=q.sibling;return null}function f(Q){for(var q=new Map;Q!==null;)Q.key!==null?q.set(Q.key,Q):q.set(Q.index,Q),Q=Q.sibling;return q}function x(Q,q){return Q=Ja(Q,q),Q.index=0,Q.sibling=null,Q}function y(Q,q,re){return Q.index=re,r?(re=Q.alternate,re!==null?(re=re.index,re<q?(Q.flags|=67108866,q):re):(Q.flags|=67108866,q)):(Q.flags|=1048576,q)}function E(Q){return r&&Q.alternate===null&&(Q.flags|=67108866),Q}function O(Q,q,re,ve){return q===null||q.tag!==6?(q=lm(re,Q.mode,ve),q.return=Q,q):(q=x(q,re),q.return=Q,q)}function F(Q,q,re,ve){var Je=re.type;return Je===S?pe(Q,q,re.props.children,ve,re.key):q!==null&&(q.elementType===Je||typeof Je=="object"&&Je!==null&&Je.$$typeof===P&&zi(Je)===q.type)?(q=x(q,re.props),Cc(q,re),q.return=Q,q):(q=Od(re.type,re.key,re.props,null,Q.mode,ve),Cc(q,re),q.return=Q,q)}function ae(Q,q,re,ve){return q===null||q.tag!==4||q.stateNode.containerInfo!==re.containerInfo||q.stateNode.implementation!==re.implementation?(q=cm(re,Q.mode,ve),q.return=Q,q):(q=x(q,re.children||[]),q.return=Q,q)}function pe(Q,q,re,ve,Je){return q===null||q.tag!==7?(q=Pi(re,Q.mode,ve,Je),q.return=Q,q):(q=x(q,re),q.return=Q,q)}function ye(Q,q,re){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=lm(""+q,Q.mode,re),q.return=Q,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case w:return re=Od(q.type,q.key,q.props,null,Q.mode,re),Cc(re,q),re.return=Q,re;case j:return q=cm(q,Q.mode,re),q.return=Q,q;case P:return q=zi(q),ye(Q,q,re)}if(Ce(q)||W(q))return q=Pi(q,Q.mode,re,null),q.return=Q,q;if(typeof q.then=="function")return ye(Q,Id(q),re);if(q.$$typeof===T)return ye(Q,Pd(Q,q),re);zd(Q,q)}return null}function ie(Q,q,re,ve){var Je=q!==null?q.key:null;if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return Je!==null?null:O(Q,q,""+re,ve);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case w:return re.key===Je?F(Q,q,re,ve):null;case j:return re.key===Je?ae(Q,q,re,ve):null;case P:return re=zi(re),ie(Q,q,re,ve)}if(Ce(re)||W(re))return Je!==null?null:pe(Q,q,re,ve,null);if(typeof re.then=="function")return ie(Q,q,Id(re),ve);if(re.$$typeof===T)return ie(Q,q,Pd(Q,re),ve);zd(Q,re)}return null}function ce(Q,q,re,ve,Je){if(typeof ve=="string"&&ve!==""||typeof ve=="number"||typeof ve=="bigint")return Q=Q.get(re)||null,O(q,Q,""+ve,Je);if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case w:return Q=Q.get(ve.key===null?re:ve.key)||null,F(q,Q,ve,Je);case j:return Q=Q.get(ve.key===null?re:ve.key)||null,ae(q,Q,ve,Je);case P:return ve=zi(ve),ce(Q,q,re,ve,Je)}if(Ce(ve)||W(ve))return Q=Q.get(re)||null,pe(q,Q,ve,Je,null);if(typeof ve.then=="function")return ce(Q,q,re,Id(ve),Je);if(ve.$$typeof===T)return ce(Q,q,re,Pd(q,ve),Je);zd(q,ve)}return null}function Ve(Q,q,re,ve){for(var Je=null,$t=null,We=q,Nt=q=0,It=null;We!==null&&Nt<re.length;Nt++){We.index>Nt?(It=We,We=null):It=We.sibling;var Gt=ie(Q,We,re[Nt],ve);if(Gt===null){We===null&&(We=It);break}r&&We&&Gt.alternate===null&&s(Q,We),q=y(Gt,q,Nt),$t===null?Je=Gt:$t.sibling=Gt,$t=Gt,We=It}if(Nt===re.length)return c(Q,We),Ft&&es(Q,Nt),Je;if(We===null){for(;Nt<re.length;Nt++)We=ye(Q,re[Nt],ve),We!==null&&(q=y(We,q,Nt),$t===null?Je=We:$t.sibling=We,$t=We);return Ft&&es(Q,Nt),Je}for(We=f(We);Nt<re.length;Nt++)It=ce(We,Q,Nt,re[Nt],ve),It!==null&&(r&&It.alternate!==null&&We.delete(It.key===null?Nt:It.key),q=y(It,q,Nt),$t===null?Je=It:$t.sibling=It,$t=It);return r&&We.forEach(function(oi){return s(Q,oi)}),Ft&&es(Q,Nt),Je}function rt(Q,q,re,ve){if(re==null)throw Error(a(151));for(var Je=null,$t=null,We=q,Nt=q=0,It=null,Gt=re.next();We!==null&&!Gt.done;Nt++,Gt=re.next()){We.index>Nt?(It=We,We=null):It=We.sibling;var oi=ie(Q,We,Gt.value,ve);if(oi===null){We===null&&(We=It);break}r&&We&&oi.alternate===null&&s(Q,We),q=y(oi,q,Nt),$t===null?Je=oi:$t.sibling=oi,$t=oi,We=It}if(Gt.done)return c(Q,We),Ft&&es(Q,Nt),Je;if(We===null){for(;!Gt.done;Nt++,Gt=re.next())Gt=ye(Q,Gt.value,ve),Gt!==null&&(q=y(Gt,q,Nt),$t===null?Je=Gt:$t.sibling=Gt,$t=Gt);return Ft&&es(Q,Nt),Je}for(We=f(We);!Gt.done;Nt++,Gt=re.next())Gt=ce(We,Q,Nt,Gt.value,ve),Gt!==null&&(r&&Gt.alternate!==null&&We.delete(Gt.key===null?Nt:Gt.key),q=y(Gt,q,Nt),$t===null?Je=Gt:$t.sibling=Gt,$t=Gt);return r&&We.forEach(function(sI){return s(Q,sI)}),Ft&&es(Q,Nt),Je}function en(Q,q,re,ve){if(typeof re=="object"&&re!==null&&re.type===S&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case w:e:{for(var Je=re.key;q!==null;){if(q.key===Je){if(Je=re.type,Je===S){if(q.tag===7){c(Q,q.sibling),ve=x(q,re.props.children),ve.return=Q,Q=ve;break e}}else if(q.elementType===Je||typeof Je=="object"&&Je!==null&&Je.$$typeof===P&&zi(Je)===q.type){c(Q,q.sibling),ve=x(q,re.props),Cc(ve,re),ve.return=Q,Q=ve;break e}c(Q,q);break}else s(Q,q);q=q.sibling}re.type===S?(ve=Pi(re.props.children,Q.mode,ve,re.key),ve.return=Q,Q=ve):(ve=Od(re.type,re.key,re.props,null,Q.mode,ve),Cc(ve,re),ve.return=Q,Q=ve)}return E(Q);case j:e:{for(Je=re.key;q!==null;){if(q.key===Je)if(q.tag===4&&q.stateNode.containerInfo===re.containerInfo&&q.stateNode.implementation===re.implementation){c(Q,q.sibling),ve=x(q,re.children||[]),ve.return=Q,Q=ve;break e}else{c(Q,q);break}else s(Q,q);q=q.sibling}ve=cm(re,Q.mode,ve),ve.return=Q,Q=ve}return E(Q);case P:return re=zi(re),en(Q,q,re,ve)}if(Ce(re))return Ve(Q,q,re,ve);if(W(re)){if(Je=W(re),typeof Je!="function")throw Error(a(150));return re=Je.call(re),rt(Q,q,re,ve)}if(typeof re.then=="function")return en(Q,q,Id(re),ve);if(re.$$typeof===T)return en(Q,q,Pd(Q,re),ve);zd(Q,re)}return typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint"?(re=""+re,q!==null&&q.tag===6?(c(Q,q.sibling),ve=x(q,re),ve.return=Q,Q=ve):(c(Q,q),ve=lm(re,Q.mode,ve),ve.return=Q,Q=ve),E(Q)):c(Q,q)}return function(Q,q,re,ve){try{jc=0;var Je=en(Q,q,re,ve);return To=null,Je}catch(We){if(We===Eo||We===Ld)throw We;var $t=Sr(29,We,null,Q.mode);return $t.lanes=ve,$t.return=Q,$t}}}var Hi=tj(!0),nj=tj(!1),qs=!1;function wm(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Sm(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function $s(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Gs(r,s,c){var f=r.updateQueue;if(f===null)return null;if(f=f.shared,(Yt&2)!==0){var x=f.pending;return x===null?s.next=s:(s.next=x.next,x.next=s),f.pending=s,s=Ad(r),z1(r,null,c),s}return Rd(r,f,s,c),Ad(r)}function Nc(r,s,c){if(s=s.updateQueue,s!==null&&(s=s.shared,(c&4194048)!==0)){var f=s.lanes;f&=r.pendingLanes,c|=f,s.lanes=c,Y(r,c)}}function jm(r,s){var c=r.updateQueue,f=r.alternate;if(f!==null&&(f=f.updateQueue,c===f)){var x=null,y=null;if(c=c.firstBaseUpdate,c!==null){do{var E={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};y===null?x=y=E:y=y.next=E,c=c.next}while(c!==null);y===null?x=y=s:y=y.next=s}else x=y=s;c={baseState:f.baseState,firstBaseUpdate:x,lastBaseUpdate:y,shared:f.shared,callbacks:f.callbacks},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=s:r.next=s,c.lastBaseUpdate=s}var Cm=!1;function _c(){if(Cm){var r=_o;if(r!==null)throw r}}function Ec(r,s,c,f){Cm=!1;var x=r.updateQueue;qs=!1;var y=x.firstBaseUpdate,E=x.lastBaseUpdate,O=x.shared.pending;if(O!==null){x.shared.pending=null;var F=O,ae=F.next;F.next=null,E===null?y=ae:E.next=ae,E=F;var pe=r.alternate;pe!==null&&(pe=pe.updateQueue,O=pe.lastBaseUpdate,O!==E&&(O===null?pe.firstBaseUpdate=ae:O.next=ae,pe.lastBaseUpdate=F))}if(y!==null){var ye=x.baseState;E=0,pe=ae=F=null,O=y;do{var ie=O.lane&-536870913,ce=ie!==O.lane;if(ce?(Bt&ie)===ie:(f&ie)===ie){ie!==0&&ie===No&&(Cm=!0),pe!==null&&(pe=pe.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var Ve=r,rt=O;ie=s;var en=c;switch(rt.tag){case 1:if(Ve=rt.payload,typeof Ve=="function"){ye=Ve.call(en,ye,ie);break e}ye=Ve;break e;case 3:Ve.flags=Ve.flags&-65537|128;case 0:if(Ve=rt.payload,ie=typeof Ve=="function"?Ve.call(en,ye,ie):Ve,ie==null)break e;ye=m({},ye,ie);break e;case 2:qs=!0}}ie=O.callback,ie!==null&&(r.flags|=64,ce&&(r.flags|=8192),ce=x.callbacks,ce===null?x.callbacks=[ie]:ce.push(ie))}else ce={lane:ie,tag:O.tag,payload:O.payload,callback:O.callback,next:null},pe===null?(ae=pe=ce,F=ye):pe=pe.next=ce,E|=ie;if(O=O.next,O===null){if(O=x.shared.pending,O===null)break;ce=O,O=ce.next,ce.next=null,x.lastBaseUpdate=ce,x.shared.pending=null}}while(!0);pe===null&&(F=ye),x.baseState=F,x.firstBaseUpdate=ae,x.lastBaseUpdate=pe,y===null&&(x.shared.lanes=0),Qs|=E,r.lanes=E,r.memoizedState=ye}}function rj(r,s){if(typeof r!="function")throw Error(a(191,r));r.call(s)}function aj(r,s){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)rj(c[r],s)}var Ro=B(null),Fd=B(0);function sj(r,s){r=ds,X(Fd,r),X(Ro,s),ds=r|s.baseLanes}function Nm(){X(Fd,ds),X(Ro,Ro.current)}function _m(){ds=Fd.current,G(Ro),G(Fd)}var jr=B(null),Ur=null;function Ks(r){var s=r.alternate;X(yn,yn.current&1),X(jr,r),Ur===null&&(s===null||Ro.current!==null||s.memoizedState!==null)&&(Ur=r)}function Em(r){X(yn,yn.current),X(jr,r),Ur===null&&(Ur=r)}function ij(r){r.tag===22?(X(yn,yn.current),X(jr,r),Ur===null&&(Ur=r)):Ys()}function Ys(){X(yn,yn.current),X(jr,jr.current)}function Cr(r){G(jr),Ur===r&&(Ur=null),G(yn)}var yn=B(0);function Hd(r){for(var s=r;s!==null;){if(s.tag===13){var c=s.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Dg(c)||Pg(c)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var rs=0,bt=null,Zt=null,Sn=null,Ud=!1,Ao=!1,Ui=!1,Vd=0,Tc=0,Oo=null,W4=0;function mn(){throw Error(a(321))}function Tm(r,s){if(s===null)return!1;for(var c=0;c<s.length&&c<r.length;c++)if(!wr(r[c],s[c]))return!1;return!0}function Rm(r,s,c,f,x,y){return rs=y,bt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,I.H=r===null||r.memoizedState===null?Vj:qm,Ui=!1,y=c(f,x),Ui=!1,Ao&&(y=lj(s,c,f,x)),oj(r),y}function oj(r){I.H=Oc;var s=Zt!==null&&Zt.next!==null;if(rs=0,Sn=Zt=bt=null,Ud=!1,Tc=0,Oo=null,s)throw Error(a(300));r===null||jn||(r=r.dependencies,r!==null&&Dd(r)&&(jn=!0))}function lj(r,s,c,f){bt=r;var x=0;do{if(Ao&&(Oo=null),Tc=0,Ao=!1,25<=x)throw Error(a(301));if(x+=1,Sn=Zt=null,r.updateQueue!=null){var y=r.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}I.H=qj,y=s(c,f)}while(Ao);return y}function X4(){var r=I.H,s=r.useState()[0];return s=typeof s.then=="function"?Rc(s):s,r=r.useState()[0],(Zt!==null?Zt.memoizedState:null)!==r&&(bt.flags|=1024),s}function Am(){var r=Vd!==0;return Vd=0,r}function Om(r,s,c){s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~c}function Mm(r){if(Ud){for(r=r.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Ud=!1}rs=0,Sn=Zt=bt=null,Ao=!1,Tc=Vd=0,Oo=null}function er(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Sn===null?bt.memoizedState=Sn=r:Sn=Sn.next=r,Sn}function bn(){if(Zt===null){var r=bt.alternate;r=r!==null?r.memoizedState:null}else r=Zt.next;var s=Sn===null?bt.memoizedState:Sn.next;if(s!==null)Sn=s,Zt=r;else{if(r===null)throw bt.alternate===null?Error(a(467)):Error(a(310));Zt=r,r={memoizedState:Zt.memoizedState,baseState:Zt.baseState,baseQueue:Zt.baseQueue,queue:Zt.queue,next:null},Sn===null?bt.memoizedState=Sn=r:Sn=Sn.next=r}return Sn}function qd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Rc(r){var s=Tc;return Tc+=1,Oo===null&&(Oo=[]),r=Z1(Oo,r,s),s=bt,(Sn===null?s.memoizedState:Sn.next)===null&&(s=s.alternate,I.H=s===null||s.memoizedState===null?Vj:qm),r}function $d(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return Rc(r);if(r.$$typeof===T)return Bn(r)}throw Error(a(438,String(r)))}function Dm(r){var s=null,c=bt.updateQueue;if(c!==null&&(s=c.memoCache),s==null){var f=bt.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(s={data:f.data.map(function(x){return x.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),c===null&&(c=qd(),bt.updateQueue=c),c.memoCache=s,c=s.data[s.index],c===void 0)for(c=s.data[s.index]=Array(r),f=0;f<r;f++)c[f]=J;return s.index++,c}function as(r,s){return typeof s=="function"?s(r):s}function Gd(r){var s=bn();return Pm(s,Zt,r)}function Pm(r,s,c){var f=r.queue;if(f===null)throw Error(a(311));f.lastRenderedReducer=c;var x=r.baseQueue,y=f.pending;if(y!==null){if(x!==null){var E=x.next;x.next=y.next,y.next=E}s.baseQueue=x=y,f.pending=null}if(y=r.baseState,x===null)r.memoizedState=y;else{s=x.next;var O=E=null,F=null,ae=s,pe=!1;do{var ye=ae.lane&-536870913;if(ye!==ae.lane?(Bt&ye)===ye:(rs&ye)===ye){var ie=ae.revertLane;if(ie===0)F!==null&&(F=F.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),ye===No&&(pe=!0);else if((rs&ie)===ie){ae=ae.next,ie===No&&(pe=!0);continue}else ye={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},F===null?(O=F=ye,E=y):F=F.next=ye,bt.lanes|=ie,Qs|=ie;ye=ae.action,Ui&&c(y,ye),y=ae.hasEagerState?ae.eagerState:c(y,ye)}else ie={lane:ye,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},F===null?(O=F=ie,E=y):F=F.next=ie,bt.lanes|=ye,Qs|=ye;ae=ae.next}while(ae!==null&&ae!==s);if(F===null?E=y:F.next=O,!wr(y,r.memoizedState)&&(jn=!0,pe&&(c=_o,c!==null)))throw c;r.memoizedState=y,r.baseState=E,r.baseQueue=F,f.lastRenderedState=y}return x===null&&(f.lanes=0),[r.memoizedState,f.dispatch]}function km(r){var s=bn(),c=s.queue;if(c===null)throw Error(a(311));c.lastRenderedReducer=r;var f=c.dispatch,x=c.pending,y=s.memoizedState;if(x!==null){c.pending=null;var E=x=x.next;do y=r(y,E.action),E=E.next;while(E!==x);wr(y,s.memoizedState)||(jn=!0),s.memoizedState=y,s.baseQueue===null&&(s.baseState=y),c.lastRenderedState=y}return[y,f]}function cj(r,s,c){var f=bt,x=bn(),y=Ft;if(y){if(c===void 0)throw Error(a(407));c=c()}else c=s();var E=!wr((Zt||x).memoizedState,c);if(E&&(x.memoizedState=c,jn=!0),x=x.queue,Im(fj.bind(null,f,x,r),[r]),x.getSnapshot!==s||E||Sn!==null&&Sn.memoizedState.tag&1){if(f.flags|=2048,Mo(9,{destroy:void 0},dj.bind(null,f,x,c,s),null),nn===null)throw Error(a(349));y||(rs&127)!==0||uj(f,s,c)}return c}function uj(r,s,c){r.flags|=16384,r={getSnapshot:s,value:c},s=bt.updateQueue,s===null?(s=qd(),bt.updateQueue=s,s.stores=[r]):(c=s.stores,c===null?s.stores=[r]:c.push(r))}function dj(r,s,c,f){s.value=c,s.getSnapshot=f,hj(s)&&pj(r)}function fj(r,s,c){return c(function(){hj(s)&&pj(r)})}function hj(r){var s=r.getSnapshot;r=r.value;try{var c=s();return!wr(r,c)}catch{return!0}}function pj(r){var s=Di(r,2);s!==null&&pr(s,r,2)}function Lm(r){var s=er();if(typeof r=="function"){var c=r;if(r=c(),Ui){qt(!0);try{c()}finally{qt(!1)}}}return s.memoizedState=s.baseState=r,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:r},s}function mj(r,s,c,f){return r.baseState=c,Pm(r,Zt,typeof f=="function"?f:as)}function Q4(r,s,c,f,x){if(Wd(r))throw Error(a(485));if(r=s.action,r!==null){var y={payload:x,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(E){y.listeners.push(E)}};I.T!==null?c(!0):y.isTransition=!1,f(y),c=s.pending,c===null?(y.next=s.pending=y,gj(s,y)):(y.next=c.next,s.pending=c.next=y)}}function gj(r,s){var c=s.action,f=s.payload,x=r.state;if(s.isTransition){var y=I.T,E={};I.T=E;try{var O=c(x,f),F=I.S;F!==null&&F(E,O),vj(r,s,O)}catch(ae){Bm(r,s,ae)}finally{y!==null&&E.types!==null&&(y.types=E.types),I.T=y}}else try{y=c(x,f),vj(r,s,y)}catch(ae){Bm(r,s,ae)}}function vj(r,s,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(f){xj(r,s,f)},function(f){return Bm(r,s,f)}):xj(r,s,c)}function xj(r,s,c){s.status="fulfilled",s.value=c,yj(s),r.state=c,s=r.pending,s!==null&&(c=s.next,c===s?r.pending=null:(c=c.next,s.next=c,gj(r,c)))}function Bm(r,s,c){var f=r.pending;if(r.pending=null,f!==null){f=f.next;do s.status="rejected",s.reason=c,yj(s),s=s.next;while(s!==f)}r.action=null}function yj(r){r=r.listeners;for(var s=0;s<r.length;s++)(0,r[s])()}function bj(r,s){return s}function wj(r,s){if(Ft){var c=nn.formState;if(c!==null){e:{var f=bt;if(Ft){if(sn){t:{for(var x=sn,y=Hr;x.nodeType!==8;){if(!y){x=null;break t}if(x=Vr(x.nextSibling),x===null){x=null;break t}}y=x.data,x=y==="F!"||y==="F"?x:null}if(x){sn=Vr(x.nextSibling),f=x.data==="F!";break e}}Us(f)}f=!1}f&&(s=c[0])}}return c=er(),c.memoizedState=c.baseState=s,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bj,lastRenderedState:s},c.queue=f,c=Fj.bind(null,bt,f),f.dispatch=c,f=Lm(!1),y=Vm.bind(null,bt,!1,f.queue),f=er(),x={state:s,dispatch:null,action:r,pending:null},f.queue=x,c=Q4.bind(null,bt,x,y,c),x.dispatch=c,f.memoizedState=r,[s,c,!1]}function Sj(r){var s=bn();return jj(s,Zt,r)}function jj(r,s,c){if(s=Pm(r,s,bj)[0],r=Gd(as)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var f=Rc(s)}catch(E){throw E===Eo?Ld:E}else f=s;s=bn();var x=s.queue,y=x.dispatch;return c!==s.memoizedState&&(bt.flags|=2048,Mo(9,{destroy:void 0},Z4.bind(null,x,c),null)),[f,y,r]}function Z4(r,s){r.action=s}function Cj(r){var s=bn(),c=Zt;if(c!==null)return jj(s,c,r);bn(),s=s.memoizedState,c=bn();var f=c.queue.dispatch;return c.memoizedState=r,[s,f,!1]}function Mo(r,s,c,f){return r={tag:r,create:c,deps:f,inst:s,next:null},s=bt.updateQueue,s===null&&(s=qd(),bt.updateQueue=s),c=s.lastEffect,c===null?s.lastEffect=r.next=r:(f=c.next,c.next=r,r.next=f,s.lastEffect=r),r}function Nj(){return bn().memoizedState}function Kd(r,s,c,f){var x=er();bt.flags|=r,x.memoizedState=Mo(1|s,{destroy:void 0},c,f===void 0?null:f)}function Yd(r,s,c,f){var x=bn();f=f===void 0?null:f;var y=x.memoizedState.inst;Zt!==null&&f!==null&&Tm(f,Zt.memoizedState.deps)?x.memoizedState=Mo(s,y,c,f):(bt.flags|=r,x.memoizedState=Mo(1|s,y,c,f))}function _j(r,s){Kd(8390656,8,r,s)}function Im(r,s){Yd(2048,8,r,s)}function J4(r){bt.flags|=4;var s=bt.updateQueue;if(s===null)s=qd(),bt.updateQueue=s,s.events=[r];else{var c=s.events;c===null?s.events=[r]:c.push(r)}}function Ej(r){var s=bn().memoizedState;return J4({ref:s,nextImpl:r}),function(){if((Yt&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}function Tj(r,s){return Yd(4,2,r,s)}function Rj(r,s){return Yd(4,4,r,s)}function Aj(r,s){if(typeof s=="function"){r=r();var c=s(r);return function(){typeof c=="function"?c():s(null)}}if(s!=null)return r=r(),s.current=r,function(){s.current=null}}function Oj(r,s,c){c=c!=null?c.concat([r]):null,Yd(4,4,Aj.bind(null,s,r),c)}function zm(){}function Mj(r,s){var c=bn();s=s===void 0?null:s;var f=c.memoizedState;return s!==null&&Tm(s,f[1])?f[0]:(c.memoizedState=[r,s],r)}function Dj(r,s){var c=bn();s=s===void 0?null:s;var f=c.memoizedState;if(s!==null&&Tm(s,f[1]))return f[0];if(f=r(),Ui){qt(!0);try{r()}finally{qt(!1)}}return c.memoizedState=[f,s],f}function Fm(r,s,c){return c===void 0||(rs&1073741824)!==0&&(Bt&261930)===0?r.memoizedState=s:(r.memoizedState=c,r=PC(),bt.lanes|=r,Qs|=r,c)}function Pj(r,s,c,f){return wr(c,s)?c:Ro.current!==null?(r=Fm(r,c,f),wr(r,s)||(jn=!0),r):(rs&42)===0||(rs&1073741824)!==0&&(Bt&261930)===0?(jn=!0,r.memoizedState=c):(r=PC(),bt.lanes|=r,Qs|=r,s)}function kj(r,s,c,f,x){var y=V.p;V.p=y!==0&&8>y?y:8;var E=I.T,O={};I.T=O,Vm(r,!1,s,c);try{var F=x(),ae=I.S;if(ae!==null&&ae(O,F),F!==null&&typeof F=="object"&&typeof F.then=="function"){var pe=Y4(F,f);Ac(r,s,pe,Er(r))}else Ac(r,s,f,Er(r))}catch(ye){Ac(r,s,{then:function(){},status:"rejected",reason:ye},Er())}finally{V.p=y,E!==null&&O.types!==null&&(E.types=O.types),I.T=E}}function eB(){}function Hm(r,s,c,f){if(r.tag!==5)throw Error(a(476));var x=Lj(r).queue;kj(r,x,s,H,c===null?eB:function(){return Bj(r),c(f)})}function Lj(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:H,baseState:H,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:H},next:null};var c={};return s.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:c},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function Bj(r){var s=Lj(r);s.next===null&&(s=r.alternate.memoizedState),Ac(r,s.next.queue,{},Er())}function Um(){return Bn(Kc)}function Ij(){return bn().memoizedState}function zj(){return bn().memoizedState}function tB(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var c=Er();r=$s(c);var f=Gs(s,r,c);f!==null&&(pr(f,s,c),Nc(f,s,c)),s={cache:vm()},r.payload=s;return}s=s.return}}function nB(r,s,c){var f=Er();c={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Wd(r)?Hj(s,c):(c=im(r,s,c,f),c!==null&&(pr(c,r,f),Uj(c,s,f)))}function Fj(r,s,c){var f=Er();Ac(r,s,c,f)}function Ac(r,s,c,f){var x={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Wd(r))Hj(s,x);else{var y=r.alternate;if(r.lanes===0&&(y===null||y.lanes===0)&&(y=s.lastRenderedReducer,y!==null))try{var E=s.lastRenderedState,O=y(E,c);if(x.hasEagerState=!0,x.eagerState=O,wr(O,E))return Rd(r,s,x,0),nn===null&&Td(),!1}catch{}if(c=im(r,s,x,f),c!==null)return pr(c,r,f),Uj(c,s,f),!0}return!1}function Vm(r,s,c,f){if(f={lane:2,revertLane:wg(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Wd(r)){if(s)throw Error(a(479))}else s=im(r,c,f,2),s!==null&&pr(s,r,2)}function Wd(r){var s=r.alternate;return r===bt||s!==null&&s===bt}function Hj(r,s){Ao=Ud=!0;var c=r.pending;c===null?s.next=s:(s.next=c.next,c.next=s),r.pending=s}function Uj(r,s,c){if((c&4194048)!==0){var f=s.lanes;f&=r.pendingLanes,c|=f,s.lanes=c,Y(r,c)}}var Oc={readContext:Bn,use:$d,useCallback:mn,useContext:mn,useEffect:mn,useImperativeHandle:mn,useLayoutEffect:mn,useInsertionEffect:mn,useMemo:mn,useReducer:mn,useRef:mn,useState:mn,useDebugValue:mn,useDeferredValue:mn,useTransition:mn,useSyncExternalStore:mn,useId:mn,useHostTransitionStatus:mn,useFormState:mn,useActionState:mn,useOptimistic:mn,useMemoCache:mn,useCacheRefresh:mn};Oc.useEffectEvent=mn;var Vj={readContext:Bn,use:$d,useCallback:function(r,s){return er().memoizedState=[r,s===void 0?null:s],r},useContext:Bn,useEffect:_j,useImperativeHandle:function(r,s,c){c=c!=null?c.concat([r]):null,Kd(4194308,4,Aj.bind(null,s,r),c)},useLayoutEffect:function(r,s){return Kd(4194308,4,r,s)},useInsertionEffect:function(r,s){Kd(4,2,r,s)},useMemo:function(r,s){var c=er();s=s===void 0?null:s;var f=r();if(Ui){qt(!0);try{r()}finally{qt(!1)}}return c.memoizedState=[f,s],f},useReducer:function(r,s,c){var f=er();if(c!==void 0){var x=c(s);if(Ui){qt(!0);try{c(s)}finally{qt(!1)}}}else x=s;return f.memoizedState=f.baseState=x,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:x},f.queue=r,r=r.dispatch=nB.bind(null,bt,r),[f.memoizedState,r]},useRef:function(r){var s=er();return r={current:r},s.memoizedState=r},useState:function(r){r=Lm(r);var s=r.queue,c=Fj.bind(null,bt,s);return s.dispatch=c,[r.memoizedState,c]},useDebugValue:zm,useDeferredValue:function(r,s){var c=er();return Fm(c,r,s)},useTransition:function(){var r=Lm(!1);return r=kj.bind(null,bt,r.queue,!0,!1),er().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,c){var f=bt,x=er();if(Ft){if(c===void 0)throw Error(a(407));c=c()}else{if(c=s(),nn===null)throw Error(a(349));(Bt&127)!==0||uj(f,s,c)}x.memoizedState=c;var y={value:c,getSnapshot:s};return x.queue=y,_j(fj.bind(null,f,y,r),[r]),f.flags|=2048,Mo(9,{destroy:void 0},dj.bind(null,f,y,c,s),null),c},useId:function(){var r=er(),s=nn.identifierPrefix;if(Ft){var c=Ta,f=Ea;c=(f&~(1<<32-ue(f)-1)).toString(32)+c,s="_"+s+"R_"+c,c=Vd++,0<c&&(s+="H"+c.toString(32)),s+="_"}else c=W4++,s="_"+s+"r_"+c.toString(32)+"_";return r.memoizedState=s},useHostTransitionStatus:Um,useFormState:wj,useActionState:wj,useOptimistic:function(r){var s=er();s.memoizedState=s.baseState=r;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=c,s=Vm.bind(null,bt,!0,c),c.dispatch=s,[r,s]},useMemoCache:Dm,useCacheRefresh:function(){return er().memoizedState=tB.bind(null,bt)},useEffectEvent:function(r){var s=er(),c={impl:r};return s.memoizedState=c,function(){if((Yt&2)!==0)throw Error(a(440));return c.impl.apply(void 0,arguments)}}},qm={readContext:Bn,use:$d,useCallback:Mj,useContext:Bn,useEffect:Im,useImperativeHandle:Oj,useInsertionEffect:Tj,useLayoutEffect:Rj,useMemo:Dj,useReducer:Gd,useRef:Nj,useState:function(){return Gd(as)},useDebugValue:zm,useDeferredValue:function(r,s){var c=bn();return Pj(c,Zt.memoizedState,r,s)},useTransition:function(){var r=Gd(as)[0],s=bn().memoizedState;return[typeof r=="boolean"?r:Rc(r),s]},useSyncExternalStore:cj,useId:Ij,useHostTransitionStatus:Um,useFormState:Sj,useActionState:Sj,useOptimistic:function(r,s){var c=bn();return mj(c,Zt,r,s)},useMemoCache:Dm,useCacheRefresh:zj};qm.useEffectEvent=Ej;var qj={readContext:Bn,use:$d,useCallback:Mj,useContext:Bn,useEffect:Im,useImperativeHandle:Oj,useInsertionEffect:Tj,useLayoutEffect:Rj,useMemo:Dj,useReducer:km,useRef:Nj,useState:function(){return km(as)},useDebugValue:zm,useDeferredValue:function(r,s){var c=bn();return Zt===null?Fm(c,r,s):Pj(c,Zt.memoizedState,r,s)},useTransition:function(){var r=km(as)[0],s=bn().memoizedState;return[typeof r=="boolean"?r:Rc(r),s]},useSyncExternalStore:cj,useId:Ij,useHostTransitionStatus:Um,useFormState:Cj,useActionState:Cj,useOptimistic:function(r,s){var c=bn();return Zt!==null?mj(c,Zt,r,s):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:Dm,useCacheRefresh:zj};qj.useEffectEvent=Ej;function $m(r,s,c,f){s=r.memoizedState,c=c(f,s),c=c==null?s:m({},s,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var Gm={enqueueSetState:function(r,s,c){r=r._reactInternals;var f=Er(),x=$s(f);x.payload=s,c!=null&&(x.callback=c),s=Gs(r,x,f),s!==null&&(pr(s,r,f),Nc(s,r,f))},enqueueReplaceState:function(r,s,c){r=r._reactInternals;var f=Er(),x=$s(f);x.tag=1,x.payload=s,c!=null&&(x.callback=c),s=Gs(r,x,f),s!==null&&(pr(s,r,f),Nc(s,r,f))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var c=Er(),f=$s(c);f.tag=2,s!=null&&(f.callback=s),s=Gs(r,f,c),s!==null&&(pr(s,r,c),Nc(s,r,c))}};function $j(r,s,c,f,x,y,E){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(f,y,E):s.prototype&&s.prototype.isPureReactComponent?!vc(c,f)||!vc(x,y):!0}function Gj(r,s,c,f){r=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(c,f),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(c,f),s.state!==r&&Gm.enqueueReplaceState(s,s.state,null)}function Vi(r,s){var c=s;if("ref"in s){c={};for(var f in s)f!=="ref"&&(c[f]=s[f])}if(r=r.defaultProps){c===s&&(c=m({},c));for(var x in r)c[x]===void 0&&(c[x]=r[x])}return c}function Kj(r){Ed(r)}function Yj(r){console.error(r)}function Wj(r){Ed(r)}function Xd(r,s){try{var c=r.onUncaughtError;c(s.value,{componentStack:s.stack})}catch(f){setTimeout(function(){throw f})}}function Xj(r,s,c){try{var f=r.onCaughtError;f(c.value,{componentStack:c.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Km(r,s,c){return c=$s(c),c.tag=3,c.payload={element:null},c.callback=function(){Xd(r,s)},c}function Qj(r){return r=$s(r),r.tag=3,r}function Zj(r,s,c,f){var x=c.type.getDerivedStateFromError;if(typeof x=="function"){var y=f.value;r.payload=function(){return x(y)},r.callback=function(){Xj(s,c,f)}}var E=c.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(r.callback=function(){Xj(s,c,f),typeof x!="function"&&(Zs===null?Zs=new Set([this]):Zs.add(this));var O=f.stack;this.componentDidCatch(f.value,{componentStack:O!==null?O:""})})}function rB(r,s,c,f,x){if(c.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(s=c.alternate,s!==null&&Co(s,c,x,!0),c=jr.current,c!==null){switch(c.tag){case 31:case 13:return Ur===null?cf():c.alternate===null&&gn===0&&(gn=3),c.flags&=-257,c.flags|=65536,c.lanes=x,f===Bd?c.flags|=16384:(s=c.updateQueue,s===null?c.updateQueue=new Set([f]):s.add(f),xg(r,f,x)),!1;case 22:return c.flags|=65536,f===Bd?c.flags|=16384:(s=c.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([f])},c.updateQueue=s):(c=s.retryQueue,c===null?s.retryQueue=new Set([f]):c.add(f)),xg(r,f,x)),!1}throw Error(a(435,c.tag))}return xg(r,f,x),cf(),!1}if(Ft)return s=jr.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=x,f!==fm&&(r=Error(a(422),{cause:f}),bc(Ir(r,c)))):(f!==fm&&(s=Error(a(423),{cause:f}),bc(Ir(s,c))),r=r.current.alternate,r.flags|=65536,x&=-x,r.lanes|=x,f=Ir(f,c),x=Km(r.stateNode,f,x),jm(r,x),gn!==4&&(gn=2)),!1;var y=Error(a(520),{cause:f});if(y=Ir(y,c),zc===null?zc=[y]:zc.push(y),gn!==4&&(gn=2),s===null)return!0;f=Ir(f,c),c=s;do{switch(c.tag){case 3:return c.flags|=65536,r=x&-x,c.lanes|=r,r=Km(c.stateNode,f,r),jm(c,r),!1;case 1:if(s=c.type,y=c.stateNode,(c.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Zs===null||!Zs.has(y))))return c.flags|=65536,x&=-x,c.lanes|=x,x=Qj(x),Zj(x,r,c,f),jm(c,x),!1}c=c.return}while(c!==null);return!1}var Ym=Error(a(461)),jn=!1;function In(r,s,c,f){s.child=r===null?nj(s,null,c,f):Hi(s,r.child,c,f)}function Jj(r,s,c,f,x){c=c.render;var y=s.ref;if("ref"in f){var E={};for(var O in f)O!=="ref"&&(E[O]=f[O])}else E=f;return Bi(s),f=Rm(r,s,c,E,y,x),O=Am(),r!==null&&!jn?(Om(r,s,x),ss(r,s,x)):(Ft&&O&&um(s),s.flags|=1,In(r,s,f,x),s.child)}function eC(r,s,c,f,x){if(r===null){var y=c.type;return typeof y=="function"&&!om(y)&&y.defaultProps===void 0&&c.compare===null?(s.tag=15,s.type=y,tC(r,s,y,f,x)):(r=Od(c.type,null,f,s,s.mode,x),r.ref=s.ref,r.return=s,s.child=r)}if(y=r.child,!ng(r,x)){var E=y.memoizedProps;if(c=c.compare,c=c!==null?c:vc,c(E,f)&&r.ref===s.ref)return ss(r,s,x)}return s.flags|=1,r=Ja(y,f),r.ref=s.ref,r.return=s,s.child=r}function tC(r,s,c,f,x){if(r!==null){var y=r.memoizedProps;if(vc(y,f)&&r.ref===s.ref)if(jn=!1,s.pendingProps=f=y,ng(r,x))(r.flags&131072)!==0&&(jn=!0);else return s.lanes=r.lanes,ss(r,s,x)}return Wm(r,s,c,f,x)}function nC(r,s,c,f){var x=f.children,y=r!==null?r.memoizedState:null;if(r===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((s.flags&128)!==0){if(y=y!==null?y.baseLanes|c:c,r!==null){for(f=s.child=r.child,x=0;f!==null;)x=x|f.lanes|f.childLanes,f=f.sibling;f=x&~y}else f=0,s.child=null;return rC(r,s,y,c,f)}if((c&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},r!==null&&kd(s,y!==null?y.cachePool:null),y!==null?sj(s,y):Nm(),ij(s);else return f=s.lanes=536870912,rC(r,s,y!==null?y.baseLanes|c:c,c,f)}else y!==null?(kd(s,y.cachePool),sj(s,y),Ys(),s.memoizedState=null):(r!==null&&kd(s,null),Nm(),Ys());return In(r,s,x,c),s.child}function Mc(r,s){return r!==null&&r.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function rC(r,s,c,f,x){var y=ym();return y=y===null?null:{parent:wn._currentValue,pool:y},s.memoizedState={baseLanes:c,cachePool:y},r!==null&&kd(s,null),Nm(),ij(s),r!==null&&Co(r,s,f,!0),s.childLanes=x,null}function Qd(r,s){return s=Jd({mode:s.mode,children:s.children},r.mode),s.ref=r.ref,r.child=s,s.return=r,s}function aC(r,s,c){return Hi(s,r.child,null,c),r=Qd(s,s.pendingProps),r.flags|=2,Cr(s),s.memoizedState=null,r}function aB(r,s,c){var f=s.pendingProps,x=(s.flags&128)!==0;if(s.flags&=-129,r===null){if(Ft){if(f.mode==="hidden")return r=Qd(s,f),s.lanes=536870912,Mc(null,r);if(Em(s),(r=sn)?(r=gN(r,Hr),r=r!==null&&r.data==="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:Fs!==null?{id:Ea,overflow:Ta}:null,retryLane:536870912,hydrationErrors:null},c=H1(r),c.return=s,s.child=c,Ln=s,sn=null)):r=null,r===null)throw Us(s);return s.lanes=536870912,null}return Qd(s,f)}var y=r.memoizedState;if(y!==null){var E=y.dehydrated;if(Em(s),x)if(s.flags&256)s.flags&=-257,s=aC(r,s,c);else if(s.memoizedState!==null)s.child=r.child,s.flags|=128,s=null;else throw Error(a(558));else if(jn||Co(r,s,c,!1),x=(c&r.childLanes)!==0,jn||x){if(f=nn,f!==null&&(E=xe(f,c),E!==0&&E!==y.retryLane))throw y.retryLane=E,Di(r,E),pr(f,r,E),Ym;cf(),s=aC(r,s,c)}else r=y.treeContext,sn=Vr(E.nextSibling),Ln=s,Ft=!0,Hs=null,Hr=!1,r!==null&&q1(s,r),s=Qd(s,f),s.flags|=4096;return s}return r=Ja(r.child,{mode:f.mode,children:f.children}),r.ref=s.ref,s.child=r,r.return=s,r}function Zd(r,s){var c=s.ref;if(c===null)r!==null&&r.ref!==null&&(s.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(a(284));(r===null||r.ref!==c)&&(s.flags|=4194816)}}function Wm(r,s,c,f,x){return Bi(s),c=Rm(r,s,c,f,void 0,x),f=Am(),r!==null&&!jn?(Om(r,s,x),ss(r,s,x)):(Ft&&f&&um(s),s.flags|=1,In(r,s,c,x),s.child)}function sC(r,s,c,f,x,y){return Bi(s),s.updateQueue=null,c=lj(s,f,c,x),oj(r),f=Am(),r!==null&&!jn?(Om(r,s,y),ss(r,s,y)):(Ft&&f&&um(s),s.flags|=1,In(r,s,c,y),s.child)}function iC(r,s,c,f,x){if(Bi(s),s.stateNode===null){var y=bo,E=c.contextType;typeof E=="object"&&E!==null&&(y=Bn(E)),y=new c(f,y),s.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Gm,s.stateNode=y,y._reactInternals=s,y=s.stateNode,y.props=f,y.state=s.memoizedState,y.refs={},wm(s),E=c.contextType,y.context=typeof E=="object"&&E!==null?Bn(E):bo,y.state=s.memoizedState,E=c.getDerivedStateFromProps,typeof E=="function"&&($m(s,c,E,f),y.state=s.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(E=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),E!==y.state&&Gm.enqueueReplaceState(y,y.state,null),Ec(s,f,y,x),_c(),y.state=s.memoizedState),typeof y.componentDidMount=="function"&&(s.flags|=4194308),f=!0}else if(r===null){y=s.stateNode;var O=s.memoizedProps,F=Vi(c,O);y.props=F;var ae=y.context,pe=c.contextType;E=bo,typeof pe=="object"&&pe!==null&&(E=Bn(pe));var ye=c.getDerivedStateFromProps;pe=typeof ye=="function"||typeof y.getSnapshotBeforeUpdate=="function",O=s.pendingProps!==O,pe||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(O||ae!==E)&&Gj(s,y,f,E),qs=!1;var ie=s.memoizedState;y.state=ie,Ec(s,f,y,x),_c(),ae=s.memoizedState,O||ie!==ae||qs?(typeof ye=="function"&&($m(s,c,ye,f),ae=s.memoizedState),(F=qs||$j(s,c,F,f,ie,ae,E))?(pe||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"&&(s.flags|=4194308)):(typeof y.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=f,s.memoizedState=ae),y.props=f,y.state=ae,y.context=E,f=F):(typeof y.componentDidMount=="function"&&(s.flags|=4194308),f=!1)}else{y=s.stateNode,Sm(r,s),E=s.memoizedProps,pe=Vi(c,E),y.props=pe,ye=s.pendingProps,ie=y.context,ae=c.contextType,F=bo,typeof ae=="object"&&ae!==null&&(F=Bn(ae)),O=c.getDerivedStateFromProps,(ae=typeof O=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(E!==ye||ie!==F)&&Gj(s,y,f,F),qs=!1,ie=s.memoizedState,y.state=ie,Ec(s,f,y,x),_c();var ce=s.memoizedState;E!==ye||ie!==ce||qs||r!==null&&r.dependencies!==null&&Dd(r.dependencies)?(typeof O=="function"&&($m(s,c,O,f),ce=s.memoizedState),(pe=qs||$j(s,c,pe,f,ie,ce,F)||r!==null&&r.dependencies!==null&&Dd(r.dependencies))?(ae||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(f,ce,F),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(f,ce,F)),typeof y.componentDidUpdate=="function"&&(s.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof y.componentDidUpdate!="function"||E===r.memoizedProps&&ie===r.memoizedState||(s.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&ie===r.memoizedState||(s.flags|=1024),s.memoizedProps=f,s.memoizedState=ce),y.props=f,y.state=ce,y.context=F,f=pe):(typeof y.componentDidUpdate!="function"||E===r.memoizedProps&&ie===r.memoizedState||(s.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&ie===r.memoizedState||(s.flags|=1024),f=!1)}return y=f,Zd(r,s),f=(s.flags&128)!==0,y||f?(y=s.stateNode,c=f&&typeof c.getDerivedStateFromError!="function"?null:y.render(),s.flags|=1,r!==null&&f?(s.child=Hi(s,r.child,null,x),s.child=Hi(s,null,c,x)):In(r,s,c,x),s.memoizedState=y.state,r=s.child):r=ss(r,s,x),r}function oC(r,s,c,f){return ki(),s.flags|=256,In(r,s,c,f),s.child}var Xm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qm(r){return{baseLanes:r,cachePool:X1()}}function Zm(r,s,c){return r=r!==null?r.childLanes&~c:0,s&&(r|=_r),r}function lC(r,s,c){var f=s.pendingProps,x=!1,y=(s.flags&128)!==0,E;if((E=y)||(E=r!==null&&r.memoizedState===null?!1:(yn.current&2)!==0),E&&(x=!0,s.flags&=-129),E=(s.flags&32)!==0,s.flags&=-33,r===null){if(Ft){if(x?Ks(s):Ys(),(r=sn)?(r=gN(r,Hr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:Fs!==null?{id:Ea,overflow:Ta}:null,retryLane:536870912,hydrationErrors:null},c=H1(r),c.return=s,s.child=c,Ln=s,sn=null)):r=null,r===null)throw Us(s);return Pg(r)?s.lanes=32:s.lanes=536870912,null}var O=f.children;return f=f.fallback,x?(Ys(),x=s.mode,O=Jd({mode:"hidden",children:O},x),f=Pi(f,x,c,null),O.return=s,f.return=s,O.sibling=f,s.child=O,f=s.child,f.memoizedState=Qm(c),f.childLanes=Zm(r,E,c),s.memoizedState=Xm,Mc(null,f)):(Ks(s),Jm(s,O))}var F=r.memoizedState;if(F!==null&&(O=F.dehydrated,O!==null)){if(y)s.flags&256?(Ks(s),s.flags&=-257,s=eg(r,s,c)):s.memoizedState!==null?(Ys(),s.child=r.child,s.flags|=128,s=null):(Ys(),O=f.fallback,x=s.mode,f=Jd({mode:"visible",children:f.children},x),O=Pi(O,x,c,null),O.flags|=2,f.return=s,O.return=s,f.sibling=O,s.child=f,Hi(s,r.child,null,c),f=s.child,f.memoizedState=Qm(c),f.childLanes=Zm(r,E,c),s.memoizedState=Xm,s=Mc(null,f));else if(Ks(s),Pg(O)){if(E=O.nextSibling&&O.nextSibling.dataset,E)var ae=E.dgst;E=ae,f=Error(a(419)),f.stack="",f.digest=E,bc({value:f,source:null,stack:null}),s=eg(r,s,c)}else if(jn||Co(r,s,c,!1),E=(c&r.childLanes)!==0,jn||E){if(E=nn,E!==null&&(f=xe(E,c),f!==0&&f!==F.retryLane))throw F.retryLane=f,Di(r,f),pr(E,r,f),Ym;Dg(O)||cf(),s=eg(r,s,c)}else Dg(O)?(s.flags|=192,s.child=r.child,s=null):(r=F.treeContext,sn=Vr(O.nextSibling),Ln=s,Ft=!0,Hs=null,Hr=!1,r!==null&&q1(s,r),s=Jm(s,f.children),s.flags|=4096);return s}return x?(Ys(),O=f.fallback,x=s.mode,F=r.child,ae=F.sibling,f=Ja(F,{mode:"hidden",children:f.children}),f.subtreeFlags=F.subtreeFlags&65011712,ae!==null?O=Ja(ae,O):(O=Pi(O,x,c,null),O.flags|=2),O.return=s,f.return=s,f.sibling=O,s.child=f,Mc(null,f),f=s.child,O=r.child.memoizedState,O===null?O=Qm(c):(x=O.cachePool,x!==null?(F=wn._currentValue,x=x.parent!==F?{parent:F,pool:F}:x):x=X1(),O={baseLanes:O.baseLanes|c,cachePool:x}),f.memoizedState=O,f.childLanes=Zm(r,E,c),s.memoizedState=Xm,Mc(r.child,f)):(Ks(s),c=r.child,r=c.sibling,c=Ja(c,{mode:"visible",children:f.children}),c.return=s,c.sibling=null,r!==null&&(E=s.deletions,E===null?(s.deletions=[r],s.flags|=16):E.push(r)),s.child=c,s.memoizedState=null,c)}function Jm(r,s){return s=Jd({mode:"visible",children:s},r.mode),s.return=r,r.child=s}function Jd(r,s){return r=Sr(22,r,null,s),r.lanes=0,r}function eg(r,s,c){return Hi(s,r.child,null,c),r=Jm(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function cC(r,s,c){r.lanes|=s;var f=r.alternate;f!==null&&(f.lanes|=s),mm(r.return,s,c)}function tg(r,s,c,f,x,y){var E=r.memoizedState;E===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:f,tail:c,tailMode:x,treeForkCount:y}:(E.isBackwards=s,E.rendering=null,E.renderingStartTime=0,E.last=f,E.tail=c,E.tailMode=x,E.treeForkCount=y)}function uC(r,s,c){var f=s.pendingProps,x=f.revealOrder,y=f.tail;f=f.children;var E=yn.current,O=(E&2)!==0;if(O?(E=E&1|2,s.flags|=128):E&=1,X(yn,E),In(r,s,f,c),f=Ft?yc:0,!O&&r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&cC(r,c,s);else if(r.tag===19)cC(r,c,s);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(x){case"forwards":for(c=s.child,x=null;c!==null;)r=c.alternate,r!==null&&Hd(r)===null&&(x=c),c=c.sibling;c=x,c===null?(x=s.child,s.child=null):(x=c.sibling,c.sibling=null),tg(s,!1,x,c,y,f);break;case"backwards":case"unstable_legacy-backwards":for(c=null,x=s.child,s.child=null;x!==null;){if(r=x.alternate,r!==null&&Hd(r)===null){s.child=x;break}r=x.sibling,x.sibling=c,c=x,x=r}tg(s,!0,c,null,y,f);break;case"together":tg(s,!1,null,null,void 0,f);break;default:s.memoizedState=null}return s.child}function ss(r,s,c){if(r!==null&&(s.dependencies=r.dependencies),Qs|=s.lanes,(c&s.childLanes)===0)if(r!==null){if(Co(r,s,c,!1),(c&s.childLanes)===0)return null}else return null;if(r!==null&&s.child!==r.child)throw Error(a(153));if(s.child!==null){for(r=s.child,c=Ja(r,r.pendingProps),s.child=c,c.return=s;r.sibling!==null;)r=r.sibling,c=c.sibling=Ja(r,r.pendingProps),c.return=s;c.sibling=null}return s.child}function ng(r,s){return(r.lanes&s)!==0?!0:(r=r.dependencies,!!(r!==null&&Dd(r)))}function sB(r,s,c){switch(s.tag){case 3:he(s,s.stateNode.containerInfo),Vs(s,wn,r.memoizedState.cache),ki();break;case 27:case 5:je(s);break;case 4:he(s,s.stateNode.containerInfo);break;case 10:Vs(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Em(s),null;break;case 13:var f=s.memoizedState;if(f!==null)return f.dehydrated!==null?(Ks(s),s.flags|=128,null):(c&s.child.childLanes)!==0?lC(r,s,c):(Ks(s),r=ss(r,s,c),r!==null?r.sibling:null);Ks(s);break;case 19:var x=(r.flags&128)!==0;if(f=(c&s.childLanes)!==0,f||(Co(r,s,c,!1),f=(c&s.childLanes)!==0),x){if(f)return uC(r,s,c);s.flags|=128}if(x=s.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),X(yn,yn.current),f)break;return null;case 22:return s.lanes=0,nC(r,s,c,s.pendingProps);case 24:Vs(s,wn,r.memoizedState.cache)}return ss(r,s,c)}function dC(r,s,c){if(r!==null)if(r.memoizedProps!==s.pendingProps)jn=!0;else{if(!ng(r,c)&&(s.flags&128)===0)return jn=!1,sB(r,s,c);jn=(r.flags&131072)!==0}else jn=!1,Ft&&(s.flags&1048576)!==0&&V1(s,yc,s.index);switch(s.lanes=0,s.tag){case 16:e:{var f=s.pendingProps;if(r=zi(s.elementType),s.type=r,typeof r=="function")om(r)?(f=Vi(r,f),s.tag=1,s=iC(null,s,r,f,c)):(s.tag=0,s=Wm(null,s,r,f,c));else{if(r!=null){var x=r.$$typeof;if(x===R){s.tag=11,s=Jj(null,s,r,f,c);break e}else if(x===k){s.tag=14,s=eC(null,s,r,f,c);break e}}throw s=we(r)||r,Error(a(306,s,""))}}return s;case 0:return Wm(r,s,s.type,s.pendingProps,c);case 1:return f=s.type,x=Vi(f,s.pendingProps),iC(r,s,f,x,c);case 3:e:{if(he(s,s.stateNode.containerInfo),r===null)throw Error(a(387));f=s.pendingProps;var y=s.memoizedState;x=y.element,Sm(r,s),Ec(s,f,null,c);var E=s.memoizedState;if(f=E.cache,Vs(s,wn,f),f!==y.cache&&gm(s,[wn],c,!0),_c(),f=E.element,y.isDehydrated)if(y={element:f,isDehydrated:!1,cache:E.cache},s.updateQueue.baseState=y,s.memoizedState=y,s.flags&256){s=oC(r,s,f,c);break e}else if(f!==x){x=Ir(Error(a(424)),s),bc(x),s=oC(r,s,f,c);break e}else for(r=s.stateNode.containerInfo,r.nodeType===9?r=r.body:r=r.nodeName==="HTML"?r.ownerDocument.body:r,sn=Vr(r.firstChild),Ln=s,Ft=!0,Hs=null,Hr=!0,c=nj(s,null,f,c),s.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(ki(),f===x){s=ss(r,s,c);break e}In(r,s,f,c)}s=s.child}return s;case 26:return Zd(r,s),r===null?(c=SN(s.type,null,s.pendingProps,null))?s.memoizedState=c:Ft||(c=s.type,r=s.pendingProps,f=gf(Z.current).createElement(c),f[Rt]=s,f[it]=r,zn(f,c,r),xn(f),s.stateNode=f):s.memoizedState=SN(s.type,r.memoizedProps,s.pendingProps,r.memoizedState),null;case 27:return je(s),r===null&&Ft&&(f=s.stateNode=yN(s.type,s.pendingProps,Z.current),Ln=s,Hr=!0,x=sn,ni(s.type)?(kg=x,sn=Vr(f.firstChild)):sn=x),In(r,s,s.pendingProps.children,c),Zd(r,s),r===null&&(s.flags|=4194304),s.child;case 5:return r===null&&Ft&&((x=f=sn)&&(f=kB(f,s.type,s.pendingProps,Hr),f!==null?(s.stateNode=f,Ln=s,sn=Vr(f.firstChild),Hr=!1,x=!0):x=!1),x||Us(s)),je(s),x=s.type,y=s.pendingProps,E=r!==null?r.memoizedProps:null,f=y.children,Ag(x,y)?f=null:E!==null&&Ag(x,E)&&(s.flags|=32),s.memoizedState!==null&&(x=Rm(r,s,X4,null,null,c),Kc._currentValue=x),Zd(r,s),In(r,s,f,c),s.child;case 6:return r===null&&Ft&&((r=c=sn)&&(c=LB(c,s.pendingProps,Hr),c!==null?(s.stateNode=c,Ln=s,sn=null,r=!0):r=!1),r||Us(s)),null;case 13:return lC(r,s,c);case 4:return he(s,s.stateNode.containerInfo),f=s.pendingProps,r===null?s.child=Hi(s,null,f,c):In(r,s,f,c),s.child;case 11:return Jj(r,s,s.type,s.pendingProps,c);case 7:return In(r,s,s.pendingProps,c),s.child;case 8:return In(r,s,s.pendingProps.children,c),s.child;case 12:return In(r,s,s.pendingProps.children,c),s.child;case 10:return f=s.pendingProps,Vs(s,s.type,f.value),In(r,s,f.children,c),s.child;case 9:return x=s.type._context,f=s.pendingProps.children,Bi(s),x=Bn(x),f=f(x),s.flags|=1,In(r,s,f,c),s.child;case 14:return eC(r,s,s.type,s.pendingProps,c);case 15:return tC(r,s,s.type,s.pendingProps,c);case 19:return uC(r,s,c);case 31:return aB(r,s,c);case 22:return nC(r,s,c,s.pendingProps);case 24:return Bi(s),f=Bn(wn),r===null?(x=ym(),x===null&&(x=nn,y=vm(),x.pooledCache=y,y.refCount++,y!==null&&(x.pooledCacheLanes|=c),x=y),s.memoizedState={parent:f,cache:x},wm(s),Vs(s,wn,x)):((r.lanes&c)!==0&&(Sm(r,s),Ec(s,null,null,c),_c()),x=r.memoizedState,y=s.memoizedState,x.parent!==f?(x={parent:f,cache:f},s.memoizedState=x,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=x),Vs(s,wn,f)):(f=y.cache,Vs(s,wn,f),f!==x.cache&&gm(s,[wn],c,!0))),In(r,s,s.pendingProps.children,c),s.child;case 29:throw s.pendingProps}throw Error(a(156,s.tag))}function is(r){r.flags|=4}function rg(r,s,c,f,x){if((s=(r.mode&32)!==0)&&(s=!1),s){if(r.flags|=16777216,(x&335544128)===x)if(r.stateNode.complete)r.flags|=8192;else if(IC())r.flags|=8192;else throw Fi=Bd,bm}else r.flags&=-16777217}function fC(r,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!EN(s))if(IC())r.flags|=8192;else throw Fi=Bd,bm}function ef(r,s){s!==null&&(r.flags|=4),r.flags&16384&&(s=r.tag!==22?Re():536870912,r.lanes|=s,Lo|=s)}function Dc(r,s){if(!Ft)switch(r.tailMode){case"hidden":s=r.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:f.sibling=null}}function on(r){var s=r.alternate!==null&&r.alternate.child===r.child,c=0,f=0;if(s)for(var x=r.child;x!==null;)c|=x.lanes|x.childLanes,f|=x.subtreeFlags&65011712,f|=x.flags&65011712,x.return=r,x=x.sibling;else for(x=r.child;x!==null;)c|=x.lanes|x.childLanes,f|=x.subtreeFlags,f|=x.flags,x.return=r,x=x.sibling;return r.subtreeFlags|=f,r.childLanes=c,s}function iB(r,s,c){var f=s.pendingProps;switch(dm(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return on(s),null;case 1:return on(s),null;case 3:return c=s.stateNode,f=null,r!==null&&(f=r.memoizedState.cache),s.memoizedState.cache!==f&&(s.flags|=2048),ns(wn),Ee(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(jo(s)?is(s):r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,hm())),on(s),null;case 26:var x=s.type,y=s.memoizedState;return r===null?(is(s),y!==null?(on(s),fC(s,y)):(on(s),rg(s,x,null,f,c))):y?y!==r.memoizedState?(is(s),on(s),fC(s,y)):(on(s),s.flags&=-16777217):(r=r.memoizedProps,r!==f&&is(s),on(s),rg(s,x,r,f,c)),null;case 27:if(ke(s),c=Z.current,x=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==f&&is(s);else{if(!f){if(s.stateNode===null)throw Error(a(166));return on(s),null}r=oe.current,jo(s)?$1(s):(r=yN(x,f,c),s.stateNode=r,is(s))}return on(s),null;case 5:if(ke(s),x=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==f&&is(s);else{if(!f){if(s.stateNode===null)throw Error(a(166));return on(s),null}if(y=oe.current,jo(s))$1(s);else{var E=gf(Z.current);switch(y){case 1:y=E.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:y=E.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":y=E.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":y=E.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":y=E.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof f.is=="string"?E.createElement("select",{is:f.is}):E.createElement("select"),f.multiple?y.multiple=!0:f.size&&(y.size=f.size);break;default:y=typeof f.is=="string"?E.createElement(x,{is:f.is}):E.createElement(x)}}y[Rt]=s,y[it]=f;e:for(E=s.child;E!==null;){if(E.tag===5||E.tag===6)y.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===s)break e;for(;E.sibling===null;){if(E.return===null||E.return===s)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}s.stateNode=y;e:switch(zn(y,x,f),x){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&is(s)}}return on(s),rg(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,c),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==f&&is(s);else{if(typeof f!="string"&&s.stateNode===null)throw Error(a(166));if(r=Z.current,jo(s)){if(r=s.stateNode,c=s.memoizedProps,f=null,x=Ln,x!==null)switch(x.tag){case 27:case 5:f=x.memoizedProps}r[Rt]=s,r=!!(r.nodeValue===c||f!==null&&f.suppressHydrationWarning===!0||lN(r.nodeValue,c)),r||Us(s,!0)}else r=gf(r).createTextNode(f),r[Rt]=s,s.stateNode=r}return on(s),null;case 31:if(c=s.memoizedState,r===null||r.memoizedState!==null){if(f=jo(s),c!==null){if(r===null){if(!f)throw Error(a(318));if(r=s.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(557));r[Rt]=s}else ki(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;on(s),r=!1}else c=hm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return s.flags&256?(Cr(s),s):(Cr(s),null);if((s.flags&128)!==0)throw Error(a(558))}return on(s),null;case 13:if(f=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(x=jo(s),f!==null&&f.dehydrated!==null){if(r===null){if(!x)throw Error(a(318));if(x=s.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(a(317));x[Rt]=s}else ki(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;on(s),x=!1}else x=hm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=x),x=!0;if(!x)return s.flags&256?(Cr(s),s):(Cr(s),null)}return Cr(s),(s.flags&128)!==0?(s.lanes=c,s):(c=f!==null,r=r!==null&&r.memoizedState!==null,c&&(f=s.child,x=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(x=f.alternate.memoizedState.cachePool.pool),y=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(y=f.memoizedState.cachePool.pool),y!==x&&(f.flags|=2048)),c!==r&&c&&(s.child.flags|=8192),ef(s,s.updateQueue),on(s),null);case 4:return Ee(),r===null&&Ng(s.stateNode.containerInfo),on(s),null;case 10:return ns(s.type),on(s),null;case 19:if(G(yn),f=s.memoizedState,f===null)return on(s),null;if(x=(s.flags&128)!==0,y=f.rendering,y===null)if(x)Dc(f,!1);else{if(gn!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(y=Hd(r),y!==null){for(s.flags|=128,Dc(f,!1),r=y.updateQueue,s.updateQueue=r,ef(s,r),s.subtreeFlags=0,r=c,c=s.child;c!==null;)F1(c,r),c=c.sibling;return X(yn,yn.current&1|2),Ft&&es(s,f.treeForkCount),s.child}r=r.sibling}f.tail!==null&&Ct()>sf&&(s.flags|=128,x=!0,Dc(f,!1),s.lanes=4194304)}else{if(!x)if(r=Hd(y),r!==null){if(s.flags|=128,x=!0,r=r.updateQueue,s.updateQueue=r,ef(s,r),Dc(f,!0),f.tail===null&&f.tailMode==="hidden"&&!y.alternate&&!Ft)return on(s),null}else 2*Ct()-f.renderingStartTime>sf&&c!==536870912&&(s.flags|=128,x=!0,Dc(f,!1),s.lanes=4194304);f.isBackwards?(y.sibling=s.child,s.child=y):(r=f.last,r!==null?r.sibling=y:s.child=y,f.last=y)}return f.tail!==null?(r=f.tail,f.rendering=r,f.tail=r.sibling,f.renderingStartTime=Ct(),r.sibling=null,c=yn.current,X(yn,x?c&1|2:c&1),Ft&&es(s,f.treeForkCount),r):(on(s),null);case 22:case 23:return Cr(s),_m(),f=s.memoizedState!==null,r!==null?r.memoizedState!==null!==f&&(s.flags|=8192):f&&(s.flags|=8192),f?(c&536870912)!==0&&(s.flags&128)===0&&(on(s),s.subtreeFlags&6&&(s.flags|=8192)):on(s),c=s.updateQueue,c!==null&&ef(s,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),f=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(f=s.memoizedState.cachePool.pool),f!==c&&(s.flags|=2048),r!==null&&G(Ii),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),ns(wn),on(s),null;case 25:return null;case 30:return null}throw Error(a(156,s.tag))}function oB(r,s){switch(dm(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return ns(wn),Ee(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return ke(s),null;case 31:if(s.memoizedState!==null){if(Cr(s),s.alternate===null)throw Error(a(340));ki()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 13:if(Cr(s),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(a(340));ki()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return G(yn),null;case 4:return Ee(),null;case 10:return ns(s.type),null;case 22:case 23:return Cr(s),_m(),r!==null&&G(Ii),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return ns(wn),null;case 25:return null;default:return null}}function hC(r,s){switch(dm(s),s.tag){case 3:ns(wn),Ee();break;case 26:case 27:case 5:ke(s);break;case 4:Ee();break;case 31:s.memoizedState!==null&&Cr(s);break;case 13:Cr(s);break;case 19:G(yn);break;case 10:ns(s.type);break;case 22:case 23:Cr(s),_m(),r!==null&&G(Ii);break;case 24:ns(wn)}}function Pc(r,s){try{var c=s.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var x=f.next;c=x;do{if((c.tag&r)===r){f=void 0;var y=c.create,E=c.inst;f=y(),E.destroy=f}c=c.next}while(c!==x)}}catch(O){Qt(s,s.return,O)}}function Ws(r,s,c){try{var f=s.updateQueue,x=f!==null?f.lastEffect:null;if(x!==null){var y=x.next;f=y;do{if((f.tag&r)===r){var E=f.inst,O=E.destroy;if(O!==void 0){E.destroy=void 0,x=s;var F=c,ae=O;try{ae()}catch(pe){Qt(x,F,pe)}}}f=f.next}while(f!==y)}}catch(pe){Qt(s,s.return,pe)}}function pC(r){var s=r.updateQueue;if(s!==null){var c=r.stateNode;try{aj(s,c)}catch(f){Qt(r,r.return,f)}}}function mC(r,s,c){c.props=Vi(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(f){Qt(r,s,f)}}function kc(r,s){try{var c=r.ref;if(c!==null){switch(r.tag){case 26:case 27:case 5:var f=r.stateNode;break;case 30:f=r.stateNode;break;default:f=r.stateNode}typeof c=="function"?r.refCleanup=c(f):c.current=f}}catch(x){Qt(r,s,x)}}function Ra(r,s){var c=r.ref,f=r.refCleanup;if(c!==null)if(typeof f=="function")try{f()}catch(x){Qt(r,s,x)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(x){Qt(r,s,x)}else c.current=null}function gC(r){var s=r.type,c=r.memoizedProps,f=r.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":c.autoFocus&&f.focus();break e;case"img":c.src?f.src=c.src:c.srcSet&&(f.srcset=c.srcSet)}}catch(x){Qt(r,r.return,x)}}function ag(r,s,c){try{var f=r.stateNode;RB(f,r.type,c,s),f[it]=s}catch(x){Qt(r,r.return,x)}}function vC(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&ni(r.type)||r.tag===4}function sg(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||vC(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&ni(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function ig(r,s,c){var f=r.tag;if(f===5||f===6)r=r.stateNode,s?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(r,s):(s=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,s.appendChild(r),c=c._reactRootContainer,c!=null||s.onclick!==null||(s.onclick=Lt));else if(f!==4&&(f===27&&ni(r.type)&&(c=r.stateNode,s=null),r=r.child,r!==null))for(ig(r,s,c),r=r.sibling;r!==null;)ig(r,s,c),r=r.sibling}function tf(r,s,c){var f=r.tag;if(f===5||f===6)r=r.stateNode,s?c.insertBefore(r,s):c.appendChild(r);else if(f!==4&&(f===27&&ni(r.type)&&(c=r.stateNode),r=r.child,r!==null))for(tf(r,s,c),r=r.sibling;r!==null;)tf(r,s,c),r=r.sibling}function xC(r){var s=r.stateNode,c=r.memoizedProps;try{for(var f=r.type,x=s.attributes;x.length;)s.removeAttributeNode(x[0]);zn(s,f,c),s[Rt]=r,s[it]=c}catch(y){Qt(r,r.return,y)}}var os=!1,Cn=!1,og=!1,yC=typeof WeakSet=="function"?WeakSet:Set,Dn=null;function lB(r,s){if(r=r.containerInfo,Tg=jf,r=O1(r),em(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var f=c.getSelection&&c.getSelection();if(f&&f.rangeCount!==0){c=f.anchorNode;var x=f.anchorOffset,y=f.focusNode;f=f.focusOffset;try{c.nodeType,y.nodeType}catch{c=null;break e}var E=0,O=-1,F=-1,ae=0,pe=0,ye=r,ie=null;t:for(;;){for(var ce;ye!==c||x!==0&&ye.nodeType!==3||(O=E+x),ye!==y||f!==0&&ye.nodeType!==3||(F=E+f),ye.nodeType===3&&(E+=ye.nodeValue.length),(ce=ye.firstChild)!==null;)ie=ye,ye=ce;for(;;){if(ye===r)break t;if(ie===c&&++ae===x&&(O=E),ie===y&&++pe===f&&(F=E),(ce=ye.nextSibling)!==null)break;ye=ie,ie=ye.parentNode}ye=ce}c=O===-1||F===-1?null:{start:O,end:F}}else c=null}c=c||{start:0,end:0}}else c=null;for(Rg={focusedElem:r,selectionRange:c},jf=!1,Dn=s;Dn!==null;)if(s=Dn,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,Dn=r;else for(;Dn!==null;){switch(s=Dn,y=s.alternate,r=s.flags,s.tag){case 0:if((r&4)!==0&&(r=s.updateQueue,r=r!==null?r.events:null,r!==null))for(c=0;c<r.length;c++)x=r[c],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&y!==null){r=void 0,c=s,x=y.memoizedProps,y=y.memoizedState,f=c.stateNode;try{var Ve=Vi(c.type,x);r=f.getSnapshotBeforeUpdate(Ve,y),f.__reactInternalSnapshotBeforeUpdate=r}catch(rt){Qt(c,c.return,rt)}}break;case 3:if((r&1024)!==0){if(r=s.stateNode.containerInfo,c=r.nodeType,c===9)Mg(r);else if(c===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Mg(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(a(163))}if(r=s.sibling,r!==null){r.return=s.return,Dn=r;break}Dn=s.return}}function bC(r,s,c){var f=c.flags;switch(c.tag){case 0:case 11:case 15:cs(r,c),f&4&&Pc(5,c);break;case 1:if(cs(r,c),f&4)if(r=c.stateNode,s===null)try{r.componentDidMount()}catch(E){Qt(c,c.return,E)}else{var x=Vi(c.type,s.memoizedProps);s=s.memoizedState;try{r.componentDidUpdate(x,s,r.__reactInternalSnapshotBeforeUpdate)}catch(E){Qt(c,c.return,E)}}f&64&&pC(c),f&512&&kc(c,c.return);break;case 3:if(cs(r,c),f&64&&(r=c.updateQueue,r!==null)){if(s=null,c.child!==null)switch(c.child.tag){case 27:case 5:s=c.child.stateNode;break;case 1:s=c.child.stateNode}try{aj(r,s)}catch(E){Qt(c,c.return,E)}}break;case 27:s===null&&f&4&&xC(c);case 26:case 5:cs(r,c),s===null&&f&4&&gC(c),f&512&&kc(c,c.return);break;case 12:cs(r,c);break;case 31:cs(r,c),f&4&&jC(r,c);break;case 13:cs(r,c),f&4&&CC(r,c),f&64&&(r=c.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(c=vB.bind(null,c),BB(r,c))));break;case 22:if(f=c.memoizedState!==null||os,!f){s=s!==null&&s.memoizedState!==null||Cn,x=os;var y=Cn;os=f,(Cn=s)&&!y?us(r,c,(c.subtreeFlags&8772)!==0):cs(r,c),os=x,Cn=y}break;case 30:break;default:cs(r,c)}}function wC(r){var s=r.alternate;s!==null&&(r.alternate=null,wC(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&Jl(s)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var cn=null,ur=!1;function ls(r,s,c){for(c=c.child;c!==null;)SC(r,s,c),c=c.sibling}function SC(r,s,c){if(xt&&typeof xt.onCommitFiberUnmount=="function")try{xt.onCommitFiberUnmount(gt,c)}catch{}switch(c.tag){case 26:Cn||Ra(c,s),ls(r,s,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:Cn||Ra(c,s);var f=cn,x=ur;ni(c.type)&&(cn=c.stateNode,ur=!1),ls(r,s,c),qc(c.stateNode),cn=f,ur=x;break;case 5:Cn||Ra(c,s);case 6:if(f=cn,x=ur,cn=null,ls(r,s,c),cn=f,ur=x,cn!==null)if(ur)try{(cn.nodeType===9?cn.body:cn.nodeName==="HTML"?cn.ownerDocument.body:cn).removeChild(c.stateNode)}catch(y){Qt(c,s,y)}else try{cn.removeChild(c.stateNode)}catch(y){Qt(c,s,y)}break;case 18:cn!==null&&(ur?(r=cn,pN(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,c.stateNode),qo(r)):pN(cn,c.stateNode));break;case 4:f=cn,x=ur,cn=c.stateNode.containerInfo,ur=!0,ls(r,s,c),cn=f,ur=x;break;case 0:case 11:case 14:case 15:Ws(2,c,s),Cn||Ws(4,c,s),ls(r,s,c);break;case 1:Cn||(Ra(c,s),f=c.stateNode,typeof f.componentWillUnmount=="function"&&mC(c,s,f)),ls(r,s,c);break;case 21:ls(r,s,c);break;case 22:Cn=(f=Cn)||c.memoizedState!==null,ls(r,s,c),Cn=f;break;default:ls(r,s,c)}}function jC(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{qo(r)}catch(c){Qt(s,s.return,c)}}}function CC(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{qo(r)}catch(c){Qt(s,s.return,c)}}function cB(r){switch(r.tag){case 31:case 13:case 19:var s=r.stateNode;return s===null&&(s=r.stateNode=new yC),s;case 22:return r=r.stateNode,s=r._retryCache,s===null&&(s=r._retryCache=new yC),s;default:throw Error(a(435,r.tag))}}function nf(r,s){var c=cB(r);s.forEach(function(f){if(!c.has(f)){c.add(f);var x=xB.bind(null,r,f);f.then(x,x)}})}function dr(r,s){var c=s.deletions;if(c!==null)for(var f=0;f<c.length;f++){var x=c[f],y=r,E=s,O=E;e:for(;O!==null;){switch(O.tag){case 27:if(ni(O.type)){cn=O.stateNode,ur=!1;break e}break;case 5:cn=O.stateNode,ur=!1;break e;case 3:case 4:cn=O.stateNode.containerInfo,ur=!0;break e}O=O.return}if(cn===null)throw Error(a(160));SC(y,E,x),cn=null,ur=!1,y=x.alternate,y!==null&&(y.return=null),x.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)NC(s,r),s=s.sibling}var ra=null;function NC(r,s){var c=r.alternate,f=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:dr(s,r),fr(r),f&4&&(Ws(3,r,r.return),Pc(3,r),Ws(5,r,r.return));break;case 1:dr(s,r),fr(r),f&512&&(Cn||c===null||Ra(c,c.return)),f&64&&os&&(r=r.updateQueue,r!==null&&(f=r.callbacks,f!==null&&(c=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=c===null?f:c.concat(f))));break;case 26:var x=ra;if(dr(s,r),fr(r),f&512&&(Cn||c===null||Ra(c,c.return)),f&4){var y=c!==null?c.memoizedState:null;if(f=r.memoizedState,c===null)if(f===null)if(r.stateNode===null){e:{f=r.type,c=r.memoizedProps,x=x.ownerDocument||x;t:switch(f){case"title":y=x.getElementsByTagName("title")[0],(!y||y[Ka]||y[Rt]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=x.createElement(f),x.head.insertBefore(y,x.querySelector("head > title"))),zn(y,f,c),y[Rt]=r,xn(y),f=y;break e;case"link":var E=NN("link","href",x).get(f+(c.href||""));if(E){for(var O=0;O<E.length;O++)if(y=E[O],y.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&y.getAttribute("rel")===(c.rel==null?null:c.rel)&&y.getAttribute("title")===(c.title==null?null:c.title)&&y.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){E.splice(O,1);break t}}y=x.createElement(f),zn(y,f,c),x.head.appendChild(y);break;case"meta":if(E=NN("meta","content",x).get(f+(c.content||""))){for(O=0;O<E.length;O++)if(y=E[O],y.getAttribute("content")===(c.content==null?null:""+c.content)&&y.getAttribute("name")===(c.name==null?null:c.name)&&y.getAttribute("property")===(c.property==null?null:c.property)&&y.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&y.getAttribute("charset")===(c.charSet==null?null:c.charSet)){E.splice(O,1);break t}}y=x.createElement(f),zn(y,f,c),x.head.appendChild(y);break;default:throw Error(a(468,f))}y[Rt]=r,xn(y),f=y}r.stateNode=f}else _N(x,r.type,r.stateNode);else r.stateNode=CN(x,f,r.memoizedProps);else y!==f?(y===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):y.count--,f===null?_N(x,r.type,r.stateNode):CN(x,f,r.memoizedProps)):f===null&&r.stateNode!==null&&ag(r,r.memoizedProps,c.memoizedProps)}break;case 27:dr(s,r),fr(r),f&512&&(Cn||c===null||Ra(c,c.return)),c!==null&&f&4&&ag(r,r.memoizedProps,c.memoizedProps);break;case 5:if(dr(s,r),fr(r),f&512&&(Cn||c===null||Ra(c,c.return)),r.flags&32){x=r.stateNode;try{_a(x,"")}catch(Ve){Qt(r,r.return,Ve)}}f&4&&r.stateNode!=null&&(x=r.memoizedProps,ag(r,x,c!==null?c.memoizedProps:x)),f&1024&&(og=!0);break;case 6:if(dr(s,r),fr(r),f&4){if(r.stateNode===null)throw Error(a(162));f=r.memoizedProps,c=r.stateNode;try{c.nodeValue=f}catch(Ve){Qt(r,r.return,Ve)}}break;case 3:if(yf=null,x=ra,ra=vf(s.containerInfo),dr(s,r),ra=x,fr(r),f&4&&c!==null&&c.memoizedState.isDehydrated)try{qo(s.containerInfo)}catch(Ve){Qt(r,r.return,Ve)}og&&(og=!1,_C(r));break;case 4:f=ra,ra=vf(r.stateNode.containerInfo),dr(s,r),fr(r),ra=f;break;case 12:dr(s,r),fr(r);break;case 31:dr(s,r),fr(r),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,nf(r,f)));break;case 13:dr(s,r),fr(r),r.child.flags&8192&&r.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(af=Ct()),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,nf(r,f)));break;case 22:x=r.memoizedState!==null;var F=c!==null&&c.memoizedState!==null,ae=os,pe=Cn;if(os=ae||x,Cn=pe||F,dr(s,r),Cn=pe,os=ae,fr(r),f&8192)e:for(s=r.stateNode,s._visibility=x?s._visibility&-2:s._visibility|1,x&&(c===null||F||os||Cn||qi(r)),c=null,s=r;;){if(s.tag===5||s.tag===26){if(c===null){F=c=s;try{if(y=F.stateNode,x)E=y.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{O=F.stateNode;var ye=F.memoizedProps.style,ie=ye!=null&&ye.hasOwnProperty("display")?ye.display:null;O.style.display=ie==null||typeof ie=="boolean"?"":(""+ie).trim()}}catch(Ve){Qt(F,F.return,Ve)}}}else if(s.tag===6){if(c===null){F=s;try{F.stateNode.nodeValue=x?"":F.memoizedProps}catch(Ve){Qt(F,F.return,Ve)}}}else if(s.tag===18){if(c===null){F=s;try{var ce=F.stateNode;x?mN(ce,!0):mN(F.stateNode,!1)}catch(Ve){Qt(F,F.return,Ve)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===r)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;c===s&&(c=null),s=s.return}c===s&&(c=null),s.sibling.return=s.return,s=s.sibling}f&4&&(f=r.updateQueue,f!==null&&(c=f.retryQueue,c!==null&&(f.retryQueue=null,nf(r,c))));break;case 19:dr(s,r),fr(r),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,nf(r,f)));break;case 30:break;case 21:break;default:dr(s,r),fr(r)}}function fr(r){var s=r.flags;if(s&2){try{for(var c,f=r.return;f!==null;){if(vC(f)){c=f;break}f=f.return}if(c==null)throw Error(a(160));switch(c.tag){case 27:var x=c.stateNode,y=sg(r);tf(r,y,x);break;case 5:var E=c.stateNode;c.flags&32&&(_a(E,""),c.flags&=-33);var O=sg(r);tf(r,O,E);break;case 3:case 4:var F=c.stateNode.containerInfo,ae=sg(r);ig(r,ae,F);break;default:throw Error(a(161))}}catch(pe){Qt(r,r.return,pe)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function _C(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var s=r;_C(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),r=r.sibling}}function cs(r,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)bC(r,s.alternate,s),s=s.sibling}function qi(r){for(r=r.child;r!==null;){var s=r;switch(s.tag){case 0:case 11:case 14:case 15:Ws(4,s,s.return),qi(s);break;case 1:Ra(s,s.return);var c=s.stateNode;typeof c.componentWillUnmount=="function"&&mC(s,s.return,c),qi(s);break;case 27:qc(s.stateNode);case 26:case 5:Ra(s,s.return),qi(s);break;case 22:s.memoizedState===null&&qi(s);break;case 30:qi(s);break;default:qi(s)}r=r.sibling}}function us(r,s,c){for(c=c&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var f=s.alternate,x=r,y=s,E=y.flags;switch(y.tag){case 0:case 11:case 15:us(x,y,c),Pc(4,y);break;case 1:if(us(x,y,c),f=y,x=f.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(ae){Qt(f,f.return,ae)}if(f=y,x=f.updateQueue,x!==null){var O=f.stateNode;try{var F=x.shared.hiddenCallbacks;if(F!==null)for(x.shared.hiddenCallbacks=null,x=0;x<F.length;x++)rj(F[x],O)}catch(ae){Qt(f,f.return,ae)}}c&&E&64&&pC(y),kc(y,y.return);break;case 27:xC(y);case 26:case 5:us(x,y,c),c&&f===null&&E&4&&gC(y),kc(y,y.return);break;case 12:us(x,y,c);break;case 31:us(x,y,c),c&&E&4&&jC(x,y);break;case 13:us(x,y,c),c&&E&4&&CC(x,y);break;case 22:y.memoizedState===null&&us(x,y,c),kc(y,y.return);break;case 30:break;default:us(x,y,c)}s=s.sibling}}function lg(r,s){var c=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),r=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(r=s.memoizedState.cachePool.pool),r!==c&&(r!=null&&r.refCount++,c!=null&&wc(c))}function cg(r,s){r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&wc(r))}function aa(r,s,c,f){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)EC(r,s,c,f),s=s.sibling}function EC(r,s,c,f){var x=s.flags;switch(s.tag){case 0:case 11:case 15:aa(r,s,c,f),x&2048&&Pc(9,s);break;case 1:aa(r,s,c,f);break;case 3:aa(r,s,c,f),x&2048&&(r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&wc(r)));break;case 12:if(x&2048){aa(r,s,c,f),r=s.stateNode;try{var y=s.memoizedProps,E=y.id,O=y.onPostCommit;typeof O=="function"&&O(E,s.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(F){Qt(s,s.return,F)}}else aa(r,s,c,f);break;case 31:aa(r,s,c,f);break;case 13:aa(r,s,c,f);break;case 23:break;case 22:y=s.stateNode,E=s.alternate,s.memoizedState!==null?y._visibility&2?aa(r,s,c,f):Lc(r,s):y._visibility&2?aa(r,s,c,f):(y._visibility|=2,Do(r,s,c,f,(s.subtreeFlags&10256)!==0||!1)),x&2048&&lg(E,s);break;case 24:aa(r,s,c,f),x&2048&&cg(s.alternate,s);break;default:aa(r,s,c,f)}}function Do(r,s,c,f,x){for(x=x&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var y=r,E=s,O=c,F=f,ae=E.flags;switch(E.tag){case 0:case 11:case 15:Do(y,E,O,F,x),Pc(8,E);break;case 23:break;case 22:var pe=E.stateNode;E.memoizedState!==null?pe._visibility&2?Do(y,E,O,F,x):Lc(y,E):(pe._visibility|=2,Do(y,E,O,F,x)),x&&ae&2048&&lg(E.alternate,E);break;case 24:Do(y,E,O,F,x),x&&ae&2048&&cg(E.alternate,E);break;default:Do(y,E,O,F,x)}s=s.sibling}}function Lc(r,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var c=r,f=s,x=f.flags;switch(f.tag){case 22:Lc(c,f),x&2048&&lg(f.alternate,f);break;case 24:Lc(c,f),x&2048&&cg(f.alternate,f);break;default:Lc(c,f)}s=s.sibling}}var Bc=8192;function Po(r,s,c){if(r.subtreeFlags&Bc)for(r=r.child;r!==null;)TC(r,s,c),r=r.sibling}function TC(r,s,c){switch(r.tag){case 26:Po(r,s,c),r.flags&Bc&&r.memoizedState!==null&&WB(c,ra,r.memoizedState,r.memoizedProps);break;case 5:Po(r,s,c);break;case 3:case 4:var f=ra;ra=vf(r.stateNode.containerInfo),Po(r,s,c),ra=f;break;case 22:r.memoizedState===null&&(f=r.alternate,f!==null&&f.memoizedState!==null?(f=Bc,Bc=16777216,Po(r,s,c),Bc=f):Po(r,s,c));break;default:Po(r,s,c)}}function RC(r){var s=r.alternate;if(s!==null&&(r=s.child,r!==null)){s.child=null;do s=r.sibling,r.sibling=null,r=s;while(r!==null)}}function Ic(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var c=0;c<s.length;c++){var f=s[c];Dn=f,OC(f,r)}RC(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)AC(r),r=r.sibling}function AC(r){switch(r.tag){case 0:case 11:case 15:Ic(r),r.flags&2048&&Ws(9,r,r.return);break;case 3:Ic(r);break;case 12:Ic(r);break;case 22:var s=r.stateNode;r.memoizedState!==null&&s._visibility&2&&(r.return===null||r.return.tag!==13)?(s._visibility&=-3,rf(r)):Ic(r);break;default:Ic(r)}}function rf(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var c=0;c<s.length;c++){var f=s[c];Dn=f,OC(f,r)}RC(r)}for(r=r.child;r!==null;){switch(s=r,s.tag){case 0:case 11:case 15:Ws(8,s,s.return),rf(s);break;case 22:c=s.stateNode,c._visibility&2&&(c._visibility&=-3,rf(s));break;default:rf(s)}r=r.sibling}}function OC(r,s){for(;Dn!==null;){var c=Dn;switch(c.tag){case 0:case 11:case 15:Ws(8,c,s);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var f=c.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:wc(c.memoizedState.cache)}if(f=c.child,f!==null)f.return=c,Dn=f;else e:for(c=r;Dn!==null;){f=Dn;var x=f.sibling,y=f.return;if(wC(f),f===c){Dn=null;break e}if(x!==null){x.return=y,Dn=x;break e}Dn=y}}}var uB={getCacheForType:function(r){var s=Bn(wn),c=s.data.get(r);return c===void 0&&(c=r(),s.data.set(r,c)),c},cacheSignal:function(){return Bn(wn).controller.signal}},dB=typeof WeakMap=="function"?WeakMap:Map,Yt=0,nn=null,Pt=null,Bt=0,Xt=0,Nr=null,Xs=!1,ko=!1,ug=!1,ds=0,gn=0,Qs=0,$i=0,dg=0,_r=0,Lo=0,zc=null,hr=null,fg=!1,af=0,MC=0,sf=1/0,of=null,Zs=null,En=0,Js=null,Bo=null,fs=0,hg=0,pg=null,DC=null,Fc=0,mg=null;function Er(){return(Yt&2)!==0&&Bt!==0?Bt&-Bt:I.T!==null?wg():Ue()}function PC(){if(_r===0)if((Bt&536870912)===0||Ft){var r=Ze;Ze<<=1,(Ze&3932160)===0&&(Ze=262144),_r=r}else _r=536870912;return r=jr.current,r!==null&&(r.flags|=32),_r}function pr(r,s,c){(r===nn&&(Xt===2||Xt===9)||r.cancelPendingCommit!==null)&&(Io(r,0),ei(r,Bt,_r,!1)),ge(r,c),((Yt&2)===0||r!==nn)&&(r===nn&&((Yt&2)===0&&($i|=c),gn===4&&ei(r,Bt,_r,!1)),Aa(r))}function kC(r,s,c){if((Yt&6)!==0)throw Error(a(327));var f=!c&&(s&127)===0&&(s&r.expiredLanes)===0||Se(r,s),x=f?pB(r,s):vg(r,s,!0),y=f;do{if(x===0){ko&&!f&&ei(r,s,0,!1);break}else{if(c=r.current.alternate,y&&!fB(c)){x=vg(r,s,!1),y=!1;continue}if(x===2){if(y=s,r.errorRecoveryDisabledLanes&y)var E=0;else E=r.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){s=E;e:{var O=r;x=zc;var F=O.current.memoizedState.isDehydrated;if(F&&(Io(O,E).flags|=256),E=vg(O,E,!1),E!==2){if(ug&&!F){O.errorRecoveryDisabledLanes|=y,$i|=y,x=4;break e}y=hr,hr=x,y!==null&&(hr===null?hr=y:hr.push.apply(hr,y))}x=E}if(y=!1,x!==2)continue}}if(x===1){Io(r,0),ei(r,s,0,!0);break}e:{switch(f=r,y=x,y){case 0:case 1:throw Error(a(345));case 4:if((s&4194048)!==s)break;case 6:ei(f,s,_r,!Xs);break e;case 2:hr=null;break;case 3:case 5:break;default:throw Error(a(329))}if((s&62914560)===s&&(x=af+300-Ct(),10<x)){if(ei(f,s,_r,!Xs),z(f,0,!0)!==0)break e;fs=s,f.timeoutHandle=fN(LC.bind(null,f,c,hr,of,fg,s,_r,$i,Lo,Xs,y,"Throttled",-0,0),x);break e}LC(f,c,hr,of,fg,s,_r,$i,Lo,Xs,y,null,-0,0)}}break}while(!0);Aa(r)}function LC(r,s,c,f,x,y,E,O,F,ae,pe,ye,ie,ce){if(r.timeoutHandle=-1,ye=s.subtreeFlags,ye&8192||(ye&16785408)===16785408){ye={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Lt},TC(s,y,ye);var Ve=(y&62914560)===y?af-Ct():(y&4194048)===y?MC-Ct():0;if(Ve=XB(ye,Ve),Ve!==null){fs=y,r.cancelPendingCommit=Ve(qC.bind(null,r,s,y,c,f,x,E,O,F,pe,ye,null,ie,ce)),ei(r,y,E,!ae);return}}qC(r,s,y,c,f,x,E,O,F)}function fB(r){for(var s=r;;){var c=s.tag;if((c===0||c===11||c===15)&&s.flags&16384&&(c=s.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var f=0;f<c.length;f++){var x=c[f],y=x.getSnapshot;x=x.value;try{if(!wr(y(),x))return!1}catch{return!1}}if(c=s.child,s.subtreeFlags&16384&&c!==null)c.return=s,s=c;else{if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ei(r,s,c,f){s&=~dg,s&=~$i,r.suspendedLanes|=s,r.pingedLanes&=~s,f&&(r.warmLanes|=s),f=r.expirationTimes;for(var x=s;0<x;){var y=31-ue(x),E=1<<y;f[y]=-1,x&=~E}c!==0&&mt(r,c,s)}function lf(){return(Yt&6)===0?(Hc(0),!1):!0}function gg(){if(Pt!==null){if(Xt===0)var r=Pt.return;else r=Pt,ts=Li=null,Mm(r),To=null,jc=0,r=Pt;for(;r!==null;)hC(r.alternate,r),r=r.return;Pt=null}}function Io(r,s){var c=r.timeoutHandle;c!==-1&&(r.timeoutHandle=-1,MB(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),fs=0,gg(),nn=r,Pt=c=Ja(r.current,null),Bt=s,Xt=0,Nr=null,Xs=!1,ko=Se(r,s),ug=!1,Lo=_r=dg=$i=Qs=gn=0,hr=zc=null,fg=!1,(s&8)!==0&&(s|=s&32);var f=r.entangledLanes;if(f!==0)for(r=r.entanglements,f&=s;0<f;){var x=31-ue(f),y=1<<x;s|=r[x],f&=~y}return ds=s,Td(),c}function BC(r,s){bt=null,I.H=Oc,s===Eo||s===Ld?(s=J1(),Xt=3):s===bm?(s=J1(),Xt=4):Xt=s===Ym?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Nr=s,Pt===null&&(gn=1,Xd(r,Ir(s,r.current)))}function IC(){var r=jr.current;return r===null?!0:(Bt&4194048)===Bt?Ur===null:(Bt&62914560)===Bt||(Bt&536870912)!==0?r===Ur:!1}function zC(){var r=I.H;return I.H=Oc,r===null?Oc:r}function FC(){var r=I.A;return I.A=uB,r}function cf(){gn=4,Xs||(Bt&4194048)!==Bt&&jr.current!==null||(ko=!0),(Qs&134217727)===0&&($i&134217727)===0||nn===null||ei(nn,Bt,_r,!1)}function vg(r,s,c){var f=Yt;Yt|=2;var x=zC(),y=FC();(nn!==r||Bt!==s)&&(of=null,Io(r,s)),s=!1;var E=gn;e:do try{if(Xt!==0&&Pt!==null){var O=Pt,F=Nr;switch(Xt){case 8:gg(),E=6;break e;case 3:case 2:case 9:case 6:jr.current===null&&(s=!0);var ae=Xt;if(Xt=0,Nr=null,zo(r,O,F,ae),c&&ko){E=0;break e}break;default:ae=Xt,Xt=0,Nr=null,zo(r,O,F,ae)}}hB(),E=gn;break}catch(pe){BC(r,pe)}while(!0);return s&&r.shellSuspendCounter++,ts=Li=null,Yt=f,I.H=x,I.A=y,Pt===null&&(nn=null,Bt=0,Td()),E}function hB(){for(;Pt!==null;)HC(Pt)}function pB(r,s){var c=Yt;Yt|=2;var f=zC(),x=FC();nn!==r||Bt!==s?(of=null,sf=Ct()+500,Io(r,s)):ko=Se(r,s);e:do try{if(Xt!==0&&Pt!==null){s=Pt;var y=Nr;t:switch(Xt){case 1:Xt=0,Nr=null,zo(r,s,y,1);break;case 2:case 9:if(Q1(y)){Xt=0,Nr=null,UC(s);break}s=function(){Xt!==2&&Xt!==9||nn!==r||(Xt=7),Aa(r)},y.then(s,s);break e;case 3:Xt=7;break e;case 4:Xt=5;break e;case 7:Q1(y)?(Xt=0,Nr=null,UC(s)):(Xt=0,Nr=null,zo(r,s,y,7));break;case 5:var E=null;switch(Pt.tag){case 26:E=Pt.memoizedState;case 5:case 27:var O=Pt;if(E?EN(E):O.stateNode.complete){Xt=0,Nr=null;var F=O.sibling;if(F!==null)Pt=F;else{var ae=O.return;ae!==null?(Pt=ae,uf(ae)):Pt=null}break t}}Xt=0,Nr=null,zo(r,s,y,5);break;case 6:Xt=0,Nr=null,zo(r,s,y,6);break;case 8:gg(),gn=6;break e;default:throw Error(a(462))}}mB();break}catch(pe){BC(r,pe)}while(!0);return ts=Li=null,I.H=f,I.A=x,Yt=c,Pt!==null?0:(nn=null,Bt=0,Td(),gn)}function mB(){for(;Pt!==null&&!ot();)HC(Pt)}function HC(r){var s=dC(r.alternate,r,ds);r.memoizedProps=r.pendingProps,s===null?uf(r):Pt=s}function UC(r){var s=r,c=s.alternate;switch(s.tag){case 15:case 0:s=sC(c,s,s.pendingProps,s.type,void 0,Bt);break;case 11:s=sC(c,s,s.pendingProps,s.type.render,s.ref,Bt);break;case 5:Mm(s);default:hC(c,s),s=Pt=F1(s,ds),s=dC(c,s,ds)}r.memoizedProps=r.pendingProps,s===null?uf(r):Pt=s}function zo(r,s,c,f){ts=Li=null,Mm(s),To=null,jc=0;var x=s.return;try{if(rB(r,x,s,c,Bt)){gn=1,Xd(r,Ir(c,r.current)),Pt=null;return}}catch(y){if(x!==null)throw Pt=x,y;gn=1,Xd(r,Ir(c,r.current)),Pt=null;return}s.flags&32768?(Ft||f===1?r=!0:ko||(Bt&536870912)!==0?r=!1:(Xs=r=!0,(f===2||f===9||f===3||f===6)&&(f=jr.current,f!==null&&f.tag===13&&(f.flags|=16384))),VC(s,r)):uf(s)}function uf(r){var s=r;do{if((s.flags&32768)!==0){VC(s,Xs);return}r=s.return;var c=iB(s.alternate,s,ds);if(c!==null){Pt=c;return}if(s=s.sibling,s!==null){Pt=s;return}Pt=s=r}while(s!==null);gn===0&&(gn=5)}function VC(r,s){do{var c=oB(r.alternate,r);if(c!==null){c.flags&=32767,Pt=c;return}if(c=r.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!s&&(r=r.sibling,r!==null)){Pt=r;return}Pt=r=c}while(r!==null);gn=6,Pt=null}function qC(r,s,c,f,x,y,E,O,F){r.cancelPendingCommit=null;do df();while(En!==0);if((Yt&6)!==0)throw Error(a(327));if(s!==null){if(s===r.current)throw Error(a(177));if(y=s.lanes|s.childLanes,y|=sm,Ne(r,c,y,E,O,F),r===nn&&(Pt=nn=null,Bt=0),Bo=s,Js=r,fs=c,hg=y,pg=x,DC=f,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,yB(te,function(){return WC(),null})):(r.callbackNode=null,r.callbackPriority=0),f=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||f){f=I.T,I.T=null,x=V.p,V.p=2,E=Yt,Yt|=4;try{lB(r,s,c)}finally{Yt=E,V.p=x,I.T=f}}En=1,$C(),GC(),KC()}}function $C(){if(En===1){En=0;var r=Js,s=Bo,c=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||c){c=I.T,I.T=null;var f=V.p;V.p=2;var x=Yt;Yt|=4;try{NC(s,r);var y=Rg,E=O1(r.containerInfo),O=y.focusedElem,F=y.selectionRange;if(E!==O&&O&&O.ownerDocument&&A1(O.ownerDocument.documentElement,O)){if(F!==null&&em(O)){var ae=F.start,pe=F.end;if(pe===void 0&&(pe=ae),"selectionStart"in O)O.selectionStart=ae,O.selectionEnd=Math.min(pe,O.value.length);else{var ye=O.ownerDocument||document,ie=ye&&ye.defaultView||window;if(ie.getSelection){var ce=ie.getSelection(),Ve=O.textContent.length,rt=Math.min(F.start,Ve),en=F.end===void 0?rt:Math.min(F.end,Ve);!ce.extend&&rt>en&&(E=en,en=rt,rt=E);var Q=R1(O,rt),q=R1(O,en);if(Q&&q&&(ce.rangeCount!==1||ce.anchorNode!==Q.node||ce.anchorOffset!==Q.offset||ce.focusNode!==q.node||ce.focusOffset!==q.offset)){var re=ye.createRange();re.setStart(Q.node,Q.offset),ce.removeAllRanges(),rt>en?(ce.addRange(re),ce.extend(q.node,q.offset)):(re.setEnd(q.node,q.offset),ce.addRange(re))}}}}for(ye=[],ce=O;ce=ce.parentNode;)ce.nodeType===1&&ye.push({element:ce,left:ce.scrollLeft,top:ce.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;O<ye.length;O++){var ve=ye[O];ve.element.scrollLeft=ve.left,ve.element.scrollTop=ve.top}}jf=!!Tg,Rg=Tg=null}finally{Yt=x,V.p=f,I.T=c}}r.current=s,En=2}}function GC(){if(En===2){En=0;var r=Js,s=Bo,c=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||c){c=I.T,I.T=null;var f=V.p;V.p=2;var x=Yt;Yt|=4;try{bC(r,s.alternate,s)}finally{Yt=x,V.p=f,I.T=c}}En=3}}function KC(){if(En===4||En===3){En=0,lt();var r=Js,s=Bo,c=fs,f=DC;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?En=5:(En=0,Bo=Js=null,YC(r,r.pendingLanes));var x=r.pendingLanes;if(x===0&&(Zs=null),Ie(c),s=s.stateNode,xt&&typeof xt.onCommitFiberRoot=="function")try{xt.onCommitFiberRoot(gt,s,void 0,(s.current.flags&128)===128)}catch{}if(f!==null){s=I.T,x=V.p,V.p=2,I.T=null;try{for(var y=r.onRecoverableError,E=0;E<f.length;E++){var O=f[E];y(O.value,{componentStack:O.stack})}}finally{I.T=s,V.p=x}}(fs&3)!==0&&df(),Aa(r),x=r.pendingLanes,(c&261930)!==0&&(x&42)!==0?r===mg?Fc++:(Fc=0,mg=r):Fc=0,Hc(0)}}function YC(r,s){(r.pooledCacheLanes&=s)===0&&(s=r.pooledCache,s!=null&&(r.pooledCache=null,wc(s)))}function df(){return $C(),GC(),KC(),WC()}function WC(){if(En!==5)return!1;var r=Js,s=hg;hg=0;var c=Ie(fs),f=I.T,x=V.p;try{V.p=32>c?32:c,I.T=null,c=pg,pg=null;var y=Js,E=fs;if(En=0,Bo=Js=null,fs=0,(Yt&6)!==0)throw Error(a(331));var O=Yt;if(Yt|=4,AC(y.current),EC(y,y.current,E,c),Yt=O,Hc(0,!1),xt&&typeof xt.onPostCommitFiberRoot=="function")try{xt.onPostCommitFiberRoot(gt,y)}catch{}return!0}finally{V.p=x,I.T=f,YC(r,s)}}function XC(r,s,c){s=Ir(c,s),s=Km(r.stateNode,s,2),r=Gs(r,s,2),r!==null&&(ge(r,2),Aa(r))}function Qt(r,s,c){if(r.tag===3)XC(r,r,c);else for(;s!==null;){if(s.tag===3){XC(s,r,c);break}else if(s.tag===1){var f=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Zs===null||!Zs.has(f))){r=Ir(c,r),c=Qj(2),f=Gs(s,c,2),f!==null&&(Zj(c,f,s,r),ge(f,2),Aa(f));break}}s=s.return}}function xg(r,s,c){var f=r.pingCache;if(f===null){f=r.pingCache=new dB;var x=new Set;f.set(s,x)}else x=f.get(s),x===void 0&&(x=new Set,f.set(s,x));x.has(c)||(ug=!0,x.add(c),r=gB.bind(null,r,s,c),s.then(r,r))}function gB(r,s,c){var f=r.pingCache;f!==null&&f.delete(s),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,nn===r&&(Bt&c)===c&&(gn===4||gn===3&&(Bt&62914560)===Bt&&300>Ct()-af?(Yt&2)===0&&Io(r,0):dg|=c,Lo===Bt&&(Lo=0)),Aa(r)}function QC(r,s){s===0&&(s=Re()),r=Di(r,s),r!==null&&(ge(r,s),Aa(r))}function vB(r){var s=r.memoizedState,c=0;s!==null&&(c=s.retryLane),QC(r,c)}function xB(r,s){var c=0;switch(r.tag){case 31:case 13:var f=r.stateNode,x=r.memoizedState;x!==null&&(c=x.retryLane);break;case 19:f=r.stateNode;break;case 22:f=r.stateNode._retryCache;break;default:throw Error(a(314))}f!==null&&f.delete(s),QC(r,c)}function yB(r,s){return _t(r,s)}var ff=null,Fo=null,yg=!1,hf=!1,bg=!1,ti=0;function Aa(r){r!==Fo&&r.next===null&&(Fo===null?ff=Fo=r:Fo=Fo.next=r),hf=!0,yg||(yg=!0,wB())}function Hc(r,s){if(!bg&&hf){bg=!0;do for(var c=!1,f=ff;f!==null;){if(r!==0){var x=f.pendingLanes;if(x===0)var y=0;else{var E=f.suspendedLanes,O=f.pingedLanes;y=(1<<31-ue(42|r)+1)-1,y&=x&~(E&~O),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(c=!0,tN(f,y))}else y=Bt,y=z(f,f===nn?y:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(y&3)===0||Se(f,y)||(c=!0,tN(f,y));f=f.next}while(c);bg=!1}}function bB(){ZC()}function ZC(){hf=yg=!1;var r=0;ti!==0&&OB()&&(r=ti);for(var s=Ct(),c=null,f=ff;f!==null;){var x=f.next,y=JC(f,s);y===0?(f.next=null,c===null?ff=x:c.next=x,x===null&&(Fo=c)):(c=f,(r!==0||(y&3)!==0)&&(hf=!0)),f=x}En!==0&&En!==5||Hc(r),ti!==0&&(ti=0)}function JC(r,s){for(var c=r.suspendedLanes,f=r.pingedLanes,x=r.expirationTimes,y=r.pendingLanes&-62914561;0<y;){var E=31-ue(y),O=1<<E,F=x[E];F===-1?((O&c)===0||(O&f)!==0)&&(x[E]=Ae(O,s)):F<=s&&(r.expiredLanes|=O),y&=~O}if(s=nn,c=Bt,c=z(r,r===s?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),f=r.callbackNode,c===0||r===s&&(Xt===2||Xt===9)||r.cancelPendingCommit!==null)return f!==null&&f!==null&&jt(f),r.callbackNode=null,r.callbackPriority=0;if((c&3)===0||Se(r,c)){if(s=c&-c,s===r.callbackPriority)return s;switch(f!==null&&jt(f),Ie(c)){case 2:case 8:c=Wt;break;case 32:c=te;break;case 268435456:c=st;break;default:c=te}return f=eN.bind(null,r),c=_t(c,f),r.callbackPriority=s,r.callbackNode=c,s}return f!==null&&f!==null&&jt(f),r.callbackPriority=2,r.callbackNode=null,2}function eN(r,s){if(En!==0&&En!==5)return r.callbackNode=null,r.callbackPriority=0,null;var c=r.callbackNode;if(df()&&r.callbackNode!==c)return null;var f=Bt;return f=z(r,r===nn?f:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),f===0?null:(kC(r,f,s),JC(r,Ct()),r.callbackNode!=null&&r.callbackNode===c?eN.bind(null,r):null)}function tN(r,s){if(df())return null;kC(r,s,!0)}function wB(){DB(function(){(Yt&6)!==0?_t(Kt,bB):ZC()})}function wg(){if(ti===0){var r=No;r===0&&(r=Pe,Pe<<=1,(Pe&261888)===0&&(Pe=256)),ti=r}return ti}function nN(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Dt(""+r)}function rN(r,s){var c=s.ownerDocument.createElement("input");return c.name=s.name,c.value=s.value,r.id&&c.setAttribute("form",r.id),s.parentNode.insertBefore(c,s),r=new FormData(r),c.parentNode.removeChild(c),r}function SB(r,s,c,f,x){if(s==="submit"&&c&&c.stateNode===x){var y=nN((x[it]||null).action),E=f.submitter;E&&(s=(s=E[it]||null)?nN(s.formAction):E.getAttribute("formAction"),s!==null&&(y=s,E=null));var O=new Cd("action","action",null,f,x);r.push({event:O,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(ti!==0){var F=E?rN(x,E):new FormData(x);Hm(c,{pending:!0,data:F,method:x.method,action:y},null,F)}}else typeof y=="function"&&(O.preventDefault(),F=E?rN(x,E):new FormData(x),Hm(c,{pending:!0,data:F,method:x.method,action:y},y,F))},currentTarget:x}]})}}for(var Sg=0;Sg<am.length;Sg++){var jg=am[Sg],jB=jg.toLowerCase(),CB=jg[0].toUpperCase()+jg.slice(1);na(jB,"on"+CB)}na(P1,"onAnimationEnd"),na(k1,"onAnimationIteration"),na(L1,"onAnimationStart"),na("dblclick","onDoubleClick"),na("focusin","onFocus"),na("focusout","onBlur"),na(F4,"onTransitionRun"),na(H4,"onTransitionStart"),na(U4,"onTransitionCancel"),na(B1,"onTransitionEnd"),ir("onMouseEnter",["mouseout","mouseover"]),ir("onMouseLeave",["mouseout","mouseover"]),ir("onPointerEnter",["pointerout","pointerover"]),ir("onPointerLeave",["pointerout","pointerover"]),Xa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Xa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Xa("onBeforeInput",["compositionend","keypress","textInput","paste"]),Xa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Xa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Xa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Uc="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(" "),NB=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Uc));function aN(r,s){s=(s&4)!==0;for(var c=0;c<r.length;c++){var f=r[c],x=f.event;f=f.listeners;e:{var y=void 0;if(s)for(var E=f.length-1;0<=E;E--){var O=f[E],F=O.instance,ae=O.currentTarget;if(O=O.listener,F!==y&&x.isPropagationStopped())break e;y=O,x.currentTarget=ae;try{y(x)}catch(pe){Ed(pe)}x.currentTarget=null,y=F}else for(E=0;E<f.length;E++){if(O=f[E],F=O.instance,ae=O.currentTarget,O=O.listener,F!==y&&x.isPropagationStopped())break e;y=O,x.currentTarget=ae;try{y(x)}catch(pe){Ed(pe)}x.currentTarget=null,y=F}}}}function kt(r,s){var c=s[Zn];c===void 0&&(c=s[Zn]=new Set);var f=r+"__bubble";c.has(f)||(sN(s,r,2,!1),c.add(f))}function Cg(r,s,c){var f=0;s&&(f|=4),sN(c,r,f,s)}var pf="_reactListening"+Math.random().toString(36).slice(2);function Ng(r){if(!r[pf]){r[pf]=!0,ec.forEach(function(c){c!=="selectionchange"&&(NB.has(c)||Cg(c,!1,r),Cg(c,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[pf]||(s[pf]=!0,Cg("selectionchange",!1,s))}}function sN(r,s,c,f){switch(PN(s)){case 2:var x=JB;break;case 8:x=eI;break;default:x=Fg}c=x.bind(null,s,c,r),x=void 0,!$p||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(x=!0),f?x!==void 0?r.addEventListener(s,c,{capture:!0,passive:x}):r.addEventListener(s,c,!0):x!==void 0?r.addEventListener(s,c,{passive:x}):r.addEventListener(s,c,!1)}function _g(r,s,c,f,x){var y=f;if((s&1)===0&&(s&2)===0&&f!==null)e:for(;;){if(f===null)return;var E=f.tag;if(E===3||E===4){var O=f.stateNode.containerInfo;if(O===x)break;if(E===4)for(E=f.return;E!==null;){var F=E.tag;if((F===3||F===4)&&E.stateNode.containerInfo===x)return;E=E.return}for(;O!==null;){if(E=Ya(O),E===null)return;if(F=E.tag,F===5||F===6||F===26||F===27){f=y=E;continue e}O=O.parentNode}}f=f.return}u1(function(){var ae=y,pe=fn(c),ye=[];e:{var ie=I1.get(r);if(ie!==void 0){var ce=Cd,Ve=r;switch(r){case"keypress":if(Sd(c)===0)break e;case"keydown":case"keyup":ce=x4;break;case"focusin":Ve="focus",ce=Wp;break;case"focusout":Ve="blur",ce=Wp;break;case"beforeblur":case"afterblur":ce=Wp;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ce=h1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ce=i4;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ce=w4;break;case P1:case k1:case L1:ce=c4;break;case B1:ce=j4;break;case"scroll":case"scrollend":ce=a4;break;case"wheel":ce=N4;break;case"copy":case"cut":case"paste":ce=d4;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ce=m1;break;case"toggle":case"beforetoggle":ce=E4}var rt=(s&4)!==0,en=!rt&&(r==="scroll"||r==="scrollend"),Q=rt?ie!==null?ie+"Capture":null:ie;rt=[];for(var q=ae,re;q!==null;){var ve=q;if(re=ve.stateNode,ve=ve.tag,ve!==5&&ve!==26&&ve!==27||re===null||Q===null||(ve=uc(q,Q),ve!=null&&rt.push(Vc(q,ve,re))),en)break;q=q.return}0<rt.length&&(ie=new ce(ie,Ve,null,c,pe),ye.push({event:ie,listeners:rt}))}}if((s&7)===0){e:{if(ie=r==="mouseover"||r==="pointerover",ce=r==="mouseout"||r==="pointerout",ie&&c!==_n&&(Ve=c.relatedTarget||c.fromElement)&&(Ya(Ve)||Ve[zt]))break e;if((ce||ie)&&(ie=pe.window===pe?pe:(ie=pe.ownerDocument)?ie.defaultView||ie.parentWindow:window,ce?(Ve=c.relatedTarget||c.toElement,ce=ae,Ve=Ve?Ya(Ve):null,Ve!==null&&(en=l(Ve),rt=Ve.tag,Ve!==en||rt!==5&&rt!==27&&rt!==6)&&(Ve=null)):(ce=null,Ve=ae),ce!==Ve)){if(rt=h1,ve="onMouseLeave",Q="onMouseEnter",q="mouse",(r==="pointerout"||r==="pointerover")&&(rt=m1,ve="onPointerLeave",Q="onPointerEnter",q="pointer"),en=ce==null?ie:ks(ce),re=Ve==null?ie:ks(Ve),ie=new rt(ve,q+"leave",ce,c,pe),ie.target=en,ie.relatedTarget=re,ve=null,Ya(pe)===ae&&(rt=new rt(Q,q+"enter",Ve,c,pe),rt.target=re,rt.relatedTarget=en,ve=rt),en=ve,ce&&Ve)t:{for(rt=_B,Q=ce,q=Ve,re=0,ve=Q;ve;ve=rt(ve))re++;ve=0;for(var Je=q;Je;Je=rt(Je))ve++;for(;0<re-ve;)Q=rt(Q),re--;for(;0<ve-re;)q=rt(q),ve--;for(;re--;){if(Q===q||q!==null&&Q===q.alternate){rt=Q;break t}Q=rt(Q),q=rt(q)}rt=null}else rt=null;ce!==null&&iN(ye,ie,ce,rt,!1),Ve!==null&&en!==null&&iN(ye,en,Ve,rt,!0)}}e:{if(ie=ae?ks(ae):window,ce=ie.nodeName&&ie.nodeName.toLowerCase(),ce==="select"||ce==="input"&&ie.type==="file")var $t=j1;else if(w1(ie))if(C1)$t=B4;else{$t=k4;var We=P4}else ce=ie.nodeName,!ce||ce.toLowerCase()!=="input"||ie.type!=="checkbox"&&ie.type!=="radio"?ae&&ee(ae.elementType)&&($t=j1):$t=L4;if($t&&($t=$t(r,ae))){S1(ye,$t,c,pe);break e}We&&We(r,ie,ae),r==="focusout"&&ae&&ie.type==="number"&&ae.memoizedProps.value!=null&&ac(ie,"number",ie.value)}switch(We=ae?ks(ae):window,r){case"focusin":(w1(We)||We.contentEditable==="true")&&(vo=We,tm=ae,xc=null);break;case"focusout":xc=tm=vo=null;break;case"mousedown":nm=!0;break;case"contextmenu":case"mouseup":case"dragend":nm=!1,M1(ye,c,pe);break;case"selectionchange":if(z4)break;case"keydown":case"keyup":M1(ye,c,pe)}var Nt;if(Qp)e:{switch(r){case"compositionstart":var It="onCompositionStart";break e;case"compositionend":It="onCompositionEnd";break e;case"compositionupdate":It="onCompositionUpdate";break e}It=void 0}else go?y1(r,c)&&(It="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(It="onCompositionStart");It&&(g1&&c.locale!=="ko"&&(go||It!=="onCompositionStart"?It==="onCompositionEnd"&&go&&(Nt=d1()):(zs=pe,Gp="value"in zs?zs.value:zs.textContent,go=!0)),We=mf(ae,It),0<We.length&&(It=new p1(It,r,null,c,pe),ye.push({event:It,listeners:We}),Nt?It.data=Nt:(Nt=b1(c),Nt!==null&&(It.data=Nt)))),(Nt=R4?A4(r,c):O4(r,c))&&(It=mf(ae,"onBeforeInput"),0<It.length&&(We=new p1("onBeforeInput","beforeinput",null,c,pe),ye.push({event:We,listeners:It}),We.data=Nt)),SB(ye,r,ae,c,pe)}aN(ye,s)})}function Vc(r,s,c){return{instance:r,listener:s,currentTarget:c}}function mf(r,s){for(var c=s+"Capture",f=[];r!==null;){var x=r,y=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||y===null||(x=uc(r,c),x!=null&&f.unshift(Vc(r,x,y)),x=uc(r,s),x!=null&&f.push(Vc(r,x,y))),r.tag===3)return f;r=r.return}return[]}function _B(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function iN(r,s,c,f,x){for(var y=s._reactName,E=[];c!==null&&c!==f;){var O=c,F=O.alternate,ae=O.stateNode;if(O=O.tag,F!==null&&F===f)break;O!==5&&O!==26&&O!==27||ae===null||(F=ae,x?(ae=uc(c,y),ae!=null&&E.unshift(Vc(c,ae,F))):x||(ae=uc(c,y),ae!=null&&E.push(Vc(c,ae,F)))),c=c.return}E.length!==0&&r.push({event:s,listeners:E})}var EB=/\r\n?/g,TB=/\u0000|\uFFFD/g;function oN(r){return(typeof r=="string"?r:""+r).replace(EB,`
  9. `).replace(TB,"")}function lN(r,s){return s=oN(s),oN(r)===s}function Jt(r,s,c,f,x,y){switch(c){case"children":typeof f=="string"?s==="body"||s==="textarea"&&f===""||_a(r,f):(typeof f=="number"||typeof f=="bigint")&&s!=="body"&&_a(r,""+f);break;case"className":Bs(r,"class",f);break;case"tabIndex":Bs(r,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":Bs(r,c,f);break;case"style":oc(r,f,y);break;case"data":if(s!=="object"){Bs(r,"data",f);break}case"src":case"href":if(f===""&&(s!=="a"||c!=="href")){r.removeAttribute(c);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){r.removeAttribute(c);break}f=Dt(""+f),r.setAttribute(c,f);break;case"action":case"formAction":if(typeof f=="function"){r.setAttribute(c,"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"&&(c==="formAction"?(s!=="input"&&Jt(r,s,"name",x.name,x,null),Jt(r,s,"formEncType",x.formEncType,x,null),Jt(r,s,"formMethod",x.formMethod,x,null),Jt(r,s,"formTarget",x.formTarget,x,null)):(Jt(r,s,"encType",x.encType,x,null),Jt(r,s,"method",x.method,x,null),Jt(r,s,"target",x.target,x,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){r.removeAttribute(c);break}f=Dt(""+f),r.setAttribute(c,f);break;case"onClick":f!=null&&(r.onclick=Lt);break;case"onScroll":f!=null&&kt("scroll",r);break;case"onScrollEnd":f!=null&&kt("scrollend",r);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(a(61));if(c=f.__html,c!=null){if(x.children!=null)throw Error(a(60));r.innerHTML=c}}break;case"multiple":r.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":r.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){r.removeAttribute("xlink:href");break}c=Dt(""+f),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?r.setAttribute(c,""+f):r.removeAttribute(c);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":f&&typeof f!="function"&&typeof f!="symbol"?r.setAttribute(c,""):r.removeAttribute(c);break;case"capture":case"download":f===!0?r.setAttribute(c,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?r.setAttribute(c,f):r.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?r.setAttribute(c,f):r.removeAttribute(c);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?r.removeAttribute(c):r.setAttribute(c,f);break;case"popover":kt("beforetoggle",r),kt("toggle",r),Ls(r,"popover",f);break;case"xlinkActuate":or(r,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":or(r,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":or(r,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":or(r,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":or(r,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":or(r,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":or(r,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":or(r,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":or(r,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":Ls(r,"is",f);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=Te.get(c)||c,Ls(r,c,f))}}function Eg(r,s,c,f,x,y){switch(c){case"style":oc(r,f,y);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(a(61));if(c=f.__html,c!=null){if(x.children!=null)throw Error(a(60));r.innerHTML=c}}break;case"children":typeof f=="string"?_a(r,f):(typeof f=="number"||typeof f=="bigint")&&_a(r,""+f);break;case"onScroll":f!=null&&kt("scroll",r);break;case"onScrollEnd":f!=null&&kt("scrollend",r);break;case"onClick":f!=null&&(r.onclick=Lt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!tc.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(x=c.endsWith("Capture"),s=c.slice(2,x?c.length-7:void 0),y=r[it]||null,y=y!=null?y[c]:null,typeof y=="function"&&r.removeEventListener(s,y,x),typeof f=="function")){typeof y!="function"&&y!==null&&(c in r?r[c]=null:r.hasAttribute(c)&&r.removeAttribute(c)),r.addEventListener(s,f,x);break e}c in r?r[c]=f:f===!0?r.setAttribute(c,""):Ls(r,c,f)}}}function zn(r,s,c){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":kt("error",r),kt("load",r);var f=!1,x=!1,y;for(y in c)if(c.hasOwnProperty(y)){var E=c[y];if(E!=null)switch(y){case"src":f=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:Jt(r,s,y,E,c,null)}}x&&Jt(r,s,"srcSet",c.srcSet,c,null),f&&Jt(r,s,"src",c.src,c,null);return;case"input":kt("invalid",r);var O=y=E=x=null,F=null,ae=null;for(f in c)if(c.hasOwnProperty(f)){var pe=c[f];if(pe!=null)switch(f){case"name":x=pe;break;case"type":E=pe;break;case"checked":F=pe;break;case"defaultChecked":ae=pe;break;case"value":y=pe;break;case"defaultValue":O=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(a(137,s));break;default:Jt(r,s,f,pe,c,null)}}yd(r,y,O,F,ae,E,x,!1);return;case"select":kt("invalid",r),f=E=y=null;for(x in c)if(c.hasOwnProperty(x)&&(O=c[x],O!=null))switch(x){case"value":y=O;break;case"defaultValue":E=O;break;case"multiple":f=O;default:Jt(r,s,x,O,c,null)}s=y,c=E,r.multiple=!!f,s!=null?Is(r,!!f,s,!1):c!=null&&Is(r,!!f,c,!0);return;case"textarea":kt("invalid",r),y=x=f=null;for(E in c)if(c.hasOwnProperty(E)&&(O=c[E],O!=null))switch(E){case"value":f=O;break;case"defaultValue":x=O;break;case"children":y=O;break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(a(91));break;default:Jt(r,s,E,O,c,null)}sc(r,f,x,y);return;case"option":for(F in c)c.hasOwnProperty(F)&&(f=c[F],f!=null)&&(F==="selected"?r.selected=f&&typeof f!="function"&&typeof f!="symbol":Jt(r,s,F,f,c,null));return;case"dialog":kt("beforetoggle",r),kt("toggle",r),kt("cancel",r),kt("close",r);break;case"iframe":case"object":kt("load",r);break;case"video":case"audio":for(f=0;f<Uc.length;f++)kt(Uc[f],r);break;case"image":kt("error",r),kt("load",r);break;case"details":kt("toggle",r);break;case"embed":case"source":case"link":kt("error",r),kt("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in c)if(c.hasOwnProperty(ae)&&(f=c[ae],f!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:Jt(r,s,ae,f,c,null)}return;default:if(ee(s)){for(pe in c)c.hasOwnProperty(pe)&&(f=c[pe],f!==void 0&&Eg(r,s,pe,f,c,void 0));return}}for(O in c)c.hasOwnProperty(O)&&(f=c[O],f!=null&&Jt(r,s,O,f,c,null))}function RB(r,s,c,f){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,y=null,E=null,O=null,F=null,ae=null,pe=null;for(ce in c){var ye=c[ce];if(c.hasOwnProperty(ce)&&ye!=null)switch(ce){case"checked":break;case"value":break;case"defaultValue":F=ye;default:f.hasOwnProperty(ce)||Jt(r,s,ce,null,f,ye)}}for(var ie in f){var ce=f[ie];if(ye=c[ie],f.hasOwnProperty(ie)&&(ce!=null||ye!=null))switch(ie){case"type":y=ce;break;case"name":x=ce;break;case"checked":ae=ce;break;case"defaultChecked":pe=ce;break;case"value":E=ce;break;case"defaultValue":O=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(a(137,s));break;default:ce!==ye&&Jt(r,s,ie,ce,f,ye)}}rc(r,E,O,F,ae,pe,y,x);return;case"select":ce=E=O=ie=null;for(y in c)if(F=c[y],c.hasOwnProperty(y)&&F!=null)switch(y){case"value":break;case"multiple":ce=F;default:f.hasOwnProperty(y)||Jt(r,s,y,null,f,F)}for(x in f)if(y=f[x],F=c[x],f.hasOwnProperty(x)&&(y!=null||F!=null))switch(x){case"value":ie=y;break;case"defaultValue":O=y;break;case"multiple":E=y;default:y!==F&&Jt(r,s,x,y,f,F)}s=O,c=E,f=ce,ie!=null?Is(r,!!c,ie,!1):!!f!=!!c&&(s!=null?Is(r,!!c,s,!0):Is(r,!!c,c?[]:"",!1));return;case"textarea":ce=ie=null;for(O in c)if(x=c[O],c.hasOwnProperty(O)&&x!=null&&!f.hasOwnProperty(O))switch(O){case"value":break;case"children":break;default:Jt(r,s,O,null,f,x)}for(E in f)if(x=f[E],y=c[E],f.hasOwnProperty(E)&&(x!=null||y!=null))switch(E){case"value":ie=x;break;case"defaultValue":ce=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(a(91));break;default:x!==y&&Jt(r,s,E,x,f,y)}Ri(r,ie,ce);return;case"option":for(var Ve in c)ie=c[Ve],c.hasOwnProperty(Ve)&&ie!=null&&!f.hasOwnProperty(Ve)&&(Ve==="selected"?r.selected=!1:Jt(r,s,Ve,null,f,ie));for(F in f)ie=f[F],ce=c[F],f.hasOwnProperty(F)&&ie!==ce&&(ie!=null||ce!=null)&&(F==="selected"?r.selected=ie&&typeof ie!="function"&&typeof ie!="symbol":Jt(r,s,F,ie,f,ce));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 rt in c)ie=c[rt],c.hasOwnProperty(rt)&&ie!=null&&!f.hasOwnProperty(rt)&&Jt(r,s,rt,null,f,ie);for(ae in f)if(ie=f[ae],ce=c[ae],f.hasOwnProperty(ae)&&ie!==ce&&(ie!=null||ce!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(a(137,s));break;default:Jt(r,s,ae,ie,f,ce)}return;default:if(ee(s)){for(var en in c)ie=c[en],c.hasOwnProperty(en)&&ie!==void 0&&!f.hasOwnProperty(en)&&Eg(r,s,en,void 0,f,ie);for(pe in f)ie=f[pe],ce=c[pe],!f.hasOwnProperty(pe)||ie===ce||ie===void 0&&ce===void 0||Eg(r,s,pe,ie,f,ce);return}}for(var Q in c)ie=c[Q],c.hasOwnProperty(Q)&&ie!=null&&!f.hasOwnProperty(Q)&&Jt(r,s,Q,null,f,ie);for(ye in f)ie=f[ye],ce=c[ye],!f.hasOwnProperty(ye)||ie===ce||ie==null&&ce==null||Jt(r,s,ye,ie,f,ce)}function cN(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function AB(){if(typeof performance.getEntriesByType=="function"){for(var r=0,s=0,c=performance.getEntriesByType("resource"),f=0;f<c.length;f++){var x=c[f],y=x.transferSize,E=x.initiatorType,O=x.duration;if(y&&O&&cN(E)){for(E=0,O=x.responseEnd,f+=1;f<c.length;f++){var F=c[f],ae=F.startTime;if(ae>O)break;var pe=F.transferSize,ye=F.initiatorType;pe&&cN(ye)&&(F=F.responseEnd,E+=pe*(F<O?1:(O-ae)/(F-ae)))}if(--f,s+=8*(y+E)/(x.duration/1e3),r++,10<r)break}}if(0<r)return s/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var Tg=null,Rg=null;function gf(r){return r.nodeType===9?r:r.ownerDocument}function uN(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function dN(r,s){if(r===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&s==="foreignObject"?0:r}function Ag(r,s){return r==="textarea"||r==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Og=null;function OB(){var r=window.event;return r&&r.type==="popstate"?r===Og?!1:(Og=r,!0):(Og=null,!1)}var fN=typeof setTimeout=="function"?setTimeout:void 0,MB=typeof clearTimeout=="function"?clearTimeout:void 0,hN=typeof Promise=="function"?Promise:void 0,DB=typeof queueMicrotask=="function"?queueMicrotask:typeof hN<"u"?function(r){return hN.resolve(null).then(r).catch(PB)}:fN;function PB(r){setTimeout(function(){throw r})}function ni(r){return r==="head"}function pN(r,s){var c=s,f=0;do{var x=c.nextSibling;if(r.removeChild(c),x&&x.nodeType===8)if(c=x.data,c==="/$"||c==="/&"){if(f===0){r.removeChild(x),qo(s);return}f--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")f++;else if(c==="html")qc(r.ownerDocument.documentElement);else if(c==="head"){c=r.ownerDocument.head,qc(c);for(var y=c.firstChild;y;){var E=y.nextSibling,O=y.nodeName;y[Ka]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&y.rel.toLowerCase()==="stylesheet"||c.removeChild(y),y=E}}else c==="body"&&qc(r.ownerDocument.body);c=x}while(c);qo(s)}function mN(r,s){var c=r;r=0;do{var f=c.nextSibling;if(c.nodeType===1?s?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(s?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),f&&f.nodeType===8)if(c=f.data,c==="/$"){if(r===0)break;r--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||r++;c=f}while(c)}function Mg(r){var s=r.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var c=s;switch(s=s.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Mg(c),Jl(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}r.removeChild(c)}}function kB(r,s,c,f){for(;r.nodeType===1;){var x=c;if(r.nodeName.toLowerCase()!==s.toLowerCase()){if(!f&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(f){if(!r[Ka])switch(s){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(y=r.getAttribute("rel"),y==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(y!==x.rel||r.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||r.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||r.getAttribute("title")!==(x.title==null?null:x.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(y=r.getAttribute("src"),(y!==(x.src==null?null:x.src)||r.getAttribute("type")!==(x.type==null?null:x.type)||r.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&y&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(s==="input"&&r.type==="hidden"){var y=x.name==null?null:""+x.name;if(x.type==="hidden"&&r.getAttribute("name")===y)return r}else return r;if(r=Vr(r.nextSibling),r===null)break}return null}function LB(r,s,c){if(s==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!c||(r=Vr(r.nextSibling),r===null))return null;return r}function gN(r,s){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!s||(r=Vr(r.nextSibling),r===null))return null;return r}function Dg(r){return r.data==="$?"||r.data==="$~"}function Pg(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function BB(r,s){var c=r.ownerDocument;if(r.data==="$~")r._reactRetry=s;else if(r.data!=="$?"||c.readyState!=="loading")s();else{var f=function(){s(),c.removeEventListener("DOMContentLoaded",f)};c.addEventListener("DOMContentLoaded",f),r._reactRetry=f}}function Vr(r){for(;r!=null;r=r.nextSibling){var s=r.nodeType;if(s===1||s===3)break;if(s===8){if(s=r.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return r}var kg=null;function vN(r){r=r.nextSibling;for(var s=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"||c==="/&"){if(s===0)return Vr(r.nextSibling);s--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||s++}r=r.nextSibling}return null}function xN(r){r=r.previousSibling;for(var s=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(s===0)return r;s--}else c!=="/$"&&c!=="/&"||s++}r=r.previousSibling}return null}function yN(r,s,c){switch(s=gf(c),r){case"html":if(r=s.documentElement,!r)throw Error(a(452));return r;case"head":if(r=s.head,!r)throw Error(a(453));return r;case"body":if(r=s.body,!r)throw Error(a(454));return r;default:throw Error(a(451))}}function qc(r){for(var s=r.attributes;s.length;)r.removeAttributeNode(s[0]);Jl(r)}var qr=new Map,bN=new Set;function vf(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var hs=V.d;V.d={f:IB,r:zB,D:FB,C:HB,L:UB,m:VB,X:$B,S:qB,M:GB};function IB(){var r=hs.f(),s=lf();return r||s}function zB(r){var s=Ps(r);s!==null&&s.tag===5&&s.type==="form"?Bj(s):hs.r(r)}var Ho=typeof document>"u"?null:document;function wN(r,s,c){var f=Ho;if(f&&typeof s=="string"&&s){var x=Jn(s);x='link[rel="'+r+'"][href="'+x+'"]',typeof c=="string"&&(x+='[crossorigin="'+c+'"]'),bN.has(x)||(bN.add(x),r={rel:r,crossOrigin:c,href:s},f.querySelector(x)===null&&(s=f.createElement("link"),zn(s,"link",r),xn(s),f.head.appendChild(s)))}}function FB(r){hs.D(r),wN("dns-prefetch",r,null)}function HB(r,s){hs.C(r,s),wN("preconnect",r,s)}function UB(r,s,c){hs.L(r,s,c);var f=Ho;if(f&&r&&s){var x='link[rel="preload"][as="'+Jn(s)+'"]';s==="image"&&c&&c.imageSrcSet?(x+='[imagesrcset="'+Jn(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(x+='[imagesizes="'+Jn(c.imageSizes)+'"]')):x+='[href="'+Jn(r)+'"]';var y=x;switch(s){case"style":y=Uo(r);break;case"script":y=Vo(r)}qr.has(y)||(r=m({rel:"preload",href:s==="image"&&c&&c.imageSrcSet?void 0:r,as:s},c),qr.set(y,r),f.querySelector(x)!==null||s==="style"&&f.querySelector($c(y))||s==="script"&&f.querySelector(Gc(y))||(s=f.createElement("link"),zn(s,"link",r),xn(s),f.head.appendChild(s)))}}function VB(r,s){hs.m(r,s);var c=Ho;if(c&&r){var f=s&&typeof s.as=="string"?s.as:"script",x='link[rel="modulepreload"][as="'+Jn(f)+'"][href="'+Jn(r)+'"]',y=x;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=Vo(r)}if(!qr.has(y)&&(r=m({rel:"modulepreload",href:r},s),qr.set(y,r),c.querySelector(x)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Gc(y)))return}f=c.createElement("link"),zn(f,"link",r),xn(f),c.head.appendChild(f)}}}function qB(r,s,c){hs.S(r,s,c);var f=Ho;if(f&&r){var x=Wa(f).hoistableStyles,y=Uo(r);s=s||"default";var E=x.get(y);if(!E){var O={loading:0,preload:null};if(E=f.querySelector($c(y)))O.loading=5;else{r=m({rel:"stylesheet",href:r,"data-precedence":s},c),(c=qr.get(y))&&Lg(r,c);var F=E=f.createElement("link");xn(F),zn(F,"link",r),F._p=new Promise(function(ae,pe){F.onload=ae,F.onerror=pe}),F.addEventListener("load",function(){O.loading|=1}),F.addEventListener("error",function(){O.loading|=2}),O.loading|=4,xf(E,s,f)}E={type:"stylesheet",instance:E,count:1,state:O},x.set(y,E)}}}function $B(r,s){hs.X(r,s);var c=Ho;if(c&&r){var f=Wa(c).hoistableScripts,x=Vo(r),y=f.get(x);y||(y=c.querySelector(Gc(x)),y||(r=m({src:r,async:!0},s),(s=qr.get(x))&&Bg(r,s),y=c.createElement("script"),xn(y),zn(y,"link",r),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},f.set(x,y))}}function GB(r,s){hs.M(r,s);var c=Ho;if(c&&r){var f=Wa(c).hoistableScripts,x=Vo(r),y=f.get(x);y||(y=c.querySelector(Gc(x)),y||(r=m({src:r,async:!0,type:"module"},s),(s=qr.get(x))&&Bg(r,s),y=c.createElement("script"),xn(y),zn(y,"link",r),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},f.set(x,y))}}function SN(r,s,c,f){var x=(x=Z.current)?vf(x):null;if(!x)throw Error(a(446));switch(r){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(s=Uo(c.href),c=Wa(x).hoistableStyles,f=c.get(s),f||(f={type:"style",instance:null,count:0,state:null},c.set(s,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){r=Uo(c.href);var y=Wa(x).hoistableStyles,E=y.get(r);if(E||(x=x.ownerDocument||x,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(r,E),(y=x.querySelector($c(r)))&&!y._p&&(E.instance=y,E.state.loading=5),qr.has(r)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},qr.set(r,c),y||KB(x,r,c,E.state))),s&&f===null)throw Error(a(528,""));return E}if(s&&f!==null)throw Error(a(529,""));return null;case"script":return s=c.async,c=c.src,typeof c=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Vo(c),c=Wa(x).hoistableScripts,f=c.get(s),f||(f={type:"script",instance:null,count:0,state:null},c.set(s,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,r))}}function Uo(r){return'href="'+Jn(r)+'"'}function $c(r){return'link[rel="stylesheet"]['+r+"]"}function jN(r){return m({},r,{"data-precedence":r.precedence,precedence:null})}function KB(r,s,c,f){r.querySelector('link[rel="preload"][as="style"]['+s+"]")?f.loading=1:(s=r.createElement("link"),f.preload=s,s.addEventListener("load",function(){return f.loading|=1}),s.addEventListener("error",function(){return f.loading|=2}),zn(s,"link",c),xn(s),r.head.appendChild(s))}function Vo(r){return'[src="'+Jn(r)+'"]'}function Gc(r){return"script[async]"+r}function CN(r,s,c){if(s.count++,s.instance===null)switch(s.type){case"style":var f=r.querySelector('style[data-href~="'+Jn(c.href)+'"]');if(f)return s.instance=f,xn(f),f;var x=m({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return f=(r.ownerDocument||r).createElement("style"),xn(f),zn(f,"style",x),xf(f,c.precedence,r),s.instance=f;case"stylesheet":x=Uo(c.href);var y=r.querySelector($c(x));if(y)return s.state.loading|=4,s.instance=y,xn(y),y;f=jN(c),(x=qr.get(x))&&Lg(f,x),y=(r.ownerDocument||r).createElement("link"),xn(y);var E=y;return E._p=new Promise(function(O,F){E.onload=O,E.onerror=F}),zn(y,"link",f),s.state.loading|=4,xf(y,c.precedence,r),s.instance=y;case"script":return y=Vo(c.src),(x=r.querySelector(Gc(y)))?(s.instance=x,xn(x),x):(f=c,(x=qr.get(y))&&(f=m({},c),Bg(f,x)),r=r.ownerDocument||r,x=r.createElement("script"),xn(x),zn(x,"link",f),r.head.appendChild(x),s.instance=x);case"void":return null;default:throw Error(a(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(f=s.instance,s.state.loading|=4,xf(f,c.precedence,r));return s.instance}function xf(r,s,c){for(var f=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=f.length?f[f.length-1]:null,y=x,E=0;E<f.length;E++){var O=f[E];if(O.dataset.precedence===s)y=O;else if(y!==x)break}y?y.parentNode.insertBefore(r,y.nextSibling):(s=c.nodeType===9?c.head:c,s.insertBefore(r,s.firstChild))}function Lg(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.title==null&&(r.title=s.title)}function Bg(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.integrity==null&&(r.integrity=s.integrity)}var yf=null;function NN(r,s,c){if(yf===null){var f=new Map,x=yf=new Map;x.set(c,f)}else x=yf,f=x.get(c),f||(f=new Map,x.set(c,f));if(f.has(r))return f;for(f.set(r,null),c=c.getElementsByTagName(r),x=0;x<c.length;x++){var y=c[x];if(!(y[Ka]||y[Rt]||r==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var E=y.getAttribute(s)||"";E=r+E;var O=f.get(E);O?O.push(y):f.set(E,[y])}}return f}function _N(r,s,c){r=r.ownerDocument||r,r.head.insertBefore(c,s==="title"?r.querySelector("head > title"):null)}function YB(r,s,c){if(c===1||s.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(r=s.disabled,typeof s.precedence=="string"&&r==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function EN(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function WB(r,s,c,f){if(c.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var x=Uo(f.href),y=s.querySelector($c(x));if(y){s=y._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=bf.bind(r),s.then(r,r)),c.state.loading|=4,c.instance=y,xn(y);return}y=s.ownerDocument||s,f=jN(f),(x=qr.get(x))&&Lg(f,x),y=y.createElement("link"),xn(y);var E=y;E._p=new Promise(function(O,F){E.onload=O,E.onerror=F}),zn(y,"link",f),c.instance=y}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(c,s),(s=c.state.preload)&&(c.state.loading&3)===0&&(r.count++,c=bf.bind(r),s.addEventListener("load",c),s.addEventListener("error",c))}}var Ig=0;function XB(r,s){return r.stylesheets&&r.count===0&&Sf(r,r.stylesheets),0<r.count||0<r.imgCount?function(c){var f=setTimeout(function(){if(r.stylesheets&&Sf(r,r.stylesheets),r.unsuspend){var y=r.unsuspend;r.unsuspend=null,y()}},6e4+s);0<r.imgBytes&&Ig===0&&(Ig=62500*AB());var x=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Sf(r,r.stylesheets),r.unsuspend)){var y=r.unsuspend;r.unsuspend=null,y()}},(r.imgBytes>Ig?50:800)+s);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(f),clearTimeout(x)}}:null}function bf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Sf(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var wf=null;function Sf(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,wf=new Map,s.forEach(QB,r),wf=null,bf.call(r))}function QB(r,s){if(!(s.state.loading&4)){var c=wf.get(r);if(c)var f=c.get(null);else{c=new Map,wf.set(r,c);for(var x=r.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<x.length;y++){var E=x[y];(E.nodeName==="LINK"||E.getAttribute("media")!=="not all")&&(c.set(E.dataset.precedence,E),f=E)}f&&c.set(null,f)}x=s.instance,E=x.getAttribute("data-precedence"),y=c.get(E)||f,y===f&&c.set(null,x),c.set(E,x),this.count++,f=bf.bind(this),x.addEventListener("load",f),x.addEventListener("error",f),y?y.parentNode.insertBefore(x,y.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(x,r.firstChild)),s.state.loading|=4}}var Kc={$$typeof:T,Provider:null,Consumer:null,_currentValue:H,_currentValue2:H,_threadCount:0};function ZB(r,s,c,f,x,y,E,O,F){this.tag=1,this.containerInfo=r,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=M(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=M(0),this.hiddenUpdates=M(null),this.identifierPrefix=f,this.onUncaughtError=x,this.onCaughtError=y,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=F,this.incompleteTransitions=new Map}function TN(r,s,c,f,x,y,E,O,F,ae,pe,ye){return r=new ZB(r,s,c,E,F,ae,pe,ye,O),s=1,y===!0&&(s|=24),y=Sr(3,null,null,s),r.current=y,y.stateNode=r,s=vm(),s.refCount++,r.pooledCache=s,s.refCount++,y.memoizedState={element:f,isDehydrated:c,cache:s},wm(y),r}function RN(r){return r?(r=bo,r):bo}function AN(r,s,c,f,x,y){x=RN(x),f.context===null?f.context=x:f.pendingContext=x,f=$s(s),f.payload={element:c},y=y===void 0?null:y,y!==null&&(f.callback=y),c=Gs(r,f,s),c!==null&&(pr(c,r,s),Nc(c,r,s))}function ON(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<s?c:s}}function zg(r,s){ON(r,s),(r=r.alternate)&&ON(r,s)}function MN(r){if(r.tag===13||r.tag===31){var s=Di(r,67108864);s!==null&&pr(s,r,67108864),zg(r,67108864)}}function DN(r){if(r.tag===13||r.tag===31){var s=Er();s=Le(s);var c=Di(r,s);c!==null&&pr(c,r,s),zg(r,s)}}var jf=!0;function JB(r,s,c,f){var x=I.T;I.T=null;var y=V.p;try{V.p=2,Fg(r,s,c,f)}finally{V.p=y,I.T=x}}function eI(r,s,c,f){var x=I.T;I.T=null;var y=V.p;try{V.p=8,Fg(r,s,c,f)}finally{V.p=y,I.T=x}}function Fg(r,s,c,f){if(jf){var x=Hg(f);if(x===null)_g(r,s,f,Cf,c),kN(r,f);else if(nI(x,r,s,c,f))f.stopPropagation();else if(kN(r,f),s&4&&-1<tI.indexOf(r)){for(;x!==null;){var y=Ps(x);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var E=pt(y.pendingLanes);if(E!==0){var O=y;for(O.pendingLanes|=2,O.entangledLanes|=2;E;){var F=1<<31-ue(E);O.entanglements[1]|=F,E&=~F}Aa(y),(Yt&6)===0&&(sf=Ct()+500,Hc(0))}}break;case 31:case 13:O=Di(y,2),O!==null&&pr(O,y,2),lf(),zg(y,2)}if(y=Hg(f),y===null&&_g(r,s,f,Cf,c),y===x)break;x=y}x!==null&&f.stopPropagation()}else _g(r,s,f,null,c)}}function Hg(r){return r=fn(r),Ug(r)}var Cf=null;function Ug(r){if(Cf=null,r=Ya(r),r!==null){var s=l(r);if(s===null)r=null;else{var c=s.tag;if(c===13){if(r=u(s),r!==null)return r;r=null}else if(c===31){if(r=d(s),r!==null)return r;r=null}else if(c===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;r=null}else s!==r&&(r=null)}}return Cf=r,null}function PN(r){switch(r){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(Vt()){case Kt:return 2;case Wt:return 8;case te:case Me:return 32;case st:return 268435456;default:return 32}default:return 32}}var Vg=!1,ri=null,ai=null,si=null,Yc=new Map,Wc=new Map,ii=[],tI="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 kN(r,s){switch(r){case"focusin":case"focusout":ri=null;break;case"dragenter":case"dragleave":ai=null;break;case"mouseover":case"mouseout":si=null;break;case"pointerover":case"pointerout":Yc.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Wc.delete(s.pointerId)}}function Xc(r,s,c,f,x,y){return r===null||r.nativeEvent!==y?(r={blockedOn:s,domEventName:c,eventSystemFlags:f,nativeEvent:y,targetContainers:[x]},s!==null&&(s=Ps(s),s!==null&&MN(s)),r):(r.eventSystemFlags|=f,s=r.targetContainers,x!==null&&s.indexOf(x)===-1&&s.push(x),r)}function nI(r,s,c,f,x){switch(s){case"focusin":return ri=Xc(ri,r,s,c,f,x),!0;case"dragenter":return ai=Xc(ai,r,s,c,f,x),!0;case"mouseover":return si=Xc(si,r,s,c,f,x),!0;case"pointerover":var y=x.pointerId;return Yc.set(y,Xc(Yc.get(y)||null,r,s,c,f,x)),!0;case"gotpointercapture":return y=x.pointerId,Wc.set(y,Xc(Wc.get(y)||null,r,s,c,f,x)),!0}return!1}function LN(r){var s=Ya(r.target);if(s!==null){var c=l(s);if(c!==null){if(s=c.tag,s===13){if(s=u(c),s!==null){r.blockedOn=s,ut(r.priority,function(){DN(c)});return}}else if(s===31){if(s=d(c),s!==null){r.blockedOn=s,ut(r.priority,function(){DN(c)});return}}else if(s===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Nf(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var c=Hg(r.nativeEvent);if(c===null){c=r.nativeEvent;var f=new c.constructor(c.type,c);_n=f,c.target.dispatchEvent(f),_n=null}else return s=Ps(c),s!==null&&MN(s),r.blockedOn=c,!1;s.shift()}return!0}function BN(r,s,c){Nf(r)&&c.delete(s)}function rI(){Vg=!1,ri!==null&&Nf(ri)&&(ri=null),ai!==null&&Nf(ai)&&(ai=null),si!==null&&Nf(si)&&(si=null),Yc.forEach(BN),Wc.forEach(BN)}function _f(r,s){r.blockedOn===s&&(r.blockedOn=null,Vg||(Vg=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,rI)))}var Ef=null;function IN(r){Ef!==r&&(Ef=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Ef===r&&(Ef=null);for(var s=0;s<r.length;s+=3){var c=r[s],f=r[s+1],x=r[s+2];if(typeof f!="function"){if(Ug(f||c)===null)continue;break}var y=Ps(c);y!==null&&(r.splice(s,3),s-=3,Hm(y,{pending:!0,data:x,method:c.method,action:f},f,x))}}))}function qo(r){function s(F){return _f(F,r)}ri!==null&&_f(ri,r),ai!==null&&_f(ai,r),si!==null&&_f(si,r),Yc.forEach(s),Wc.forEach(s);for(var c=0;c<ii.length;c++){var f=ii[c];f.blockedOn===r&&(f.blockedOn=null)}for(;0<ii.length&&(c=ii[0],c.blockedOn===null);)LN(c),c.blockedOn===null&&ii.shift();if(c=(r.ownerDocument||r).$$reactFormReplay,c!=null)for(f=0;f<c.length;f+=3){var x=c[f],y=c[f+1],E=x[it]||null;if(typeof y=="function")E||IN(c);else if(E){var O=null;if(y&&y.hasAttribute("formAction")){if(x=y,E=y[it]||null)O=E.formAction;else if(Ug(x)!==null)continue}else O=E.action;typeof O=="function"?c[f+1]=O:(c.splice(f,3),f-=3),IN(c)}}}function zN(){function r(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(E){return x=E})},focusReset:"manual",scroll:"manual"})}function s(){x!==null&&(x(),x=null),f||setTimeout(c,20)}function c(){if(!f&&!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 f=!1,x=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(c,100),function(){f=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),x!==null&&(x(),x=null)}}}function qg(r){this._internalRoot=r}Tf.prototype.render=qg.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(a(409));var c=s.current,f=Er();AN(c,f,r,s,null,null)},Tf.prototype.unmount=qg.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;AN(r.current,2,null,r,null,null),lf(),s[zt]=null}};function Tf(r){this._internalRoot=r}Tf.prototype.unstable_scheduleHydration=function(r){if(r){var s=Ue();r={blockedOn:null,target:r,priority:s};for(var c=0;c<ii.length&&s!==0&&s<ii[c].priority;c++);ii.splice(c,0,r),c===0&&LN(r)}};var FN=t.version;if(FN!=="19.2.3")throw Error(a(527,FN,"19.2.3"));V.findDOMNode=function(r){var s=r._reactInternals;if(s===void 0)throw typeof r.render=="function"?Error(a(188)):(r=Object.keys(r).join(","),Error(a(268,r)));return r=p(s),r=r!==null?v(r):null,r=r===null?null:r.stateNode,r};var aI={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Rf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Rf.isDisabled&&Rf.supportsFiber)try{gt=Rf.inject(aI),xt=Rf}catch{}}return Zc.createRoot=function(r,s){if(!i(r))throw Error(a(299));var c=!1,f="",x=Kj,y=Yj,E=Wj;return s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(f=s.identifierPrefix),s.onUncaughtError!==void 0&&(x=s.onUncaughtError),s.onCaughtError!==void 0&&(y=s.onCaughtError),s.onRecoverableError!==void 0&&(E=s.onRecoverableError)),s=TN(r,1,!1,null,null,c,f,null,x,y,E,zN),r[zt]=s.current,Ng(r),new qg(s)},Zc.hydrateRoot=function(r,s,c){if(!i(r))throw Error(a(299));var f=!1,x="",y=Kj,E=Yj,O=Wj,F=null;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(x=c.identifierPrefix),c.onUncaughtError!==void 0&&(y=c.onUncaughtError),c.onCaughtError!==void 0&&(E=c.onCaughtError),c.onRecoverableError!==void 0&&(O=c.onRecoverableError),c.formState!==void 0&&(F=c.formState)),s=TN(r,1,!0,s,c??null,f,x,F,y,E,O,zN),s.context=RN(null),c=s.current,f=Er(),f=Le(f),x=$s(f),x.callback=null,Gs(c,x,f),c=f,s.current.lanes=c,ge(s,c),Aa(s),r[zt]=s.current,Ng(r),new Tf(s)},Zc.version="19.2.3",Zc}var XN;function mI(){if(XN)return Kg.exports;XN=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(),Kg.exports=pI(),Kg.exports}var gI=mI();var QN="popstate";function vI(e={}){function t(a,i){let{pathname:l,search:u,hash:d}=a.location;return Ib("",{pathname:l,search:u,hash:d},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(a,i){return typeof i=="string"?i:Eu(i)}return yI(t,n,null,e)}function pn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Qr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function xI(){return Math.random().toString(36).substring(2,10)}function ZN(e,t){return{usr:e.state,key:e.key,idx:t}}function Ib(e,t,n=null,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Dl(t):t,state:n,key:t&&t.key||a||xI()}}function Eu({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Dl(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function yI(e,t,n,a={}){let{window:i=document.defaultView,v5Compat:l=!1}=a,u=i.history,d="POP",h=null,p=v();p==null&&(p=0,u.replaceState({...u.state,idx:p},""));function v(){return(u.state||{idx:null}).idx}function m(){d="POP";let C=v(),N=C==null?null:C-p;p=C,h&&h({action:d,location:S.location,delta:N})}function b(C,N){d="PUSH";let _=Ib(S.location,C,N);p=v()+1;let T=ZN(_,p),R=S.createHref(_);try{u.pushState(T,"",R)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;i.location.assign(R)}l&&h&&h({action:d,location:S.location,delta:1})}function w(C,N){d="REPLACE";let _=Ib(S.location,C,N);p=v();let T=ZN(_,p),R=S.createHref(_);u.replaceState(T,"",R),l&&h&&h({action:d,location:S.location,delta:0})}function j(C){return bI(C)}let S={get action(){return d},get location(){return e(i,u)},listen(C){if(h)throw new Error("A history only accepts one active listener");return i.addEventListener(QN,m),h=C,()=>{i.removeEventListener(QN,m),h=null}},createHref(C){return t(i,C)},createURL:j,encodeLocation(C){let N=j(C);return{pathname:N.pathname,search:N.search,hash:N.hash}},push:b,replace:w,go(C){return u.go(C)}};return S}function bI(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),pn(n,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:Eu(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=n+a),new URL(a,n)}function EO(e,t,n="/"){return wI(e,t,n,!1)}function wI(e,t,n,a){let i=typeof t=="string"?Dl(t):t,l=Ss(i.pathname||"/",n);if(l==null)return null;let u=TO(e);SI(u);let d=null;for(let h=0;d==null&&h<u.length;++h){let p=DI(l);d=OI(u[h],p,a)}return d}function TO(e,t=[],n=[],a="",i=!1){let l=(u,d,h=i,p)=>{let v={relativePath:p===void 0?u.path||"":p,caseSensitive:u.caseSensitive===!0,childrenIndex:d,route:u};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(a)&&h)return;pn(v.relativePath.startsWith(a),`Absolute route path "${v.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(a.length)}let m=bs([a,v.relativePath]),b=n.concat(v);u.children&&u.children.length>0&&(pn(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),TO(u.children,t,b,m,h)),!(u.path==null&&!u.index)&&t.push({path:m,score:RI(m,u.index),routesMeta:b})};return e.forEach((u,d)=>{if(u.path===""||!u.path?.includes("?"))l(u,d);else for(let h of RO(u.path))l(u,d,!0,h)}),t}function RO(e){let t=e.split("/");if(t.length===0)return[];let[n,...a]=t,i=n.endsWith("?"),l=n.replace(/\?$/,"");if(a.length===0)return i?[l,""]:[l];let u=RO(a.join("/")),d=[];return d.push(...u.map(h=>h===""?l:[l,h].join("/"))),i&&d.push(...u),d.map(h=>e.startsWith("/")&&h===""?"/":h)}function SI(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:AI(t.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var jI=/^:[\w-]+$/,CI=3,NI=2,_I=1,EI=10,TI=-2,JN=e=>e==="*";function RI(e,t){let n=e.split("/"),a=n.length;return n.some(JN)&&(a+=TI),t&&(a+=NI),n.filter(i=>!JN(i)).reduce((i,l)=>i+(jI.test(l)?CI:l===""?_I:EI),a)}function AI(e,t){return e.length===t.length&&e.slice(0,-1).every((a,i)=>a===t[i])?e[e.length-1]-t[t.length-1]:0}function OI(e,t,n=!1){let{routesMeta:a}=e,i={},l="/",u=[];for(let d=0;d<a.length;++d){let h=a[d],p=d===a.length-1,v=l==="/"?t:t.slice(l.length)||"/",m=uh({path:h.relativePath,caseSensitive:h.caseSensitive,end:p},v),b=h.route;if(!m&&p&&n&&!a[a.length-1].route.index&&(m=uh({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},v)),!m)return null;Object.assign(i,m.params),u.push({params:i,pathname:bs([l,m.pathname]),pathnameBase:BI(bs([l,m.pathnameBase])),route:b}),m.pathnameBase!=="/"&&(l=bs([l,m.pathnameBase]))}return u}function uh(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=MI(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let l=i[0],u=l.replace(/(.)\/+$/,"$1"),d=i.slice(1);return{params:a.reduce((p,{paramName:v,isOptional:m},b)=>{if(v==="*"){let j=d[b]||"";u=l.slice(0,l.length-j.length).replace(/(.)\/+$/,"$1")}const w=d[b];return m&&!w?p[v]=void 0:p[v]=(w||"").replace(/%2F/g,"/"),p},{}),pathname:l,pathnameBase:u,pattern:e}}function MI(e,t=!1,n=!0){Qr(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 a=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,h)=>(a.push({paramName:d,isOptional:h!=null}),h?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),a]}function DI(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Qr(!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 Ss(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,a=e.charAt(n);return a&&a!=="/"?null:e.slice(n)||"/"}var AO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,PI=e=>AO.test(e);function kI(e,t="/"){let{pathname:n,search:a="",hash:i=""}=typeof e=="string"?Dl(e):e,l;if(n)if(PI(n))l=n;else{if(n.includes("//")){let u=n;n=n.replace(/\/\/+/g,"/"),Qr(!1,`Pathnames cannot have embedded double slashes - normalizing ${u} -> ${n}`)}n.startsWith("/")?l=e_(n.substring(1),"/"):l=e_(n,t)}else l=t;return{pathname:l,search:II(a),hash:zI(i)}}function e_(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Qg(e,t,n,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function LI(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function OO(e){let t=LI(e);return t.map((n,a)=>a===t.length-1?n.pathname:n.pathnameBase)}function MO(e,t,n,a=!1){let i;typeof e=="string"?i=Dl(e):(i={...e},pn(!i.pathname||!i.pathname.includes("?"),Qg("?","pathname","search",i)),pn(!i.pathname||!i.pathname.includes("#"),Qg("#","pathname","hash",i)),pn(!i.search||!i.search.includes("#"),Qg("#","search","hash",i)));let l=e===""||i.pathname==="",u=l?"/":i.pathname,d;if(u==null)d=n;else{let m=t.length-1;if(!a&&u.startsWith("..")){let b=u.split("/");for(;b[0]==="..";)b.shift(),m-=1;i.pathname=b.join("/")}d=m>=0?t[m]:"/"}let h=kI(i,d),p=u&&u!=="/"&&u.endsWith("/"),v=(l||u===".")&&n.endsWith("/");return!h.pathname.endsWith("/")&&(p||v)&&(h.pathname+="/"),h}var bs=e=>e.join("/").replace(/\/\/+/g,"/"),BI=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),II=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,zI=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,FI=class{constructor(e,t,n,a=!1){this.status=e,this.statusText=t||"",this.internal=a,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function HI(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function UI(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var DO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function PO(e,t){let n=e;if(typeof n!="string"||!AO.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=n,i=!1;if(DO)try{let l=new URL(window.location.href),u=n.startsWith("//")?new URL(l.protocol+n):new URL(n),d=Ss(u.pathname,t);u.origin===l.origin&&d!=null?n=d+u.search+u.hash:i=!0}catch{Qr(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var kO=["POST","PUT","PATCH","DELETE"];new Set(kO);var VI=["GET",...kO];new Set(VI);var Pl=g.createContext(null);Pl.displayName="DataRouter";var Fh=g.createContext(null);Fh.displayName="DataRouterState";var qI=g.createContext(!1),LO=g.createContext({isTransitioning:!1});LO.displayName="ViewTransition";var $I=g.createContext(new Map);$I.displayName="Fetchers";var GI=g.createContext(null);GI.displayName="Await";var ea=g.createContext(null);ea.displayName="Navigation";var Ku=g.createContext(null);Ku.displayName="Location";var qa=g.createContext({outlet:null,matches:[],isDataRoute:!1});qa.displayName="Route";var Y0=g.createContext(null);Y0.displayName="RouteError";var BO="REACT_ROUTER_ERROR",KI="REDIRECT",YI="ROUTE_ERROR_RESPONSE";function WI(e){if(e.startsWith(`${BO}:${KI}:{`))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 XI(e){if(e.startsWith(`${BO}:${YI}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new FI(t.status,t.statusText,t.data)}catch{}}function QI(e,{relative:t}={}){pn(Yu(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=g.useContext(ea),{hash:i,pathname:l,search:u}=Wu(e,{relative:t}),d=l;return n!=="/"&&(d=l==="/"?n:bs([n,l])),a.createHref({pathname:d,search:u,hash:i})}function Yu(){return g.useContext(Ku)!=null}function Es(){return pn(Yu(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(Ku).location}var IO="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function zO(e){g.useContext(ea).static||g.useLayoutEffect(e)}function kl(){let{isDataRoute:e}=g.useContext(qa);return e?d6():ZI()}function ZI(){pn(Yu(),"useNavigate() may be used only in the context of a <Router> component.");let e=g.useContext(Pl),{basename:t,navigator:n}=g.useContext(ea),{matches:a}=g.useContext(qa),{pathname:i}=Es(),l=JSON.stringify(OO(a)),u=g.useRef(!1);return zO(()=>{u.current=!0}),g.useCallback((h,p={})=>{if(Qr(u.current,IO),!u.current)return;if(typeof h=="number"){n.go(h);return}let v=MO(h,JSON.parse(l),i,p.relative==="path");e==null&&t!=="/"&&(v.pathname=v.pathname==="/"?t:bs([t,v.pathname])),(p.replace?n.replace:n.push)(v,p.state,p)},[t,n,l,i,e])}var FO=g.createContext(null);function HO(){return g.useContext(FO)}function JI(e){let t=g.useContext(qa).outlet;return g.useMemo(()=>t&&g.createElement(FO.Provider,{value:e},t),[t,e])}function Wu(e,{relative:t}={}){let{matches:n}=g.useContext(qa),{pathname:a}=Es(),i=JSON.stringify(OO(n));return g.useMemo(()=>MO(e,JSON.parse(i),a,t==="path"),[e,i,a,t])}function e6(e,t){return UO(e,t)}function UO(e,t,n,a,i){pn(Yu(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:l}=g.useContext(ea),{matches:u}=g.useContext(qa),d=u[u.length-1],h=d?d.params:{},p=d?d.pathname:"/",v=d?d.pathnameBase:"/",m=d&&d.route;{let _=m&&m.path||"";qO(p,!m||_.endsWith("*")||_.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${_}">) 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.
  10. Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}/*`}">.`)}let b=Es(),w;if(t){let _=typeof t=="string"?Dl(t):t;pn(v==="/"||_.pathname?.startsWith(v),`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 "${v}" but pathname "${_.pathname}" was given in the \`location\` prop.`),w=_}else w=b;let j=w.pathname||"/",S=j;if(v!=="/"){let _=v.replace(/^\//,"").split("/");S="/"+j.replace(/^\//,"").split("/").slice(_.length).join("/")}let C=EO(e,{pathname:S});Qr(m||C!=null,`No routes matched location "${w.pathname}${w.search}${w.hash}" `),Qr(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${w.pathname}${w.search}${w.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 N=s6(C&&C.map(_=>Object.assign({},_,{params:Object.assign({},h,_.params),pathname:bs([v,l.encodeLocation?l.encodeLocation(_.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?v:bs([v,l.encodeLocation?l.encodeLocation(_.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathnameBase])})),u,n,a,i);return t&&N?g.createElement(Ku.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...w},navigationType:"POP"}},N):N}function t6(){let e=u6(),t=HI(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:a},l={padding:"2px 4px",backgroundColor:a},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=g.createElement(g.Fragment,null,g.createElement("p",null,"💿 Hey developer 👋"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:l},"ErrorBoundary")," or"," ",g.createElement("code",{style:l},"errorElement")," prop on your route.")),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),n?g.createElement("pre",{style:i},n):null,u)}var n6=g.createElement(t6,null),VO=class extends g.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 n=XI(e.digest);n&&(e=n)}let t=e!==void 0?g.createElement(qa.Provider,{value:this.props.routeContext},g.createElement(Y0.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?g.createElement(r6,{error:e},t):t}};VO.contextType=qI;var Zg=new WeakMap;function r6({children:e,error:t}){let{basename:n}=g.useContext(ea);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=WI(t.digest);if(a){let i=Zg.get(t);if(i)throw i;let l=PO(a.location,n);if(DO&&!Zg.get(t))if(l.isExternal||a.reloadDocument)window.location.href=l.absoluteURL||l.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:a.replace}));throw Zg.set(t,u),u}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function a6({routeContext:e,match:t,children:n}){let a=g.useContext(Pl);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(qa.Provider,{value:e},n)}function s6(e,t=[],n=null,a=null,i=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let l=e,u=n?.errors;if(u!=null){let v=l.findIndex(m=>m.route.id&&u?.[m.route.id]!==void 0);pn(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),l=l.slice(0,Math.min(l.length,v+1))}let d=!1,h=-1;if(n)for(let v=0;v<l.length;v++){let m=l[v];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(h=v),m.route.id){let{loaderData:b,errors:w}=n,j=m.route.loader&&!b.hasOwnProperty(m.route.id)&&(!w||w[m.route.id]===void 0);if(m.route.lazy||j){d=!0,h>=0?l=l.slice(0,h+1):l=[l[0]];break}}}let p=n&&a?(v,m)=>{a(v,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:UI(n.matches),errorInfo:m})}:void 0;return l.reduceRight((v,m,b)=>{let w,j=!1,S=null,C=null;n&&(w=u&&m.route.id?u[m.route.id]:void 0,S=m.route.errorElement||n6,d&&(h<0&&b===0?(qO("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),j=!0,C=null):h===b&&(j=!0,C=m.route.hydrateFallbackElement||null)));let N=t.concat(l.slice(0,b+1)),_=()=>{let T;return w?T=S:j?T=C:m.route.Component?T=g.createElement(m.route.Component,null):m.route.element?T=m.route.element:T=v,g.createElement(a6,{match:m,routeContext:{outlet:v,matches:N,isDataRoute:n!=null},children:T})};return n&&(m.route.ErrorBoundary||m.route.errorElement||b===0)?g.createElement(VO,{location:n.location,revalidation:n.revalidation,component:S,error:w,children:_(),routeContext:{outlet:null,matches:N,isDataRoute:!0},onError:p}):_()},null)}function W0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function i6(e){let t=g.useContext(Pl);return pn(t,W0(e)),t}function o6(e){let t=g.useContext(Fh);return pn(t,W0(e)),t}function l6(e){let t=g.useContext(qa);return pn(t,W0(e)),t}function X0(e){let t=l6(e),n=t.matches[t.matches.length-1];return pn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function c6(){return X0("useRouteId")}function u6(){let e=g.useContext(Y0),t=o6("useRouteError"),n=X0("useRouteError");return e!==void 0?e:t.errors?.[n]}function d6(){let{router:e}=i6("useNavigate"),t=X0("useNavigate"),n=g.useRef(!1);return zO(()=>{n.current=!0}),g.useCallback(async(i,l={})=>{Qr(n.current,IO),n.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:t,...l}))},[e,t])}var t_={};function qO(e,t,n){!t&&!t_[e]&&(t_[e]=!0,Qr(!1,n))}g.memo(f6);function f6({routes:e,future:t,state:n,onError:a}){return UO(e,void 0,n,a,t)}function h6(e){return JI(e.context)}function Ma(e){pn(!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 p6({basename:e="/",children:t=null,location:n,navigationType:a="POP",navigator:i,static:l=!1,unstable_useTransitions:u}){pn(!Yu(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),h=g.useMemo(()=>({basename:d,navigator:i,static:l,unstable_useTransitions:u,future:{}}),[d,i,l,u]);typeof n=="string"&&(n=Dl(n));let{pathname:p="/",search:v="",hash:m="",state:b=null,key:w="default"}=n,j=g.useMemo(()=>{let S=Ss(p,d);return S==null?null:{location:{pathname:S,search:v,hash:m,state:b,key:w},navigationType:a}},[d,p,v,m,b,w,a]);return Qr(j!=null,`<Router basename="${d}"> is not able to match the URL "${p}${v}${m}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:g.createElement(ea.Provider,{value:h},g.createElement(Ku.Provider,{children:t,value:j}))}function m6({children:e,location:t}){return e6(zb(e),t)}function zb(e,t=[]){let n=[];return g.Children.forEach(e,(a,i)=>{if(!g.isValidElement(a))return;let l=[...t,i];if(a.type===g.Fragment){n.push.apply(n,zb(a.props.children,l));return}pn(a.type===Ma,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),pn(!a.props.index||!a.props.children,"An index route cannot have child routes.");let u={id:a.props.id||l.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(u.children=zb(a.props.children,l)),n.push(u)}),n}var Qf="get",Zf="application/x-www-form-urlencoded";function Hh(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function g6(e){return Hh(e)&&e.tagName.toLowerCase()==="button"}function v6(e){return Hh(e)&&e.tagName.toLowerCase()==="form"}function x6(e){return Hh(e)&&e.tagName.toLowerCase()==="input"}function y6(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function b6(e,t){return e.button===0&&(!t||t==="_self")&&!y6(e)}function Fb(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let a=e[n];return t.concat(Array.isArray(a)?a.map(i=>[n,i]):[[n,a]])},[]))}function w6(e,t){let n=Fb(e);return t&&t.forEach((a,i)=>{n.has(i)||t.getAll(i).forEach(l=>{n.append(i,l)})}),n}var Of=null;function S6(){if(Of===null)try{new FormData(document.createElement("form"),0),Of=!1}catch{Of=!0}return Of}var j6=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Jg(e){return e!=null&&!j6.has(e)?(Qr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Zf}"`),null):e}function C6(e,t){let n,a,i,l,u;if(v6(e)){let d=e.getAttribute("action");a=d?Ss(d,t):null,n=e.getAttribute("method")||Qf,i=Jg(e.getAttribute("enctype"))||Zf,l=new FormData(e)}else if(g6(e)||x6(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(a=h?Ss(h,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||Qf,i=Jg(e.getAttribute("formenctype"))||Jg(d.getAttribute("enctype"))||Zf,l=new FormData(d,e),!S6()){let{name:p,type:v,value:m}=e;if(v==="image"){let b=p?`${p}.`:"";l.append(`${b}x`,"0"),l.append(`${b}y`,"0")}else p&&l.append(p,m)}}else{if(Hh(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Qf,a=null,i=Zf,u=e}return l&&i==="text/plain"&&(u=l,l=void 0),{action:a,method:n.toLowerCase(),encType:i,formData:l,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Q0(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function N6(e,t,n,a){let i=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${a}`:i.pathname=`${i.pathname}.${a}`:i.pathname==="/"?i.pathname=`_root.${a}`:t&&Ss(i.pathname,t)==="/"?i.pathname=`${t.replace(/\/$/,"")}/_root.${a}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${a}`,i}async function _6(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function E6(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 T6(e,t,n){let a=await Promise.all(e.map(async i=>{let l=t.routes[i.route.id];if(l){let u=await _6(l,n);return u.links?u.links():[]}return[]}));return M6(a.flat(1).filter(E6).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function n_(e,t,n,a,i,l){let u=(h,p)=>n[p]?h.route.id!==n[p].route.id:!0,d=(h,p)=>n[p].pathname!==h.pathname||n[p].route.path?.endsWith("*")&&n[p].params["*"]!==h.params["*"];return l==="assets"?t.filter((h,p)=>u(h,p)||d(h,p)):l==="data"?t.filter((h,p)=>{let v=a.routes[h.route.id];if(!v||!v.hasLoader)return!1;if(u(h,p)||d(h,p))return!0;if(h.route.shouldRevalidate){let m=h.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function R6(e,t,{includeHydrateFallback:n}={}){return A6(e.map(a=>{let i=t.routes[a.route.id];if(!i)return[];let l=[i.module];return i.clientActionModule&&(l=l.concat(i.clientActionModule)),i.clientLoaderModule&&(l=l.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(l=l.concat(i.hydrateFallbackModule)),i.imports&&(l=l.concat(i.imports)),l}).flat(1))}function A6(e){return[...new Set(e)]}function O6(e){let t={},n=Object.keys(e).sort();for(let a of n)t[a]=e[a];return t}function M6(e,t){let n=new Set;return new Set(t),e.reduce((a,i)=>{let l=JSON.stringify(O6(i));return n.has(l)||(n.add(l),a.push({key:l,link:i})),a},[])}function $O(){let e=g.useContext(Pl);return Q0(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function D6(){let e=g.useContext(Fh);return Q0(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Z0=g.createContext(void 0);Z0.displayName="FrameworkContext";function GO(){let e=g.useContext(Z0);return Q0(e,"You must render this element inside a <HydratedRouter> element"),e}function P6(e,t){let n=g.useContext(Z0),[a,i]=g.useState(!1),[l,u]=g.useState(!1),{onFocus:d,onBlur:h,onMouseEnter:p,onMouseLeave:v,onTouchStart:m}=t,b=g.useRef(null);g.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let S=N=>{N.forEach(_=>{u(_.isIntersecting)})},C=new IntersectionObserver(S,{threshold:.5});return b.current&&C.observe(b.current),()=>{C.disconnect()}}},[e]),g.useEffect(()=>{if(a){let S=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(S)}}},[a]);let w=()=>{i(!0)},j=()=>{i(!1),u(!1)};return n?e!=="intent"?[l,b,{}]:[l,b,{onFocus:Jc(d,w),onBlur:Jc(h,j),onMouseEnter:Jc(p,w),onMouseLeave:Jc(v,j),onTouchStart:Jc(m,w)}]:[!1,b,{}]}function Jc(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function k6({page:e,...t}){let{router:n}=$O(),a=g.useMemo(()=>EO(n.routes,e,n.basename),[n.routes,e,n.basename]);return a?g.createElement(B6,{page:e,matches:a,...t}):null}function L6(e){let{manifest:t,routeModules:n}=GO(),[a,i]=g.useState([]);return g.useEffect(()=>{let l=!1;return T6(e,t,n).then(u=>{l||i(u)}),()=>{l=!0}},[e,t,n]),a}function B6({page:e,matches:t,...n}){let a=Es(),{future:i,manifest:l,routeModules:u}=GO(),{basename:d}=$O(),{loaderData:h,matches:p}=D6(),v=g.useMemo(()=>n_(e,t,p,l,a,"data"),[e,t,p,l,a]),m=g.useMemo(()=>n_(e,t,p,l,a,"assets"),[e,t,p,l,a]),b=g.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let S=new Set,C=!1;if(t.forEach(_=>{let T=l.routes[_.route.id];!T||!T.hasLoader||(!v.some(R=>R.route.id===_.route.id)&&_.route.id in h&&u[_.route.id]?.shouldRevalidate||T.hasClientLoader?C=!0:S.add(_.route.id))}),S.size===0)return[];let N=N6(e,d,i.unstable_trailingSlashAwareDataRequests,"data");return C&&S.size>0&&N.searchParams.set("_routes",t.filter(_=>S.has(_.route.id)).map(_=>_.route.id).join(",")),[N.pathname+N.search]},[d,i.unstable_trailingSlashAwareDataRequests,h,a,l,v,t,e,u]),w=g.useMemo(()=>R6(m,l),[m,l]),j=L6(m);return g.createElement(g.Fragment,null,b.map(S=>g.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...n})),w.map(S=>g.createElement("link",{key:S,rel:"modulepreload",href:S,...n})),j.map(({key:S,link:C})=>g.createElement("link",{key:S,nonce:n.nonce,...C})))}function I6(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var z6=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{z6&&(window.__reactRouterVersion="7.12.0")}catch{}function F6({basename:e,children:t,unstable_useTransitions:n,window:a}){let i=g.useRef();i.current==null&&(i.current=vI({window:a,v5Compat:!0}));let l=i.current,[u,d]=g.useState({action:l.action,location:l.location}),h=g.useCallback(p=>{n===!1?d(p):g.startTransition(()=>d(p))},[n]);return g.useLayoutEffect(()=>l.listen(h),[l,h]),g.createElement(p6,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:l,unstable_useTransitions:n})}var KO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,pi=g.forwardRef(function({onClick:t,discover:n="render",prefetch:a="none",relative:i,reloadDocument:l,replace:u,state:d,target:h,to:p,preventScrollReset:v,viewTransition:m,unstable_defaultShouldRevalidate:b,...w},j){let{basename:S,unstable_useTransitions:C}=g.useContext(ea),N=typeof p=="string"&&KO.test(p),_=PO(p,S);p=_.to;let T=QI(p,{relative:i}),[R,D,L]=P6(a,w),k=q6(p,{replace:u,state:d,target:h,preventScrollReset:v,relative:i,viewTransition:m,unstable_defaultShouldRevalidate:b,unstable_useTransitions:C});function P(J){t&&t(J),J.defaultPrevented||k(J)}let U=g.createElement("a",{...w,...L,href:_.absoluteURL||T,onClick:_.isExternal||l?t:P,ref:I6(j,D),target:h,"data-discover":!N&&n==="render"?"true":void 0});return R&&!N?g.createElement(g.Fragment,null,U,g.createElement(k6,{page:T})):U});pi.displayName="Link";var H6=g.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:a="",end:i=!1,style:l,to:u,viewTransition:d,children:h,...p},v){let m=Wu(u,{relative:p.relative}),b=Es(),w=g.useContext(Fh),{navigator:j,basename:S}=g.useContext(ea),C=w!=null&&X6(m)&&d===!0,N=j.encodeLocation?j.encodeLocation(m).pathname:m.pathname,_=b.pathname,T=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;n||(_=_.toLowerCase(),T=T?T.toLowerCase():null,N=N.toLowerCase()),T&&S&&(T=Ss(T,S)||T);const R=N!=="/"&&N.endsWith("/")?N.length-1:N.length;let D=_===N||!i&&_.startsWith(N)&&_.charAt(R)==="/",L=T!=null&&(T===N||!i&&T.startsWith(N)&&T.charAt(N.length)==="/"),k={isActive:D,isPending:L,isTransitioning:C},P=D?t:void 0,U;typeof a=="function"?U=a(k):U=[a,D?"active":null,L?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let J=typeof l=="function"?l(k):l;return g.createElement(pi,{...p,"aria-current":P,className:U,ref:v,style:J,to:u,viewTransition:d},typeof h=="function"?h(k):h)});H6.displayName="NavLink";var U6=g.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:i,state:l,method:u=Qf,action:d,onSubmit:h,relative:p,preventScrollReset:v,viewTransition:m,unstable_defaultShouldRevalidate:b,...w},j)=>{let{unstable_useTransitions:S}=g.useContext(ea),C=Y6(),N=W6(d,{relative:p}),_=u.toLowerCase()==="get"?"get":"post",T=typeof d=="string"&&KO.test(d),R=D=>{if(h&&h(D),D.defaultPrevented)return;D.preventDefault();let L=D.nativeEvent.submitter,k=L?.getAttribute("formmethod")||u,P=()=>C(L||D.currentTarget,{fetcherKey:t,method:k,navigate:n,replace:i,state:l,relative:p,preventScrollReset:v,viewTransition:m,unstable_defaultShouldRevalidate:b});S&&n!==!1?g.startTransition(()=>P()):P()};return g.createElement("form",{ref:j,method:_,action:N,onSubmit:a?h:R,...w,"data-discover":!T&&e==="render"?"true":void 0})});U6.displayName="Form";function V6(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function YO(e){let t=g.useContext(Pl);return pn(t,V6(e)),t}function q6(e,{target:t,replace:n,state:a,preventScrollReset:i,relative:l,viewTransition:u,unstable_defaultShouldRevalidate:d,unstable_useTransitions:h}={}){let p=kl(),v=Es(),m=Wu(e,{relative:l});return g.useCallback(b=>{if(b6(b,t)){b.preventDefault();let w=n!==void 0?n:Eu(v)===Eu(m),j=()=>p(e,{replace:w,state:a,preventScrollReset:i,relative:l,viewTransition:u,unstable_defaultShouldRevalidate:d});h?g.startTransition(()=>j()):j()}},[v,p,m,n,a,t,e,i,l,u,d,h])}function $6(e){Qr(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=g.useRef(Fb(e)),n=g.useRef(!1),a=Es(),i=g.useMemo(()=>w6(a.search,n.current?null:t.current),[a.search]),l=kl(),u=g.useCallback((d,h)=>{const p=Fb(typeof d=="function"?d(new URLSearchParams(i)):d);n.current=!0,l("?"+p,h)},[l,i]);return[i,u]}var G6=0,K6=()=>`__${String(++G6)}__`;function Y6(){let{router:e}=YO("useSubmit"),{basename:t}=g.useContext(ea),n=c6(),a=e.fetch,i=e.navigate;return g.useCallback(async(l,u={})=>{let{action:d,method:h,encType:p,formData:v,body:m}=C6(l,t);if(u.navigate===!1){let b=u.fetcherKey||K6();await a(b,n,u.action||d,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:m,formMethod:u.method||h,formEncType:u.encType||p,flushSync:u.flushSync})}else await i(u.action||d,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:m,formMethod:u.method||h,formEncType:u.encType||p,replace:u.replace,state:u.state,fromRouteId:n,flushSync:u.flushSync,viewTransition:u.viewTransition})},[a,i,t,n])}function W6(e,{relative:t}={}){let{basename:n}=g.useContext(ea),a=g.useContext(qa);pn(a,"useFormAction must be used inside a RouteContext");let[i]=a.matches.slice(-1),l={...Wu(e||".",{relative:t})},u=Es();if(e==null){l.search=u.search;let d=new URLSearchParams(l.search),h=d.getAll("index");if(h.some(v=>v==="")){d.delete("index"),h.filter(m=>m).forEach(m=>d.append("index",m));let v=d.toString();l.search=v?`?${v}`:""}}return(!e||e===".")&&i.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(l.pathname=l.pathname==="/"?n:bs([n,l.pathname])),Eu(l)}function X6(e,{relative:t}={}){let n=g.useContext(LO);pn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=YO("useViewTransitionState"),i=Wu(e,{relative:t});if(!n.isTransitioning)return!1;let l=Ss(n.currentLocation.pathname,a)||n.currentLocation.pathname,u=Ss(n.nextLocation.pathname,a)||n.nextLocation.pathname;return uh(i.pathname,u)!=null||uh(i.pathname,l)!=null}var ka=_O();const WO=Ml(ka);var Uh=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Q6={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Z6=class{#e=Q6;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},Hb=new Z6;function J6(e){setTimeout(e,0)}var Vh=typeof window>"u"||"Deno"in globalThis;function ca(){}function ez(e,t){return typeof e=="function"?e(t):e}function tz(e){return typeof e=="number"&&e>=0&&e!==1/0}function nz(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ub(e,t){return typeof e=="function"?e(t):e}function rz(e,t){return typeof e=="function"?e(t):e}function r_(e,t){const{type:n="all",exact:a,fetchStatus:i,predicate:l,queryKey:u,stale:d}=e;if(u){if(a){if(t.queryHash!==J0(u,t.options))return!1}else if(!Ru(t.queryKey,u))return!1}if(n!=="all"){const h=t.isActive();if(n==="active"&&!h||n==="inactive"&&h)return!1}return!(typeof d=="boolean"&&t.isStale()!==d||i&&i!==t.state.fetchStatus||l&&!l(t))}function a_(e,t){const{exact:n,status:a,predicate:i,mutationKey:l}=e;if(l){if(!t.options.mutationKey)return!1;if(n){if(Tu(t.options.mutationKey)!==Tu(l))return!1}else if(!Ru(t.options.mutationKey,l))return!1}return!(a&&t.state.status!==a||i&&!i(t))}function J0(e,t){return(t?.queryKeyHashFn||Tu)(e)}function Tu(e){return JSON.stringify(e,(t,n)=>Vb(n)?Object.keys(n).sort().reduce((a,i)=>(a[i]=n[i],a),{}):n)}function Ru(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Ru(e[n],t[n])):!1}var az=Object.prototype.hasOwnProperty;function XO(e,t){if(e===t)return e;const n=s_(e)&&s_(t);if(!n&&!(Vb(e)&&Vb(t)))return t;const i=(n?e:Object.keys(e)).length,l=n?t:Object.keys(t),u=l.length,d=n?new Array(u):{};let h=0;for(let p=0;p<u;p++){const v=n?p:l[p],m=e[v],b=t[v];if(m===b){d[v]=m,(n?p<i:az.call(e,v))&&h++;continue}if(m===null||b===null||typeof m!="object"||typeof b!="object"){d[v]=b;continue}const w=XO(m,b);d[v]=w,w===m&&h++}return i===u&&h===i?e:d}function s_(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Vb(e){if(!i_(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!i_(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function i_(e){return Object.prototype.toString.call(e)==="[object Object]"}function sz(e){return new Promise(t=>{Hb.setTimeout(t,e)})}function iz(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?XO(e,t):t}function oz(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function lz(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var ew=Symbol();function QO(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ew?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function cz(e,t,n){let a=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),a||(a=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),e}var uz=class extends Uh{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!Vh&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},ZO=new uz;function dz(){let e,t;const n=new Promise((i,l)=>{e=i,t=l});n.status="pending",n.catch(()=>{});function a(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{a({status:"fulfilled",value:i}),e(i)},n.reject=i=>{a({status:"rejected",reason:i}),t(i)},n}var fz=J6;function hz(){let e=[],t=0,n=d=>{d()},a=d=>{d()},i=fz;const l=d=>{t?e.push(d):i(()=>{n(d)})},u=()=>{const d=e;e=[],d.length&&i(()=>{a(()=>{d.forEach(h=>{n(h)})})})};return{batch:d=>{let h;t++;try{h=d()}finally{t--,t||u()}return h},batchCalls:d=>(...h)=>{l(()=>{d(...h)})},schedule:l,setNotifyFunction:d=>{n=d},setBatchNotifyFunction:d=>{a=d},setScheduler:d=>{i=d}}}var tr=hz(),pz=class extends Uh{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!Vh&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},dh=new pz;function mz(e){return Math.min(1e3*2**e,3e4)}function JO(e){return(e??"online")==="online"?dh.isOnline():!0}var qb=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function eM(e){let t=!1,n=0,a;const i=dz(),l=()=>i.status!=="pending",u=S=>{if(!l()){const C=new qb(S);b(C),e.onCancel?.(C)}},d=()=>{t=!0},h=()=>{t=!1},p=()=>ZO.isFocused()&&(e.networkMode==="always"||dh.isOnline())&&e.canRun(),v=()=>JO(e.networkMode)&&e.canRun(),m=S=>{l()||(a?.(),i.resolve(S))},b=S=>{l()||(a?.(),i.reject(S))},w=()=>new Promise(S=>{a=C=>{(l()||p())&&S(C)},e.onPause?.()}).then(()=>{a=void 0,l()||e.onContinue?.()}),j=()=>{if(l())return;let S;const C=n===0?e.initialPromise:void 0;try{S=C??e.fn()}catch(N){S=Promise.reject(N)}Promise.resolve(S).then(m).catch(N=>{if(l())return;const _=e.retry??(Vh?0:3),T=e.retryDelay??mz,R=typeof T=="function"?T(n,N):T,D=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,N);if(t||!D){b(N);return}n++,e.onFail?.(n,N),sz(R).then(()=>p()?void 0:w()).then(()=>{t?b(N):j()})})};return{promise:i,status:()=>i.status,cancel:u,continue:()=>(a?.(),i),cancelRetry:d,continueRetry:h,canStart:v,start:()=>(v()?j():w().then(j),i)}}var tM=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),tz(this.gcTime)&&(this.#e=Hb.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Vh?1/0:300*1e3))}clearGcTimeout(){this.#e&&(Hb.clearTimeout(this.#e),this.#e=void 0)}},gz=class extends tM{#e;#t;#n;#a;#r;#i;#o;constructor(e){super(),this.#o=!1,this.#i=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#a=e.client,this.#n=this.#a.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=l_(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#i,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=l_(this.options);t.data!==void 0&&(this.setState(o_(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=iz(this.state.data,e,this.options);return this.#s({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#s({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(ca).catch(ca):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>rz(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ew||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Ub(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!nz(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#o?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const d=this.observers.find(h=>h.options.queryFn);d&&this.setOptions(d.options)}const n=new AbortController,a=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{const d=QO(this.options,t),p=(()=>{const v={client:this.#a,queryKey:this.queryKey,meta:this.meta};return a(v),v})();return this.#o=!1,this.options.persister?this.options.persister(d,p,this):d(p)},u=(()=>{const d={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#a,state:this.state,fetchFn:i};return a(d),d})();this.options.behavior?.onFetch(u,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==u.fetchOptions?.meta)&&this.#s({type:"fetch",meta:u.fetchOptions?.meta}),this.#r=eM({initialPromise:t?.initialPromise,fn:u.fetchFn,onCancel:d=>{d instanceof qb&&d.revert&&this.setState({...this.#t,fetchStatus:"idle"}),n.abort()},onFail:(d,h)=>{this.#s({type:"failed",failureCount:d,error:h})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0});try{const d=await this.#r.start();if(d===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(d),this.#n.config.onSuccess?.(d,this),this.#n.config.onSettled?.(d,this.state.error,this),d}catch(d){if(d instanceof qb){if(d.silent)return this.#r.promise;if(d.revert){if(this.state.data===void 0)throw d;return this.state.data}}throw this.#s({type:"error",error:d}),this.#n.config.onError?.(d,this),this.#n.config.onSettled?.(this.state.data,d,this),d}finally{this.scheduleGc()}}#s(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...vz(n.data,this.options),fetchMeta:e.meta??null};case"success":const a={...n,...o_(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?a:void 0,a;case"error":const i=e.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),tr.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function vz(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:JO(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function o_(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function l_(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,a=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}function c_(e){return{onFetch:(t,n)=>{const a=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,l=t.state.data?.pages||[],u=t.state.data?.pageParams||[];let d={pages:[],pageParams:[]},h=0;const p=async()=>{let v=!1;const m=j=>{cz(j,()=>t.signal,()=>v=!0)},b=QO(t.options,t.fetchOptions),w=async(j,S,C)=>{if(v)return Promise.reject();if(S==null&&j.pages.length)return Promise.resolve(j);const _=(()=>{const L={client:t.client,queryKey:t.queryKey,pageParam:S,direction:C?"backward":"forward",meta:t.options.meta};return m(L),L})(),T=await b(_),{maxPages:R}=t.options,D=C?lz:oz;return{pages:D(j.pages,T,R),pageParams:D(j.pageParams,S,R)}};if(i&&l.length){const j=i==="backward",S=j?xz:u_,C={pages:l,pageParams:u},N=S(a,C);d=await w(C,N,j)}else{const j=e??l.length;do{const S=h===0?u[0]??a.initialPageParam:u_(a,d);if(h>0&&S==null)break;d=await w(d,S),h++}while(h<j)}return d};t.options.persister?t.fetchFn=()=>t.options.persister?.(p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=p}}}function u_(e,{pages:t,pageParams:n}){const a=t.length-1;return t.length>0?e.getNextPageParam(t[a],t,n[a],n):void 0}function xz(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var yz=class extends tM{#e;#t;#n;#a;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||bz(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#a?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#r({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#a=eM({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(l,u)=>{this.#r({type:"failed",failureCount:l,error:u})},onPause:()=>{this.#r({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const a=this.state.status==="pending",i=!this.#a.canStart();try{if(a)t();else{this.#r({type:"pending",variables:e,isPaused:i}),await this.#n.config.onMutate?.(e,this,n);const u=await this.options.onMutate?.(e,n);u!==this.state.context&&this.#r({type:"pending",context:u,variables:e,isPaused:i})}const l=await this.#a.start();return await this.#n.config.onSuccess?.(l,e,this.state.context,this,n),await this.options.onSuccess?.(l,e,this.state.context,n),await this.#n.config.onSettled?.(l,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(l,null,e,this.state.context,n),this.#r({type:"success",data:l}),l}catch(l){try{await this.#n.config.onError?.(l,e,this.state.context,this,n)}catch(u){Promise.reject(u)}try{await this.options.onError?.(l,e,this.state.context,n)}catch(u){Promise.reject(u)}try{await this.#n.config.onSettled?.(void 0,l,this.state.variables,this.state.context,this,n)}catch(u){Promise.reject(u)}try{await this.options.onSettled?.(void 0,l,e,this.state.context,n)}catch(u){Promise.reject(u)}throw this.#r({type:"error",error:l}),l}finally{this.#n.runNext(this)}}#r(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),tr.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function bz(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var wz=class extends Uh{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const a=new yz({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(a),a}add(e){this.#e.add(e);const t=Mf(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Mf(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const a=n.indexOf(e);a!==-1&&n.splice(a,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Mf(e);if(typeof t=="string"){const a=this.#t.get(t)?.find(i=>i.state.status==="pending");return!a||a===e}else return!0}runNext(e){const t=Mf(e);return typeof t=="string"?this.#t.get(t)?.find(a=>a!==e&&a.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){tr.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>a_(t,n))}findAll(e={}){return this.getAll().filter(t=>a_(e,t))}notify(e){tr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return tr.batch(()=>Promise.all(e.map(t=>t.continue().catch(ca))))}};function Mf(e){return e.options.scope?.id}var Sz=class extends Uh{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const a=t.queryKey,i=t.queryHash??J0(a,t);let l=this.get(i);return l||(l=new gz({client:e,queryKey:a,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(a)}),this.add(l)),l}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){tr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>r_(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>r_(e,n)):t}notify(e){tr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){tr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){tr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},jz=class{#e;#t;#n;#a;#r;#i;#o;#s;constructor(e={}){this.#e=e.queryCache||new Sz,this.#t=e.mutationCache||new wz,this.#n=e.defaultOptions||{},this.#a=new Map,this.#r=new Map,this.#i=0}mount(){this.#i++,this.#i===1&&(this.#o=ZO.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=dh.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#i--,this.#i===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),a=n.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ub(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const a=n.data;return[t,a]})}setQueryData(e,t,n){const a=this.defaultQueryOptions({queryKey:e}),l=this.#e.get(a.queryHash)?.state.data,u=ez(t,l);if(u!==void 0)return this.#e.build(this,a).setData(u,{...n,manual:!0})}setQueriesData(e,t,n){return tr.batch(()=>this.#e.findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;tr.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return tr.batch(()=>(n.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},a=tr.batch(()=>this.#e.findAll(e).map(i=>i.cancel(n)));return Promise.all(a).then(ca).catch(ca)}invalidateQueries(e,t={}){return tr.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},a=tr.batch(()=>this.#e.findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let l=i.fetch(void 0,n);return n.throwOnError||(l=l.catch(ca)),i.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(a).then(ca)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(Ub(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ca).catch(ca)}fetchInfiniteQuery(e){return e.behavior=c_(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ca).catch(ca)}ensureInfiniteQueryData(e){return e.behavior=c_(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return dh.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#a.set(Tu(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#a.values()],n={};return t.forEach(a=>{Ru(e,a.queryKey)&&Object.assign(n,a.defaultOptions)}),n}setMutationDefaults(e,t){this.#r.set(Tu(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(a=>{Ru(e,a.mutationKey)&&Object.assign(n,a.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=J0(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ew&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Cz=g.createContext(void 0),Nz=({client:e,children:t})=>(g.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),o.jsx(Cz.Provider,{value:e,children:t}));function _z(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const Ez=e=>{switch(e){case"success":return Az;case"info":return Mz;case"warning":return Oz;case"error":return Dz;default:return null}},Tz=Array(12).fill(0),Rz=({visible:e,className:t})=>A.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},A.createElement("div",{className:"sonner-spinner"},Tz.map((n,a)=>A.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),Az=A.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},A.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"})),Oz=A.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},A.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"})),Mz=A.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},A.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"})),Dz=A.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},A.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"})),Pz=A.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"},A.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),A.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),kz=()=>{const[e,t]=A.useState(document.hidden);return A.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let $b=1;class Lz{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:a,...i}=t,l=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:$b++,u=this.toasts.find(h=>h.id===l),d=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),u?this.toasts=this.toasts.map(h=>h.id===l?(this.publish({...h,...t,id:l,title:a}),{...h,...t,id:l,dismissible:d,title:a}):h):this.addToast({title:a,...i,dismissible:d,id:l}),l},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(a=>a({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let a;n.loading!==void 0&&(a=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const i=Promise.resolve(t instanceof Function?t():t);let l=a!==void 0,u;const d=i.then(async p=>{if(u=["resolve",p],A.isValidElement(p))l=!1,this.create({id:a,type:"default",message:p});else if(Iz(p)&&!p.ok){l=!1;const m=typeof n.error=="function"?await n.error(`HTTP error! status: ${p.status}`):n.error,b=typeof n.description=="function"?await n.description(`HTTP error! status: ${p.status}`):n.description,j=typeof m=="object"&&!A.isValidElement(m)?m:{message:m};this.create({id:a,type:"error",description:b,...j})}else if(p instanceof Error){l=!1;const m=typeof n.error=="function"?await n.error(p):n.error,b=typeof n.description=="function"?await n.description(p):n.description,j=typeof m=="object"&&!A.isValidElement(m)?m:{message:m};this.create({id:a,type:"error",description:b,...j})}else if(n.success!==void 0){l=!1;const m=typeof n.success=="function"?await n.success(p):n.success,b=typeof n.description=="function"?await n.description(p):n.description,j=typeof m=="object"&&!A.isValidElement(m)?m:{message:m};this.create({id:a,type:"success",description:b,...j})}}).catch(async p=>{if(u=["reject",p],n.error!==void 0){l=!1;const v=typeof n.error=="function"?await n.error(p):n.error,m=typeof n.description=="function"?await n.description(p):n.description,w=typeof v=="object"&&!A.isValidElement(v)?v:{message:v};this.create({id:a,type:"error",description:m,...w})}}).finally(()=>{l&&(this.dismiss(a),a=void 0),n.finally==null||n.finally.call(n)}),h=()=>new Promise((p,v)=>d.then(()=>u[0]==="reject"?v(u[1]):p(u[1])).catch(v));return typeof a!="string"&&typeof a!="number"?{unwrap:h}:Object.assign(a,{unwrap:h})},this.custom=(t,n)=>{const a=n?.id||$b++;return this.create({jsx:t(a),id:a,...n}),a},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const vr=new Lz,Bz=(e,t)=>{const n=t?.id||$b++;return vr.addToast({title:e,...t,id:n}),n},Iz=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",zz=Bz,Fz=()=>vr.toasts,Hz=()=>vr.getActiveToasts(),K=Object.assign(zz,{success:vr.success,info:vr.info,warning:vr.warning,error:vr.error,custom:vr.custom,message:vr.message,promise:vr.promise,dismiss:vr.dismiss,loading:vr.loading},{getHistory:Fz,getToasts:Hz});_z("[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 Df(e){return e.label!==void 0}const Uz=3,Vz="24px",qz="16px",d_=4e3,$z=356,Gz=14,Kz=45,Yz=200;function Oa(...e){return e.filter(Boolean).join(" ")}function Wz(e){const[t,n]=e.split("-"),a=[];return t&&a.push(t),n&&a.push(n),a}const Xz=e=>{var t,n,a,i,l,u,d,h,p;const{invert:v,toast:m,unstyled:b,interacting:w,setHeights:j,visibleToasts:S,heights:C,index:N,toasts:_,expanded:T,removeToast:R,defaultRichColors:D,closeButton:L,style:k,cancelButtonStyle:P,actionButtonStyle:U,className:J="",descriptionClassName:$="",duration:W,position:fe,gap:we,expandByDefault:Ce,classNames:I,icons:V,closeButtonAriaLabel:H="Close toast"}=e,[be,_e]=A.useState(null),[B,G]=A.useState(null),[X,oe]=A.useState(!1),[me,Z]=A.useState(!1),[ne,he]=A.useState(!1),[Ee,je]=A.useState(!1),[ke,le]=A.useState(!1),[Fe,Ge]=A.useState(0),[He,at]=A.useState(0),Ke=A.useRef(m.duration||W||d_),Mt=A.useRef(null),St=A.useRef(null),_t=N===0,jt=N+1<=S,ot=m.type,lt=m.dismissible!==!1,Ct=m.className||"",Vt=m.descriptionClassName||"",Kt=A.useMemo(()=>C.findIndex(z=>z.toastId===m.id)||0,[C,m.id]),Wt=A.useMemo(()=>{var z;return(z=m.closeButton)!=null?z:L},[m.closeButton,L]),te=A.useMemo(()=>m.duration||W||d_,[m.duration,W]),Me=A.useRef(0),st=A.useRef(0),nt=A.useRef(0),yt=A.useRef(null),[gt,xt]=fe.split("-"),qt=A.useMemo(()=>C.reduce((z,Se,Ae)=>Ae>=Kt?z:z+Se.height,0),[C,Kt]),ue=kz(),Oe=m.invert||v,Be=ot==="loading";st.current=A.useMemo(()=>Kt*we+qt,[Kt,qt]),A.useEffect(()=>{Ke.current=te},[te]),A.useEffect(()=>{oe(!0)},[]),A.useEffect(()=>{const z=St.current;if(z){const Se=z.getBoundingClientRect().height;return at(Se),j(Ae=>[{toastId:m.id,height:Se,position:m.position},...Ae]),()=>j(Ae=>Ae.filter(Re=>Re.toastId!==m.id))}},[j,m.id]),A.useLayoutEffect(()=>{if(!X)return;const z=St.current,Se=z.style.height;z.style.height="auto";const Ae=z.getBoundingClientRect().height;z.style.height=Se,at(Ae),j(Re=>Re.find(ge=>ge.toastId===m.id)?Re.map(ge=>ge.toastId===m.id?{...ge,height:Ae}:ge):[{toastId:m.id,height:Ae,position:m.position},...Re])},[X,m.title,m.description,j,m.id,m.jsx,m.action,m.cancel]);const Qe=A.useCallback(()=>{Z(!0),Ge(st.current),j(z=>z.filter(Se=>Se.toastId!==m.id)),setTimeout(()=>{R(m)},Yz)},[m,R,j,st]);A.useEffect(()=>{if(m.promise&&ot==="loading"||m.duration===1/0||m.type==="loading")return;let z;return T||w||ue?(()=>{if(nt.current<Me.current){const Re=new Date().getTime()-Me.current;Ke.current=Ke.current-Re}nt.current=new Date().getTime()})():Ke.current!==1/0&&(Me.current=new Date().getTime(),z=setTimeout(()=>{m.onAutoClose==null||m.onAutoClose.call(m,m),Qe()},Ke.current)),()=>clearTimeout(z)},[T,w,m,ot,ue,Qe]),A.useEffect(()=>{m.delete&&(Qe(),m.onDismiss==null||m.onDismiss.call(m,m))},[Qe,m.delete]);function Pe(){var z;if(V?.loading){var Se;return A.createElement("div",{className:Oa(I?.loader,m==null||(Se=m.classNames)==null?void 0:Se.loader,"sonner-loader"),"data-visible":ot==="loading"},V.loading)}return A.createElement(Rz,{className:Oa(I?.loader,m==null||(z=m.classNames)==null?void 0:z.loader),visible:ot==="loading"})}const Ze=m.icon||V?.[ot]||Ez(ot);var ft,pt;return A.createElement("li",{tabIndex:0,ref:St,className:Oa(J,Ct,I?.toast,m==null||(t=m.classNames)==null?void 0:t.toast,I?.default,I?.[ot],m==null||(n=m.classNames)==null?void 0:n[ot]),"data-sonner-toast":"","data-rich-colors":(ft=m.richColors)!=null?ft:D,"data-styled":!(m.jsx||m.unstyled||b),"data-mounted":X,"data-promise":!!m.promise,"data-swiped":ke,"data-removed":me,"data-visible":jt,"data-y-position":gt,"data-x-position":xt,"data-index":N,"data-front":_t,"data-swiping":ne,"data-dismissible":lt,"data-type":ot,"data-invert":Oe,"data-swipe-out":Ee,"data-swipe-direction":B,"data-expanded":!!(T||Ce&&X),"data-testid":m.testId,style:{"--index":N,"--toasts-before":N,"--z-index":_.length-N,"--offset":`${me?Fe:st.current}px`,"--initial-height":Ce?"auto":`${He}px`,...k,...m.style},onDragEnd:()=>{he(!1),_e(null),yt.current=null},onPointerDown:z=>{z.button!==2&&(Be||!lt||(Mt.current=new Date,Ge(st.current),z.target.setPointerCapture(z.pointerId),z.target.tagName!=="BUTTON"&&(he(!0),yt.current={x:z.clientX,y:z.clientY})))},onPointerUp:()=>{var z,Se,Ae;if(Ee||!lt)return;yt.current=null;const Re=Number(((z=St.current)==null?void 0:z.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),M=Number(((Se=St.current)==null?void 0:Se.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ge=new Date().getTime()-((Ae=Mt.current)==null?void 0:Ae.getTime()),Ne=be==="x"?Re:M,mt=Math.abs(Ne)/ge;if(Math.abs(Ne)>=Kz||mt>.11){Ge(st.current),m.onDismiss==null||m.onDismiss.call(m,m),G(be==="x"?Re>0?"right":"left":M>0?"down":"up"),Qe(),je(!0);return}else{var Y,xe;(Y=St.current)==null||Y.style.setProperty("--swipe-amount-x","0px"),(xe=St.current)==null||xe.style.setProperty("--swipe-amount-y","0px")}le(!1),he(!1),_e(null)},onPointerMove:z=>{var Se,Ae,Re;if(!yt.current||!lt||((Se=window.getSelection())==null?void 0:Se.toString().length)>0)return;const ge=z.clientY-yt.current.y,Ne=z.clientX-yt.current.x;var mt;const Y=(mt=e.swipeDirections)!=null?mt:Wz(fe);!be&&(Math.abs(Ne)>1||Math.abs(ge)>1)&&_e(Math.abs(Ne)>Math.abs(ge)?"x":"y");let xe={x:0,y:0};const Le=Ie=>1/(1.5+Math.abs(Ie)/20);if(be==="y"){if(Y.includes("top")||Y.includes("bottom"))if(Y.includes("top")&&ge<0||Y.includes("bottom")&&ge>0)xe.y=ge;else{const Ie=ge*Le(ge);xe.y=Math.abs(Ie)<Math.abs(ge)?Ie:ge}}else if(be==="x"&&(Y.includes("left")||Y.includes("right")))if(Y.includes("left")&&Ne<0||Y.includes("right")&&Ne>0)xe.x=Ne;else{const Ie=Ne*Le(Ne);xe.x=Math.abs(Ie)<Math.abs(Ne)?Ie:Ne}(Math.abs(xe.x)>0||Math.abs(xe.y)>0)&&le(!0),(Ae=St.current)==null||Ae.style.setProperty("--swipe-amount-x",`${xe.x}px`),(Re=St.current)==null||Re.style.setProperty("--swipe-amount-y",`${xe.y}px`)}},Wt&&!m.jsx&&ot!=="loading"?A.createElement("button",{"aria-label":H,"data-disabled":Be,"data-close-button":!0,onClick:Be||!lt?()=>{}:()=>{Qe(),m.onDismiss==null||m.onDismiss.call(m,m)},className:Oa(I?.closeButton,m==null||(a=m.classNames)==null?void 0:a.closeButton)},(pt=V?.close)!=null?pt:Pz):null,(ot||m.icon||m.promise)&&m.icon!==null&&(V?.[ot]!==null||m.icon)?A.createElement("div",{"data-icon":"",className:Oa(I?.icon,m==null||(i=m.classNames)==null?void 0:i.icon)},m.promise||m.type==="loading"&&!m.icon?m.icon||Pe():null,m.type!=="loading"?Ze:null):null,A.createElement("div",{"data-content":"",className:Oa(I?.content,m==null||(l=m.classNames)==null?void 0:l.content)},A.createElement("div",{"data-title":"",className:Oa(I?.title,m==null||(u=m.classNames)==null?void 0:u.title)},m.jsx?m.jsx:typeof m.title=="function"?m.title():m.title),m.description?A.createElement("div",{"data-description":"",className:Oa($,Vt,I?.description,m==null||(d=m.classNames)==null?void 0:d.description)},typeof m.description=="function"?m.description():m.description):null),A.isValidElement(m.cancel)?m.cancel:m.cancel&&Df(m.cancel)?A.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||P,onClick:z=>{Df(m.cancel)&&lt&&(m.cancel.onClick==null||m.cancel.onClick.call(m.cancel,z),Qe())},className:Oa(I?.cancelButton,m==null||(h=m.classNames)==null?void 0:h.cancelButton)},m.cancel.label):null,A.isValidElement(m.action)?m.action:m.action&&Df(m.action)?A.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||U,onClick:z=>{Df(m.action)&&(m.action.onClick==null||m.action.onClick.call(m.action,z),!z.defaultPrevented&&Qe())},className:Oa(I?.actionButton,m==null||(p=m.classNames)==null?void 0:p.actionButton)},m.action.label):null)};function f_(){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 Qz(e,t){const n={};return[e,t].forEach((a,i)=>{const l=i===1,u=l?"--mobile-offset":"--offset",d=l?qz:Vz;function h(p){["top","right","bottom","left"].forEach(v=>{n[`${u}-${v}`]=typeof p=="number"?`${p}px`:p})}typeof a=="number"||typeof a=="string"?h(a):typeof a=="object"?["top","right","bottom","left"].forEach(p=>{a[p]===void 0?n[`${u}-${p}`]=d:n[`${u}-${p}`]=typeof a[p]=="number"?`${a[p]}px`:a[p]}):h(d)}),n}const Zz=A.forwardRef(function(t,n){const{id:a,invert:i,position:l="bottom-right",hotkey:u=["altKey","KeyT"],expand:d,closeButton:h,className:p,offset:v,mobileOffset:m,theme:b="light",richColors:w,duration:j,style:S,visibleToasts:C=Uz,toastOptions:N,dir:_=f_(),gap:T=Gz,icons:R,containerAriaLabel:D="Notifications"}=t,[L,k]=A.useState([]),P=A.useMemo(()=>a?L.filter(X=>X.toasterId===a):L.filter(X=>!X.toasterId),[L,a]),U=A.useMemo(()=>Array.from(new Set([l].concat(P.filter(X=>X.position).map(X=>X.position)))),[P,l]),[J,$]=A.useState([]),[W,fe]=A.useState(!1),[we,Ce]=A.useState(!1),[I,V]=A.useState(b!=="system"?b:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=A.useRef(null),be=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),_e=A.useRef(null),B=A.useRef(!1),G=A.useCallback(X=>{k(oe=>{var me;return(me=oe.find(Z=>Z.id===X.id))!=null&&me.delete||vr.dismiss(X.id),oe.filter(({id:Z})=>Z!==X.id)})},[]);return A.useEffect(()=>vr.subscribe(X=>{if(X.dismiss){requestAnimationFrame(()=>{k(oe=>oe.map(me=>me.id===X.id?{...me,delete:!0}:me))});return}setTimeout(()=>{WO.flushSync(()=>{k(oe=>{const me=oe.findIndex(Z=>Z.id===X.id);return me!==-1?[...oe.slice(0,me),{...oe[me],...X},...oe.slice(me+1)]:[X,...oe]})})})}),[L]),A.useEffect(()=>{if(b!=="system"){V(b);return}if(b==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?V("dark"):V("light")),typeof window>"u")return;const X=window.matchMedia("(prefers-color-scheme: dark)");try{X.addEventListener("change",({matches:oe})=>{V(oe?"dark":"light")})}catch{X.addListener(({matches:me})=>{try{V(me?"dark":"light")}catch(Z){console.error(Z)}})}},[b]),A.useEffect(()=>{L.length<=1&&fe(!1)},[L]),A.useEffect(()=>{const X=oe=>{var me;if(u.every(he=>oe[he]||oe.code===he)){var ne;fe(!0),(ne=H.current)==null||ne.focus()}oe.code==="Escape"&&(document.activeElement===H.current||(me=H.current)!=null&&me.contains(document.activeElement))&&fe(!1)};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[u]),A.useEffect(()=>{if(H.current)return()=>{_e.current&&(_e.current.focus({preventScroll:!0}),_e.current=null,B.current=!1)}},[H.current]),A.createElement("section",{ref:n,"aria-label":`${D} ${be}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},U.map((X,oe)=>{var me;const[Z,ne]=X.split("-");return P.length?A.createElement("ol",{key:X,dir:_==="auto"?f_():_,tabIndex:-1,ref:H,className:p,"data-sonner-toaster":!0,"data-sonner-theme":I,"data-y-position":Z,"data-x-position":ne,style:{"--front-toast-height":`${((me=J[0])==null?void 0:me.height)||0}px`,"--width":`${$z}px`,"--gap":`${T}px`,...S,...Qz(v,m)},onBlur:he=>{B.current&&!he.currentTarget.contains(he.relatedTarget)&&(B.current=!1,_e.current&&(_e.current.focus({preventScroll:!0}),_e.current=null))},onFocus:he=>{he.target instanceof HTMLElement&&he.target.dataset.dismissible==="false"||B.current||(B.current=!0,_e.current=he.relatedTarget)},onMouseEnter:()=>fe(!0),onMouseMove:()=>fe(!0),onMouseLeave:()=>{we||fe(!1)},onDragEnd:()=>fe(!1),onPointerDown:he=>{he.target instanceof HTMLElement&&he.target.dataset.dismissible==="false"||Ce(!0)},onPointerUp:()=>Ce(!1)},P.filter(he=>!he.position&&oe===0||he.position===X).map((he,Ee)=>{var je,ke;return A.createElement(Xz,{key:he.id,icons:R,index:Ee,toast:he,defaultRichColors:w,duration:(je=N?.duration)!=null?je:j,className:N?.className,descriptionClassName:N?.descriptionClassName,invert:i,visibleToasts:C,closeButton:(ke=N?.closeButton)!=null?ke:h,interacting:we,position:X,style:N?.style,unstyled:N?.unstyled,classNames:N?.classNames,cancelButtonStyle:N?.cancelButtonStyle,actionButtonStyle:N?.actionButtonStyle,closeButtonAriaLabel:N?.closeButtonAriaLabel,removeToast:G,toasts:P.filter(le=>le.position==he.position),heights:J.filter(le=>le.position==he.position),setHeights:$,expandByDefault:d,gap:T,expanded:W,swipeDirections:t.swipeDirections})})):null}))});function h_(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function oo(...e){return t=>{let n=!1;const a=e.map(i=>{const l=h_(i,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let i=0;i<a.length;i++){const l=a[i];typeof l=="function"?l():h_(e[i],null)}}}}function Ot(...e){return g.useCallback(oo(...e),e)}var Jz=Symbol.for("react.lazy"),fh=K0[" use ".trim().toString()];function eF(e){return typeof e=="object"&&e!==null&&"then"in e}function nM(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Jz&&"_payload"in e&&eF(e._payload)}function qh(e){const t=nF(e),n=g.forwardRef((a,i)=>{let{children:l,...u}=a;nM(l)&&typeof fh=="function"&&(l=fh(l._payload));const d=g.Children.toArray(l),h=d.find(aF);if(h){const p=h.props.children,v=d.map(m=>m===h?g.Children.count(p)>1?g.Children.only(null):g.isValidElement(p)?p.props.children:null:m);return o.jsx(t,{...u,ref:i,children:g.isValidElement(p)?g.cloneElement(p,void 0,v):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}var tF=qh("Slot");function nF(e){const t=g.forwardRef((n,a)=>{let{children:i,...l}=n;if(nM(i)&&typeof fh=="function"&&(i=fh(i._payload)),g.isValidElement(i)){const u=iF(i),d=sF(l,i.props);return i.type!==g.Fragment&&(d.ref=a?oo(a,u):u),g.cloneElement(i,d)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var rF=Symbol("radix.slottable");function aF(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===rF}function sF(e,t){const n={...t};for(const a in t){const i=e[a],l=t[a];/^on[A-Z]/.test(a)?i&&l?n[a]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(n[a]=i):a==="style"?n[a]={...i,...l}:a==="className"&&(n[a]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function iF(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function rM(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=rM(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function aM(){for(var e,t,n=0,a="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=rM(e))&&(a&&(a+=" "),a+=t);return a}const p_=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,m_=aM,Xu=(e,t)=>n=>{var a;if(t?.variants==null)return m_(e,n?.class,n?.className);const{variants:i,defaultVariants:l}=t,u=Object.keys(i).map(p=>{const v=n?.[p],m=l?.[p];if(v===null)return null;const b=p_(v)||p_(m);return i[p][b]}),d=n&&Object.entries(n).reduce((p,v)=>{let[m,b]=v;return b===void 0||(p[m]=b),p},{}),h=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((p,v)=>{let{class:m,className:b,...w}=v;return Object.entries(w).every(j=>{let[S,C]=j;return Array.isArray(C)?C.includes({...l,...d}[S]):{...l,...d}[S]===C})?[...p,m,b]:p},[]);return m_(e,u,h,n?.class,n?.className)},oF=(e,t)=>{const n=new Array(e.length+t.length);for(let a=0;a<e.length;a++)n[a]=e[a];for(let a=0;a<t.length;a++)n[e.length+a]=t[a];return n},lF=(e,t)=>({classGroupId:e,validator:t}),sM=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),hh="-",g_=[],cF="arbitrary..",uF=e=>{const t=fF(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return dF(u);const d=u.split(hh),h=d[0]===""&&d.length>1?1:0;return iM(d,h,t)},getConflictingClassGroupIds:(u,d)=>{if(d){const h=a[u],p=n[u];return h?p?oF(p,h):h:p||g_}return n[u]||g_}}},iM=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],l=n.nextPart.get(i);if(l){const p=iM(e,t+1,l);if(p)return p}const u=n.validators;if(u===null)return;const d=t===0?e.join(hh):e.slice(t).join(hh),h=u.length;for(let p=0;p<h;p++){const v=u[p];if(v.validator(d))return v.classGroupId}},dF=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),a=t.slice(0,n);return a?cF+a:void 0})(),fF=e=>{const{theme:t,classGroups:n}=e;return hF(n,t)},hF=(e,t)=>{const n=sM();for(const a in e){const i=e[a];tw(i,n,a,t)}return n},tw=(e,t,n,a)=>{const i=e.length;for(let l=0;l<i;l++){const u=e[l];pF(u,t,n,a)}},pF=(e,t,n,a)=>{if(typeof e=="string"){mF(e,t,n);return}if(typeof e=="function"){gF(e,t,n,a);return}vF(e,t,n,a)},mF=(e,t,n)=>{const a=e===""?t:oM(t,e);a.classGroupId=n},gF=(e,t,n,a)=>{if(xF(e)){tw(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(lF(n,e))},vF=(e,t,n,a)=>{const i=Object.entries(e),l=i.length;for(let u=0;u<l;u++){const[d,h]=i[u];tw(h,oM(t,d),n,a)}},oM=(e,t)=>{let n=e;const a=t.split(hh),i=a.length;for(let l=0;l<i;l++){const u=a[l];let d=n.nextPart.get(u);d||(d=sM(),n.nextPart.set(u,d)),n=d}return n},xF=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,yF=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),a=Object.create(null);const i=(l,u)=>{n[l]=u,t++,t>e&&(t=0,a=n,n=Object.create(null))};return{get(l){let u=n[l];if(u!==void 0)return u;if((u=a[l])!==void 0)return i(l,u),u},set(l,u){l in n?n[l]=u:i(l,u)}}},Gb="!",v_=":",bF=[],x_=(e,t,n,a,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:i}),wF=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=i=>{const l=[];let u=0,d=0,h=0,p;const v=i.length;for(let S=0;S<v;S++){const C=i[S];if(u===0&&d===0){if(C===v_){l.push(i.slice(h,S)),h=S+1;continue}if(C==="/"){p=S;continue}}C==="["?u++:C==="]"?u--:C==="("?d++:C===")"&&d--}const m=l.length===0?i:i.slice(h);let b=m,w=!1;m.endsWith(Gb)?(b=m.slice(0,-1),w=!0):m.startsWith(Gb)&&(b=m.slice(1),w=!0);const j=p&&p>h?p-h:void 0;return x_(l,w,b,j)};if(t){const i=t+v_,l=a;a=u=>u.startsWith(i)?l(u.slice(i.length)):x_(bF,!1,u,void 0,!0)}if(n){const i=a;a=l=>n({className:l,parseClassName:i})}return a},SF=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,a)=>{t.set(n,1e6+a)}),n=>{const a=[];let i=[];for(let l=0;l<n.length;l++){const u=n[l],d=u[0]==="[",h=t.has(u);d||h?(i.length>0&&(i.sort(),a.push(...i),i=[]),a.push(u)):i.push(u)}return i.length>0&&(i.sort(),a.push(...i)),a}},jF=e=>({cache:yF(e.cacheSize),parseClassName:wF(e),sortModifiers:SF(e),...uF(e)}),CF=/\s+/,NF=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:i,sortModifiers:l}=t,u=[],d=e.trim().split(CF);let h="";for(let p=d.length-1;p>=0;p-=1){const v=d[p],{isExternal:m,modifiers:b,hasImportantModifier:w,baseClassName:j,maybePostfixModifierPosition:S}=n(v);if(m){h=v+(h.length>0?" "+h:h);continue}let C=!!S,N=a(C?j.substring(0,S):j);if(!N){if(!C){h=v+(h.length>0?" "+h:h);continue}if(N=a(j),!N){h=v+(h.length>0?" "+h:h);continue}C=!1}const _=b.length===0?"":b.length===1?b[0]:l(b).join(":"),T=w?_+Gb:_,R=T+N;if(u.indexOf(R)>-1)continue;u.push(R);const D=i(N,C);for(let L=0;L<D.length;++L){const k=D[L];u.push(T+k)}h=v+(h.length>0?" "+h:h)}return h},_F=(...e)=>{let t=0,n,a,i="";for(;t<e.length;)(n=e[t++])&&(a=lM(n))&&(i&&(i+=" "),i+=a);return i},lM=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=lM(e[a]))&&(n&&(n+=" "),n+=t);return n},EF=(e,...t)=>{let n,a,i,l;const u=h=>{const p=t.reduce((v,m)=>m(v),e());return n=jF(p),a=n.cache.get,i=n.cache.set,l=d,d(h)},d=h=>{const p=a(h);if(p)return p;const v=NF(h,n);return i(h,v),v};return l=u,(...h)=>l(_F(...h))},TF=[],Tn=e=>{const t=n=>n[e]||TF;return t.isThemeGetter=!0,t},cM=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,uM=/^\((?:(\w[\w-]*):)?(.+)\)$/i,RF=/^\d+\/\d+$/,AF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,OF=/\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$/,MF=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,DF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,PF=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$o=e=>RF.test(e),At=e=>!!e&&!Number.isNaN(Number(e)),li=e=>!!e&&Number.isInteger(Number(e)),ev=e=>e.endsWith("%")&&At(e.slice(0,-1)),ps=e=>AF.test(e),kF=()=>!0,LF=e=>OF.test(e)&&!MF.test(e),dM=()=>!1,BF=e=>DF.test(e),IF=e=>PF.test(e),zF=e=>!qe(e)&&!$e(e),FF=e=>Ll(e,pM,dM),qe=e=>cM.test(e),Gi=e=>Ll(e,mM,LF),tv=e=>Ll(e,$F,At),y_=e=>Ll(e,fM,dM),HF=e=>Ll(e,hM,IF),Pf=e=>Ll(e,gM,BF),$e=e=>uM.test(e),eu=e=>Bl(e,mM),UF=e=>Bl(e,GF),b_=e=>Bl(e,fM),VF=e=>Bl(e,pM),qF=e=>Bl(e,hM),kf=e=>Bl(e,gM,!0),Ll=(e,t,n)=>{const a=cM.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},Bl=(e,t,n=!1)=>{const a=uM.exec(e);return a?a[1]?t(a[1]):n:!1},fM=e=>e==="position"||e==="percentage",hM=e=>e==="image"||e==="url",pM=e=>e==="length"||e==="size"||e==="bg-size",mM=e=>e==="length",$F=e=>e==="number",GF=e=>e==="family-name",gM=e=>e==="shadow",KF=()=>{const e=Tn("color"),t=Tn("font"),n=Tn("text"),a=Tn("font-weight"),i=Tn("tracking"),l=Tn("leading"),u=Tn("breakpoint"),d=Tn("container"),h=Tn("spacing"),p=Tn("radius"),v=Tn("shadow"),m=Tn("inset-shadow"),b=Tn("text-shadow"),w=Tn("drop-shadow"),j=Tn("blur"),S=Tn("perspective"),C=Tn("aspect"),N=Tn("ease"),_=Tn("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...R(),$e,qe],L=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],P=()=>[$e,qe,h],U=()=>[$o,"full","auto",...P()],J=()=>[li,"none","subgrid",$e,qe],$=()=>["auto",{span:["full",li,$e,qe]},li,$e,qe],W=()=>[li,"auto",$e,qe],fe=()=>["auto","min","max","fr",$e,qe],we=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Ce=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...P()],V=()=>[$o,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],H=()=>[e,$e,qe],be=()=>[...R(),b_,y_,{position:[$e,qe]}],_e=()=>["no-repeat",{repeat:["","x","y","space","round"]}],B=()=>["auto","cover","contain",VF,FF,{size:[$e,qe]}],G=()=>[ev,eu,Gi],X=()=>["","none","full",p,$e,qe],oe=()=>["",At,eu,Gi],me=()=>["solid","dashed","dotted","double"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>[At,ev,b_,y_],he=()=>["","none",j,$e,qe],Ee=()=>["none",At,$e,qe],je=()=>["none",At,$e,qe],ke=()=>[At,$e,qe],le=()=>[$o,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ps],breakpoint:[ps],color:[kF],container:[ps],"drop-shadow":[ps],ease:["in","out","in-out"],font:[zF],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ps],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ps],shadow:[ps],spacing:["px",At],text:[ps],"text-shadow":[ps],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",$o,qe,$e,C]}],container:["container"],columns:[{columns:[At,qe,$e,d]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"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:D()}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:U()}],"inset-x":[{"inset-x":U()}],"inset-y":[{"inset-y":U()}],start:[{start:U()}],end:[{end:U()}],top:[{top:U()}],right:[{right:U()}],bottom:[{bottom:U()}],left:[{left:U()}],visibility:["visible","invisible","collapse"],z:[{z:[li,"auto",$e,qe]}],basis:[{basis:[$o,"full","auto",d,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[At,$o,"auto","initial","none",qe]}],grow:[{grow:["",At,$e,qe]}],shrink:[{shrink:["",At,$e,qe]}],order:[{order:[li,"first","last","none",$e,qe]}],"grid-cols":[{"grid-cols":J()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":W()}],"col-end":[{"col-end":W()}],"grid-rows":[{"grid-rows":J()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":W()}],"row-end":[{"row-end":W()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":fe()}],"auto-rows":[{"auto-rows":fe()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...we(),"normal"]}],"justify-items":[{"justify-items":[...Ce(),"normal"]}],"justify-self":[{"justify-self":["auto",...Ce()]}],"align-content":[{content:["normal",...we()]}],"align-items":[{items:[...Ce(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Ce(),{baseline:["","last"]}]}],"place-content":[{"place-content":we()}],"place-items":[{"place-items":[...Ce(),"baseline"]}],"place-self":[{"place-self":["auto",...Ce()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:V()}],w:[{w:[d,"screen",...V()]}],"min-w":[{"min-w":[d,"screen","none",...V()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...V()]}],h:[{h:["screen","lh",...V()]}],"min-h":[{"min-h":["screen","lh","none",...V()]}],"max-h":[{"max-h":["screen","lh",...V()]}],"font-size":[{text:["base",n,eu,Gi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,$e,tv]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ev,qe]}],"font-family":[{font:[UF,qe,t]}],"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,qe]}],"line-clamp":[{"line-clamp":[At,"none",$e,tv]}],leading:[{leading:[l,...P()]}],"list-image":[{"list-image":["none",$e,qe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",$e,qe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:H()}],"text-color":[{text:H()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...me(),"wavy"]}],"text-decoration-thickness":[{decoration:[At,"from-font","auto",$e,Gi]}],"text-decoration-color":[{decoration:H()}],"underline-offset":[{"underline-offset":[At,"auto",$e,qe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",$e,qe]}],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,qe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:be()}],"bg-repeat":[{bg:_e()}],"bg-size":[{bg:B()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},li,$e,qe],radial:["",$e,qe],conic:[li,$e,qe]},qF,HF]}],"bg-color":[{bg:H()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:H()}],"gradient-via":[{via:H()}],"gradient-to":[{to:H()}],rounded:[{rounded:X()}],"rounded-s":[{"rounded-s":X()}],"rounded-e":[{"rounded-e":X()}],"rounded-t":[{"rounded-t":X()}],"rounded-r":[{"rounded-r":X()}],"rounded-b":[{"rounded-b":X()}],"rounded-l":[{"rounded-l":X()}],"rounded-ss":[{"rounded-ss":X()}],"rounded-se":[{"rounded-se":X()}],"rounded-ee":[{"rounded-ee":X()}],"rounded-es":[{"rounded-es":X()}],"rounded-tl":[{"rounded-tl":X()}],"rounded-tr":[{"rounded-tr":X()}],"rounded-br":[{"rounded-br":X()}],"rounded-bl":[{"rounded-bl":X()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...me(),"hidden","none"]}],"divide-style":[{divide:[...me(),"hidden","none"]}],"border-color":[{border:H()}],"border-color-x":[{"border-x":H()}],"border-color-y":[{"border-y":H()}],"border-color-s":[{"border-s":H()}],"border-color-e":[{"border-e":H()}],"border-color-t":[{"border-t":H()}],"border-color-r":[{"border-r":H()}],"border-color-b":[{"border-b":H()}],"border-color-l":[{"border-l":H()}],"divide-color":[{divide:H()}],"outline-style":[{outline:[...me(),"none","hidden"]}],"outline-offset":[{"outline-offset":[At,$e,qe]}],"outline-w":[{outline:["",At,eu,Gi]}],"outline-color":[{outline:H()}],shadow:[{shadow:["","none",v,kf,Pf]}],"shadow-color":[{shadow:H()}],"inset-shadow":[{"inset-shadow":["none",m,kf,Pf]}],"inset-shadow-color":[{"inset-shadow":H()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:H()}],"ring-offset-w":[{"ring-offset":[At,Gi]}],"ring-offset-color":[{"ring-offset":H()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":H()}],"text-shadow":[{"text-shadow":["none",b,kf,Pf]}],"text-shadow-color":[{"text-shadow":H()}],opacity:[{opacity:[At,$e,qe]}],"mix-blend":[{"mix-blend":[...Z(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Z()}],"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":[At]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":H()}],"mask-image-linear-to-color":[{"mask-linear-to":H()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":H()}],"mask-image-t-to-color":[{"mask-t-to":H()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":H()}],"mask-image-r-to-color":[{"mask-r-to":H()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":H()}],"mask-image-b-to-color":[{"mask-b-to":H()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":H()}],"mask-image-l-to-color":[{"mask-l-to":H()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":H()}],"mask-image-x-to-color":[{"mask-x-to":H()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":H()}],"mask-image-y-to-color":[{"mask-y-to":H()}],"mask-image-radial":[{"mask-radial":[$e,qe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":H()}],"mask-image-radial-to-color":[{"mask-radial-to":H()}],"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":R()}],"mask-image-conic-pos":[{"mask-conic":[At]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":H()}],"mask-image-conic-to-color":[{"mask-conic-to":H()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:be()}],"mask-repeat":[{mask:_e()}],"mask-size":[{mask:B()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",$e,qe]}],filter:[{filter:["","none",$e,qe]}],blur:[{blur:he()}],brightness:[{brightness:[At,$e,qe]}],contrast:[{contrast:[At,$e,qe]}],"drop-shadow":[{"drop-shadow":["","none",w,kf,Pf]}],"drop-shadow-color":[{"drop-shadow":H()}],grayscale:[{grayscale:["",At,$e,qe]}],"hue-rotate":[{"hue-rotate":[At,$e,qe]}],invert:[{invert:["",At,$e,qe]}],saturate:[{saturate:[At,$e,qe]}],sepia:[{sepia:["",At,$e,qe]}],"backdrop-filter":[{"backdrop-filter":["","none",$e,qe]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[At,$e,qe]}],"backdrop-contrast":[{"backdrop-contrast":[At,$e,qe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",At,$e,qe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[At,$e,qe]}],"backdrop-invert":[{"backdrop-invert":["",At,$e,qe]}],"backdrop-opacity":[{"backdrop-opacity":[At,$e,qe]}],"backdrop-saturate":[{"backdrop-saturate":[At,$e,qe]}],"backdrop-sepia":[{"backdrop-sepia":["",At,$e,qe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",$e,qe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[At,"initial",$e,qe]}],ease:[{ease:["linear","initial",N,$e,qe]}],delay:[{delay:[At,$e,qe]}],animate:[{animate:["none",_,$e,qe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,$e,qe]}],"perspective-origin":[{"perspective-origin":D()}],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:ke()}],"skew-x":[{"skew-x":ke()}],"skew-y":[{"skew-y":ke()}],transform:[{transform:[$e,qe,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":["translate-none"],accent:[{accent:H()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:H()}],"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,qe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"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,qe]}],fill:[{fill:["none",...H()]}],"stroke-w":[{stroke:[At,eu,Gi,tv]}],stroke:[{stroke:["none",...H()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],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-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},YF=EF(KF);function ct(...e){return YF(aM(e))}function w_(e){return e.toLowerCase().replace(/[\s_-]+/g," ")}function Au(e,t){return w_(e).includes(w_(t))}const WF=Xu("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-card text-foreground border border-border shadow-sm hover:bg-accent",primary:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-accent hover:text-accent-foreground hover:scale-105 hover:shadow-md transition-all duration-150",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 px-3",lg:"h-11 px-8",icon:"h-10 w-10","icon-sm":"h-8 w-8"}},defaultVariants:{variant:"default",size:"default"}}),se=g.forwardRef(({className:e,variant:t,size:n,asChild:a=!1,...i},l)=>{const u=a?tF:"button";return o.jsx(u,{className:ct(WF({variant:t,size:n,className:e})),ref:l,...i})});se.displayName="Button";function XF(e,t=[]){let n=[];function a(l,u){const d=g.createContext(u);d.displayName=l+"Context";const h=n.length;n=[...n,u];const p=m=>{const{scope:b,children:w,...j}=m,S=b?.[e]?.[h]||d,C=g.useMemo(()=>j,Object.values(j));return o.jsx(S.Provider,{value:C,children:w})};p.displayName=l+"Provider";function v(m,b){const w=b?.[e]?.[h]||d,j=g.useContext(w);if(j)return j;if(u!==void 0)return u;throw new Error(`\`${m}\` must be used within \`${l}\``)}return[p,v]}const i=()=>{const l=n.map(u=>g.createContext(u));return function(d){const h=d?.[e]||l;return g.useMemo(()=>({[`__scope${e}`]:{...d,[e]:h}}),[d,h])}};return i.scopeName=e,[a,QF(i,...t)]}function QF(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(l){const u=a.reduce((d,{useScope:h,scopeName:p})=>{const m=h(l)[`__scope${p}`];return{...d,...m}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var ZF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],vM=ZF.reduce((e,t)=>{const n=qh(`Primitive.${t}`),a=g.forwardRef((i,l)=>{const{asChild:u,...d}=i,h=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(h,{...d,ref:l})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),nw="Progress",rw=100,[JF]=XF(nw),[e8,t8]=JF(nw),xM=g.forwardRef((e,t)=>{const{__scopeProgress:n,value:a=null,max:i,getValueLabel:l=n8,...u}=e;(i||i===0)&&!S_(i)&&console.error(r8(`${i}`,"Progress"));const d=S_(i)?i:rw;a!==null&&!j_(a,d)&&console.error(a8(`${a}`,"Progress"));const h=j_(a,d)?a:null,p=ph(h)?l(h,d):void 0;return o.jsx(e8,{scope:n,value:h,max:d,children:o.jsx(vM.div,{"aria-valuemax":d,"aria-valuemin":0,"aria-valuenow":ph(h)?h:void 0,"aria-valuetext":p,role:"progressbar","data-state":wM(h,d),"data-value":h??void 0,"data-max":d,...u,ref:t})})});xM.displayName=nw;var yM="ProgressIndicator",bM=g.forwardRef((e,t)=>{const{__scopeProgress:n,...a}=e,i=t8(yM,n);return o.jsx(vM.div,{"data-state":wM(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...a,ref:t})});bM.displayName=yM;function n8(e,t){return`${Math.round(e/t*100)}%`}function wM(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function ph(e){return typeof e=="number"}function S_(e){return ph(e)&&!isNaN(e)&&e>0}function j_(e,t){return ph(e)&&!isNaN(e)&&e<=t&&e>=0}function r8(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${rw}\`.`}function a8(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
  11. - a positive number
  12. - less than the value passed to \`max\` (or ${rw} if no \`max\` prop is set)
  13. - \`null\` or \`undefined\` if the progress is indeterminate.
  14. Defaulting to \`null\`.`}var SM=xM,s8=bM;const Yi=g.forwardRef(({className:e,value:t,...n},a)=>o.jsx(SM,{ref:a,className:ct("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...n,children:o.jsx(s8,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Yi.displayName=SM.displayName;const wt=g.forwardRef(({className:e,type:t,...n},a)=>o.jsx("input",{type:t,className:ct("flex h-10 w-full rounded-full border border-input bg-background px-4 py-2 text-base ring-offset-background 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-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:a,...n}));wt.displayName="Input";function et(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}function i8(e,t){const n=g.createContext(t),a=l=>{const{children:u,...d}=l,h=g.useMemo(()=>d,Object.values(d));return o.jsx(n.Provider,{value:h,children:u})};a.displayName=e+"Provider";function i(l){const u=g.useContext(n);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[a,i]}function Lr(e,t=[]){let n=[];function a(l,u){const d=g.createContext(u),h=n.length;n=[...n,u];const p=m=>{const{scope:b,children:w,...j}=m,S=b?.[e]?.[h]||d,C=g.useMemo(()=>j,Object.values(j));return o.jsx(S.Provider,{value:C,children:w})};p.displayName=l+"Provider";function v(m,b){const w=b?.[e]?.[h]||d,j=g.useContext(w);if(j)return j;if(u!==void 0)return u;throw new Error(`\`${m}\` must be used within \`${l}\``)}return[p,v]}const i=()=>{const l=n.map(u=>g.createContext(u));return function(d){const h=d?.[e]||l;return g.useMemo(()=>({[`__scope${e}`]:{...d,[e]:h}}),[d,h])}};return i.scopeName=e,[a,o8(i,...t)]}function o8(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(l){const u=a.reduce((d,{useScope:h,scopeName:p})=>{const m=h(l)[`__scope${p}`];return{...d,...m}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var Kn=globalThis?.document?g.useLayoutEffect:()=>{},l8=K0[" useId ".trim().toString()]||(()=>{}),c8=0;function ma(e){const[t,n]=g.useState(l8());return Kn(()=>{n(a=>a??String(c8++))},[e]),t?`radix-${t}`:""}var u8=K0[" useInsertionEffect ".trim().toString()]||Kn;function Zr({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[i,l,u]=d8({defaultProp:t,onChange:n}),d=e!==void 0,h=d?e:i;{const v=g.useRef(e!==void 0);g.useEffect(()=>{const m=v.current;m!==d&&console.warn(`${a} is changing from ${m?"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.`),v.current=d},[d,a])}const p=g.useCallback(v=>{if(d){const m=f8(v)?v(e):v;m!==e&&u.current?.(m)}else l(v)},[d,e,l,u]);return[h,p]}function d8({defaultProp:e,onChange:t}){const[n,a]=g.useState(e),i=g.useRef(n),l=g.useRef(t);return u8(()=>{l.current=t},[t]),g.useEffect(()=>{i.current!==n&&(l.current?.(n),i.current=n)},[n,i]),[n,a,l]}function f8(e){return typeof e=="function"}function h8(e){const t=p8(e),n=g.forwardRef((a,i)=>{const{children:l,...u}=a,d=g.Children.toArray(l),h=d.find(g8);if(h){const p=h.props.children,v=d.map(m=>m===h?g.Children.count(p)>1?g.Children.only(null):g.isValidElement(p)?p.props.children:null:m);return o.jsx(t,{...u,ref:i,children:g.isValidElement(p)?g.cloneElement(p,void 0,v):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function p8(e){const t=g.forwardRef((n,a)=>{const{children:i,...l}=n;if(g.isValidElement(i)){const u=x8(i),d=v8(l,i.props);return i.type!==g.Fragment&&(d.ref=a?oo(a,u):u),g.cloneElement(i,d)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var m8=Symbol("radix.slottable");function g8(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===m8}function v8(e,t){const n={...t};for(const a in t){const i=e[a],l=t[a];/^on[A-Z]/.test(a)?i&&l?n[a]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(n[a]=i):a==="style"?n[a]={...i,...l}:a==="className"&&(n[a]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function x8(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var y8=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],dt=y8.reduce((e,t)=>{const n=h8(`Primitive.${t}`),a=g.forwardRef((i,l)=>{const{asChild:u,...d}=i,h=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(h,{...d,ref:l})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function b8(e,t){e&&ka.flushSync(()=>e.dispatchEvent(t))}function gi(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>t.current?.(...n),[])}function w8(e,t=globalThis?.document){const n=gi(e);g.useEffect(()=>{const a=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[n,t])}var S8="DismissableLayer",Kb="dismissableLayer.update",j8="dismissableLayer.pointerDownOutside",C8="dismissableLayer.focusOutside",C_,jM=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Qu=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:l,onInteractOutside:u,onDismiss:d,...h}=e,p=g.useContext(jM),[v,m]=g.useState(null),b=v?.ownerDocument??globalThis?.document,[,w]=g.useState({}),j=Ot(t,k=>m(k)),S=Array.from(p.layers),[C]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),N=S.indexOf(C),_=v?S.indexOf(v):-1,T=p.layersWithOutsidePointerEventsDisabled.size>0,R=_>=N,D=E8(k=>{const P=k.target,U=[...p.branches].some(J=>J.contains(P));!R||U||(i?.(k),u?.(k),k.defaultPrevented||d?.())},b),L=T8(k=>{const P=k.target;[...p.branches].some(J=>J.contains(P))||(l?.(k),u?.(k),k.defaultPrevented||d?.())},b);return w8(k=>{_===p.layers.size-1&&(a?.(k),!k.defaultPrevented&&d&&(k.preventDefault(),d()))},b),g.useEffect(()=>{if(v)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(C_=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(v)),p.layers.add(v),N_(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(b.body.style.pointerEvents=C_)}},[v,b,n,p]),g.useEffect(()=>()=>{v&&(p.layers.delete(v),p.layersWithOutsidePointerEventsDisabled.delete(v),N_())},[v,p]),g.useEffect(()=>{const k=()=>w({});return document.addEventListener(Kb,k),()=>document.removeEventListener(Kb,k)},[]),o.jsx(dt.div,{...h,ref:j,style:{pointerEvents:T?R?"auto":"none":void 0,...e.style},onFocusCapture:et(e.onFocusCapture,L.onFocusCapture),onBlurCapture:et(e.onBlurCapture,L.onBlurCapture),onPointerDownCapture:et(e.onPointerDownCapture,D.onPointerDownCapture)})});Qu.displayName=S8;var N8="DismissableLayerBranch",_8=g.forwardRef((e,t)=>{const n=g.useContext(jM),a=g.useRef(null),i=Ot(t,a);return g.useEffect(()=>{const l=a.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),o.jsx(dt.div,{...e,ref:i})});_8.displayName=N8;function E8(e,t=globalThis?.document){const n=gi(e),a=g.useRef(!1),i=g.useRef(()=>{});return g.useEffect(()=>{const l=d=>{if(d.target&&!a.current){let h=function(){CM(j8,n,p,{discrete:!0})};const p={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);a.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",l),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>a.current=!0}}function T8(e,t=globalThis?.document){const n=gi(e),a=g.useRef(!1);return g.useEffect(()=>{const i=l=>{l.target&&!a.current&&CM(C8,n,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function N_(){const e=new CustomEvent(Kb);document.dispatchEvent(e)}function CM(e,t,n,{discrete:a}){const i=n.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),a?b8(i,l):i.dispatchEvent(l)}var nv="focusScope.autoFocusOnMount",rv="focusScope.autoFocusOnUnmount",__={bubbles:!1,cancelable:!0},R8="FocusScope",$h=g.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:i,onUnmountAutoFocus:l,...u}=e,[d,h]=g.useState(null),p=gi(i),v=gi(l),m=g.useRef(null),b=Ot(t,S=>h(S)),w=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(a){let S=function(T){if(w.paused||!d)return;const R=T.target;d.contains(R)?m.current=R:ci(m.current,{select:!0})},C=function(T){if(w.paused||!d)return;const R=T.relatedTarget;R!==null&&(d.contains(R)||ci(m.current,{select:!0}))},N=function(T){if(document.activeElement===document.body)for(const D of T)D.removedNodes.length>0&&ci(d)};document.addEventListener("focusin",S),document.addEventListener("focusout",C);const _=new MutationObserver(N);return d&&_.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",C),_.disconnect()}}},[a,d,w.paused]),g.useEffect(()=>{if(d){T_.add(w);const S=document.activeElement;if(!d.contains(S)){const N=new CustomEvent(nv,__);d.addEventListener(nv,p),d.dispatchEvent(N),N.defaultPrevented||(A8(k8(NM(d)),{select:!0}),document.activeElement===S&&ci(d))}return()=>{d.removeEventListener(nv,p),setTimeout(()=>{const N=new CustomEvent(rv,__);d.addEventListener(rv,v),d.dispatchEvent(N),N.defaultPrevented||ci(S??document.body,{select:!0}),d.removeEventListener(rv,v),T_.remove(w)},0)}}},[d,p,v,w]);const j=g.useCallback(S=>{if(!n&&!a||w.paused)return;const C=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,N=document.activeElement;if(C&&N){const _=S.currentTarget,[T,R]=O8(_);T&&R?!S.shiftKey&&N===R?(S.preventDefault(),n&&ci(T,{select:!0})):S.shiftKey&&N===T&&(S.preventDefault(),n&&ci(R,{select:!0})):N===_&&S.preventDefault()}},[n,a,w.paused]);return o.jsx(dt.div,{tabIndex:-1,...u,ref:b,onKeyDown:j})});$h.displayName=R8;function A8(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(ci(a,{select:t}),document.activeElement!==n)return}function O8(e){const t=NM(e),n=E_(t,e),a=E_(t.reverse(),e);return[n,a]}function NM(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const i=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||i?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function E_(e,t){for(const n of e)if(!M8(n,{upTo:t}))return n}function M8(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 D8(e){return e instanceof HTMLInputElement&&"select"in e}function ci(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&D8(e)&&t&&e.select()}}var T_=P8();function P8(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=R_(e,t),e.unshift(t)},remove(t){e=R_(e,t),e[0]?.resume()}}}function R_(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function k8(e){return e.filter(t=>t.tagName!=="A")}var L8="Portal",Gh=g.forwardRef((e,t)=>{const{container:n,...a}=e,[i,l]=g.useState(!1);Kn(()=>l(!0),[]);const u=n||i&&globalThis?.document?.body;return u?WO.createPortal(o.jsx(dt.div,{...a,ref:t}),u):null});Gh.displayName=L8;function B8(e,t){return g.useReducer((n,a)=>t[n][a]??n,e)}var Ts=e=>{const{present:t,children:n}=e,a=I8(t),i=typeof n=="function"?n({present:a.isPresent}):g.Children.only(n),l=Ot(a.ref,z8(i));return typeof n=="function"||a.isPresent?g.cloneElement(i,{ref:l}):null};Ts.displayName="Presence";function I8(e){const[t,n]=g.useState(),a=g.useRef(null),i=g.useRef(e),l=g.useRef("none"),u=e?"mounted":"unmounted",[d,h]=B8(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const p=Lf(a.current);l.current=d==="mounted"?p:"none"},[d]),Kn(()=>{const p=a.current,v=i.current;if(v!==e){const b=l.current,w=Lf(p);e?h("MOUNT"):w==="none"||p?.display==="none"?h("UNMOUNT"):h(v&&b!==w?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,h]),Kn(()=>{if(t){let p;const v=t.ownerDocument.defaultView??window,m=w=>{const S=Lf(a.current).includes(CSS.escape(w.animationName));if(w.target===t&&S&&(h("ANIMATION_END"),!i.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",p=v.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},b=w=>{w.target===t&&(l.current=Lf(a.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{v.clearTimeout(p),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:g.useCallback(p=>{a.current=p?getComputedStyle(p):null,n(p)},[])}}function Lf(e){return e?.animationName||"none"}function z8(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var av=0;function aw(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??A_()),document.body.insertAdjacentElement("beforeend",e[1]??A_()),av++,()=>{av===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),av--}},[])}function A_(){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 Pa=function(){return Pa=Object.assign||function(t){for(var n,a=1,i=arguments.length;a<i;a++){n=arguments[a];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},Pa.apply(this,arguments)};function _M(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,a=Object.getOwnPropertySymbols(e);i<a.length;i++)t.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(n[a[i]]=e[a[i]]);return n}function F8(e,t,n){if(n||arguments.length===2)for(var a=0,i=t.length,l;a<i;a++)(l||!(a in t))&&(l||(l=Array.prototype.slice.call(t,0,a)),l[a]=t[a]);return e.concat(l||Array.prototype.slice.call(t))}var Jf="right-scroll-bar-position",eh="width-before-scroll-bar",H8="with-scroll-bars-hidden",U8="--removed-body-scroll-bar-size";function sv(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function V8(e,t){var n=g.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(a){var i=n.value;i!==a&&(n.value=a,n.callback(a,i))}}}})[0];return n.callback=t,n.facade}var q8=typeof window<"u"?g.useLayoutEffect:g.useEffect,O_=new WeakMap;function $8(e,t){var n=V8(null,function(a){return e.forEach(function(i){return sv(i,a)})});return q8(function(){var a=O_.get(n);if(a){var i=new Set(a),l=new Set(e),u=n.current;i.forEach(function(d){l.has(d)||sv(d,null)}),l.forEach(function(d){i.has(d)||sv(d,u)})}O_.set(n,e)},[e]),n}function G8(e){return e}function K8(e,t){t===void 0&&(t=G8);var n=[],a=!1,i={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(l){var u=t(l,a);return n.push(u),function(){n=n.filter(function(d){return d!==u})}},assignSyncMedium:function(l){for(a=!0;n.length;){var u=n;n=[],u.forEach(l)}n={push:function(d){return l(d)},filter:function(){return n}}},assignMedium:function(l){a=!0;var u=[];if(n.length){var d=n;n=[],d.forEach(l),u=n}var h=function(){var v=u;u=[],v.forEach(l)},p=function(){return Promise.resolve().then(h)};p(),n={push:function(v){u.push(v),p()},filter:function(v){return u=u.filter(v),n}}}};return i}function Y8(e){e===void 0&&(e={});var t=K8(null);return t.options=Pa({async:!0,ssr:!1},e),t}var EM=function(e){var t=e.sideCar,n=_M(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return g.createElement(a,Pa({},n))};EM.isSideCarExport=!0;function W8(e,t){return e.useMedium(t),EM}var TM=Y8(),iv=function(){},Kh=g.forwardRef(function(e,t){var n=g.useRef(null),a=g.useState({onScrollCapture:iv,onWheelCapture:iv,onTouchMoveCapture:iv}),i=a[0],l=a[1],u=e.forwardProps,d=e.children,h=e.className,p=e.removeScrollBar,v=e.enabled,m=e.shards,b=e.sideCar,w=e.noRelative,j=e.noIsolation,S=e.inert,C=e.allowPinchZoom,N=e.as,_=N===void 0?"div":N,T=e.gapMode,R=_M(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),D=b,L=$8([n,t]),k=Pa(Pa({},R),i);return g.createElement(g.Fragment,null,v&&g.createElement(D,{sideCar:TM,removeScrollBar:p,shards:m,noRelative:w,noIsolation:j,inert:S,setCallbacks:l,allowPinchZoom:!!C,lockRef:n,gapMode:T}),u?g.cloneElement(g.Children.only(d),Pa(Pa({},k),{ref:L})):g.createElement(_,Pa({},k,{className:h,ref:L}),d))});Kh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Kh.classNames={fullWidth:eh,zeroRight:Jf};var X8=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Q8(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=X8();return t&&e.setAttribute("nonce",t),e}function Z8(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function J8(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var eH=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Q8())&&(Z8(t,n),J8(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},tH=function(){var e=eH();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},RM=function(){var e=tH(),t=function(n){var a=n.styles,i=n.dynamic;return e(a,i),null};return t},nH={left:0,top:0,right:0,gap:0},ov=function(e){return parseInt(e||"",10)||0},rH=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[ov(n),ov(a),ov(i)]},aH=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return nH;var t=rH(e),n=document.documentElement.clientWidth,a=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,a-n+t[2]-t[0])}},sH=RM(),Sl="data-scroll-locked",iH=function(e,t,n,a){var i=e.left,l=e.top,u=e.right,d=e.gap;return n===void 0&&(n="margin"),`
  15. .`.concat(H8,` {
  16. overflow: hidden `).concat(a,`;
  17. padding-right: `).concat(d,"px ").concat(a,`;
  18. }
  19. body[`).concat(Sl,`] {
  20. overflow: hidden `).concat(a,`;
  21. overscroll-behavior: contain;
  22. `).concat([t&&"position: relative ".concat(a,";"),n==="margin"&&`
  23. padding-left: `.concat(i,`px;
  24. padding-top: `).concat(l,`px;
  25. padding-right: `).concat(u,`px;
  26. margin-left:0;
  27. margin-top:0;
  28. margin-right: `).concat(d,"px ").concat(a,`;
  29. `),n==="padding"&&"padding-right: ".concat(d,"px ").concat(a,";")].filter(Boolean).join(""),`
  30. }
  31. .`).concat(Jf,` {
  32. right: `).concat(d,"px ").concat(a,`;
  33. }
  34. .`).concat(eh,` {
  35. margin-right: `).concat(d,"px ").concat(a,`;
  36. }
  37. .`).concat(Jf," .").concat(Jf,` {
  38. right: 0 `).concat(a,`;
  39. }
  40. .`).concat(eh," .").concat(eh,` {
  41. margin-right: 0 `).concat(a,`;
  42. }
  43. body[`).concat(Sl,`] {
  44. `).concat(U8,": ").concat(d,`px;
  45. }
  46. `)},M_=function(){var e=parseInt(document.body.getAttribute(Sl)||"0",10);return isFinite(e)?e:0},oH=function(){g.useEffect(function(){return document.body.setAttribute(Sl,(M_()+1).toString()),function(){var e=M_()-1;e<=0?document.body.removeAttribute(Sl):document.body.setAttribute(Sl,e.toString())}},[])},lH=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,i=a===void 0?"margin":a;oH();var l=g.useMemo(function(){return aH(i)},[i]);return g.createElement(sH,{styles:iH(l,!t,i,n?"":"!important")})},Yb=!1;if(typeof window<"u")try{var Bf=Object.defineProperty({},"passive",{get:function(){return Yb=!0,!0}});window.addEventListener("test",Bf,Bf),window.removeEventListener("test",Bf,Bf)}catch{Yb=!1}var Go=Yb?{passive:!1}:!1,cH=function(e){return e.tagName==="TEXTAREA"},AM=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!cH(e)&&n[t]==="visible")},uH=function(e){return AM(e,"overflowY")},dH=function(e){return AM(e,"overflowX")},D_=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var i=OM(e,a);if(i){var l=MM(e,a),u=l[1],d=l[2];if(u>d)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},fH=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},hH=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},OM=function(e,t){return e==="v"?uH(t):dH(t)},MM=function(e,t){return e==="v"?fH(t):hH(t)},pH=function(e,t){return e==="h"&&t==="rtl"?-1:1},mH=function(e,t,n,a,i){var l=pH(e,window.getComputedStyle(t).direction),u=l*a,d=n.target,h=t.contains(d),p=!1,v=u>0,m=0,b=0;do{if(!d)break;var w=MM(e,d),j=w[0],S=w[1],C=w[2],N=S-C-l*j;(j||N)&&OM(e,d)&&(m+=N,b+=j);var _=d.parentNode;d=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!h&&d!==document.body||h&&(t.contains(d)||t===d));return(v&&Math.abs(m)<1||!v&&Math.abs(b)<1)&&(p=!0),p},If=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},P_=function(e){return[e.deltaX,e.deltaY]},k_=function(e){return e&&"current"in e?e.current:e},gH=function(e,t){return e[0]===t[0]&&e[1]===t[1]},vH=function(e){return`
  47. .block-interactivity-`.concat(e,` {pointer-events: none;}
  48. .allow-interactivity-`).concat(e,` {pointer-events: all;}
  49. `)},xH=0,Ko=[];function yH(e){var t=g.useRef([]),n=g.useRef([0,0]),a=g.useRef(),i=g.useState(xH++)[0],l=g.useState(RM)[0],u=g.useRef(e);g.useEffect(function(){u.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var S=F8([e.lockRef.current],(e.shards||[]).map(k_),!0).filter(Boolean);return S.forEach(function(C){return C.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var d=g.useCallback(function(S,C){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!u.current.allowPinchZoom;var N=If(S),_=n.current,T="deltaX"in S?S.deltaX:_[0]-N[0],R="deltaY"in S?S.deltaY:_[1]-N[1],D,L=S.target,k=Math.abs(T)>Math.abs(R)?"h":"v";if("touches"in S&&k==="h"&&L.type==="range")return!1;var P=window.getSelection(),U=P&&P.anchorNode,J=U?U===L||U.contains(L):!1;if(J)return!1;var $=D_(k,L);if(!$)return!0;if($?D=k:(D=k==="v"?"h":"v",$=D_(k,L)),!$)return!1;if(!a.current&&"changedTouches"in S&&(T||R)&&(a.current=D),!D)return!0;var W=a.current||D;return mH(W,C,S,W==="h"?T:R)},[]),h=g.useCallback(function(S){var C=S;if(!(!Ko.length||Ko[Ko.length-1]!==l)){var N="deltaY"in C?P_(C):If(C),_=t.current.filter(function(D){return D.name===C.type&&(D.target===C.target||C.target===D.shadowParent)&&gH(D.delta,N)})[0];if(_&&_.should){C.cancelable&&C.preventDefault();return}if(!_){var T=(u.current.shards||[]).map(k_).filter(Boolean).filter(function(D){return D.contains(C.target)}),R=T.length>0?d(C,T[0]):!u.current.noIsolation;R&&C.cancelable&&C.preventDefault()}}},[]),p=g.useCallback(function(S,C,N,_){var T={name:S,delta:C,target:N,should:_,shadowParent:bH(N)};t.current.push(T),setTimeout(function(){t.current=t.current.filter(function(R){return R!==T})},1)},[]),v=g.useCallback(function(S){n.current=If(S),a.current=void 0},[]),m=g.useCallback(function(S){p(S.type,P_(S),S.target,d(S,e.lockRef.current))},[]),b=g.useCallback(function(S){p(S.type,If(S),S.target,d(S,e.lockRef.current))},[]);g.useEffect(function(){return Ko.push(l),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:b}),document.addEventListener("wheel",h,Go),document.addEventListener("touchmove",h,Go),document.addEventListener("touchstart",v,Go),function(){Ko=Ko.filter(function(S){return S!==l}),document.removeEventListener("wheel",h,Go),document.removeEventListener("touchmove",h,Go),document.removeEventListener("touchstart",v,Go)}},[]);var w=e.removeScrollBar,j=e.inert;return g.createElement(g.Fragment,null,j?g.createElement(l,{styles:vH(i)}):null,w?g.createElement(lH,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function bH(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const wH=W8(TM,yH);var Yh=g.forwardRef(function(e,t){return g.createElement(Kh,Pa({},e,{ref:t,sideCar:wH}))});Yh.classNames=Kh.classNames;var SH=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Yo=new WeakMap,zf=new WeakMap,Ff={},lv=0,DM=function(e){return e&&(e.host||DM(e.parentNode))},jH=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=DM(n);return a&&e.contains(a)?a:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},CH=function(e,t,n,a){var i=jH(t,Array.isArray(e)?e:[e]);Ff[n]||(Ff[n]=new WeakMap);var l=Ff[n],u=[],d=new Set,h=new Set(i),p=function(m){!m||d.has(m)||(d.add(m),p(m.parentNode))};i.forEach(p);var v=function(m){!m||h.has(m)||Array.prototype.forEach.call(m.children,function(b){if(d.has(b))v(b);else try{var w=b.getAttribute(a),j=w!==null&&w!=="false",S=(Yo.get(b)||0)+1,C=(l.get(b)||0)+1;Yo.set(b,S),l.set(b,C),u.push(b),S===1&&j&&zf.set(b,!0),C===1&&b.setAttribute(n,"true"),j||b.setAttribute(a,"true")}catch(N){console.error("aria-hidden: cannot operate on ",b,N)}})};return v(t),d.clear(),lv++,function(){u.forEach(function(m){var b=Yo.get(m)-1,w=l.get(m)-1;Yo.set(m,b),l.set(m,w),b||(zf.has(m)||m.removeAttribute(a),zf.delete(m)),w||m.removeAttribute(n)}),lv--,lv||(Yo=new WeakMap,Yo=new WeakMap,zf=new WeakMap,Ff={})}},sw=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),i=SH(e);return i?(a.push.apply(a,Array.from(i.querySelectorAll("[aria-live], script"))),CH(a,i,n,"aria-hidden")):function(){return null}};function NH(e){const t=_H(e),n=g.forwardRef((a,i)=>{const{children:l,...u}=a,d=g.Children.toArray(l),h=d.find(TH);if(h){const p=h.props.children,v=d.map(m=>m===h?g.Children.count(p)>1?g.Children.only(null):g.isValidElement(p)?p.props.children:null:m);return o.jsx(t,{...u,ref:i,children:g.isValidElement(p)?g.cloneElement(p,void 0,v):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function _H(e){const t=g.forwardRef((n,a)=>{const{children:i,...l}=n;if(g.isValidElement(i)){const u=AH(i),d=RH(l,i.props);return i.type!==g.Fragment&&(d.ref=a?oo(a,u):u),g.cloneElement(i,d)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var EH=Symbol("radix.slottable");function TH(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===EH}function RH(e,t){const n={...t};for(const a in t){const i=e[a],l=t[a];/^on[A-Z]/.test(a)?i&&l?n[a]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(n[a]=i):a==="style"?n[a]={...i,...l}:a==="className"&&(n[a]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function AH(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Wh="Dialog",[PM]=Lr(Wh),[OH,wa]=PM(Wh),kM=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:i,onOpenChange:l,modal:u=!0}=e,d=g.useRef(null),h=g.useRef(null),[p,v]=Zr({prop:a,defaultProp:i??!1,onChange:l,caller:Wh});return o.jsx(OH,{scope:t,triggerRef:d,contentRef:h,contentId:ma(),titleId:ma(),descriptionId:ma(),open:p,onOpenChange:v,onOpenToggle:g.useCallback(()=>v(m=>!m),[v]),modal:u,children:n})};kM.displayName=Wh;var LM="DialogTrigger",BM=g.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,i=wa(LM,n),l=Ot(t,i.triggerRef);return o.jsx(dt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":lw(i.open),...a,ref:l,onClick:et(e.onClick,i.onOpenToggle)})});BM.displayName=LM;var iw="DialogPortal",[MH,IM]=PM(iw,{forceMount:void 0}),zM=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:i}=e,l=wa(iw,t);return o.jsx(MH,{scope:t,forceMount:n,children:g.Children.map(a,u=>o.jsx(Ts,{present:n||l.open,children:o.jsx(Gh,{asChild:!0,container:i,children:u})}))})};zM.displayName=iw;var mh="DialogOverlay",FM=g.forwardRef((e,t)=>{const n=IM(mh,e.__scopeDialog),{forceMount:a=n.forceMount,...i}=e,l=wa(mh,e.__scopeDialog);return l.modal?o.jsx(Ts,{present:a||l.open,children:o.jsx(PH,{...i,ref:t})}):null});FM.displayName=mh;var DH=NH("DialogOverlay.RemoveScroll"),PH=g.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,i=wa(mh,n);return o.jsx(Yh,{as:DH,allowPinchZoom:!0,shards:[i.contentRef],children:o.jsx(dt.div,{"data-state":lw(i.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),eo="DialogContent",HM=g.forwardRef((e,t)=>{const n=IM(eo,e.__scopeDialog),{forceMount:a=n.forceMount,...i}=e,l=wa(eo,e.__scopeDialog);return o.jsx(Ts,{present:a||l.open,children:l.modal?o.jsx(kH,{...i,ref:t}):o.jsx(LH,{...i,ref:t})})});HM.displayName=eo;var kH=g.forwardRef((e,t)=>{const n=wa(eo,e.__scopeDialog),a=g.useRef(null),i=Ot(t,n.contentRef,a);return g.useEffect(()=>{const l=a.current;if(l)return sw(l)},[]),o.jsx(UM,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:et(e.onCloseAutoFocus,l=>{l.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:et(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&l.preventDefault()}),onFocusOutside:et(e.onFocusOutside,l=>l.preventDefault())})}),LH=g.forwardRef((e,t)=>{const n=wa(eo,e.__scopeDialog),a=g.useRef(!1),i=g.useRef(!1);return o.jsx(UM,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{e.onCloseAutoFocus?.(l),l.defaultPrevented||(a.current||n.triggerRef.current?.focus(),l.preventDefault()),a.current=!1,i.current=!1},onInteractOutside:l=>{e.onInteractOutside?.(l),l.defaultPrevented||(a.current=!0,l.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const u=l.target;n.triggerRef.current?.contains(u)&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&i.current&&l.preventDefault()}})}),UM=g.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:l,...u}=e,d=wa(eo,n),h=g.useRef(null),p=Ot(t,h);return aw(),o.jsxs(o.Fragment,{children:[o.jsx($h,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:i,onUnmountAutoFocus:l,children:o.jsx(Qu,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":lw(d.open),...u,ref:p,onDismiss:()=>d.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(BH,{titleId:d.titleId}),o.jsx(zH,{contentRef:h,descriptionId:d.descriptionId})]})]})}),ow="DialogTitle",VM=g.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,i=wa(ow,n);return o.jsx(dt.h2,{id:i.titleId,...a,ref:t})});VM.displayName=ow;var qM="DialogDescription",$M=g.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,i=wa(qM,n);return o.jsx(dt.p,{id:i.descriptionId,...a,ref:t})});$M.displayName=qM;var GM="DialogClose",KM=g.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,i=wa(GM,n);return o.jsx(dt.button,{type:"button",...a,ref:t,onClick:et(e.onClick,()=>i.onOpenChange(!1))})});KM.displayName=GM;function lw(e){return e?"open":"closed"}var YM="DialogTitleWarning",[Fse,WM]=i8(YM,{contentName:eo,titleName:ow,docsSlug:"dialog"}),BH=({titleId:e})=>{const t=WM(YM),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
  50. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
  51. For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},IH="DialogDescriptionWarning",zH=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${WM(IH).contentName}}.`;return g.useEffect(()=>{const i=e.current?.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},XM=kM,FH=BM,QM=zM,Xh=FM,Qh=HM,Zh=VM,Jh=$M,ZM=KM;const HH=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),UH=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase()),L_=e=>{const t=UH(e);return t.charAt(0).toUpperCase()+t.slice(1)},JM=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim(),VH=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var qH={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const $H=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:i="",children:l,iconNode:u,...d},h)=>g.createElement("svg",{ref:h,...qH,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:JM("lucide",i),...!l&&!VH(d)&&{"aria-hidden":"true"},...d},[...u.map(([p,v])=>g.createElement(p,v)),...Array.isArray(l)?l:[l]]));const Rs=(e,t)=>{const n=g.forwardRef(({className:a,...i},l)=>g.createElement($H,{ref:l,iconNode:t,className:JM(`lucide-${HH(L_(e))}`,`lucide-${e}`,a),...i}));return n.displayName=L_(e),n};const GH=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],eD=Rs("check",GH);const KH=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],cw=Rs("chevron-down",KH);const YH=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],WH=Rs("chevron-up",YH);const XH=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],QH=Rs("circle",XH);const ZH=[["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"}]],JH=Rs("layers",ZH);const eU=[["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"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],tU=Rs("pencil",eU);const nU=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],rU=Rs("plus",nU);const aU=[["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"}]],tD=Rs("trash-2",aU);const sU=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],nD=Rs("x",sU),ga=XM,tu=FH,iU=QM,rD=g.forwardRef(({className:e,...t},n)=>o.jsx(Xh,{ref:n,className:ct("fixed inset-0 z-[100] 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}));rD.displayName=Xh.displayName;const Wr=g.forwardRef(({className:e,children:t,...n},a)=>o.jsxs(iU,{children:[o.jsx(rD,{}),o.jsxs(Qh,{ref:a,className:ct("fixed left-[50%] top-[50%] z-[100] 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 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,o.jsxs(ZM,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background 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:[o.jsx(nD,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Wr.displayName=Qh.displayName;const Mr=({className:e,...t})=>o.jsx("div",{className:ct("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Mr.displayName="DialogHeader";const va=({className:e,...t})=>o.jsx("div",{className:ct("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});va.displayName="DialogFooter";const Dr=g.forwardRef(({className:e,...t},n)=>o.jsx(Zh,{ref:n,className:ct("text-lg font-semibold leading-none tracking-tight",e),...t}));Dr.displayName=Zh.displayName;const vi=g.forwardRef(({className:e,...t},n)=>o.jsx(Jh,{ref:n,className:ct("text-sm text-muted-foreground",e),...t}));vi.displayName=Jh.displayName;class oU{_baseUrl="";_listeners=new Set;get baseUrl(){return this._baseUrl}setBaseUrl(t){const n=t.replace(/\/$/,"");n!==this._baseUrl&&(this._baseUrl=n,this._listeners.forEach(a=>a(this._baseUrl)))}onBaseUrlChange(t){return this._listeners.add(t),()=>this._listeners.delete(t)}buildUrl(t){const n=t.startsWith("/")?t:`/${t}`;return`${this._baseUrl}${n}`}async request(t,n={}){const{method:a="GET",body:i,headers:l={},signal:u}=n,d=this.buildUrl(t),h={method:a,headers:{"Content-Type":"application/json",...l},signal:u};i!==void 0&&(h.body=JSON.stringify(i));const p=await fetch(d,h);if(!p.ok){const m=await p.text();throw new Error(`HTTP ${p.status}: ${m}`)}const v=await p.text();return v?JSON.parse(v):{}}async get(t,n){return this.request(t,{method:"GET",signal:n})}async post(t,n,a){return this.request(t,{method:"POST",body:n,signal:a})}async patch(t,n,a){return this.request(t,{method:"PATCH",body:n,signal:a})}async delete(t,n,a){return this.request(t,{method:"DELETE",body:n,signal:a})}getWebSocketUrl(t){const n=t.startsWith("/")?t:`/${t}`;if(this._baseUrl){const a=new URL(this._baseUrl);return`${a.protocol==="https:"?"wss:":"ws:"}//${a.host}${n}`}else{const a=window.location.protocol==="https:"?"wss:":"ws:",i=window.location.hostname,l=window.location.port,u=l?`:${l}`:"";return`${a}//${i}${u}${n}`}}getAssetUrl(t){const n=t.startsWith("/")?t:`/${t}`;return`${this._baseUrl}${n}`}async uploadFile(t,n,a="file",i){const l=this.buildUrl(t),u=new FormData;u.append(a,n),i&&Object.entries(i).forEach(([p,v])=>{u.append(p,v)});const d=await fetch(l,{method:"POST",body:u});if(!d.ok){const p=await d.text();throw new Error(`HTTP ${d.status}: ${p}`)}const h=await d.text();return h?JSON.parse(h):{}}}const de=new oU;function lU(){try{const e="duneweaver_tables",t="duneweaver_active_table",n=localStorage.getItem(e),a=localStorage.getItem(t);if(!n||!a)return;const u=(JSON.parse(n).tables||[]).find(v=>v.id===a);if(!u?.url)return;const h=(v=>{try{return new URL(v).origin}catch{return v}})(u.url),p=window.location.origin;h!==p&&de.setBaseUrl(u.url)}catch{}}lU();const B_=e=>{let t;const n=new Set,a=(p,v)=>{const m=typeof p=="function"?p(t):p;if(!Object.is(m,t)){const b=t;t=v??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(w=>w(t,b))}},i=()=>t,d={setState:a,getState:i,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=t=e(a,i,d);return d},cU=(e=>e?B_(e):B_),uU=e=>e;function dU(e,t=uU){const n=A.useSyncExternalStore(e.subscribe,A.useCallback(()=>t(e.getState()),[e,t]),A.useCallback(()=>t(e.getInitialState()),[e,t]));return A.useDebugValue(n),n}const fU=e=>{const t=cU(e),n=a=>dU(t,a);return Object.assign(n,t),n},aD=(e=>fU),un=aD()(()=>({isBackendConnected:!1,connectionAttempts:0,status:null}));let ua=null,th=null;function uw(){if(ua){if(ua.readyState===WebSocket.CONNECTING)return;ua.readyState===WebSocket.OPEN&&ua.close(),ua=null}const e=new WebSocket(de.getWebSocketUrl("/ws/status"));ua=e,e.onopen=()=>{un.setState({isBackendConnected:!0,connectionAttempts:0}),window.dispatchEvent(new CustomEvent("backend-connected"))},e.onmessage=t=>{try{const n=JSON.parse(t.data);n.type==="status_update"&&n.data&&un.setState({status:n.data})}catch{}},e.onclose=()=>{ua=null,un.setState(t=>({isBackendConnected:!1,connectionAttempts:t.connectionAttempts+1})),th=setTimeout(uw,3e3)},e.onerror=()=>{un.setState({isBackendConnected:!1})}}de.onBaseUrlChange(()=>{un.setState({status:null,isBackendConnected:!1}),th&&(clearTimeout(th),th=null),ua&&(ua.readyState===WebSocket.OPEN&&ua.close(),ua=null),uw()});uw();let nh=null;un.subscribe(e=>{const t=e.status;if(!t)return;const n=!!t.current_file||!!t.is_running||!!t.is_paused||(t.pause_time_remaining??0)>0;nh!==null&&n&&!nh&&window.dispatchEvent(new CustomEvent("playback-started")),nh=n});de.onBaseUrlChange(()=>{nh=null});function hU(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>a=>{t.forEach(i=>i(a))},t)}const ep=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Il(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function dw(e){return"nodeType"in e}function xr(e){var t,n;return e?Il(e)?e:dw(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function fw(e){const{Document:t}=xr(e);return e instanceof t}function Zu(e){return Il(e)?!1:e instanceof xr(e).HTMLElement}function sD(e){return e instanceof xr(e).SVGElement}function zl(e){return e?Il(e)?e.document:dw(e)?fw(e)?e:Zu(e)||sD(e)?e.ownerDocument:document:document:document}const Fa=ep?g.useLayoutEffect:g.useEffect;function hw(e){const t=g.useRef(e);return Fa(()=>{t.current=e}),g.useCallback(function(){for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return t.current==null?void 0:t.current(...a)},[])}function pU(){const e=g.useRef(null),t=g.useCallback((a,i)=>{e.current=setInterval(a,i)},[]),n=g.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ou(e,t){t===void 0&&(t=[e]);const n=g.useRef(e);return Fa(()=>{n.current!==e&&(n.current=e)},t),n}function Ju(e,t){const n=g.useRef();return g.useMemo(()=>{const a=e(n.current);return n.current=a,a},[...t])}function gh(e){const t=hw(e),n=g.useRef(null),a=g.useCallback(i=>{i!==n.current&&t?.(i,n.current),n.current=i},[]);return[n,a]}function Wb(e){const t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}let cv={};function ed(e,t){return g.useMemo(()=>{if(t)return t;const n=cv[e]==null?0:cv[e]+1;return cv[e]=n,e+"-"+n},[e,t])}function iD(e){return function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];return a.reduce((l,u)=>{const d=Object.entries(u);for(const[h,p]of d){const v=l[h];v!=null&&(l[h]=v+e*p)}return l},{...t})}}const jl=iD(1),Mu=iD(-1);function mU(e){return"clientX"in e&&"clientY"in e}function pw(e){if(!e)return!1;const{KeyboardEvent:t}=xr(e.target);return t&&e instanceof t}function gU(e){if(!e)return!1;const{TouchEvent:t}=xr(e.target);return t&&e instanceof t}function Xb(e){if(gU(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return mU(e)?{x:e.clientX,y:e.clientY}:null}const Du=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Du.Translate.toString(e),Du.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:a}=e;return t+" "+n+"ms "+a}}}),I_="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function vU(e){return e.matches(I_)?e:e.querySelector(I_)}const xU={display:"none"};function yU(e){let{id:t,value:n}=e;return A.createElement("div",{id:t,style:xU},n)}function bU(e){let{id:t,announcement:n,ariaLiveType:a="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return A.createElement("div",{id:t,style:i,role:"status","aria-live":a,"aria-atomic":!0},n)}function wU(){const[e,t]=g.useState("");return{announce:g.useCallback(a=>{a!=null&&t(a)},[]),announcement:e}}const oD=g.createContext(null);function SU(e){const t=g.useContext(oD);g.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function jU(){const[e]=g.useState(()=>new Set),t=g.useCallback(a=>(e.add(a),()=>e.delete(a)),[e]);return[g.useCallback(a=>{let{type:i,event:l}=a;e.forEach(u=>{var d;return(d=u[i])==null?void 0:d.call(u,l)})},[e]),t]}const CU={draggable:`
  52. To pick up a draggable item, press the space bar.
  53. While dragging, use the arrow keys to move the item.
  54. Press space again to drop the item in its new position, or press escape to cancel.
  55. `},NU={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function _U(e){let{announcements:t=NU,container:n,hiddenTextDescribedById:a,screenReaderInstructions:i=CU}=e;const{announce:l,announcement:u}=wU(),d=ed("DndLiveRegion"),[h,p]=g.useState(!1);if(g.useEffect(()=>{p(!0)},[]),SU(g.useMemo(()=>({onDragStart(m){let{active:b}=m;l(t.onDragStart({active:b}))},onDragMove(m){let{active:b,over:w}=m;t.onDragMove&&l(t.onDragMove({active:b,over:w}))},onDragOver(m){let{active:b,over:w}=m;l(t.onDragOver({active:b,over:w}))},onDragEnd(m){let{active:b,over:w}=m;l(t.onDragEnd({active:b,over:w}))},onDragCancel(m){let{active:b,over:w}=m;l(t.onDragCancel({active:b,over:w}))}}),[l,t])),!h)return null;const v=A.createElement(A.Fragment,null,A.createElement(yU,{id:a,value:i.draggable}),A.createElement(bU,{id:d,announcement:u}));return n?ka.createPortal(v,n):v}var Mn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Mn||(Mn={}));function vh(){}function z_(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function EU(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(a=>a!=null),[...t])}const xa=Object.freeze({x:0,y:0});function lD(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function cD(e,t){let{data:{value:n}}=e,{data:{value:a}}=t;return n-a}function TU(e,t){let{data:{value:n}}=e,{data:{value:a}}=t;return a-n}function F_(e){let{left:t,top:n,height:a,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+a},{x:t+i,y:n+a}]}function uD(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function H_(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const RU=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const i=H_(t,t.left,t.top),l=[];for(const u of a){const{id:d}=u,h=n.get(d);if(h){const p=lD(H_(h),i);l.push({id:d,data:{droppableContainer:u,value:p}})}}return l.sort(cD)},AU=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const i=F_(t),l=[];for(const u of a){const{id:d}=u,h=n.get(d);if(h){const p=F_(h),v=i.reduce((b,w,j)=>b+lD(p[j],w),0),m=Number((v/4).toFixed(4));l.push({id:d,data:{droppableContainer:u,value:m}})}}return l.sort(cD)};function OU(e,t){const n=Math.max(t.top,e.top),a=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),l=Math.min(t.top+t.height,e.top+e.height),u=i-a,d=l-n;if(a<i&&n<l){const h=t.width*t.height,p=e.width*e.height,v=u*d,m=v/(h+p-v);return Number(m.toFixed(4))}return 0}const MU=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const i=[];for(const l of a){const{id:u}=l,d=n.get(u);if(d){const h=OU(d,t);h>0&&i.push({id:u,data:{droppableContainer:l,value:h}})}}return i.sort(TU)};function DU(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function dD(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:xa}function PU(e){return function(n){for(var a=arguments.length,i=new Array(a>1?a-1:0),l=1;l<a;l++)i[l-1]=arguments[l];return i.reduce((u,d)=>({...u,top:u.top+e*d.y,bottom:u.bottom+e*d.y,left:u.left+e*d.x,right:u.right+e*d.x}),{...n})}}const kU=PU(1);function LU(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function BU(e,t,n){const a=LU(t);if(!a)return e;const{scaleX:i,scaleY:l,x:u,y:d}=a,h=e.left-u-(1-i)*parseFloat(n),p=e.top-d-(1-l)*parseFloat(n.slice(n.indexOf(" ")+1)),v=i?e.width/i:e.width,m=l?e.height/l:e.height;return{width:v,height:m,top:p,right:h+v,bottom:p+m,left:h}}const IU={ignoreTransform:!1};function Fl(e,t){t===void 0&&(t=IU);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:p,transformOrigin:v}=xr(e).getComputedStyle(e);p&&(n=BU(n,p,v))}const{top:a,left:i,width:l,height:u,bottom:d,right:h}=n;return{top:a,left:i,width:l,height:u,bottom:d,right:h}}function U_(e){return Fl(e,{ignoreTransform:!0})}function zU(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function FU(e,t){return t===void 0&&(t=xr(e).getComputedStyle(e)),t.position==="fixed"}function HU(e,t){t===void 0&&(t=xr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const l=t[i];return typeof l=="string"?n.test(l):!1})}function tp(e,t){const n=[];function a(i){if(t!=null&&n.length>=t||!i)return n;if(fw(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Zu(i)||sD(i)||n.includes(i))return n;const l=xr(e).getComputedStyle(i);return i!==e&&HU(i,l)&&n.push(i),FU(i,l)?n:a(i.parentNode)}return e?a(e):n}function fD(e){const[t]=tp(e,1);return t??null}function uv(e){return!ep||!e?null:Il(e)?e:dw(e)?fw(e)||e===zl(e).scrollingElement?window:Zu(e)?e:null:null}function hD(e){return Il(e)?e.scrollX:e.scrollLeft}function pD(e){return Il(e)?e.scrollY:e.scrollTop}function Qb(e){return{x:hD(e),y:pD(e)}}var kn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(kn||(kn={}));function mD(e){return!ep||!e?!1:e===document.scrollingElement}function gD(e){const t={x:0,y:0},n=mD(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,l=e.scrollLeft<=t.x,u=e.scrollTop>=a.y,d=e.scrollLeft>=a.x;return{isTop:i,isLeft:l,isBottom:u,isRight:d,maxScroll:a,minScroll:t}}const UU={x:.2,y:.2};function VU(e,t,n,a,i){let{top:l,left:u,right:d,bottom:h}=n;a===void 0&&(a=10),i===void 0&&(i=UU);const{isTop:p,isBottom:v,isLeft:m,isRight:b}=gD(e),w={x:0,y:0},j={x:0,y:0},S={height:t.height*i.y,width:t.width*i.x};return!p&&l<=t.top+S.height?(w.y=kn.Backward,j.y=a*Math.abs((t.top+S.height-l)/S.height)):!v&&h>=t.bottom-S.height&&(w.y=kn.Forward,j.y=a*Math.abs((t.bottom-S.height-h)/S.height)),!b&&d>=t.right-S.width?(w.x=kn.Forward,j.x=a*Math.abs((t.right-S.width-d)/S.width)):!m&&u<=t.left+S.width&&(w.x=kn.Backward,j.x=a*Math.abs((t.left+S.width-u)/S.width)),{direction:w,speed:j}}function qU(e){if(e===document.scrollingElement){const{innerWidth:l,innerHeight:u}=window;return{top:0,left:0,right:l,bottom:u,width:l,height:u}}const{top:t,left:n,right:a,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:a,bottom:i,width:e.clientWidth,height:e.clientHeight}}function vD(e){return e.reduce((t,n)=>jl(t,Qb(n)),xa)}function $U(e){return e.reduce((t,n)=>t+hD(n),0)}function GU(e){return e.reduce((t,n)=>t+pD(n),0)}function KU(e,t){if(t===void 0&&(t=Fl),!e)return;const{top:n,left:a,bottom:i,right:l}=t(e);fD(e)&&(i<=0||l<=0||n>=window.innerHeight||a>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const YU=[["x",["left","right"],$U],["y",["top","bottom"],GU]];class mw{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const a=tp(n),i=vD(a);this.rect={...t},this.width=t.width,this.height=t.height;for(const[l,u,d]of YU)for(const h of u)Object.defineProperty(this,h,{get:()=>{const p=d(a),v=i[l]-p;return this.rect[h]+v},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class vu{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var a;return(a=this.target)==null?void 0:a.removeEventListener(...n)})},this.target=t}add(t,n,a){var i;(i=this.target)==null||i.addEventListener(t,n,a),this.listeners.push([t,n,a])}}function WU(e){const{EventTarget:t}=xr(e);return e instanceof t?e:zl(e)}function dv(e,t){const n=Math.abs(e.x),a=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+a**2)>t:"x"in t&&"y"in t?n>t.x&&a>t.y:"x"in t?n>t.x:"y"in t?a>t.y:!1}var Kr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Kr||(Kr={}));function V_(e){e.preventDefault()}function XU(e){e.stopPropagation()}var Ht;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ht||(Ht={}));const xD={start:[Ht.Space,Ht.Enter],cancel:[Ht.Esc],end:[Ht.Space,Ht.Enter,Ht.Tab]},QU=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ht.Right:return{...n,x:n.x+25};case Ht.Left:return{...n,x:n.x-25};case Ht.Down:return{...n,y:n.y+25};case Ht.Up:return{...n,y:n.y-25}}};class gw{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new vu(zl(n)),this.windowListeners=new vu(xr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Kr.Resize,this.handleCancel),this.windowListeners.add(Kr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Kr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,a=t.node.current;a&&KU(a),n(xa)}handleKeyDown(t){if(pw(t)){const{active:n,context:a,options:i}=this.props,{keyboardCodes:l=xD,coordinateGetter:u=QU,scrollBehavior:d="smooth"}=i,{code:h}=t;if(l.end.includes(h)){this.handleEnd(t);return}if(l.cancel.includes(h)){this.handleCancel(t);return}const{collisionRect:p}=a.current,v=p?{x:p.left,y:p.top}:xa;this.referenceCoordinates||(this.referenceCoordinates=v);const m=u(t,{active:n,context:a.current,currentCoordinates:v});if(m){const b=Mu(m,v),w={x:0,y:0},{scrollableAncestors:j}=a.current;for(const S of j){const C=t.code,{isTop:N,isRight:_,isLeft:T,isBottom:R,maxScroll:D,minScroll:L}=gD(S),k=qU(S),P={x:Math.min(C===Ht.Right?k.right-k.width/2:k.right,Math.max(C===Ht.Right?k.left:k.left+k.width/2,m.x)),y:Math.min(C===Ht.Down?k.bottom-k.height/2:k.bottom,Math.max(C===Ht.Down?k.top:k.top+k.height/2,m.y))},U=C===Ht.Right&&!_||C===Ht.Left&&!T,J=C===Ht.Down&&!R||C===Ht.Up&&!N;if(U&&P.x!==m.x){const $=S.scrollLeft+b.x,W=C===Ht.Right&&$<=D.x||C===Ht.Left&&$>=L.x;if(W&&!b.y){S.scrollTo({left:$,behavior:d});return}W?w.x=S.scrollLeft-$:w.x=C===Ht.Right?S.scrollLeft-D.x:S.scrollLeft-L.x,w.x&&S.scrollBy({left:-w.x,behavior:d});break}else if(J&&P.y!==m.y){const $=S.scrollTop+b.y,W=C===Ht.Down&&$<=D.y||C===Ht.Up&&$>=L.y;if(W&&!b.x){S.scrollTo({top:$,behavior:d});return}W?w.y=S.scrollTop-$:w.y=C===Ht.Down?S.scrollTop-D.y:S.scrollTop-L.y,w.y&&S.scrollBy({top:-w.y,behavior:d});break}}this.handleMove(t,jl(Mu(m,this.referenceCoordinates),w))}}}handleMove(t,n){const{onMove:a}=this.props;t.preventDefault(),a(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}gw.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:a=xD,onActivation:i}=t,{active:l}=n;const{code:u}=e.nativeEvent;if(a.start.includes(u)){const d=l.activatorNode.current;return d&&e.target!==d?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function q_(e){return!!(e&&"distance"in e)}function $_(e){return!!(e&&"delay"in e)}class vw{constructor(t,n,a){var i;a===void 0&&(a=WU(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:l}=t,{target:u}=l;this.props=t,this.events=n,this.document=zl(u),this.documentListeners=new vu(this.document),this.listeners=new vu(a),this.windowListeners=new vu(xr(u)),this.initialCoordinates=(i=Xb(l))!=null?i:xa,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:a}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Kr.Resize,this.handleCancel),this.windowListeners.add(Kr.DragStart,V_),this.windowListeners.add(Kr.VisibilityChange,this.handleCancel),this.windowListeners.add(Kr.ContextMenu,V_),this.documentListeners.add(Kr.Keydown,this.handleKeydown),n){if(a!=null&&a({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if($_(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(q_(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:a,onPending:i}=this.props;i(a,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Kr.Click,XU,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Kr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:a,initialCoordinates:i,props:l}=this,{onMove:u,options:{activationConstraint:d}}=l;if(!i)return;const h=(n=Xb(t))!=null?n:xa,p=Mu(i,h);if(!a&&d){if(q_(d)){if(d.tolerance!=null&&dv(p,d.tolerance))return this.handleCancel();if(dv(p,d.distance))return this.handleStart()}if($_(d)&&dv(p,d.tolerance))return this.handleCancel();this.handlePending(d,p);return}t.cancelable&&t.preventDefault(),u(h)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Ht.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ZU={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class xw extends vw{constructor(t){const{event:n}=t,a=zl(n.target);super(t,ZU,a)}}xw.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return!n.isPrimary||n.button!==0?!1:(a?.({event:n}),!0)}}];const JU={move:{name:"mousemove"},end:{name:"mouseup"}};var Zb;(function(e){e[e.RightClick=2]="RightClick"})(Zb||(Zb={}));class eV extends vw{constructor(t){super(t,JU,zl(t.event.target))}}eV.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return n.button===Zb.RightClick?!1:(a?.({event:n}),!0)}}];const fv={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class tV extends vw{constructor(t){super(t,fv)}static setup(){return window.addEventListener(fv.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(fv.move.name,t)};function t(){}}}tV.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;const{touches:i}=n;return i.length>1?!1:(a?.({event:n}),!0)}}];var xu;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(xu||(xu={}));var xh;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(xh||(xh={}));function nV(e){let{acceleration:t,activator:n=xu.Pointer,canScroll:a,draggingRect:i,enabled:l,interval:u=5,order:d=xh.TreeOrder,pointerCoordinates:h,scrollableAncestors:p,scrollableAncestorRects:v,delta:m,threshold:b}=e;const w=aV({delta:m,disabled:!l}),[j,S]=pU(),C=g.useRef({x:0,y:0}),N=g.useRef({x:0,y:0}),_=g.useMemo(()=>{switch(n){case xu.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case xu.DraggableRect:return i}},[n,i,h]),T=g.useRef(null),R=g.useCallback(()=>{const L=T.current;if(!L)return;const k=C.current.x*N.current.x,P=C.current.y*N.current.y;L.scrollBy(k,P)},[]),D=g.useMemo(()=>d===xh.TreeOrder?[...p].reverse():p,[d,p]);g.useEffect(()=>{if(!l||!p.length||!_){S();return}for(const L of D){if(a?.(L)===!1)continue;const k=p.indexOf(L),P=v[k];if(!P)continue;const{direction:U,speed:J}=VU(L,P,_,t,b);for(const $ of["x","y"])w[$][U[$]]||(J[$]=0,U[$]=0);if(J.x>0||J.y>0){S(),T.current=L,j(R,u),C.current=J,N.current=U;return}}C.current={x:0,y:0},N.current={x:0,y:0},S()},[t,R,a,S,l,u,JSON.stringify(_),JSON.stringify(w),j,p,D,v,JSON.stringify(b)])}const rV={x:{[kn.Backward]:!1,[kn.Forward]:!1},y:{[kn.Backward]:!1,[kn.Forward]:!1}};function aV(e){let{delta:t,disabled:n}=e;const a=Wb(t);return Ju(i=>{if(n||!a||!i)return rV;const l={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return{x:{[kn.Backward]:i.x[kn.Backward]||l.x===-1,[kn.Forward]:i.x[kn.Forward]||l.x===1},y:{[kn.Backward]:i.y[kn.Backward]||l.y===-1,[kn.Forward]:i.y[kn.Forward]||l.y===1}}},[n,t,a])}function sV(e,t){const n=t!=null?e.get(t):void 0,a=n?n.node.current:null;return Ju(i=>{var l;return t==null?null:(l=a??i)!=null?l:null},[a,t])}function iV(e,t){return g.useMemo(()=>e.reduce((n,a)=>{const{sensor:i}=a,l=i.activators.map(u=>({eventName:u.eventName,handler:t(u.handler,a)}));return[...n,...l]},[]),[e,t])}var Pu;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Pu||(Pu={}));var Jb;(function(e){e.Optimized="optimized"})(Jb||(Jb={}));const G_=new Map;function oV(e,t){let{dragging:n,dependencies:a,config:i}=t;const[l,u]=g.useState(null),{frequency:d,measure:h,strategy:p}=i,v=g.useRef(e),m=C(),b=Ou(m),w=g.useCallback(function(N){N===void 0&&(N=[]),!b.current&&u(_=>_===null?N:_.concat(N.filter(T=>!_.includes(T))))},[b]),j=g.useRef(null),S=Ju(N=>{if(m&&!n)return G_;if(!N||N===G_||v.current!==e||l!=null){const _=new Map;for(let T of e){if(!T)continue;if(l&&l.length>0&&!l.includes(T.id)&&T.rect.current){_.set(T.id,T.rect.current);continue}const R=T.node.current,D=R?new mw(h(R),R):null;T.rect.current=D,D&&_.set(T.id,D)}return _}return N},[e,l,n,m,h]);return g.useEffect(()=>{v.current=e},[e]),g.useEffect(()=>{m||w()},[n,m]),g.useEffect(()=>{l&&l.length>0&&u(null)},[JSON.stringify(l)]),g.useEffect(()=>{m||typeof d!="number"||j.current!==null||(j.current=setTimeout(()=>{w(),j.current=null},d))},[d,m,w,...a]),{droppableRects:S,measureDroppableContainers:w,measuringScheduled:l!=null};function C(){switch(p){case Pu.Always:return!1;case Pu.BeforeDragging:return n;default:return!n}}}function yD(e,t){return Ju(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function lV(e,t){return yD(e,t)}function cV(e){let{callback:t,disabled:n}=e;const a=hw(t),i=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:l}=window;return new l(a)},[a,n]);return g.useEffect(()=>()=>i?.disconnect(),[i]),i}function np(e){let{callback:t,disabled:n}=e;const a=hw(t),i=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:l}=window;return new l(a)},[n]);return g.useEffect(()=>()=>i?.disconnect(),[i]),i}function uV(e){return new mw(Fl(e),e)}function K_(e,t,n){t===void 0&&(t=uV);const[a,i]=g.useState(null);function l(){i(h=>{if(!e)return null;if(e.isConnected===!1){var p;return(p=h??n)!=null?p:null}const v=t(e);return JSON.stringify(h)===JSON.stringify(v)?h:v})}const u=cV({callback(h){if(e)for(const p of h){const{type:v,target:m}=p;if(v==="childList"&&m instanceof HTMLElement&&m.contains(e)){l();break}}}}),d=np({callback:l});return Fa(()=>{l(),e?(d?.observe(e),u?.observe(document.body,{childList:!0,subtree:!0})):(d?.disconnect(),u?.disconnect())},[e]),a}function dV(e){const t=yD(e);return dD(e,t)}const Y_=[];function fV(e){const t=g.useRef(e),n=Ju(a=>e?a&&a!==Y_&&e&&t.current&&e.parentNode===t.current.parentNode?a:tp(e):Y_,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function hV(e){const[t,n]=g.useState(null),a=g.useRef(e),i=g.useCallback(l=>{const u=uv(l.target);u&&n(d=>d?(d.set(u,Qb(u)),new Map(d)):null)},[]);return g.useEffect(()=>{const l=a.current;if(e!==l){u(l);const d=e.map(h=>{const p=uv(h);return p?(p.addEventListener("scroll",i,{passive:!0}),[p,Qb(p)]):null}).filter(h=>h!=null);n(d.length?new Map(d):null),a.current=e}return()=>{u(e),u(l)};function u(d){d.forEach(h=>{const p=uv(h);p?.removeEventListener("scroll",i)})}},[i,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((l,u)=>jl(l,u),xa):vD(e):xa,[e,t])}function W_(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const a=e!==xa;a&&!n.current&&(n.current=e),!a&&n.current&&(n.current=null)},[e]),n.current?Mu(e,n.current):xa}function pV(e){g.useEffect(()=>{if(!ep)return;const t=e.map(n=>{let{sensor:a}=n;return a.setup==null?void 0:a.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function mV(e,t){return g.useMemo(()=>e.reduce((n,a)=>{let{eventName:i,handler:l}=a;return n[i]=u=>{l(u,t)},n},{}),[e,t])}function bD(e){return g.useMemo(()=>e?zU(e):null,[e])}const X_=[];function gV(e,t){t===void 0&&(t=Fl);const[n]=e,a=bD(n?xr(n):null),[i,l]=g.useState(X_);function u(){l(()=>e.length?e.map(h=>mD(h)?a:new mw(t(h),h)):X_)}const d=np({callback:u});return Fa(()=>{d?.disconnect(),u(),e.forEach(h=>d?.observe(h))},[e]),i}function vV(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Zu(t)?t:e}function xV(e){let{measure:t}=e;const[n,a]=g.useState(null),i=g.useCallback(p=>{for(const{target:v}of p)if(Zu(v)){a(m=>{const b=t(v);return m?{...m,width:b.width,height:b.height}:b});break}},[t]),l=np({callback:i}),u=g.useCallback(p=>{const v=vV(p);l?.disconnect(),v&&l?.observe(v),a(v?t(v):null)},[t,l]),[d,h]=gh(u);return g.useMemo(()=>({nodeRef:d,rect:n,setRef:h}),[n,d,h])}const yV=[{sensor:xw,options:{}},{sensor:gw,options:{}}],bV={current:{}},rh={draggable:{measure:U_},droppable:{measure:U_,strategy:Pu.WhileDragging,frequency:Jb.Optimized},dragOverlay:{measure:Fl}};class yu extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,a;return(n=(a=this.get(t))==null?void 0:a.node.current)!=null?n:void 0}}const wV={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new yu,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:vh},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:rh,measureDroppableContainers:vh,windowRect:null,measuringScheduled:!1},SV={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:vh,draggableNodes:new Map,over:null,measureDroppableContainers:vh},rp=g.createContext(SV),wD=g.createContext(wV);function jV(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new yu}}}function CV(e,t){switch(t.type){case Mn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Mn.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Mn.DragEnd:case Mn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Mn.RegisterDroppable:{const{element:n}=t,{id:a}=n,i=new yu(e.droppable.containers);return i.set(a,n),{...e,droppable:{...e.droppable,containers:i}}}case Mn.SetDroppableDisabled:{const{id:n,key:a,disabled:i}=t,l=e.droppable.containers.get(n);if(!l||a!==l.key)return e;const u=new yu(e.droppable.containers);return u.set(n,{...l,disabled:i}),{...e,droppable:{...e.droppable,containers:u}}}case Mn.UnregisterDroppable:{const{id:n,key:a}=t,i=e.droppable.containers.get(n);if(!i||a!==i.key)return e;const l=new yu(e.droppable.containers);return l.delete(n),{...e,droppable:{...e.droppable,containers:l}}}default:return e}}function NV(e){let{disabled:t}=e;const{active:n,activatorEvent:a,draggableNodes:i}=g.useContext(rp),l=Wb(a),u=Wb(n?.id);return g.useEffect(()=>{if(!t&&!a&&l&&u!=null){if(!pw(l)||document.activeElement===l.target)return;const d=i.get(u);if(!d)return;const{activatorNode:h,node:p}=d;if(!h.current&&!p.current)return;requestAnimationFrame(()=>{for(const v of[h.current,p.current]){if(!v)continue;const m=vU(v);if(m){m.focus();break}}})}},[a,t,i,u,l]),null}function _V(e,t){let{transform:n,...a}=t;return e!=null&&e.length?e.reduce((i,l)=>l({transform:i,...a}),n):n}function EV(e){return g.useMemo(()=>({draggable:{...rh.draggable,...e?.draggable},droppable:{...rh.droppable,...e?.droppable},dragOverlay:{...rh.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function TV(e){let{activeNode:t,measure:n,initialRect:a,config:i=!0}=e;const l=g.useRef(!1),{x:u,y:d}=typeof i=="boolean"?{x:i,y:i}:i;Fa(()=>{if(!u&&!d||!t){l.current=!1;return}if(l.current||!a)return;const p=t?.node.current;if(!p||p.isConnected===!1)return;const v=n(p),m=dD(v,a);if(u||(m.x=0),d||(m.y=0),l.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){const b=fD(p);b&&b.scrollBy({top:m.y,left:m.x})}},[t,u,d,a,n])}const SD=g.createContext({...xa,scaleX:1,scaleY:1});var di;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(di||(di={}));const RV=g.memo(function(t){var n,a,i,l;let{id:u,accessibility:d,autoScroll:h=!0,children:p,sensors:v=yV,collisionDetection:m=MU,measuring:b,modifiers:w,...j}=t;const S=g.useReducer(CV,void 0,jV),[C,N]=S,[_,T]=jU(),[R,D]=g.useState(di.Uninitialized),L=R===di.Initialized,{draggable:{active:k,nodes:P,translate:U},droppable:{containers:J}}=C,$=k!=null?P.get(k):null,W=g.useRef({initial:null,translated:null}),fe=g.useMemo(()=>{var ft;return k!=null?{id:k,data:(ft=$?.data)!=null?ft:bV,rect:W}:null},[k,$]),we=g.useRef(null),[Ce,I]=g.useState(null),[V,H]=g.useState(null),be=Ou(j,Object.values(j)),_e=ed("DndDescribedBy",u),B=g.useMemo(()=>J.getEnabled(),[J]),G=EV(b),{droppableRects:X,measureDroppableContainers:oe,measuringScheduled:me}=oV(B,{dragging:L,dependencies:[U.x,U.y],config:G.droppable}),Z=sV(P,k),ne=g.useMemo(()=>V?Xb(V):null,[V]),he=Ze(),Ee=lV(Z,G.draggable.measure);TV({activeNode:k!=null?P.get(k):null,config:he.layoutShiftCompensation,initialRect:Ee,measure:G.draggable.measure});const je=K_(Z,G.draggable.measure,Ee),ke=K_(Z?Z.parentElement:null),le=g.useRef({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:X,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:J,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Fe=J.getNodeFor((n=le.current.over)==null?void 0:n.id),Ge=xV({measure:G.dragOverlay.measure}),He=(a=Ge.nodeRef.current)!=null?a:Z,at=L?(i=Ge.rect)!=null?i:je:null,Ke=!!(Ge.nodeRef.current&&Ge.rect),Mt=dV(Ke?null:je),St=bD(He?xr(He):null),_t=fV(L?Fe??Z:null),jt=gV(_t),ot=_V(w,{transform:{x:U.x-Mt.x,y:U.y-Mt.y,scaleX:1,scaleY:1},activatorEvent:V,active:fe,activeNodeRect:je,containerNodeRect:ke,draggingNodeRect:at,over:le.current.over,overlayNodeRect:Ge.rect,scrollableAncestors:_t,scrollableAncestorRects:jt,windowRect:St}),lt=ne?jl(ne,U):null,Ct=hV(_t),Vt=W_(Ct),Kt=W_(Ct,[je]),Wt=jl(ot,Vt),te=at?kU(at,ot):null,Me=fe&&te?m({active:fe,collisionRect:te,droppableRects:X,droppableContainers:B,pointerCoordinates:lt}):null,st=uD(Me,"id"),[nt,yt]=g.useState(null),gt=Ke?ot:jl(ot,Kt),xt=DU(gt,(l=nt?.rect)!=null?l:null,je),qt=g.useRef(null),ue=g.useCallback((ft,pt)=>{let{sensor:z,options:Se}=pt;if(we.current==null)return;const Ae=P.get(we.current);if(!Ae)return;const Re=ft.nativeEvent,M=new z({active:we.current,activeNode:Ae,event:Re,options:Se,context:le,onAbort(Ne){if(!P.get(Ne))return;const{onDragAbort:Y}=be.current,xe={id:Ne};Y?.(xe),_({type:"onDragAbort",event:xe})},onPending(Ne,mt,Y,xe){if(!P.get(Ne))return;const{onDragPending:Ie}=be.current,Ue={id:Ne,constraint:mt,initialCoordinates:Y,offset:xe};Ie?.(Ue),_({type:"onDragPending",event:Ue})},onStart(Ne){const mt=we.current;if(mt==null)return;const Y=P.get(mt);if(!Y)return;const{onDragStart:xe}=be.current,Le={activatorEvent:Re,active:{id:mt,data:Y.data,rect:W}};ka.unstable_batchedUpdates(()=>{xe?.(Le),D(di.Initializing),N({type:Mn.DragStart,initialCoordinates:Ne,active:mt}),_({type:"onDragStart",event:Le}),I(qt.current),H(Re)})},onMove(Ne){N({type:Mn.DragMove,coordinates:Ne})},onEnd:ge(Mn.DragEnd),onCancel:ge(Mn.DragCancel)});qt.current=M;function ge(Ne){return async function(){const{active:Y,collisions:xe,over:Le,scrollAdjustedTranslate:Ie}=le.current;let Ue=null;if(Y&&Ie){const{cancelDrop:ut}=be.current;Ue={activatorEvent:Re,active:Y,collisions:xe,delta:Ie,over:Le},Ne===Mn.DragEnd&&typeof ut=="function"&&await Promise.resolve(ut(Ue))&&(Ne=Mn.DragCancel)}we.current=null,ka.unstable_batchedUpdates(()=>{N({type:Ne}),D(di.Uninitialized),yt(null),I(null),H(null),qt.current=null;const ut=Ne===Mn.DragEnd?"onDragEnd":"onDragCancel";if(Ue){const Et=be.current[ut];Et?.(Ue),_({type:ut,event:Ue})}})}}},[P]),Oe=g.useCallback((ft,pt)=>(z,Se)=>{const Ae=z.nativeEvent,Re=P.get(Se);if(we.current!==null||!Re||Ae.dndKit||Ae.defaultPrevented)return;const M={active:Re};ft(z,pt.options,M)===!0&&(Ae.dndKit={capturedBy:pt.sensor},we.current=Se,ue(z,pt))},[P,ue]),Be=iV(v,Oe);pV(v),Fa(()=>{je&&R===di.Initializing&&D(di.Initialized)},[je,R]),g.useEffect(()=>{const{onDragMove:ft}=be.current,{active:pt,activatorEvent:z,collisions:Se,over:Ae}=le.current;if(!pt||!z)return;const Re={active:pt,activatorEvent:z,collisions:Se,delta:{x:Wt.x,y:Wt.y},over:Ae};ka.unstable_batchedUpdates(()=>{ft?.(Re),_({type:"onDragMove",event:Re})})},[Wt.x,Wt.y]),g.useEffect(()=>{const{active:ft,activatorEvent:pt,collisions:z,droppableContainers:Se,scrollAdjustedTranslate:Ae}=le.current;if(!ft||we.current==null||!pt||!Ae)return;const{onDragOver:Re}=be.current,M=Se.get(st),ge=M&&M.rect.current?{id:M.id,rect:M.rect.current,data:M.data,disabled:M.disabled}:null,Ne={active:ft,activatorEvent:pt,collisions:z,delta:{x:Ae.x,y:Ae.y},over:ge};ka.unstable_batchedUpdates(()=>{yt(ge),Re?.(Ne),_({type:"onDragOver",event:Ne})})},[st]),Fa(()=>{le.current={activatorEvent:V,active:fe,activeNode:Z,collisionRect:te,collisions:Me,droppableRects:X,draggableNodes:P,draggingNode:He,draggingNodeRect:at,droppableContainers:J,over:nt,scrollableAncestors:_t,scrollAdjustedTranslate:Wt},W.current={initial:at,translated:te}},[fe,Z,Me,te,P,He,at,X,J,nt,_t,Wt]),nV({...he,delta:U,draggingRect:te,pointerCoordinates:lt,scrollableAncestors:_t,scrollableAncestorRects:jt});const Qe=g.useMemo(()=>({active:fe,activeNode:Z,activeNodeRect:je,activatorEvent:V,collisions:Me,containerNodeRect:ke,dragOverlay:Ge,draggableNodes:P,droppableContainers:J,droppableRects:X,over:nt,measureDroppableContainers:oe,scrollableAncestors:_t,scrollableAncestorRects:jt,measuringConfiguration:G,measuringScheduled:me,windowRect:St}),[fe,Z,je,V,Me,ke,Ge,P,J,X,nt,oe,_t,jt,G,me,St]),Pe=g.useMemo(()=>({activatorEvent:V,activators:Be,active:fe,activeNodeRect:je,ariaDescribedById:{draggable:_e},dispatch:N,draggableNodes:P,over:nt,measureDroppableContainers:oe}),[V,Be,fe,je,N,_e,P,nt,oe]);return A.createElement(oD.Provider,{value:T},A.createElement(rp.Provider,{value:Pe},A.createElement(wD.Provider,{value:Qe},A.createElement(SD.Provider,{value:xt},p)),A.createElement(NV,{disabled:d?.restoreFocus===!1})),A.createElement(_U,{...d,hiddenTextDescribedById:_e}));function Ze(){const ft=Ce?.autoScrollEnabled===!1,pt=typeof h=="object"?h.enabled===!1:h===!1,z=L&&!ft&&!pt;return typeof h=="object"?{...h,enabled:z}:{enabled:z}}}),AV=g.createContext(null),Q_="button",OV="Draggable";function MV(e){let{id:t,data:n,disabled:a=!1,attributes:i}=e;const l=ed(OV),{activators:u,activatorEvent:d,active:h,activeNodeRect:p,ariaDescribedById:v,draggableNodes:m,over:b}=g.useContext(rp),{role:w=Q_,roleDescription:j="draggable",tabIndex:S=0}=i??{},C=h?.id===t,N=g.useContext(C?SD:AV),[_,T]=gh(),[R,D]=gh(),L=mV(u,t),k=Ou(n);Fa(()=>(m.set(t,{id:t,key:l,node:_,activatorNode:R,data:k}),()=>{const U=m.get(t);U&&U.key===l&&m.delete(t)}),[m,t]);const P=g.useMemo(()=>({role:w,tabIndex:S,"aria-disabled":a,"aria-pressed":C&&w===Q_?!0:void 0,"aria-roledescription":j,"aria-describedby":v.draggable}),[a,w,S,C,j,v.draggable]);return{active:h,activatorEvent:d,activeNodeRect:p,attributes:P,isDragging:C,listeners:a?void 0:L,node:_,over:b,setNodeRef:T,setActivatorNodeRef:D,transform:N}}function DV(){return g.useContext(wD)}const PV="Droppable",kV={timeout:25};function LV(e){let{data:t,disabled:n=!1,id:a,resizeObserverConfig:i}=e;const l=ed(PV),{active:u,dispatch:d,over:h,measureDroppableContainers:p}=g.useContext(rp),v=g.useRef({disabled:n}),m=g.useRef(!1),b=g.useRef(null),w=g.useRef(null),{disabled:j,updateMeasurementsFor:S,timeout:C}={...kV,...i},N=Ou(S??a),_=g.useCallback(()=>{if(!m.current){m.current=!0;return}w.current!=null&&clearTimeout(w.current),w.current=setTimeout(()=>{p(Array.isArray(N.current)?N.current:[N.current]),w.current=null},C)},[C]),T=np({callback:_,disabled:j||!u}),R=g.useCallback((P,U)=>{T&&(U&&(T.unobserve(U),m.current=!1),P&&T.observe(P))},[T]),[D,L]=gh(R),k=Ou(t);return g.useEffect(()=>{!T||!D.current||(T.disconnect(),m.current=!1,T.observe(D.current))},[D,T]),g.useEffect(()=>(d({type:Mn.RegisterDroppable,element:{id:a,key:l,disabled:n,node:D,rect:b,data:k}}),()=>d({type:Mn.UnregisterDroppable,key:l,id:a})),[a]),g.useEffect(()=>{n!==v.current.disabled&&(d({type:Mn.SetDroppableDisabled,id:a,key:l,disabled:n}),v.current.disabled=n)},[a,l,n,d]),{active:u,rect:b,isOver:h?.id===a,node:D,over:h,setNodeRef:L}}function jD(e,t,n){const a=e.slice();return a.splice(n<0?a.length+n:n,0,a.splice(t,1)[0]),a}function BV(e,t){return e.reduce((n,a,i)=>{const l=t.get(a);return l&&(n[i]=l),n},Array(e.length))}function Hf(e){return e!==null&&e>=0}function IV(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function zV(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const CD=e=>{let{rects:t,activeIndex:n,overIndex:a,index:i}=e;const l=jD(t,a,n),u=t[i],d=l[i];return!d||!u?null:{x:d.left-u.left,y:d.top-u.top,scaleX:d.width/u.width,scaleY:d.height/u.height}},Uf={scaleX:1,scaleY:1},FV=e=>{var t;let{activeIndex:n,activeNodeRect:a,index:i,rects:l,overIndex:u}=e;const d=(t=l[n])!=null?t:a;if(!d)return null;if(i===n){const p=l[u];return p?{x:0,y:n<u?p.top+p.height-(d.top+d.height):p.top-d.top,...Uf}:null}const h=HV(l,i,n);return i>n&&i<=u?{x:0,y:-d.height-h,...Uf}:i<n&&i>=u?{x:0,y:d.height+h,...Uf}:{x:0,y:0,...Uf}};function HV(e,t,n){const a=e[t],i=e[t-1],l=e[t+1];return a?n<t?i?a.top-(i.top+i.height):l?l.top-(a.top+a.height):0:l?l.top-(a.top+a.height):i?a.top-(i.top+i.height):0:0}const ND="Sortable",_D=A.createContext({activeIndex:-1,containerId:ND,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:CD,disabled:{draggable:!1,droppable:!1}});function UV(e){let{children:t,id:n,items:a,strategy:i=CD,disabled:l=!1}=e;const{active:u,dragOverlay:d,droppableRects:h,over:p,measureDroppableContainers:v}=DV(),m=ed(ND,n),b=d.rect!==null,w=g.useMemo(()=>a.map(L=>typeof L=="object"&&"id"in L?L.id:L),[a]),j=u!=null,S=u?w.indexOf(u.id):-1,C=p?w.indexOf(p.id):-1,N=g.useRef(w),_=!IV(w,N.current),T=C!==-1&&S===-1||_,R=zV(l);Fa(()=>{_&&j&&v(w)},[_,w,j,v]),g.useEffect(()=>{N.current=w},[w]);const D=g.useMemo(()=>({activeIndex:S,containerId:m,disabled:R,disableTransforms:T,items:w,overIndex:C,useDragOverlay:b,sortedRects:BV(w,h),strategy:i}),[S,m,R.draggable,R.droppable,T,w,C,h,b,i]);return A.createElement(_D.Provider,{value:D},t)}const VV=e=>{let{id:t,items:n,activeIndex:a,overIndex:i}=e;return jD(n,a,i).indexOf(t)},qV=e=>{let{containerId:t,isSorting:n,wasDragging:a,index:i,items:l,newIndex:u,previousItems:d,previousContainerId:h,transition:p}=e;return!p||!a||d!==l&&i===u?!1:n?!0:u!==i&&t===h},$V={duration:200,easing:"ease"},ED="transform",GV=Du.Transition.toString({property:ED,duration:0,easing:"linear"}),KV={roleDescription:"sortable"};function YV(e){let{disabled:t,index:n,node:a,rect:i}=e;const[l,u]=g.useState(null),d=g.useRef(n);return Fa(()=>{if(!t&&n!==d.current&&a.current){const h=i.current;if(h){const p=Fl(a.current,{ignoreTransform:!0}),v={x:h.left-p.left,y:h.top-p.top,scaleX:h.width/p.width,scaleY:h.height/p.height};(v.x||v.y)&&u(v)}}n!==d.current&&(d.current=n)},[t,n,a,i]),g.useEffect(()=>{l&&u(null)},[l]),l}function WV(e){let{animateLayoutChanges:t=qV,attributes:n,disabled:a,data:i,getNewIndex:l=VV,id:u,strategy:d,resizeObserverConfig:h,transition:p=$V}=e;const{items:v,containerId:m,activeIndex:b,disabled:w,disableTransforms:j,sortedRects:S,overIndex:C,useDragOverlay:N,strategy:_}=g.useContext(_D),T=XV(a,w),R=v.indexOf(u),D=g.useMemo(()=>({sortable:{containerId:m,index:R,items:v},...i}),[m,i,R,v]),L=g.useMemo(()=>v.slice(v.indexOf(u)),[v,u]),{rect:k,node:P,isOver:U,setNodeRef:J}=LV({id:u,data:D,disabled:T.droppable,resizeObserverConfig:{updateMeasurementsFor:L,...h}}),{active:$,activatorEvent:W,activeNodeRect:fe,attributes:we,setNodeRef:Ce,listeners:I,isDragging:V,over:H,setActivatorNodeRef:be,transform:_e}=MV({id:u,data:D,attributes:{...KV,...n},disabled:T.draggable}),B=hU(J,Ce),G=!!$,X=G&&!j&&Hf(b)&&Hf(C),oe=!N&&V,me=oe&&X?_e:null,ne=X?me??(d??_)({rects:S,activeNodeRect:fe,activeIndex:b,overIndex:C,index:R}):null,he=Hf(b)&&Hf(C)?l({id:u,items:v,activeIndex:b,overIndex:C}):R,Ee=$?.id,je=g.useRef({activeId:Ee,items:v,newIndex:he,containerId:m}),ke=v!==je.current.items,le=t({active:$,containerId:m,isDragging:V,isSorting:G,id:u,index:R,items:v,newIndex:je.current.newIndex,previousItems:je.current.items,previousContainerId:je.current.containerId,transition:p,wasDragging:je.current.activeId!=null}),Fe=YV({disabled:!le,index:R,node:P,rect:k});return g.useEffect(()=>{G&&je.current.newIndex!==he&&(je.current.newIndex=he),m!==je.current.containerId&&(je.current.containerId=m),v!==je.current.items&&(je.current.items=v)},[G,he,m,v]),g.useEffect(()=>{if(Ee===je.current.activeId)return;if(Ee!=null&&je.current.activeId==null){je.current.activeId=Ee;return}const He=setTimeout(()=>{je.current.activeId=Ee},50);return()=>clearTimeout(He)},[Ee]),{active:$,activeIndex:b,attributes:we,data:D,rect:k,index:R,newIndex:he,items:v,isOver:U,isSorting:G,isDragging:V,listeners:I,node:P,overIndex:C,over:H,setNodeRef:B,setActivatorNodeRef:be,setDroppableNodeRef:J,setDraggableNodeRef:Ce,transform:Fe??ne,transition:Ge()};function Ge(){if(Fe||ke&&je.current.newIndex===R)return GV;if(!(oe&&!pw(W)||!p)&&(G||le))return Du.Transition.toString({...p,property:ED})}}function XV(e,t){var n,a;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(a=e?.droppable)!=null?a:t.droppable}}function yh(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const QV=[Ht.Down,Ht.Right,Ht.Up,Ht.Left],ZV=(e,t)=>{let{context:{active:n,collisionRect:a,droppableRects:i,droppableContainers:l,over:u,scrollableAncestors:d}}=t;if(QV.includes(e.code)){if(e.preventDefault(),!n||!a)return;const h=[];l.getEnabled().forEach(m=>{if(!m||m!=null&&m.disabled)return;const b=i.get(m.id);if(b)switch(e.code){case Ht.Down:a.top<b.top&&h.push(m);break;case Ht.Up:a.top>b.top&&h.push(m);break;case Ht.Left:a.left>b.left&&h.push(m);break;case Ht.Right:a.left<b.left&&h.push(m);break}});const p=AU({collisionRect:a,droppableRects:i,droppableContainers:h});let v=uD(p,"id");if(v===u?.id&&p.length>1&&(v=p[1].id),v!=null){const m=l.get(n.id),b=l.get(v),w=b?i.get(b.id):null,j=b?.node.current;if(j&&w&&m&&b){const C=tp(j).some((L,k)=>d[k]!==L),N=TD(m,b),_=JV(m,b),T=C||!N?{x:0,y:0}:{x:_?a.width-w.width:0,y:_?a.height-w.height:0},R={x:w.left,y:w.top};return T.x&&T.y?R:Mu(R,T)}}}};function TD(e,t){return!yh(e)||!yh(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function JV(e,t){return!yh(e)||!yh(t)||!TD(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function ms(e){if(!e||e<0)return"--:--";const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${n.toString().padStart(2,"0")}`}function el(e){return e?e.split("/").pop()?.replace(".thr","")||e:"Unknown"}function eq({id:e,file:t,index:n,previewUrl:a,isFirst:i,isLast:l,onMoveToTop:u,onMoveToBottom:d,requestPreview:h}){const{attributes:p,listeners:v,setNodeRef:m,transform:b,transition:w,isDragging:j}=WV({id:e}),S=g.useRef(null),C=g.useRef(!1);g.useEffect(()=>{if(!S.current||a||C.current)return;const _=new IntersectionObserver(T=>{T.forEach(R=>{R.isIntersecting&&!C.current&&(C.current=!0,h(t),_.disconnect())})},{rootMargin:"50px"});return _.observe(S.current),()=>_.disconnect()},[t,a,h]);const N={transform:Du.Transform.toString(b),transition:w,opacity:j?.5:1,zIndex:j?1e3:"auto"};return o.jsxs("div",{ref:m,style:N,className:`group flex items-center gap-2 p-2 rounded-lg transition-colors hover:bg-muted/50 ${j?"shadow-lg bg-background":""}`,children:[o.jsx("div",{...p,...v,className:"w-6 flex items-center justify-center shrink-0 cursor-grab active:cursor-grabbing touch-none",children:o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-sm",children:"drag_indicator"})}),o.jsx("div",{ref:S,className:"w-28 h-28 rounded-full overflow-hidden bg-muted border shrink-0",children:a?o.jsx("img",{src:a,alt:"",loading:"lazy",className:"w-full h-full object-cover pattern-preview"}):o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-4xl",children:"image"})})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm truncate",children:el(t)}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["#",n+1]})]}),o.jsxs("div",{className:"flex flex-col gap-1 opacity-100 md:opacity-0 md:group-hover:opacity-100 transition-opacity shrink-0",children:[o.jsx("button",{onClick:u,disabled:i,className:"p-1 rounded hover:bg-muted disabled:opacity-30 disabled:cursor-not-allowed",title:"Move to top",children:o.jsx("span",{className:"material-icons-outlined text-sm",children:"vertical_align_top"})}),o.jsx("button",{onClick:d,disabled:l,className:"p-1 rounded hover:bg-muted disabled:opacity-30 disabled:cursor-not-allowed",title:"Move to bottom",children:o.jsx("span",{className:"material-icons-outlined text-sm",children:"vertical_align_bottom"})})]})]})}function tq({isLogsOpen:e=!1,logsDrawerHeight:t=256,isVisible:n,openExpanded:a=!1,onClose:i}){const l=un(ue=>ue.status),[u,d]=g.useState(null),[h,p]=g.useState(!1),v=g.useRef(null),m=g.useRef(null),b=ue=>{v.current=ue.touches[0].clientY},w=ue=>{if(v.current===null)return;const Be=ue.changedTouches[0].clientY-v.current;Be>50?h?p(!1):i():Be<-50&&j&&p(!0),v.current=null};g.useEffect(()=>{if(n)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[n]),g.useEffect(()=>{const ue=m.current;if(!ue)return;const Oe=Be=>{Be.target.closest("[data-scrollable]")||Be.preventDefault()};return ue.addEventListener("touchmove",Oe,{passive:!1}),()=>{ue.removeEventListener("touchmove",Oe)}},[]),g.useEffect(()=>{a&&n&&p(!0)},[a,n]),g.useEffect(()=>{const ue=()=>{p(!0)};return window.addEventListener("playback-started",ue),()=>window.removeEventListener("playback-started",ue)},[]);const j=l?.is_running||l?.is_paused||(l?.pause_time_remaining??0)>0,S=g.useRef(null);g.useEffect(()=>(S.current&&(clearTimeout(S.current),S.current=null),!j&&h&&(S.current=setTimeout(()=>{p(!1)},500)),()=>{S.current&&clearTimeout(S.current)}),[j,h]);const[C,N]=g.useState([]),_=g.useRef(null),T=g.useRef(null),R=g.useRef(-1),D=g.useRef(null),L=g.useRef(null),k=g.useRef(null),P=g.useRef(0),U=g.useRef(0),J=g.useRef(0),[$,W]=g.useState(null),fe=g.useRef("");g.useEffect(()=>{if(!n)return;const ue=l?.current_file,Oe=l?.playlist?.next_file,Be=[ue,Oe].filter(Boolean),Qe=Be.join("|");Qe!==fe.current&&(fe.current=Qe,Be.length>0?de.post("/preview_thr_batch",{file_names:Be}).then(Pe=>{ue&&Pe[ue]?.image_data?d(Pe[ue].image_data):d(null),Oe&&Pe[Oe]?.image_data?W(Pe[Oe].image_data):W(null)}).catch(()=>{d(null),W(null)}):(d(null),W(null)))},[n,l?.current_file,l?.playlist?.next_file]);const we=g.useCallback((ue,Oe,Be)=>{const Qe=Be/2,Pe=Be/2,Ze=Be/2*.9*Oe,ft=Qe+Ze*Math.cos(ue),pt=Pe+Ze*Math.sin(ue);return{x:ft,y:pt}},[]),Ce=g.useCallback(()=>{const ue=document.documentElement.classList.contains("dark");return{isDark:ue,bgOuter:ue?"#1a1a1a":"#f5f5f5",bgInner:ue?"#262626":"#ffffff",borderColor:ue?"rgba(255, 255, 255, 0.2)":"rgba(128, 128, 128, 0.3)",lineColor:ue?"#e5e5e5":"#333333",markerBorder:ue?"#333333":"#ffffff"}},[]),I=g.useCallback((ue,Oe)=>{const Be=Ce();T.current||(T.current=document.createElement("canvas"));const Qe=T.current;Qe.width=ue,Qe.height=ue;const Pe=Qe.getContext("2d");if(Pe){if(Pe.fillStyle=Be.bgOuter,Pe.fillRect(0,0,ue,ue),Pe.beginPath(),Pe.arc(ue/2,ue/2,ue/2*.95,0,Math.PI*2),Pe.fillStyle=Be.bgInner,Pe.fill(),Pe.strokeStyle=Be.borderColor,Pe.lineWidth=1,Pe.stroke(),Pe.strokeStyle=Be.lineColor,Pe.lineWidth=1.5,Pe.lineCap="round",Pe.lineJoin="round",Oe.length>0){const Ze=we(Oe[0][0],Oe[0][1],ue);Pe.beginPath(),Pe.moveTo(Ze.x,Ze.y),Pe.stroke()}R.current=0,L.current=Be.isDark}},[Ce,we]),V=g.useCallback((ue,Oe,Be,Qe=!1)=>{const Ze=ue.canvas.width,ft=Ce(),pt=Math.max(0,Be-16),z=Math.floor(pt);(Qe||!T.current||L.current!==ft.isDark||z<R.current)&&I(Ze,Oe);const Ae=T.current;if(!Ae)return;const Re=Ae.getContext("2d");if(Re){if(Oe.length>0&&z>R.current){Re.strokeStyle=ft.lineColor,Re.lineWidth=1.5,Re.lineCap="round",Re.lineJoin="round",Re.beginPath();const M=we(Oe[R.current][0],Oe[R.current][1],Ze);Re.moveTo(M.x,M.y);for(let ge=R.current+1;ge<=z&&ge<Oe.length;ge++){const Ne=we(Oe[ge][0],Oe[ge][1],Ze);Re.lineTo(Ne.x,Ne.y)}Re.stroke(),R.current=z}if(ue.drawImage(Ae,0,0),Oe.length>0&&z<Oe.length-1){const M=pt-z,ge=Oe[z],Ne=Oe[Math.min(z+1,Oe.length-1)],mt=ge[0]+(Ne[0]-ge[0])*M,Y=ge[1]+(Ne[1]-ge[1])*M,xe=we(mt,Y,Ze);ue.beginPath(),ue.arc(xe.x,xe.y,8,0,Math.PI*2),ue.fillStyle="#0b80ee",ue.fill(),ue.strokeStyle=ft.markerBorder,ue.lineWidth=2,ue.stroke()}else if(Oe.length>0&&z<Oe.length){const M=we(Oe[z][0],Oe[z][1],Ze);ue.beginPath(),ue.arc(M.x,M.y,8,0,Math.PI*2),ue.fillStyle="#0b80ee",ue.fill(),ue.strokeStyle=ft.markerBorder,ue.lineWidth=2,ue.stroke()}}},[Ce,I,we]);g.useEffect(()=>{const ue=l?.current_file;!ue||!(ue!==D.current||C.length===0)||(D.current=ue,R.current=-1,de.post("/get_theta_rho_coordinates",{file_name:ue}).then(Be=>{Be.coordinates&&Array.isArray(Be.coordinates)&&N(Be.coordinates)}).catch(Be=>{console.error("Failed to fetch coordinates:",Be),N([])}))},[l?.current_file,C.length]);const H=g.useCallback(ue=>ue.length===0?0:(l?.progress?.percentage||0)/100*ue.length,[l?.progress?.percentage]);g.useEffect(()=>{const ue=l?.progress?.percentage||0;ue!==P.current&&(P.current=ue,U.current=performance.now())},[l?.progress?.percentage]),g.useEffect(()=>{if(!h||C.length===0)return;const ue=l?.is_paused||!1,Oe=4.2,Be=()=>{if(!_.current)return;const Pe=_.current.getContext("2d");if(!Pe)return;const Ze=H(C),pt=(performance.now()-U.current)/1e3;let z;ue?z=Ze:(z=P.current/100*C.length+pt*Oe,z=Math.min(z,Ze+2)),J.current=z,V(Pe,C,z),k.current=requestAnimationFrame(Be)},Qe=setTimeout(()=>{if(!_.current)return;const Pe=_.current.getContext("2d");Pe&&(R.current=-1,T.current=null,J.current=H(C),U.current=performance.now(),V(Pe,C,J.current,!0),k.current=requestAnimationFrame(Be))},50);return()=>{clearTimeout(Qe),k.current&&cancelAnimationFrame(k.current)}},[h,C,l?.is_paused,V,H]);const be=async()=>{try{const ue=l?.is_paused?"/resume_execution":"/pause_execution";await de.post(ue),K.success(l?.is_paused?"Resumed":"Paused")}catch(ue){let Oe="Failed to toggle pause";if(ue instanceof Error)try{const Be=ue.message.match(/\{.*\}/);if(Be){const Qe=JSON.parse(Be[0]);Qe.detail&&(Oe=Qe.detail)}}catch{}K.error(Oe)}},_e=async()=>{try{await de.post("/stop_execution"),K.success("Stopped")}catch{try{await de.post("/force_stop"),K.success("Force stopped")}catch{K.error("Failed to stop")}}},B=async()=>{try{await de.post("/skip_pattern"),K.success("Skipping to next pattern")}catch{K.error("Failed to skip")}},[G,X]=g.useState(""),[oe,me]=g.useState(!1),[Z,ne]=g.useState({}),he=g.useRef(null),Ee=g.useRef(null),je=ue=>{he.current=ue.touches[0].clientY},ke=ue=>{if(he.current===null)return;if(ue.changedTouches[0].clientY-he.current>80){const Qe=Ee.current?.querySelector("[data-scrollable]");(!Qe||Qe.scrollTop<=0)&&me(!1)}he.current=null},[le,Fe]=g.useState(null),Ge=g.useRef(null);g.useEffect(()=>{if(le&&l?.playlist?.files){Ge.current&&clearTimeout(Ge.current);const ue=l.playlist.files.join(","),Oe=le.join(",");ue===Oe?Fe(null):Ge.current=setTimeout(()=>{Fe(null)},2e3)}return()=>{Ge.current&&clearTimeout(Ge.current)}},[l?.playlist?.files,le]);const He=le||l?.playlist?.files||[],at=EU(z_(xw,{activationConstraint:{distance:8}}),z_(gw,{coordinateGetter:ZV})),Ke=async()=>{const ue=parseInt(G);if(isNaN(ue)||ue<10||ue>6e3){K.error("Speed must be between 10 and 6000 mm/s");return}try{await de.post("/set_speed",{speed:ue}),X(""),K.success(`Speed set to ${ue} mm/s`)}catch{K.error("Failed to set speed")}},Mt=g.useRef(new Set),St=g.useRef(new Set),_t=g.useRef(null),jt=g.useCallback(ue=>{Z[ue]||Mt.current.has(ue)||St.current.has(ue)||(St.current.add(ue),_t.current&&clearTimeout(_t.current),_t.current=setTimeout(async()=>{const Oe=Array.from(St.current);if(St.current.clear(),Oe.length!==0){Oe.forEach(Be=>Mt.current.add(Be));try{const Be=await de.post("/preview_thr_batch",{file_names:Oe}),Qe={};for(const[Pe,Ze]of Object.entries(Be))Ze.image_data&&(Qe[Pe]=Ze.image_data);Object.keys(Qe).length>0&&ne(Pe=>({...Pe,...Qe}))}catch(Be){console.error("Failed to fetch queue previews:",Be)}}},100))},[Z]),ot=(ue,Oe,Be)=>{const Qe=[...ue],[Pe]=Qe.splice(Oe,1);return Qe.splice(Be,0,Pe),Qe},lt=async ue=>{const{active:Oe,over:Be}=ue;if(!Be||Oe.id===Be.id||!l?.playlist?.files)return;const Qe=parseInt(Oe.id.toString().replace("queue-item-","")),Pe=parseInt(Be.id.toString().replace("queue-item-",""));if(isNaN(Qe)||isNaN(Pe))return;const Ze=l.playlist.current_index;if(Qe<Ze){K.error("Can't move completed pattern");return}if(Pe<Ze){K.error("Can't move to completed position");return}const ft=le||l.playlist.files,pt=ot(ft,Qe,Pe);Fe(pt);try{await de.post("/reorder_playlist",{from_index:Qe,to_index:Pe})}catch{Fe(null),K.error("Failed to reorder")}},Ct=async(ue,Oe)=>{if(ue===Oe||!l?.playlist?.files)return;const Be=le||l.playlist.files,Qe=ot(Be,ue,Oe);Fe(Qe);try{await de.post("/reorder_playlist",{from_index:ue,to_index:Oe})}catch{Fe(null),K.error("Failed to reorder")}};if(!n)return null;const Vt=el(l?.current_file??null),Kt=l?.progress?.percentage||0,Wt=l?.progress?.remaining_time||0,te=l?.progress?.elapsed_time||0,Me=l?.progress?.last_completed_time?.actual_time_seconds,st=Me?Math.max(0,Me-te):Wt,nt=!!Me,yt=(l?.pause_time_remaining??0)>0,gt=l?.pause_time_remaining??0,xt=l?.original_pause_time??0,qt=xt>0?(xt-gt)/xt*100:0;return o.jsxs(o.Fragment,{children:[h&&o.jsx("div",{className:"fixed inset-0 bg-black/30 z-30",onClick:()=>p(!1)}),o.jsx("div",{ref:m,className:"fixed left-0 right-0 z-40 bg-background border-t shadow-lg transition-all duration-300",style:{bottom:e?`calc(${t}px + 4rem + env(safe-area-inset-bottom, 0px))`:"calc(4rem + env(safe-area-inset-bottom, 0px))"},"data-now-playing-bar":h?"expanded":"collapsed",onTouchStart:b,onTouchEnd:w,children:o.jsxs("div",{className:"h-full max-w-5xl mx-auto relative",children:[o.jsx("div",{className:"md:hidden flex justify-center pt-2 pb-1",children:o.jsx("div",{className:"w-10 h-1 bg-muted-foreground/30 rounded-full"})}),o.jsxs("div",{className:`absolute right-3 sm:right-4 flex items-center gap-1 z-10 ${h?"top-3 mt-safe":"top-3"}`,children:[j&&l?.playlist&&o.jsx(se,{variant:"ghost",size:"icon",className:"md:hidden h-8 w-8",onClick:()=>me(!0),title:"View queue",children:o.jsx("span",{className:"material-icons-outlined text-lg",children:"queue_music"})}),j&&o.jsx(se,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>p(!h),title:h?"Collapse":"Expand",children:o.jsx("span",{className:"material-icons-outlined text-lg",children:h?"expand_more":"expand_less"})}),o.jsx(se,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:i,title:"Close",children:o.jsx("span",{className:"material-icons-outlined text-lg",children:"close"})})]}),o.jsxs("div",{className:"h-full flex flex-col",children:[!h&&o.jsxs("div",{className:"flex-1 flex flex-col",children:[o.jsxs("div",{className:"flex-1 flex items-center gap-6 px-6 py-4",children:[o.jsx("div",{className:"w-48 h-48 rounded-full overflow-hidden bg-muted shrink-0 border-2 cursor-pointer hover:border-primary transition-colors",onClick:()=>j&&p(!0),title:j?"Click to expand":void 0,children:u&&j?o.jsx("img",{src:u,alt:Vt,className:"w-full h-full object-cover pattern-preview"}):o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-4xl",children:j?"image":"hourglass_empty"})})}),j&&l?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center gap-2 py-2",children:[o.jsx("div",{className:"flex items-center gap-3 pr-12 md:pr-16",children:o.jsx("div",{className:"flex-1 min-w-0",children:yt?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-sm md:text-base font-semibold text-muted-foreground",children:"Waiting for next pattern..."}),l.playlist?.next_file&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Up next: ",el(l.playlist.next_file)]})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-sm md:text-base font-semibold truncate",children:Vt}),l.playlist&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Pattern ",l.playlist.current_index+1," of ",l.playlist.total_files]})]})})}),yt?o.jsxs("div",{className:"hidden md:flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-lg",children:"hourglass_top"}),o.jsx(Yi,{value:qt,className:"h-2 flex-1"}),o.jsx("span",{className:"text-sm text-muted-foreground font-mono",children:ms(gt)})]}):o.jsxs("div",{className:"hidden md:flex items-center gap-3",children:[o.jsx("span",{className:"text-sm text-muted-foreground w-12 font-mono",children:ms(te)}),o.jsx(Yi,{value:Kt,className:"h-2 flex-1"}),o.jsxs("span",{className:`text-sm text-muted-foreground text-right font-mono flex items-center justify-end gap-1.5 shrink-0 ${nt?"w-24":"w-14"}`,title:nt?"ETA based on last completed run":"Estimated time remaining",children:[nt&&o.jsx("span",{className:"material-icons-outlined text-sm",children:"history"}),"-",ms(st)]})]}),o.jsxs("div",{className:"flex items-center justify-center gap-3",children:[o.jsx(se,{variant:"secondary",size:"icon",className:"h-10 w-10 rounded-full",onClick:_e,title:"Stop",children:o.jsx("span",{className:"material-icons",children:"stop"})}),o.jsx(se,{variant:"default",size:"icon",className:"h-12 w-12 rounded-full",onClick:be,children:o.jsx("span",{className:"material-icons text-xl",children:l.is_paused?"play_arrow":"pause"})}),l.playlist&&o.jsx(se,{variant:"secondary",size:"icon",className:"h-10 w-10 rounded-full",onClick:B,title:"Skip to next",children:o.jsx("span",{className:"material-icons",children:"skip_next"})})]}),o.jsxs("div",{className:"flex items-center justify-center gap-2",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Speed:"}),o.jsx(wt,{type:"number",placeholder:String(l.speed),value:G,onChange:ue=>X(ue.target.value),onKeyDown:ue=>ue.key==="Enter"&&Ke(),className:"h-7 w-20 text-sm px-2"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"mm/s"})]})]}),l.playlist?.next_file&&o.jsxs("div",{className:"hidden md:flex shrink-0 flex-col items-center gap-1 mr-16 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>me(!0),title:"View queue",children:[o.jsxs("p",{className:"text-xs text-muted-foreground font-medium flex items-center gap-1",children:["Up Next",o.jsx("span",{className:"material-icons-outlined text-xs",children:"queue_music"})]}),o.jsx("div",{className:"w-24 h-24 rounded-full overflow-hidden bg-muted border-2",children:$?o.jsx("img",{src:$,alt:"Next pattern",className:"w-full h-full object-cover pattern-preview"}):o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-2xl",children:"image"})})}),o.jsx("p",{className:"text-xs text-muted-foreground text-center max-w-24 truncate",children:el(l.playlist.next_file)})]})]}):o.jsx("div",{className:"flex-1 flex items-center",children:o.jsx("p",{className:"text-lg text-muted-foreground",children:"Not playing"})})]}),j&&l&&(yt?o.jsxs("div",{className:"flex md:hidden items-center gap-3 px-6 pb-16",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-lg",children:"hourglass_top"}),o.jsx(Yi,{value:qt,className:"h-2 flex-1"}),o.jsx("span",{className:"text-sm text-muted-foreground font-mono",children:ms(gt)})]}):o.jsxs("div",{className:"flex md:hidden items-center gap-3 px-6 pb-16",children:[o.jsx("span",{className:"text-sm text-muted-foreground w-12 font-mono",children:ms(te)}),o.jsx(Yi,{value:Kt,className:"h-2 flex-1"}),o.jsxs("span",{className:`text-sm text-muted-foreground text-right font-mono flex items-center justify-end gap-1.5 shrink-0 ${nt?"w-24":"w-14"}`,children:[nt&&o.jsx("span",{className:"material-icons-outlined text-sm",children:"history"}),"-",ms(st)]})]}))]}),h&&j&&o.jsx("div",{className:"flex-1 flex flex-col md:items-center md:justify-center px-4 py-4 md:py-8 pt-safe overflow-hidden",children:o.jsxs("div",{className:"w-full max-w-5xl mx-auto flex flex-col md:flex-row md:items-center gap-3 md:gap-6",children:[o.jsx("div",{className:"flex-1 flex items-center justify-center cursor-pointer",onClick:()=>p(!1),title:"Click to collapse",children:o.jsx("canvas",{ref:_,width:600,height:600,className:"rounded-full border-2 hover:border-primary transition-colors w-[40vh] h-[40vh] max-w-[300px] max-h-[300px] md:w-[42vh] md:h-[42vh] md:max-w-[500px] md:max-h-[500px]"})}),o.jsxs("div",{className:"md:w-80 shrink-0 flex flex-col justify-start md:justify-center gap-2 md:gap-4",children:[o.jsxs("div",{className:"flex items-center justify-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 md:w-12 md:h-12 rounded-full overflow-hidden bg-muted border shrink-0",children:u?o.jsx("img",{src:u,alt:Vt,className:"w-full h-full object-cover pattern-preview"}):o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-sm",children:"image"})})}),o.jsx("div",{className:"text-left min-w-0",children:yt?o.jsxs(o.Fragment,{children:[o.jsx("h2",{className:"text-lg md:text-xl font-semibold text-muted-foreground",children:"Waiting for next pattern..."}),l?.playlist?.next_file&&o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Up next: ",el(l.playlist.next_file)]})]}):o.jsxs(o.Fragment,{children:[o.jsx("h2",{className:"text-lg md:text-xl font-semibold truncate",children:Vt}),l?.playlist&&o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Pattern ",l.playlist.current_index+1," of ",l.playlist.total_files]})]})})]}),yt?o.jsxs("div",{className:"space-y-1 md:space-y-2",children:[o.jsx(Yi,{value:qt,className:"h-1.5 md:h-2"}),o.jsxs("div",{className:"flex justify-center items-center gap-2 text-xs md:text-sm text-muted-foreground font-mono",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"hourglass_top"}),o.jsxs("span",{children:[ms(gt)," remaining"]})]})]}):o.jsxs("div",{className:"space-y-1 md:space-y-2",children:[o.jsx(Yi,{value:Kt,className:"h-1.5 md:h-2"}),o.jsxs("div",{className:"flex justify-between text-xs md:text-sm text-muted-foreground font-mono",children:[o.jsx("span",{className:"w-16",children:ms(te)}),o.jsxs("span",{children:[Kt.toFixed(0),"%"]}),o.jsxs("span",{className:"w-16 flex items-center justify-end gap-1",children:[nt&&o.jsx("span",{className:"material-icons-outlined text-xs",children:"history"}),"-",ms(st)]})]})]}),o.jsxs("div",{className:"flex items-center justify-center gap-2 md:gap-3",children:[o.jsx(se,{variant:"secondary",size:"icon",className:"h-10 w-10 md:h-12 md:w-12 rounded-full",onClick:_e,title:"Stop",children:o.jsx("span",{className:"material-icons text-lg md:text-2xl",children:"stop"})}),o.jsx(se,{variant:"default",size:"icon",className:"h-12 w-12 md:h-14 md:w-14 rounded-full",onClick:be,children:o.jsx("span",{className:"material-icons text-xl md:text-2xl",children:l?.is_paused?"play_arrow":"pause"})}),l?.playlist&&o.jsx(se,{variant:"secondary",size:"icon",className:"h-10 w-10 md:h-12 md:w-12 rounded-full",onClick:B,title:"Skip to next",children:o.jsx("span",{className:"material-icons text-lg md:text-2xl",children:"skip_next"})})]}),o.jsxs("div",{className:"flex items-center justify-center gap-2",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Speed:"}),o.jsx(wt,{type:"number",placeholder:String(l?.speed||1e3),value:G,onChange:ue=>X(ue.target.value),onKeyDown:ue=>ue.key==="Enter"&&Ke(),className:"h-8 w-24 text-sm px-2"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"mm/s"})]}),l?.playlist?.next_file&&o.jsxs("div",{className:"flex items-center gap-3 bg-muted/50 rounded-lg p-2 md:p-3 cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>me(!0),title:"View queue",children:[o.jsx("div",{className:"w-10 h-10 md:w-12 md:h-12 rounded-full overflow-hidden bg-muted border shrink-0",children:$?o.jsx("img",{src:$,alt:"Next pattern",className:"w-full h-full object-cover pattern-preview"}):o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-sm",children:"image"})})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Up Next"}),o.jsx("p",{className:"text-sm font-medium truncate",children:el(l.playlist.next_file)})]}),o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-lg",children:"queue_music"})]})]})]})})]})]})}),o.jsx(ga,{open:oe,onOpenChange:me,children:o.jsxs(Wr,{ref:Ee,className:"max-w-md max-h-[80vh] flex flex-col",onTouchStart:je,onTouchEnd:ke,children:[o.jsx("div",{className:"md:hidden flex justify-center -mt-2 mb-2",children:o.jsx("div",{className:"w-10 h-1 bg-muted-foreground/30 rounded-full"})}),o.jsxs(Mr,{children:[o.jsxs(Dr,{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined",children:"queue_music"}),"Queue",l?.playlist?.name&&o.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["— ",l.playlist.name]})]}),o.jsx(vi,{className:"sr-only",children:"List of patterns in the current playlist queue. Swipe down to dismiss."})]}),o.jsx("div",{className:"flex-1 overflow-y-auto -mx-6 px-6 py-2","data-scrollable":!0,children:l?.playlist&&He.length>0?(()=>{const ue=l.playlist.current_index,Oe=He.map((Pe,Ze)=>({file:Pe,index:Ze})).filter(({index:Pe})=>Pe>ue);if(Oe.length===0)return o.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No upcoming patterns"});const Be=Oe[0].index,Qe=Oe[Oe.length-1].index;return o.jsx(RV,{sensors:at,collisionDetection:RU,onDragEnd:lt,children:o.jsx(UV,{items:Oe.map(({index:Pe})=>`queue-item-${Pe}`),strategy:FV,children:o.jsx("div",{className:"space-y-1",children:Oe.map(({file:Pe,index:Ze})=>o.jsx(eq,{id:`queue-item-${Ze}`,file:Pe,index:Ze,previewUrl:Z[Pe]||null,isFirst:Ze===Be,isLast:Ze===Qe,onMoveToTop:()=>Ct(Ze,Be),requestPreview:jt,onMoveToBottom:()=>Ct(Ze,Qe)},`queue-item-${Ze}`))})})})})():o.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No queue"})}),l?.playlist&&o.jsxs("div",{className:"pt-3 border-t text-xs text-muted-foreground flex justify-between",children:[o.jsxs("span",{children:["Mode: ",l.playlist.mode]}),o.jsxs("span",{children:[l.playlist.current_index+1," of ",l.playlist.total_files]})]})]})})]})}const nq=["top","right","bottom","left"],xi=Math.min,Rr=Math.max,bh=Math.round,Vf=Math.floor,Ba=e=>({x:e,y:e}),rq={left:"right",right:"left",bottom:"top",top:"bottom"},aq={start:"end",end:"start"};function e0(e,t,n){return Rr(e,xi(t,n))}function js(e,t){return typeof e=="function"?e(t):e}function Cs(e){return e.split("-")[0]}function Hl(e){return e.split("-")[1]}function yw(e){return e==="x"?"y":"x"}function bw(e){return e==="y"?"height":"width"}const sq=new Set(["top","bottom"]);function La(e){return sq.has(Cs(e))?"y":"x"}function ww(e){return yw(La(e))}function iq(e,t,n){n===void 0&&(n=!1);const a=Hl(e),i=ww(e),l=bw(i);let u=i==="x"?a===(n?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(u=wh(u)),[u,wh(u)]}function oq(e){const t=wh(e);return[t0(e),t,t0(t)]}function t0(e){return e.replace(/start|end/g,t=>aq[t])}const Z_=["left","right"],J_=["right","left"],lq=["top","bottom"],cq=["bottom","top"];function uq(e,t,n){switch(e){case"top":case"bottom":return n?t?J_:Z_:t?Z_:J_;case"left":case"right":return t?lq:cq;default:return[]}}function dq(e,t,n,a){const i=Hl(e);let l=uq(Cs(e),n==="start",a);return i&&(l=l.map(u=>u+"-"+i),t&&(l=l.concat(l.map(t0)))),l}function wh(e){return e.replace(/left|right|bottom|top/g,t=>rq[t])}function fq(e){return{top:0,right:0,bottom:0,left:0,...e}}function RD(e){return typeof e!="number"?fq(e):{top:e,right:e,bottom:e,left:e}}function Sh(e){const{x:t,y:n,width:a,height:i}=e;return{width:a,height:i,top:n,left:t,right:t+a,bottom:n+i,x:t,y:n}}function eE(e,t,n){let{reference:a,floating:i}=e;const l=La(t),u=ww(t),d=bw(u),h=Cs(t),p=l==="y",v=a.x+a.width/2-i.width/2,m=a.y+a.height/2-i.height/2,b=a[d]/2-i[d]/2;let w;switch(h){case"top":w={x:v,y:a.y-i.height};break;case"bottom":w={x:v,y:a.y+a.height};break;case"right":w={x:a.x+a.width,y:m};break;case"left":w={x:a.x-i.width,y:m};break;default:w={x:a.x,y:a.y}}switch(Hl(t)){case"start":w[u]-=b*(n&&p?-1:1);break;case"end":w[u]+=b*(n&&p?-1:1);break}return w}const hq=async(e,t,n)=>{const{placement:a="bottom",strategy:i="absolute",middleware:l=[],platform:u}=n,d=l.filter(Boolean),h=await(u.isRTL==null?void 0:u.isRTL(t));let p=await u.getElementRects({reference:e,floating:t,strategy:i}),{x:v,y:m}=eE(p,a,h),b=a,w={},j=0;for(let S=0;S<d.length;S++){const{name:C,fn:N}=d[S],{x:_,y:T,data:R,reset:D}=await N({x:v,y:m,initialPlacement:a,placement:b,strategy:i,middlewareData:w,rects:p,platform:u,elements:{reference:e,floating:t}});v=_??v,m=T??m,w={...w,[C]:{...w[C],...R}},D&&j<=50&&(j++,typeof D=="object"&&(D.placement&&(b=D.placement),D.rects&&(p=D.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:i}):D.rects),{x:v,y:m}=eE(p,b,h)),S=-1)}return{x:v,y:m,placement:b,strategy:i,middlewareData:w}};async function ku(e,t){var n;t===void 0&&(t={});const{x:a,y:i,platform:l,rects:u,elements:d,strategy:h}=e,{boundary:p="clippingAncestors",rootBoundary:v="viewport",elementContext:m="floating",altBoundary:b=!1,padding:w=0}=js(t,e),j=RD(w),C=d[b?m==="floating"?"reference":"floating":m],N=Sh(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(C)))==null||n?C:C.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(d.floating)),boundary:p,rootBoundary:v,strategy:h})),_=m==="floating"?{x:a,y:i,width:u.floating.width,height:u.floating.height}:u.reference,T=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),R=await(l.isElement==null?void 0:l.isElement(T))?await(l.getScale==null?void 0:l.getScale(T))||{x:1,y:1}:{x:1,y:1},D=Sh(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:_,offsetParent:T,strategy:h}):_);return{top:(N.top-D.top+j.top)/R.y,bottom:(D.bottom-N.bottom+j.bottom)/R.y,left:(N.left-D.left+j.left)/R.x,right:(D.right-N.right+j.right)/R.x}}const pq=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:a,placement:i,rects:l,platform:u,elements:d,middlewareData:h}=t,{element:p,padding:v=0}=js(e,t)||{};if(p==null)return{};const m=RD(v),b={x:n,y:a},w=ww(i),j=bw(w),S=await u.getDimensions(p),C=w==="y",N=C?"top":"left",_=C?"bottom":"right",T=C?"clientHeight":"clientWidth",R=l.reference[j]+l.reference[w]-b[w]-l.floating[j],D=b[w]-l.reference[w],L=await(u.getOffsetParent==null?void 0:u.getOffsetParent(p));let k=L?L[T]:0;(!k||!await(u.isElement==null?void 0:u.isElement(L)))&&(k=d.floating[T]||l.floating[j]);const P=R/2-D/2,U=k/2-S[j]/2-1,J=xi(m[N],U),$=xi(m[_],U),W=J,fe=k-S[j]-$,we=k/2-S[j]/2+P,Ce=e0(W,we,fe),I=!h.arrow&&Hl(i)!=null&&we!==Ce&&l.reference[j]/2-(we<W?J:$)-S[j]/2<0,V=I?we<W?we-W:we-fe:0;return{[w]:b[w]+V,data:{[w]:Ce,centerOffset:we-Ce-V,...I&&{alignmentOffset:V}},reset:I}}}),mq=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,a;const{placement:i,middlewareData:l,rects:u,initialPlacement:d,platform:h,elements:p}=t,{mainAxis:v=!0,crossAxis:m=!0,fallbackPlacements:b,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:S=!0,...C}=js(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const N=Cs(i),_=La(d),T=Cs(d)===d,R=await(h.isRTL==null?void 0:h.isRTL(p.floating)),D=b||(T||!S?[wh(d)]:oq(d)),L=j!=="none";!b&&L&&D.push(...dq(d,S,j,R));const k=[d,...D],P=await ku(t,C),U=[];let J=((a=l.flip)==null?void 0:a.overflows)||[];if(v&&U.push(P[N]),m){const we=iq(i,u,R);U.push(P[we[0]],P[we[1]])}if(J=[...J,{placement:i,overflows:U}],!U.every(we=>we<=0)){var $,W;const we=((($=l.flip)==null?void 0:$.index)||0)+1,Ce=k[we];if(Ce&&(!(m==="alignment"?_!==La(Ce):!1)||J.every(H=>La(H.placement)===_?H.overflows[0]>0:!0)))return{data:{index:we,overflows:J},reset:{placement:Ce}};let I=(W=J.filter(V=>V.overflows[0]<=0).sort((V,H)=>V.overflows[1]-H.overflows[1])[0])==null?void 0:W.placement;if(!I)switch(w){case"bestFit":{var fe;const V=(fe=J.filter(H=>{if(L){const be=La(H.placement);return be===_||be==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(be=>be>0).reduce((be,_e)=>be+_e,0)]).sort((H,be)=>H[1]-be[1])[0])==null?void 0:fe[0];V&&(I=V);break}case"initialPlacement":I=d;break}if(i!==I)return{reset:{placement:I}}}return{}}}};function tE(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function nE(e){return nq.some(t=>e[t]>=0)}const gq=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:a="referenceHidden",...i}=js(e,t);switch(a){case"referenceHidden":{const l=await ku(t,{...i,elementContext:"reference"}),u=tE(l,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:nE(u)}}}case"escaped":{const l=await ku(t,{...i,altBoundary:!0}),u=tE(l,n.floating);return{data:{escapedOffsets:u,escaped:nE(u)}}}default:return{}}}}},AD=new Set(["left","top"]);async function vq(e,t){const{placement:n,platform:a,elements:i}=e,l=await(a.isRTL==null?void 0:a.isRTL(i.floating)),u=Cs(n),d=Hl(n),h=La(n)==="y",p=AD.has(u)?-1:1,v=l&&h?-1:1,m=js(t,e);let{mainAxis:b,crossAxis:w,alignmentAxis:j}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return d&&typeof j=="number"&&(w=d==="end"?j*-1:j),h?{x:w*v,y:b*p}:{x:b*p,y:w*v}}const xq=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,a;const{x:i,y:l,placement:u,middlewareData:d}=t,h=await vq(t,e);return u===((n=d.offset)==null?void 0:n.placement)&&(a=d.arrow)!=null&&a.alignmentOffset?{}:{x:i+h.x,y:l+h.y,data:{...h,placement:u}}}}},yq=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:a,placement:i}=t,{mainAxis:l=!0,crossAxis:u=!1,limiter:d={fn:C=>{let{x:N,y:_}=C;return{x:N,y:_}}},...h}=js(e,t),p={x:n,y:a},v=await ku(t,h),m=La(Cs(i)),b=yw(m);let w=p[b],j=p[m];if(l){const C=b==="y"?"top":"left",N=b==="y"?"bottom":"right",_=w+v[C],T=w-v[N];w=e0(_,w,T)}if(u){const C=m==="y"?"top":"left",N=m==="y"?"bottom":"right",_=j+v[C],T=j-v[N];j=e0(_,j,T)}const S=d.fn({...t,[b]:w,[m]:j});return{...S,data:{x:S.x-n,y:S.y-a,enabled:{[b]:l,[m]:u}}}}}},bq=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:a,placement:i,rects:l,middlewareData:u}=t,{offset:d=0,mainAxis:h=!0,crossAxis:p=!0}=js(e,t),v={x:n,y:a},m=La(i),b=yw(m);let w=v[b],j=v[m];const S=js(d,t),C=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(h){const T=b==="y"?"height":"width",R=l.reference[b]-l.floating[T]+C.mainAxis,D=l.reference[b]+l.reference[T]-C.mainAxis;w<R?w=R:w>D&&(w=D)}if(p){var N,_;const T=b==="y"?"width":"height",R=AD.has(Cs(i)),D=l.reference[m]-l.floating[T]+(R&&((N=u.offset)==null?void 0:N[m])||0)+(R?0:C.crossAxis),L=l.reference[m]+l.reference[T]+(R?0:((_=u.offset)==null?void 0:_[m])||0)-(R?C.crossAxis:0);j<D?j=D:j>L&&(j=L)}return{[b]:w,[m]:j}}}},wq=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,a;const{placement:i,rects:l,platform:u,elements:d}=t,{apply:h=()=>{},...p}=js(e,t),v=await ku(t,p),m=Cs(i),b=Hl(i),w=La(i)==="y",{width:j,height:S}=l.floating;let C,N;m==="top"||m==="bottom"?(C=m,N=b===(await(u.isRTL==null?void 0:u.isRTL(d.floating))?"start":"end")?"left":"right"):(N=m,C=b==="end"?"top":"bottom");const _=S-v.top-v.bottom,T=j-v.left-v.right,R=xi(S-v[C],_),D=xi(j-v[N],T),L=!t.middlewareData.shift;let k=R,P=D;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=T),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(k=_),L&&!b){const J=Rr(v.left,0),$=Rr(v.right,0),W=Rr(v.top,0),fe=Rr(v.bottom,0);w?P=j-2*(J!==0||$!==0?J+$:Rr(v.left,v.right)):k=S-2*(W!==0||fe!==0?W+fe:Rr(v.top,v.bottom))}await h({...t,availableWidth:P,availableHeight:k});const U=await u.getDimensions(d.floating);return j!==U.width||S!==U.height?{reset:{rects:!0}}:{}}}};function ap(){return typeof window<"u"}function Ul(e){return OD(e)?(e.nodeName||"").toLowerCase():"#document"}function Pr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function $a(e){var t;return(t=(OD(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function OD(e){return ap()?e instanceof Node||e instanceof Pr(e).Node:!1}function ya(e){return ap()?e instanceof Element||e instanceof Pr(e).Element:!1}function Ha(e){return ap()?e instanceof HTMLElement||e instanceof Pr(e).HTMLElement:!1}function rE(e){return!ap()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Pr(e).ShadowRoot}const Sq=new Set(["inline","contents"]);function td(e){const{overflow:t,overflowX:n,overflowY:a,display:i}=ba(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+n)&&!Sq.has(i)}const jq=new Set(["table","td","th"]);function Cq(e){return jq.has(Ul(e))}const Nq=[":popover-open",":modal"];function sp(e){return Nq.some(t=>{try{return e.matches(t)}catch{return!1}})}const _q=["transform","translate","scale","rotate","perspective"],Eq=["transform","translate","scale","rotate","perspective","filter"],Tq=["paint","layout","strict","content"];function Sw(e){const t=jw(),n=ya(e)?ba(e):e;return _q.some(a=>n[a]?n[a]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Eq.some(a=>(n.willChange||"").includes(a))||Tq.some(a=>(n.contain||"").includes(a))}function Rq(e){let t=yi(e);for(;Ha(t)&&!El(t);){if(Sw(t))return t;if(sp(t))return null;t=yi(t)}return null}function jw(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Aq=new Set(["html","body","#document"]);function El(e){return Aq.has(Ul(e))}function ba(e){return Pr(e).getComputedStyle(e)}function ip(e){return ya(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function yi(e){if(Ul(e)==="html")return e;const t=e.assignedSlot||e.parentNode||rE(e)&&e.host||$a(e);return rE(t)?t.host:t}function MD(e){const t=yi(e);return El(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ha(t)&&td(t)?t:MD(t)}function Lu(e,t,n){var a;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=MD(e),l=i===((a=e.ownerDocument)==null?void 0:a.body),u=Pr(i);if(l){const d=n0(u);return t.concat(u,u.visualViewport||[],td(i)?i:[],d&&n?Lu(d):[])}return t.concat(i,Lu(i,[],n))}function n0(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function DD(e){const t=ba(e);let n=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const i=Ha(e),l=i?e.offsetWidth:n,u=i?e.offsetHeight:a,d=bh(n)!==l||bh(a)!==u;return d&&(n=l,a=u),{width:n,height:a,$:d}}function Cw(e){return ya(e)?e:e.contextElement}function Cl(e){const t=Cw(e);if(!Ha(t))return Ba(1);const n=t.getBoundingClientRect(),{width:a,height:i,$:l}=DD(t);let u=(l?bh(n.width):n.width)/a,d=(l?bh(n.height):n.height)/i;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const Oq=Ba(0);function PD(e){const t=Pr(e);return!jw()||!t.visualViewport?Oq:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Mq(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Pr(e)?!1:t}function to(e,t,n,a){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),l=Cw(e);let u=Ba(1);t&&(a?ya(a)&&(u=Cl(a)):u=Cl(e));const d=Mq(l,n,a)?PD(l):Ba(0);let h=(i.left+d.x)/u.x,p=(i.top+d.y)/u.y,v=i.width/u.x,m=i.height/u.y;if(l){const b=Pr(l),w=a&&ya(a)?Pr(a):a;let j=b,S=n0(j);for(;S&&a&&w!==j;){const C=Cl(S),N=S.getBoundingClientRect(),_=ba(S),T=N.left+(S.clientLeft+parseFloat(_.paddingLeft))*C.x,R=N.top+(S.clientTop+parseFloat(_.paddingTop))*C.y;h*=C.x,p*=C.y,v*=C.x,m*=C.y,h+=T,p+=R,j=Pr(S),S=n0(j)}}return Sh({width:v,height:m,x:h,y:p})}function op(e,t){const n=ip(e).scrollLeft;return t?t.left+n:to($a(e)).left+n}function kD(e,t){const n=e.getBoundingClientRect(),a=n.left+t.scrollLeft-op(e,n),i=n.top+t.scrollTop;return{x:a,y:i}}function Dq(e){let{elements:t,rect:n,offsetParent:a,strategy:i}=e;const l=i==="fixed",u=$a(a),d=t?sp(t.floating):!1;if(a===u||d&&l)return n;let h={scrollLeft:0,scrollTop:0},p=Ba(1);const v=Ba(0),m=Ha(a);if((m||!m&&!l)&&((Ul(a)!=="body"||td(u))&&(h=ip(a)),Ha(a))){const w=to(a);p=Cl(a),v.x=w.x+a.clientLeft,v.y=w.y+a.clientTop}const b=u&&!m&&!l?kD(u,h):Ba(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-h.scrollLeft*p.x+v.x+b.x,y:n.y*p.y-h.scrollTop*p.y+v.y+b.y}}function Pq(e){return Array.from(e.getClientRects())}function kq(e){const t=$a(e),n=ip(e),a=e.ownerDocument.body,i=Rr(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),l=Rr(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let u=-n.scrollLeft+op(e);const d=-n.scrollTop;return ba(a).direction==="rtl"&&(u+=Rr(t.clientWidth,a.clientWidth)-i),{width:i,height:l,x:u,y:d}}const aE=25;function Lq(e,t){const n=Pr(e),a=$a(e),i=n.visualViewport;let l=a.clientWidth,u=a.clientHeight,d=0,h=0;if(i){l=i.width,u=i.height;const v=jw();(!v||v&&t==="fixed")&&(d=i.offsetLeft,h=i.offsetTop)}const p=op(a);if(p<=0){const v=a.ownerDocument,m=v.body,b=getComputedStyle(m),w=v.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,j=Math.abs(a.clientWidth-m.clientWidth-w);j<=aE&&(l-=j)}else p<=aE&&(l+=p);return{width:l,height:u,x:d,y:h}}const Bq=new Set(["absolute","fixed"]);function Iq(e,t){const n=to(e,!0,t==="fixed"),a=n.top+e.clientTop,i=n.left+e.clientLeft,l=Ha(e)?Cl(e):Ba(1),u=e.clientWidth*l.x,d=e.clientHeight*l.y,h=i*l.x,p=a*l.y;return{width:u,height:d,x:h,y:p}}function sE(e,t,n){let a;if(t==="viewport")a=Lq(e,n);else if(t==="document")a=kq($a(e));else if(ya(t))a=Iq(t,n);else{const i=PD(e);a={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Sh(a)}function LD(e,t){const n=yi(e);return n===t||!ya(n)||El(n)?!1:ba(n).position==="fixed"||LD(n,t)}function zq(e,t){const n=t.get(e);if(n)return n;let a=Lu(e,[],!1).filter(d=>ya(d)&&Ul(d)!=="body"),i=null;const l=ba(e).position==="fixed";let u=l?yi(e):e;for(;ya(u)&&!El(u);){const d=ba(u),h=Sw(u);!h&&d.position==="fixed"&&(i=null),(l?!h&&!i:!h&&d.position==="static"&&!!i&&Bq.has(i.position)||td(u)&&!h&&LD(e,u))?a=a.filter(v=>v!==u):i=d,u=yi(u)}return t.set(e,a),a}function Fq(e){let{element:t,boundary:n,rootBoundary:a,strategy:i}=e;const u=[...n==="clippingAncestors"?sp(t)?[]:zq(t,this._c):[].concat(n),a],d=u[0],h=u.reduce((p,v)=>{const m=sE(t,v,i);return p.top=Rr(m.top,p.top),p.right=xi(m.right,p.right),p.bottom=xi(m.bottom,p.bottom),p.left=Rr(m.left,p.left),p},sE(t,d,i));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function Hq(e){const{width:t,height:n}=DD(e);return{width:t,height:n}}function Uq(e,t,n){const a=Ha(t),i=$a(t),l=n==="fixed",u=to(e,!0,l,t);let d={scrollLeft:0,scrollTop:0};const h=Ba(0);function p(){h.x=op(i)}if(a||!a&&!l)if((Ul(t)!=="body"||td(i))&&(d=ip(t)),a){const w=to(t,!0,l,t);h.x=w.x+t.clientLeft,h.y=w.y+t.clientTop}else i&&p();l&&!a&&i&&p();const v=i&&!a&&!l?kD(i,d):Ba(0),m=u.left+d.scrollLeft-h.x-v.x,b=u.top+d.scrollTop-h.y-v.y;return{x:m,y:b,width:u.width,height:u.height}}function hv(e){return ba(e).position==="static"}function iE(e,t){if(!Ha(e)||ba(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return $a(e)===n&&(n=n.ownerDocument.body),n}function BD(e,t){const n=Pr(e);if(sp(e))return n;if(!Ha(e)){let i=yi(e);for(;i&&!El(i);){if(ya(i)&&!hv(i))return i;i=yi(i)}return n}let a=iE(e,t);for(;a&&Cq(a)&&hv(a);)a=iE(a,t);return a&&El(a)&&hv(a)&&!Sw(a)?n:a||Rq(e)||n}const Vq=async function(e){const t=this.getOffsetParent||BD,n=this.getDimensions,a=await n(e.floating);return{reference:Uq(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function qq(e){return ba(e).direction==="rtl"}const $q={convertOffsetParentRelativeRectToViewportRelativeRect:Dq,getDocumentElement:$a,getClippingRect:Fq,getOffsetParent:BD,getElementRects:Vq,getClientRects:Pq,getDimensions:Hq,getScale:Cl,isElement:ya,isRTL:qq};function ID(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Gq(e,t){let n=null,a;const i=$a(e);function l(){var d;clearTimeout(a),(d=n)==null||d.disconnect(),n=null}function u(d,h){d===void 0&&(d=!1),h===void 0&&(h=1),l();const p=e.getBoundingClientRect(),{left:v,top:m,width:b,height:w}=p;if(d||t(),!b||!w)return;const j=Vf(m),S=Vf(i.clientWidth-(v+b)),C=Vf(i.clientHeight-(m+w)),N=Vf(v),T={rootMargin:-j+"px "+-S+"px "+-C+"px "+-N+"px",threshold:Rr(0,xi(1,h))||1};let R=!0;function D(L){const k=L[0].intersectionRatio;if(k!==h){if(!R)return u();k?u(!1,k):a=setTimeout(()=>{u(!1,1e-7)},1e3)}k===1&&!ID(p,e.getBoundingClientRect())&&u(),R=!1}try{n=new IntersectionObserver(D,{...T,root:i.ownerDocument})}catch{n=new IntersectionObserver(D,T)}n.observe(e)}return u(!0),l}function Kq(e,t,n,a){a===void 0&&(a={});const{ancestorScroll:i=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:h=!1}=a,p=Cw(e),v=i||l?[...p?Lu(p):[],...Lu(t)]:[];v.forEach(N=>{i&&N.addEventListener("scroll",n,{passive:!0}),l&&N.addEventListener("resize",n)});const m=p&&d?Gq(p,n):null;let b=-1,w=null;u&&(w=new ResizeObserver(N=>{let[_]=N;_&&_.target===p&&w&&(w.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var T;(T=w)==null||T.observe(t)})),n()}),p&&!h&&w.observe(p),w.observe(t));let j,S=h?to(e):null;h&&C();function C(){const N=to(e);S&&!ID(S,N)&&n(),S=N,j=requestAnimationFrame(C)}return n(),()=>{var N;v.forEach(_=>{i&&_.removeEventListener("scroll",n),l&&_.removeEventListener("resize",n)}),m?.(),(N=w)==null||N.disconnect(),w=null,h&&cancelAnimationFrame(j)}}const Yq=xq,Wq=yq,Xq=mq,Qq=wq,Zq=gq,oE=pq,Jq=bq,e9=(e,t,n)=>{const a=new Map,i={platform:$q,...n},l={...i.platform,_c:a};return hq(e,t,{...i,platform:l})};var t9=typeof document<"u",n9=function(){},ah=t9?g.useLayoutEffect:n9;function jh(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 n,a,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(a=n;a--!==0;)if(!jh(e[a],t[a]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(a=n;a--!==0;)if(!{}.hasOwnProperty.call(t,i[a]))return!1;for(a=n;a--!==0;){const l=i[a];if(!(l==="_owner"&&e.$$typeof)&&!jh(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function zD(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function lE(e,t){const n=zD(e);return Math.round(t*n)/n}function pv(e){const t=g.useRef(e);return ah(()=>{t.current=e}),t}function r9(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:a=[],platform:i,elements:{reference:l,floating:u}={},transform:d=!0,whileElementsMounted:h,open:p}=e,[v,m]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[b,w]=g.useState(a);jh(b,a)||w(a);const[j,S]=g.useState(null),[C,N]=g.useState(null),_=g.useCallback(H=>{H!==L.current&&(L.current=H,S(H))},[]),T=g.useCallback(H=>{H!==k.current&&(k.current=H,N(H))},[]),R=l||j,D=u||C,L=g.useRef(null),k=g.useRef(null),P=g.useRef(v),U=h!=null,J=pv(h),$=pv(i),W=pv(p),fe=g.useCallback(()=>{if(!L.current||!k.current)return;const H={placement:t,strategy:n,middleware:b};$.current&&(H.platform=$.current),e9(L.current,k.current,H).then(be=>{const _e={...be,isPositioned:W.current!==!1};we.current&&!jh(P.current,_e)&&(P.current=_e,ka.flushSync(()=>{m(_e)}))})},[b,t,n,$,W]);ah(()=>{p===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,m(H=>({...H,isPositioned:!1})))},[p]);const we=g.useRef(!1);ah(()=>(we.current=!0,()=>{we.current=!1}),[]),ah(()=>{if(R&&(L.current=R),D&&(k.current=D),R&&D){if(J.current)return J.current(R,D,fe);fe()}},[R,D,fe,J,U]);const Ce=g.useMemo(()=>({reference:L,floating:k,setReference:_,setFloating:T}),[_,T]),I=g.useMemo(()=>({reference:R,floating:D}),[R,D]),V=g.useMemo(()=>{const H={position:n,left:0,top:0};if(!I.floating)return H;const be=lE(I.floating,v.x),_e=lE(I.floating,v.y);return d?{...H,transform:"translate("+be+"px, "+_e+"px)",...zD(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:be,top:_e}},[n,d,I.floating,v.x,v.y]);return g.useMemo(()=>({...v,update:fe,refs:Ce,elements:I,floatingStyles:V}),[v,fe,Ce,I,V])}const a9=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:a,padding:i}=typeof e=="function"?e(n):e;return a&&t(a)?a.current!=null?oE({element:a.current,padding:i}).fn(n):{}:a?oE({element:a,padding:i}).fn(n):{}}}},s9=(e,t)=>({...Yq(e),options:[e,t]}),i9=(e,t)=>({...Wq(e),options:[e,t]}),o9=(e,t)=>({...Jq(e),options:[e,t]}),l9=(e,t)=>({...Xq(e),options:[e,t]}),c9=(e,t)=>({...Qq(e),options:[e,t]}),u9=(e,t)=>({...Zq(e),options:[e,t]}),d9=(e,t)=>({...a9(e),options:[e,t]});var f9="Arrow",FD=g.forwardRef((e,t)=>{const{children:n,width:a=10,height:i=5,...l}=e;return o.jsx(dt.svg,{...l,ref:t,width:a,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});FD.displayName=f9;var h9=FD;function lp(e){const[t,n]=g.useState(void 0);return Kn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const a=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const l=i[0];let u,d;if("borderBoxSize"in l){const h=l.borderBoxSize,p=Array.isArray(h)?h[0]:h;u=p.inlineSize,d=p.blockSize}else u=e.offsetWidth,d=e.offsetHeight;n({width:u,height:d})});return a.observe(e,{box:"border-box"}),()=>a.unobserve(e)}else n(void 0)},[e]),t}var Nw="Popper",[HD,Vl]=Lr(Nw),[p9,UD]=HD(Nw),VD=e=>{const{__scopePopper:t,children:n}=e,[a,i]=g.useState(null);return o.jsx(p9,{scope:t,anchor:a,onAnchorChange:i,children:n})};VD.displayName=Nw;var qD="PopperAnchor",$D=g.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:a,...i}=e,l=UD(qD,n),u=g.useRef(null),d=Ot(t,u),h=g.useRef(null);return g.useEffect(()=>{const p=h.current;h.current=a?.current||u.current,p!==h.current&&l.onAnchorChange(h.current)}),a?null:o.jsx(dt.div,{...i,ref:d})});$D.displayName=qD;var _w="PopperContent",[m9,g9]=HD(_w),GD=g.forwardRef((e,t)=>{const{__scopePopper:n,side:a="bottom",sideOffset:i=0,align:l="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:h=!0,collisionBoundary:p=[],collisionPadding:v=0,sticky:m="partial",hideWhenDetached:b=!1,updatePositionStrategy:w="optimized",onPlaced:j,...S}=e,C=UD(_w,n),[N,_]=g.useState(null),T=Ot(t,ne=>_(ne)),[R,D]=g.useState(null),L=lp(R),k=L?.width??0,P=L?.height??0,U=a+(l!=="center"?"-"+l:""),J=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},$=Array.isArray(p)?p:[p],W=$.length>0,fe={padding:J,boundary:$.filter(x9),altBoundary:W},{refs:we,floatingStyles:Ce,placement:I,isPositioned:V,middlewareData:H}=r9({strategy:"fixed",placement:U,whileElementsMounted:(...ne)=>Kq(...ne,{animationFrame:w==="always"}),elements:{reference:C.anchor},middleware:[s9({mainAxis:i+P,alignmentAxis:u}),h&&i9({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?o9():void 0,...fe}),h&&l9({...fe}),c9({...fe,apply:({elements:ne,rects:he,availableWidth:Ee,availableHeight:je})=>{const{width:ke,height:le}=he.reference,Fe=ne.floating.style;Fe.setProperty("--radix-popper-available-width",`${Ee}px`),Fe.setProperty("--radix-popper-available-height",`${je}px`),Fe.setProperty("--radix-popper-anchor-width",`${ke}px`),Fe.setProperty("--radix-popper-anchor-height",`${le}px`)}}),R&&d9({element:R,padding:d}),y9({arrowWidth:k,arrowHeight:P}),b&&u9({strategy:"referenceHidden",...fe})]}),[be,_e]=WD(I),B=gi(j);Kn(()=>{V&&B?.()},[V,B]);const G=H.arrow?.x,X=H.arrow?.y,oe=H.arrow?.centerOffset!==0,[me,Z]=g.useState();return Kn(()=>{N&&Z(window.getComputedStyle(N).zIndex)},[N]),o.jsx("div",{ref:we.setFloating,"data-radix-popper-content-wrapper":"",style:{...Ce,transform:V?Ce.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:me,"--radix-popper-transform-origin":[H.transformOrigin?.x,H.transformOrigin?.y].join(" "),...H.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(m9,{scope:n,placedSide:be,onArrowChange:D,arrowX:G,arrowY:X,shouldHideArrow:oe,children:o.jsx(dt.div,{"data-side":be,"data-align":_e,...S,ref:T,style:{...S.style,animation:V?void 0:"none"}})})})});GD.displayName=_w;var KD="PopperArrow",v9={top:"bottom",right:"left",bottom:"top",left:"right"},YD=g.forwardRef(function(t,n){const{__scopePopper:a,...i}=t,l=g9(KD,a),u=v9[l.placedSide];return o.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:o.jsx(h9,{...i,ref:n,style:{...i.style,display:"block"}})})});YD.displayName=KD;function x9(e){return e!==null}var y9=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:a,middlewareData:i}=t,u=i.arrow?.centerOffset!==0,d=u?0:e.arrowWidth,h=u?0:e.arrowHeight,[p,v]=WD(n),m={start:"0%",center:"50%",end:"100%"}[v],b=(i.arrow?.x??0)+d/2,w=(i.arrow?.y??0)+h/2;let j="",S="";return p==="bottom"?(j=u?m:`${b}px`,S=`${-h}px`):p==="top"?(j=u?m:`${b}px`,S=`${a.floating.height+h}px`):p==="right"?(j=`${-h}px`,S=u?m:`${w}px`):p==="left"&&(j=`${a.floating.width+h}px`,S=u?m:`${w}px`),{data:{x:j,y:S}}}});function WD(e){const[t,n="center"]=e.split("-");return[t,n]}var Ew=VD,cp=$D,Tw=GD,Rw=YD;function b9(e){const t=w9(e),n=g.forwardRef((a,i)=>{const{children:l,...u}=a,d=g.Children.toArray(l),h=d.find(j9);if(h){const p=h.props.children,v=d.map(m=>m===h?g.Children.count(p)>1?g.Children.only(null):g.isValidElement(p)?p.props.children:null:m);return o.jsx(t,{...u,ref:i,children:g.isValidElement(p)?g.cloneElement(p,void 0,v):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function w9(e){const t=g.forwardRef((n,a)=>{const{children:i,...l}=n;if(g.isValidElement(i)){const u=N9(i),d=C9(l,i.props);return i.type!==g.Fragment&&(d.ref=a?oo(a,u):u),g.cloneElement(i,d)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var S9=Symbol("radix.slottable");function j9(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===S9}function C9(e,t){const n={...t};for(const a in t){const i=e[a],l=t[a];/^on[A-Z]/.test(a)?i&&l?n[a]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(n[a]=i):a==="style"?n[a]={...i,...l}:a==="className"&&(n[a]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function N9(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var up="Popover",[XD]=Lr(up,[Vl]),nd=Vl(),[_9,ji]=XD(up),QD=e=>{const{__scopePopover:t,children:n,open:a,defaultOpen:i,onOpenChange:l,modal:u=!1}=e,d=nd(t),h=g.useRef(null),[p,v]=g.useState(!1),[m,b]=Zr({prop:a,defaultProp:i??!1,onChange:l,caller:up});return o.jsx(Ew,{...d,children:o.jsx(_9,{scope:t,contentId:ma(),triggerRef:h,open:m,onOpenChange:b,onOpenToggle:g.useCallback(()=>b(w=>!w),[b]),hasCustomAnchor:p,onCustomAnchorAdd:g.useCallback(()=>v(!0),[]),onCustomAnchorRemove:g.useCallback(()=>v(!1),[]),modal:u,children:n})})};QD.displayName=up;var ZD="PopoverAnchor",E9=g.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,i=ji(ZD,n),l=nd(n),{onCustomAnchorAdd:u,onCustomAnchorRemove:d}=i;return g.useEffect(()=>(u(),()=>d()),[u,d]),o.jsx(cp,{...l,...a,ref:t})});E9.displayName=ZD;var JD="PopoverTrigger",eP=g.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,i=ji(JD,n),l=nd(n),u=Ot(t,i.triggerRef),d=o.jsx(dt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":sP(i.open),...a,ref:u,onClick:et(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?d:o.jsx(cp,{asChild:!0,...l,children:d})});eP.displayName=JD;var Aw="PopoverPortal",[T9,R9]=XD(Aw,{forceMount:void 0}),tP=e=>{const{__scopePopover:t,forceMount:n,children:a,container:i}=e,l=ji(Aw,t);return o.jsx(T9,{scope:t,forceMount:n,children:o.jsx(Ts,{present:n||l.open,children:o.jsx(Gh,{asChild:!0,container:i,children:a})})})};tP.displayName=Aw;var Tl="PopoverContent",nP=g.forwardRef((e,t)=>{const n=R9(Tl,e.__scopePopover),{forceMount:a=n.forceMount,...i}=e,l=ji(Tl,e.__scopePopover);return o.jsx(Ts,{present:a||l.open,children:l.modal?o.jsx(O9,{...i,ref:t}):o.jsx(M9,{...i,ref:t})})});nP.displayName=Tl;var A9=b9("PopoverContent.RemoveScroll"),O9=g.forwardRef((e,t)=>{const n=ji(Tl,e.__scopePopover),a=g.useRef(null),i=Ot(t,a),l=g.useRef(!1);return g.useEffect(()=>{const u=a.current;if(u)return sw(u)},[]),o.jsx(Yh,{as:A9,allowPinchZoom:!0,children:o.jsx(rP,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:et(e.onCloseAutoFocus,u=>{u.preventDefault(),l.current||n.triggerRef.current?.focus()}),onPointerDownOutside:et(e.onPointerDownOutside,u=>{const d=u.detail.originalEvent,h=d.button===0&&d.ctrlKey===!0,p=d.button===2||h;l.current=p},{checkForDefaultPrevented:!1}),onFocusOutside:et(e.onFocusOutside,u=>u.preventDefault(),{checkForDefaultPrevented:!1})})})}),M9=g.forwardRef((e,t)=>{const n=ji(Tl,e.__scopePopover),a=g.useRef(!1),i=g.useRef(!1);return o.jsx(rP,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{e.onCloseAutoFocus?.(l),l.defaultPrevented||(a.current||n.triggerRef.current?.focus(),l.preventDefault()),a.current=!1,i.current=!1},onInteractOutside:l=>{e.onInteractOutside?.(l),l.defaultPrevented||(a.current=!0,l.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const u=l.target;n.triggerRef.current?.contains(u)&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&i.current&&l.preventDefault()}})}),rP=g.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:p,onInteractOutside:v,...m}=e,b=ji(Tl,n),w=nd(n);return aw(),o.jsx($h,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:i,onUnmountAutoFocus:l,children:o.jsx(Qu,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:v,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:p,onDismiss:()=>b.onOpenChange(!1),children:o.jsx(Tw,{"data-state":sP(b.open),role:"dialog",id:b.contentId,...w,...m,ref:t,style:{...m.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)"}})})})}),aP="PopoverClose",D9=g.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,i=ji(aP,n);return o.jsx(dt.button,{type:"button",...a,ref:t,onClick:et(e.onClick,()=>i.onOpenChange(!1))})});D9.displayName=aP;var P9="PopoverArrow",k9=g.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,i=nd(n);return o.jsx(Rw,{...i,...a,ref:t})});k9.displayName=P9;function sP(e){return e?"open":"closed"}var L9=QD,B9=eP,I9=tP,iP=nP;const Bu=L9,Iu=B9,Rl=g.forwardRef(({className:e,align:t="center",sideOffset:n=4,...a},i)=>o.jsx(I9,{children:o.jsx(iP,{ref:i,align:t,sideOffset:n,className:ct("z-[100] w-72 rounded-2xl 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),...a})}));Rl.displayName=iP.displayName;var z9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],F9=z9.reduce((e,t)=>{const n=qh(`Primitive.${t}`),a=g.forwardRef((i,l)=>{const{asChild:u,...d}=i,h=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(h,{...d,ref:l})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),H9="Separator",cE="horizontal",U9=["horizontal","vertical"],oP=g.forwardRef((e,t)=>{const{decorative:n,orientation:a=cE,...i}=e,l=V9(a)?a:cE,d=n?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return o.jsx(F9.div,{"data-orientation":l,...d,...i,ref:t})});oP.displayName=H9;function V9(e){return U9.includes(e)}var lP=oP;const Xn=g.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...a},i)=>o.jsx(lP,{ref:i,decorative:n,orientation:t,className:ct("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...a}));Xn.displayName=lP.displayName;const q9="dune_weaver_previews",$9=1,Ns="previews",G9=200,uE=G9*1024*1024;let ha=null;const Xi=new Map,K9=100;async function dp(){return ha||new Promise((e,t)=>{const n=indexedDB.open(q9,$9);n.onerror=()=>{console.error("Failed to open preview cache database"),t(n.error)},n.onsuccess=()=>{ha=n.result,console.debug("Preview cache database opened successfully"),e(ha)},n.onupgradeneeded=a=>{const l=a.target.result.createObjectStore(Ns,{keyPath:"pattern"});l.createIndex("lastAccessed","lastAccessed",{unique:!1}),l.createIndex("size","size",{unique:!1}),console.debug("Preview cache database schema created")}})}function cP(e,t){if(Xi.size>=K9){const n=Xi.keys().next().value;n&&Xi.delete(n)}Xi.set(e,t)}async function Ow(e,t){try{if(!t||!t.image_data){console.warn(`Invalid preview data for ${e}, skipping cache save`);return}ha||await dp(),cP(e,t);const n=Math.ceil(t.image_data.length*3/4);await W9(n);const a={pattern:e,data:t,size:n,lastAccessed:Date.now(),created:Date.now()},l=ha.transaction([Ns],"readwrite").objectStore(Ns);return new Promise((u,d)=>{const h=l.put(a);h.onsuccess=()=>{console.debug(`Preview cached for ${e} (${(n/1024).toFixed(1)}KB)`),u()},h.onerror=()=>d(h.error)})}catch(n){console.warn(`Error saving preview to cache: ${n}`)}}async function Y9(){try{if(!ha)return 0;const t=ha.transaction([Ns],"readonly").objectStore(Ns);return new Promise((n,a)=>{const i=t.getAll();i.onsuccess=()=>{const l=i.result.reduce((u,d)=>u+(d.size||0),0);n(l)},i.onerror=()=>a(i.error)})}catch(e){return console.warn(`Error getting cache size: ${e}`),0}}async function W9(e){try{const t=await Y9();if(t+e<=uE)return;console.debug(`Cache size would exceed limit (${((t+e)/1024/1024).toFixed(1)}MB), cleaning up...`);const a=ha.transaction([Ns],"readwrite").objectStore(Ns),i=a.index("lastAccessed"),l=await new Promise((h,p)=>{const v=i.getAll();v.onsuccess=()=>h(v.result),v.onerror=()=>p(v.error)});l.sort((h,p)=>h.lastAccessed-p.lastAccessed);let u=0;const d=e+uE*.1;for(const h of l){if(u>=d)break;await new Promise((p,v)=>{const m=a.delete(h.pattern);m.onsuccess=()=>{u+=h.size,Xi.delete(h.pattern),console.debug(`Evicted cached preview for ${h.pattern} (${(h.size/1024).toFixed(1)}KB)`),p()},m.onerror=()=>v(m.error)})}console.debug(`Freed ${(u/1024/1024).toFixed(1)}MB from preview cache`)}catch(t){console.warn(`Error managing cache size: ${t}`)}}async function bu(e){const t=new Map,n=[];for(const a of e)Xi.has(a)?t.set(a,Xi.get(a)):n.push(a);if(n.length>0&&ha)try{const i=ha.transaction([Ns],"readwrite").objectStore(Ns);await Promise.all(n.map(l=>new Promise(u=>{const d=i.get(l);d.onsuccess=()=>{const h=d.result;h&&(h.lastAccessed=Date.now(),i.put(h),t.set(l,h.data),cP(l,h.data)),u()},d.onerror=()=>u()})))}catch(a){console.warn(`Error batch getting from cache: ${a}`)}return t}async function uP(e){try{await dp();const n=await de.get("/list_theta_rho_files_with_metadata"),a=n.map(d=>d.path),i=await bu(a),l=a.filter(d=>!i.has(d));if(l.length===0)return e({completed:n.length,total:n.length,done:!0}),{success:!0,cached:0};e({completed:0,total:l.length,done:!1});const u=Math.ceil(l.length/10);for(let d=0;d<u;d++){const h=d*10,p=Math.min(h+10,l.length),v=l.slice(h,p);try{const m=await de.post("/preview_thr_batch",{file_names:v});for(const[b,w]of Object.entries(m))w&&!w.error&&await Ow(b,w)}catch{}e({completed:p,total:l.length,done:!1}),d+1<u&&await new Promise(m=>setTimeout(m,100))}return e({completed:l.length,total:l.length,done:!0}),{success:!0,cached:l.length}}catch(n){return console.error("Error caching previews:",n),{success:!1,cached:0}}}const dP=g.createContext(null),nu="duneweaver_tables",ru="duneweaver_active_table";function dE(e){try{return new URL(e).origin}catch{return e}}function X9({children:e}){const[t,n]=g.useState([]),[a,i]=g.useState(null),[l,u]=g.useState(!1),[d,h]=g.useState(null),p=g.useRef(!1),v=g.useRef(null);g.useEffect(()=>{if(!p.current){p.current=!0;try{const N=localStorage.getItem(nu),_=localStorage.getItem(ru);if(N){const T=JSON.parse(N);if(n(T.tables||[]),_&&T.tables){const R=T.tables.find(D=>D.id===_);R&&(v.current=_,i(R),dE(R.url)!==window.location.origin&&de.setBaseUrl(R.url))}}b()}catch(N){console.error("Failed to load saved tables:",N),b()}}},[]),g.useEffect(()=>{if(p.current)try{const N={tables:t,activeTableId:a?.id||null};localStorage.setItem(nu,JSON.stringify(N)),a?localStorage.setItem(ru,a.id):localStorage.removeItem(ru)}catch(N){console.error("Failed to save tables:",N)}},[t,a]);const m=g.useCallback(N=>{try{const T={tables:JSON.parse(localStorage.getItem(nu)||"{}").tables||t,activeTableId:N.id};localStorage.setItem(nu,JSON.stringify(T)),localStorage.setItem(ru,N.id)}catch(_){console.error("Failed to save table selection:",_)}dE(N.url)===window.location.origin?de.setBaseUrl(""):de.setBaseUrl(N.url),window.location.reload()},[t]),b=g.useCallback(async()=>{u(!0);try{const[N,_,T]=await Promise.all([fetch("/api/table-info"),fetch("/api/settings").catch(()=>null),fetch("/api/known-tables").catch(()=>null)]);if(!N.ok)throw new Error("Failed to fetch table info");const R=await N.json(),D=_?.ok?await _.json():null,k=(T?.ok?await T.json():null)?.tables||[],P={id:R.id,name:R.name,url:window.location.origin,version:R.version,isOnline:!0,isCurrent:!0,customLogo:D?.app?.custom_logo||void 0};if(n(()=>{const U=[P];return k.forEach(J=>{J.id!==P.id&&U.push({id:J.id,name:J.name,url:J.url,host:J.host,port:J.port,version:J.version,isOnline:!1,isCurrent:!1})}),U}),!a&&!v.current){i(P);try{const U={tables:[P],activeTableId:P.id};localStorage.setItem(nu,JSON.stringify(U)),localStorage.setItem(ru,P.id)}catch(U){console.error("Failed to save initial table selection:",U)}}else a?.isCurrent&&i(U=>U?{...U,name:P.name}:null);v.current=null,h(new Date),setTimeout(()=>{n(U=>(U.filter($=>!$.isCurrent).forEach(async $=>{try{const[W,fe]=await Promise.all([fetch(`${$.url}/api/table-info`,{signal:AbortSignal.timeout(3e3)}),fetch(`${$.url}/api/settings`,{signal:AbortSignal.timeout(3e3)}).catch(()=>null)]),we=W.ok,I=(fe?.ok?await fe.json():null)?.app?.custom_logo||void 0;n(V=>V.map(H=>H.id===$.id?{...H,isOnline:we,customLogo:I}:H))}catch{n(W=>W.map(fe=>fe.id===$.id?{...fe,isOnline:!1}:fe))}}),U))},100)}catch(N){console.error("Table refresh failed:",N)}finally{u(!1)}},[a]),w=g.useCallback(async(N,_)=>{try{const T=N.replace(/\/$/,"");if(t.find(U=>U.url===T))return null;const[R,D]=await Promise.all([fetch(`${T}/api/table-info`),fetch(`${T}/api/settings`).catch(()=>null)]);if(!R.ok)throw new Error("Failed to fetch table info");const L=await R.json(),k=D?.ok?await D.json():null,P={id:L.id,name:_||L.name,url:T,version:L.version,isOnline:!0,isCurrent:!1,customLogo:k?.app?.custom_logo||void 0};try{const U=new URL(T).hostname;await fetch("/api/known-tables",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:P.id,name:P.name,url:P.url,host:U,version:P.version})})}catch(U){console.error("Failed to persist table to backend:",U)}return n(U=>[...U,P]),P}catch(T){return console.error("Failed to add table:",T),null}},[t]),j=g.useCallback(async N=>{try{await fetch(`/api/known-tables/${N}`,{method:"DELETE"})}catch(_){console.error("Failed to remove table from backend:",_)}if(n(_=>_.filter(T=>T.id!==N)),a?.id===N){const _=t.filter(T=>T.id!==N);_.length>0?m(_[0]):(i(null),de.setBaseUrl(""))}},[a,t,m]),S=g.useCallback(async(N,_)=>{const T=t.find(R=>R.id===N);if(T)try{const R=T.isCurrent?"":T.url;if((await fetch(`${R}/api/table-info`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:_})})).ok){if(!T.isCurrent)try{await fetch(`/api/known-tables/${N}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:_})})}catch(L){console.error("Failed to update known table name:",L)}n(L=>L.map(k=>k.id===N?{...k,name:_}:k)),a?.id===N&&i(L=>L?{...L,name:_}:null)}}catch(R){console.error("Failed to update table name:",R)}},[t,a]),C=g.useCallback(async N=>{try{const _=N.isCurrent?"":N.url,[T,R]=await Promise.all([fetch(`${_}/api/table-info`,{signal:AbortSignal.timeout(3e3)}),fetch(`${_}/api/settings`,{signal:AbortSignal.timeout(3e3)}).catch(()=>null)]),D=T.ok,k=(R?.ok?await R.json():null)?.app?.custom_logo||void 0;return n(P=>P.map(U=>U.id===N.id?{...U,isOnline:D,customLogo:k}:U)),D}catch{return n(_=>_.map(T=>T.id===N.id?{...T,isOnline:!1}:T)),!1}},[]);return o.jsx(dP.Provider,{value:{tables:t,activeTable:a,isDiscovering:l,lastDiscovery:d,setActiveTable:m,discoverTables:b,addTable:w,removeTable:j,updateTableName:S,refreshTableStatus:C},children:e})}function fP(){const e=g.useContext(dP);if(!e)throw new Error("useTable must be used within a TableProvider");return e}const Q9=Xu("inline-flex items-center rounded-full 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 hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Al({className:e,variant:t,...n}){return o.jsx("div",{className:ct(Q9({variant:t}),e),...n})}function Z9({children:e}){const{tables:t,activeTable:n,setActiveTable:a,addTable:i,removeTable:l,updateTableName:u}=fP(),[d,h]=g.useState(!1),[p,v]=g.useState(!1),[m,b]=g.useState(!1),[w,j]=g.useState(""),[S,C]=g.useState(""),[N,_]=g.useState(null),[T,R]=g.useState(""),[D,L]=g.useState(!1),k=W=>{W.id!==n?.id&&(a(W),K.success(`Switched to ${W.name}`)),h(!1)},P=async()=>{if(!w.trim()){K.error("Please enter a URL");return}L(!0);try{let W=w.trim();!W.startsWith("http://")&&!W.startsWith("https://")&&(W=`http://${W}`);const fe=await i(W,S.trim()||void 0);fe?(K.success(`Added ${fe.name}`),v(!1),j(""),C("")):K.error("Failed to add table. Check the URL and try again.")}finally{L(!1)}},U=async()=>{!N||!T.trim()||(await u(N.id,T.trim()),K.success("Table renamed"),b(!1),_(null),R(""))},J=W=>{if(W.isCurrent){K.error("Can't remove the current table");return}l(W.id),K.success(`Removed ${W.name}`)},$=W=>{_(W),R(W.name),b(!0)};return o.jsxs(o.Fragment,{children:[o.jsxs(Bu,{open:d,onOpenChange:h,children:[o.jsx(Iu,{asChild:!0,children:e||o.jsxs(se,{variant:"ghost",size:"sm",className:"gap-2 h-9 px-2",children:[o.jsx(JH,{className:"h-4 w-4"}),o.jsx("span",{className:"hidden sm:inline max-w-[120px] truncate",children:n?.appName||n?.name||"Select Table"})]})}),o.jsx(Rl,{className:"w-72 p-2",align:"start",sideOffset:12,alignOffset:-56,children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"px-2 py-1",children:o.jsx("span",{className:"text-sm font-medium",children:"Sand Tables"})}),o.jsx("div",{className:"space-y-1",children:t.map(W=>o.jsxs("div",{className:`flex items-center gap-2 px-2 py-2 rounded-md cursor-pointer hover:bg-accent group ${n?.id===W.id?"bg-accent":""}`,onClick:()=>k(W),children:[o.jsxs("div",{className:"relative flex-shrink-0",children:[o.jsx("img",{src:W.customLogo?`${W.isCurrent?"":W.url}/static/custom/${W.customLogo}`:`${W.isCurrent?"":W.url}/static/android-chrome-192x192.png`,alt:W.name,className:"w-8 h-8 rounded-full object-cover",onError:fe=>{fe.target.src="/static/android-chrome-192x192.png"}}),o.jsx("span",{className:`absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full border-2 border-popover ${W.isOnline?"bg-green-500":"bg-red-500"}`})]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-sm truncate",children:W.name}),W.isCurrent&&o.jsx(Al,{variant:"secondary",className:"text-[10px] px-1 py-0",children:"This"})]}),o.jsx("span",{className:"text-xs text-muted-foreground truncate block",children:W.host||new URL(W.url).hostname})]}),o.jsxs("div",{className:"flex md:opacity-0 md:group-hover:opacity-100 items-center gap-1 transition-opacity",children:[o.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:fe=>{fe.stopPropagation(),$(W)},title:"Rename",children:o.jsx(tU,{className:"h-3.5 w-3.5"})}),!W.isCurrent&&o.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-destructive hover:text-destructive",onClick:fe=>{fe.stopPropagation(),J(W)},title:"Remove",children:o.jsx(tD,{className:"h-3.5 w-3.5"})})]}),n?.id===W.id&&o.jsx(eD,{className:"h-4 w-4 text-primary flex-shrink-0"})]},W.id))}),o.jsxs(se,{variant:"secondary",size:"sm",className:"w-full gap-2",onClick:()=>v(!0),children:[o.jsx(rU,{className:"h-3.5 w-3.5"}),"Add Table Manually"]})]})})]}),o.jsx(ga,{open:p,onOpenChange:v,children:o.jsxs(Wr,{children:[o.jsx(Mr,{children:o.jsx(Dr,{children:"Add Table Manually"})}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Table URL"}),o.jsx(wt,{placeholder:"192.168.1.100:8080 or http://...",value:w,onChange:W=>j(W.target.value),onKeyDown:W=>W.key==="Enter"&&P()}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter the IP address and port of the table's backend"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Name (optional)"}),o.jsx(wt,{placeholder:"Living Room Table",value:S,onChange:W=>C(W.target.value),onKeyDown:W=>W.key==="Enter"&&P()})]})]}),o.jsxs(va,{className:"gap-2 sm:gap-0",children:[o.jsx(se,{variant:"secondary",onClick:()=>v(!1),children:"Cancel"}),o.jsx(se,{onClick:P,disabled:D,children:D?"Adding...":"Add Table"})]})]})}),o.jsx(ga,{open:m,onOpenChange:b,children:o.jsxs(Wr,{children:[o.jsx(Mr,{children:o.jsx(Dr,{children:"Rename Table"})}),o.jsx("div",{className:"py-4",children:o.jsx(wt,{placeholder:"Table name",value:T,onChange:W=>R(W.target.value),onKeyDown:W=>W.key==="Enter"&&U(),autoFocus:!0})}),o.jsxs(va,{className:"gap-2 sm:gap-0",children:[o.jsx(se,{variant:"secondary",onClick:()=>b(!1),children:"Cancel"}),o.jsx(se,{onClick:U,children:"Save"})]})]})})]})}const hP=g.createContext({});function Mw(e){const t=g.useRef(null);return t.current===null&&(t.current=e()),t.current}const pP=typeof window<"u",mP=pP?g.useLayoutEffect:g.useEffect,Dw=g.createContext(null);function Pw(e,t){e.indexOf(t)===-1&&e.push(t)}function kw(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const Ua=(e,t,n)=>n>t?t:n<e?e:n;let Lw=()=>{};const _s={},gP=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function vP(e){return typeof e=="object"&&e!==null}const xP=e=>/^0[^.\s]+$/u.test(e);function Bw(e){let t;return()=>(t===void 0&&(t=e()),t)}const Xr=e=>e,J9=(e,t)=>n=>t(e(n)),rd=(...e)=>e.reduce(J9),zu=(e,t,n)=>{const a=t-e;return a===0?1:(n-e)/a};class Iw{constructor(){this.subscriptions=[]}add(t){return Pw(this.subscriptions,t),()=>kw(this.subscriptions,t)}notify(t,n,a){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,a);else for(let l=0;l<i;l++){const u=this.subscriptions[l];u&&u(t,n,a)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const ws=e=>e*1e3,Yr=e=>e/1e3;function yP(e,t){return t?e*(1e3/t):0}const bP=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,e$=1e-7,t$=12;function n$(e,t,n,a,i){let l,u,d=0;do u=t+(n-t)/2,l=bP(u,a,i)-e,l>0?n=u:t=u;while(Math.abs(l)>e$&&++d<t$);return u}function ad(e,t,n,a){if(e===t&&n===a)return Xr;const i=l=>n$(l,0,1,e,n);return l=>l===0||l===1?l:bP(i(l),t,a)}const wP=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,SP=e=>t=>1-e(1-t),jP=ad(.33,1.53,.69,.99),zw=SP(jP),CP=wP(zw),NP=e=>(e*=2)<1?.5*zw(e):.5*(2-Math.pow(2,-10*(e-1))),Fw=e=>1-Math.sin(Math.acos(e)),_P=SP(Fw),EP=wP(Fw),r$=ad(.42,0,1,1),a$=ad(0,0,.58,1),TP=ad(.42,0,.58,1),s$=e=>Array.isArray(e)&&typeof e[0]!="number",RP=e=>Array.isArray(e)&&typeof e[0]=="number",i$={linear:Xr,easeIn:r$,easeInOut:TP,easeOut:a$,circIn:Fw,circInOut:EP,circOut:_P,backIn:zw,backInOut:CP,backOut:jP,anticipate:NP},o$=e=>typeof e=="string",fE=e=>{if(RP(e)){Lw(e.length===4);const[t,n,a,i]=e;return ad(t,n,a,i)}else if(o$(e))return i$[e];return e},qf=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function l$(e,t){let n=new Set,a=new Set,i=!1,l=!1;const u=new WeakSet;let d={delta:0,timestamp:0,isProcessing:!1};function h(v){u.has(v)&&(p.schedule(v),e()),v(d)}const p={schedule:(v,m=!1,b=!1)=>{const j=b&&i?n:a;return m&&u.add(v),j.has(v)||j.add(v),v},cancel:v=>{a.delete(v),u.delete(v)},process:v=>{if(d=v,i){l=!0;return}i=!0,[n,a]=[a,n],n.forEach(h),n.clear(),i=!1,l&&(l=!1,p.process(v))}};return p}const c$=40;function AP(e,t){let n=!1,a=!0;const i={delta:0,timestamp:0,isProcessing:!1},l=()=>n=!0,u=qf.reduce((T,R)=>(T[R]=l$(l),T),{}),{setup:d,read:h,resolveKeyframes:p,preUpdate:v,update:m,preRender:b,render:w,postRender:j}=u,S=()=>{const T=_s.useManualTiming?i.timestamp:performance.now();n=!1,_s.useManualTiming||(i.delta=a?1e3/60:Math.max(Math.min(T-i.timestamp,c$),1)),i.timestamp=T,i.isProcessing=!0,d.process(i),h.process(i),p.process(i),v.process(i),m.process(i),b.process(i),w.process(i),j.process(i),i.isProcessing=!1,n&&t&&(a=!1,e(S))},C=()=>{n=!0,a=!0,i.isProcessing||e(S)};return{schedule:qf.reduce((T,R)=>{const D=u[R];return T[R]=(L,k=!1,P=!1)=>(n||C(),D.schedule(L,k,P)),T},{}),cancel:T=>{for(let R=0;R<qf.length;R++)u[qf[R]].cancel(T)},state:i,steps:u}}const{schedule:rn,cancel:Va,state:Vn,steps:mv}=AP(typeof requestAnimationFrame<"u"?requestAnimationFrame:Xr,!0);let sh;function u$(){sh=void 0}const ar={now:()=>(sh===void 0&&ar.set(Vn.isProcessing||_s.useManualTiming?Vn.timestamp:performance.now()),sh),set:e=>{sh=e,queueMicrotask(u$)}},OP=e=>t=>typeof t=="string"&&t.startsWith(e),MP=OP("--"),d$=OP("var(--"),Hw=e=>d$(e)?f$.test(e.split("/*")[0].trim()):!1,f$=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function hE(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const ql={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Fu={...ql,transform:e=>Ua(0,1,e)},$f={...ql,default:1},wu=e=>Math.round(e*1e5)/1e5,Uw=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function h$(e){return e==null}const p$=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Vw=(e,t)=>n=>!!(typeof n=="string"&&p$.test(n)&&n.startsWith(e)||t&&!h$(n)&&Object.prototype.hasOwnProperty.call(n,t)),DP=(e,t,n)=>a=>{if(typeof a!="string")return a;const[i,l,u,d]=a.match(Uw);return{[e]:parseFloat(i),[t]:parseFloat(l),[n]:parseFloat(u),alpha:d!==void 0?parseFloat(d):1}},m$=e=>Ua(0,255,e),gv={...ql,transform:e=>Math.round(m$(e))},Qi={test:Vw("rgb","red"),parse:DP("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:a=1})=>"rgba("+gv.transform(e)+", "+gv.transform(t)+", "+gv.transform(n)+", "+wu(Fu.transform(a))+")"};function g$(e){let t="",n="",a="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),a=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),a=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,a+=a,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(a,16),alpha:i?parseInt(i,16)/255:1}}const r0={test:Vw("#"),parse:g$,transform:Qi.transform},sd=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ui=sd("deg"),Ia=sd("%"),ze=sd("px"),v$=sd("vh"),x$=sd("vw"),pE={...Ia,parse:e=>Ia.parse(e)/100,transform:e=>Ia.transform(e*100)},xl={test:Vw("hsl","hue"),parse:DP("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:a=1})=>"hsla("+Math.round(e)+", "+Ia.transform(wu(t))+", "+Ia.transform(wu(n))+", "+wu(Fu.transform(a))+")"},Nn={test:e=>Qi.test(e)||r0.test(e)||xl.test(e),parse:e=>Qi.test(e)?Qi.parse(e):xl.test(e)?xl.parse(e):r0.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Qi.transform(e):xl.transform(e),getAnimatableNone:e=>{const t=Nn.parse(e);return t.alpha=0,Nn.transform(t)}},y$=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function b$(e){return isNaN(e)&&typeof e=="string"&&(e.match(Uw)?.length||0)+(e.match(y$)?.length||0)>0}const PP="number",kP="color",w$="var",S$="var(",mE="${}",j$=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Hu(e){const t=e.toString(),n=[],a={color:[],number:[],var:[]},i=[];let l=0;const d=t.replace(j$,h=>(Nn.test(h)?(a.color.push(l),i.push(kP),n.push(Nn.parse(h))):h.startsWith(S$)?(a.var.push(l),i.push(w$),n.push(h)):(a.number.push(l),i.push(PP),n.push(parseFloat(h))),++l,mE)).split(mE);return{values:n,split:d,indexes:a,types:i}}function LP(e){return Hu(e).values}function BP(e){const{split:t,types:n}=Hu(e),a=t.length;return i=>{let l="";for(let u=0;u<a;u++)if(l+=t[u],i[u]!==void 0){const d=n[u];d===PP?l+=wu(i[u]):d===kP?l+=Nn.transform(i[u]):l+=i[u]}return l}}const C$=e=>typeof e=="number"?0:Nn.test(e)?Nn.getAnimatableNone(e):e;function N$(e){const t=LP(e);return BP(e)(t.map(C$))}const bi={test:b$,parse:LP,createTransformer:BP,getAnimatableNone:N$};function vv(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function _$({hue:e,saturation:t,lightness:n,alpha:a}){e/=360,t/=100,n/=100;let i=0,l=0,u=0;if(!t)i=l=u=n;else{const d=n<.5?n*(1+t):n+t-n*t,h=2*n-d;i=vv(h,d,e+1/3),l=vv(h,d,e),u=vv(h,d,e-1/3)}return{red:Math.round(i*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:a}}function Ch(e,t){return n=>n>0?t:e}const hn=(e,t,n)=>e+(t-e)*n,xv=(e,t,n)=>{const a=e*e,i=n*(t*t-a)+a;return i<0?0:Math.sqrt(i)},E$=[r0,Qi,xl],T$=e=>E$.find(t=>t.test(e));function gE(e){const t=T$(e);if(!t)return!1;let n=t.parse(e);return t===xl&&(n=_$(n)),n}const vE=(e,t)=>{const n=gE(e),a=gE(t);if(!n||!a)return Ch(e,t);const i={...n};return l=>(i.red=xv(n.red,a.red,l),i.green=xv(n.green,a.green,l),i.blue=xv(n.blue,a.blue,l),i.alpha=hn(n.alpha,a.alpha,l),Qi.transform(i))},a0=new Set(["none","hidden"]);function R$(e,t){return a0.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function A$(e,t){return n=>hn(e,t,n)}function qw(e){return typeof e=="number"?A$:typeof e=="string"?Hw(e)?Ch:Nn.test(e)?vE:D$:Array.isArray(e)?IP:typeof e=="object"?Nn.test(e)?vE:O$:Ch}function IP(e,t){const n=[...e],a=n.length,i=e.map((l,u)=>qw(l)(l,t[u]));return l=>{for(let u=0;u<a;u++)n[u]=i[u](l);return n}}function O$(e,t){const n={...e,...t},a={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(a[i]=qw(e[i])(e[i],t[i]));return i=>{for(const l in a)n[l]=a[l](i);return n}}function M$(e,t){const n=[],a={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const l=t.types[i],u=e.indexes[l][a[l]],d=e.values[u]??0;n[i]=d,a[l]++}return n}const D$=(e,t)=>{const n=bi.createTransformer(t),a=Hu(e),i=Hu(t);return a.indexes.var.length===i.indexes.var.length&&a.indexes.color.length===i.indexes.color.length&&a.indexes.number.length>=i.indexes.number.length?a0.has(e)&&!i.values.length||a0.has(t)&&!a.values.length?R$(e,t):rd(IP(M$(a,i),i.values),n):Ch(e,t)};function zP(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?hn(e,t,n):qw(e)(e,t)}const P$=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>rn.update(t,n),stop:()=>Va(t),now:()=>Vn.isProcessing?Vn.timestamp:ar.now()}},FP=(e,t,n=10)=>{let a="";const i=Math.max(Math.round(t/n),2);for(let l=0;l<i;l++)a+=Math.round(e(l/(i-1))*1e4)/1e4+", ";return`linear(${a.substring(0,a.length-2)})`},Nh=2e4;function $w(e){let t=0;const n=50;let a=e.next(t);for(;!a.done&&t<Nh;)t+=n,a=e.next(t);return t>=Nh?1/0:t}function k$(e,t=100,n){const a=n({...e,keyframes:[0,t]}),i=Math.min($w(a),Nh);return{type:"keyframes",ease:l=>a.next(i*l).value/t,duration:Yr(i)}}const L$=5;function HP(e,t,n){const a=Math.max(t-L$,0);return yP(n-e(a),t-a)}const vn={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},yv=.001;function B$({duration:e=vn.duration,bounce:t=vn.bounce,velocity:n=vn.velocity,mass:a=vn.mass}){let i,l,u=1-t;u=Ua(vn.minDamping,vn.maxDamping,u),e=Ua(vn.minDuration,vn.maxDuration,Yr(e)),u<1?(i=p=>{const v=p*u,m=v*e,b=v-n,w=s0(p,u),j=Math.exp(-m);return yv-b/w*j},l=p=>{const m=p*u*e,b=m*n+n,w=Math.pow(u,2)*Math.pow(p,2)*e,j=Math.exp(-m),S=s0(Math.pow(p,2),u);return(-i(p)+yv>0?-1:1)*((b-w)*j)/S}):(i=p=>{const v=Math.exp(-p*e),m=(p-n)*e+1;return-yv+v*m},l=p=>{const v=Math.exp(-p*e),m=(n-p)*(e*e);return v*m});const d=5/e,h=z$(i,l,d);if(e=ws(e),isNaN(h))return{stiffness:vn.stiffness,damping:vn.damping,duration:e};{const p=Math.pow(h,2)*a;return{stiffness:p,damping:u*2*Math.sqrt(a*p),duration:e}}}const I$=12;function z$(e,t,n){let a=n;for(let i=1;i<I$;i++)a=a-e(a)/t(a);return a}function s0(e,t){return e*Math.sqrt(1-t*t)}const F$=["duration","bounce"],H$=["stiffness","damping","mass"];function xE(e,t){return t.some(n=>e[n]!==void 0)}function U$(e){let t={velocity:vn.velocity,stiffness:vn.stiffness,damping:vn.damping,mass:vn.mass,isResolvedFromDuration:!1,...e};if(!xE(e,H$)&&xE(e,F$))if(e.visualDuration){const n=e.visualDuration,a=2*Math.PI/(n*1.2),i=a*a,l=2*Ua(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:vn.mass,stiffness:i,damping:l}}else{const n=B$(e);t={...t,...n,mass:vn.mass},t.isResolvedFromDuration=!0}return t}function _h(e=vn.visualDuration,t=vn.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:a,restDelta:i}=n;const l=n.keyframes[0],u=n.keyframes[n.keyframes.length-1],d={done:!1,value:l},{stiffness:h,damping:p,mass:v,duration:m,velocity:b,isResolvedFromDuration:w}=U$({...n,velocity:-Yr(n.velocity||0)}),j=b||0,S=p/(2*Math.sqrt(h*v)),C=u-l,N=Yr(Math.sqrt(h/v)),_=Math.abs(C)<5;a||(a=_?vn.restSpeed.granular:vn.restSpeed.default),i||(i=_?vn.restDelta.granular:vn.restDelta.default);let T;if(S<1){const D=s0(N,S);T=L=>{const k=Math.exp(-S*N*L);return u-k*((j+S*N*C)/D*Math.sin(D*L)+C*Math.cos(D*L))}}else if(S===1)T=D=>u-Math.exp(-N*D)*(C+(j+N*C)*D);else{const D=N*Math.sqrt(S*S-1);T=L=>{const k=Math.exp(-S*N*L),P=Math.min(D*L,300);return u-k*((j+S*N*C)*Math.sinh(P)+D*C*Math.cosh(P))/D}}const R={calculatedDuration:w&&m||null,next:D=>{const L=T(D);if(w)d.done=D>=m;else{let k=D===0?j:0;S<1&&(k=D===0?ws(j):HP(T,D,L));const P=Math.abs(k)<=a,U=Math.abs(u-L)<=i;d.done=P&&U}return d.value=d.done?u:L,d},toString:()=>{const D=Math.min($w(R),Nh),L=FP(k=>R.next(D*k).value,D,30);return D+"ms "+L},toTransition:()=>{}};return R}_h.applyToOptions=e=>{const t=k$(e,100,_h);return e.ease=t.ease,e.duration=ws(t.duration),e.type="keyframes",e};function i0({keyframes:e,velocity:t=0,power:n=.8,timeConstant:a=325,bounceDamping:i=10,bounceStiffness:l=500,modifyTarget:u,min:d,max:h,restDelta:p=.5,restSpeed:v}){const m=e[0],b={done:!1,value:m},w=P=>d!==void 0&&P<d||h!==void 0&&P>h,j=P=>d===void 0?h:h===void 0||Math.abs(d-P)<Math.abs(h-P)?d:h;let S=n*t;const C=m+S,N=u===void 0?C:u(C);N!==C&&(S=N-m);const _=P=>-S*Math.exp(-P/a),T=P=>N+_(P),R=P=>{const U=_(P),J=T(P);b.done=Math.abs(U)<=p,b.value=b.done?N:J};let D,L;const k=P=>{w(b.value)&&(D=P,L=_h({keyframes:[b.value,j(b.value)],velocity:HP(T,P,b.value),damping:i,stiffness:l,restDelta:p,restSpeed:v}))};return k(0),{calculatedDuration:null,next:P=>{let U=!1;return!L&&D===void 0&&(U=!0,R(P),k(P)),D!==void 0&&P>=D?L.next(P-D):(!U&&R(P),b)}}}function V$(e,t,n){const a=[],i=n||_s.mix||zP,l=e.length-1;for(let u=0;u<l;u++){let d=i(e[u],e[u+1]);if(t){const h=Array.isArray(t)?t[u]||Xr:t;d=rd(h,d)}a.push(d)}return a}function UP(e,t,{clamp:n=!0,ease:a,mixer:i}={}){const l=e.length;if(Lw(l===t.length),l===1)return()=>t[0];if(l===2&&t[0]===t[1])return()=>t[1];const u=e[0]===e[1];e[0]>e[l-1]&&(e=[...e].reverse(),t=[...t].reverse());const d=V$(t,a,i),h=d.length,p=v=>{if(u&&v<e[0])return t[0];let m=0;if(h>1)for(;m<e.length-2&&!(v<e[m+1]);m++);const b=zu(e[m],e[m+1],v);return d[m](b)};return n?v=>p(Ua(e[0],e[l-1],v)):p}function q$(e,t){const n=e[e.length-1];for(let a=1;a<=t;a++){const i=zu(0,t,a);e.push(hn(n,1,i))}}function $$(e){const t=[0];return q$(t,e.length-1),t}function G$(e,t){return e.map(n=>n*t)}function K$(e,t){return e.map(()=>t||TP).splice(0,e.length-1)}function Su({duration:e=300,keyframes:t,times:n,ease:a="easeInOut"}){const i=s$(a)?a.map(fE):fE(a),l={done:!1,value:t[0]},u=G$(n&&n.length===t.length?n:$$(t),e),d=UP(u,t,{ease:Array.isArray(i)?i:K$(t,i)});return{calculatedDuration:e,next:h=>(l.value=d(h),l.done=h>=e,l)}}const Y$=e=>e!==null;function Gw(e,{repeat:t,repeatType:n="loop"},a,i=1){const l=e.filter(Y$),d=i<0||t&&n!=="loop"&&t%2===1?0:l.length-1;return!d||a===void 0?l[d]:a}const W$={decay:i0,inertia:i0,tween:Su,keyframes:Su,spring:_h};function VP(e){typeof e.type=="string"&&(e.type=W$[e.type])}class Kw{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const X$=e=>e/100;class Yw extends Kw{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==ar.now()&&this.tick(ar.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;VP(t);const{type:n=Su,repeat:a=0,repeatDelay:i=0,repeatType:l,velocity:u=0}=t;let{keyframes:d}=t;const h=n||Su;h!==Su&&typeof d[0]!="number"&&(this.mixKeyframes=rd(X$,zP(d[0],d[1])),d=[0,100]);const p=h({...t,keyframes:d});l==="mirror"&&(this.mirroredGenerator=h({...t,keyframes:[...d].reverse(),velocity:-u})),p.calculatedDuration===null&&(p.calculatedDuration=$w(p));const{calculatedDuration:v}=p;this.calculatedDuration=v,this.resolvedDuration=v+i,this.totalDuration=this.resolvedDuration*(a+1)-i,this.generator=p}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:a,totalDuration:i,mixKeyframes:l,mirroredGenerator:u,resolvedDuration:d,calculatedDuration:h}=this;if(this.startTime===null)return a.next(0);const{delay:p=0,keyframes:v,repeat:m,repeatType:b,repeatDelay:w,type:j,onUpdate:S,finalKeyframe:C}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const N=this.currentTime-p*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?N<0:N>i;this.currentTime=Math.max(N,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let T=this.currentTime,R=a;if(m){const P=Math.min(this.currentTime,i)/d;let U=Math.floor(P),J=P%1;!J&&P>=1&&(J=1),J===1&&U--,U=Math.min(U,m+1),U%2&&(b==="reverse"?(J=1-J,w&&(J-=w/d)):b==="mirror"&&(R=u)),T=Ua(0,1,J)*d}const D=_?{done:!1,value:v[0]}:R.next(T);l&&(D.value=l(D.value));let{done:L}=D;!_&&h!==null&&(L=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&L);return k&&j!==i0&&(D.value=Gw(v,this.options,C,this.speed)),S&&S(D.value),k&&this.finish(),D}then(t,n){return this.finished.then(t,n)}get duration(){return Yr(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Yr(t)}get time(){return Yr(this.currentTime)}set time(t){t=ws(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(ar.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Yr(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=P$,startTime:n}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),this.options.onPlay?.();const a=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=a):this.holdTime!==null?this.startTime=a-this.holdTime:this.startTime||(this.startTime=n??a),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(ar.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function Q$(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Zi=e=>e*180/Math.PI,o0=e=>{const t=Zi(Math.atan2(e[1],e[0]));return l0(t)},Z$={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:o0,rotateZ:o0,skewX:e=>Zi(Math.atan(e[1])),skewY:e=>Zi(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},l0=e=>(e=e%360,e<0&&(e+=360),e),yE=o0,bE=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),wE=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),J$={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:bE,scaleY:wE,scale:e=>(bE(e)+wE(e))/2,rotateX:e=>l0(Zi(Math.atan2(e[6],e[5]))),rotateY:e=>l0(Zi(Math.atan2(-e[2],e[0]))),rotateZ:yE,rotate:yE,skewX:e=>Zi(Math.atan(e[4])),skewY:e=>Zi(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function c0(e){return e.includes("scale")?1:0}function u0(e,t){if(!e||e==="none")return c0(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let a,i;if(n)a=J$,i=n;else{const d=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);a=Z$,i=d}if(!i)return c0(t);const l=a[t],u=i[1].split(",").map(t7);return typeof l=="function"?l(u):u[l]}const e7=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return u0(n,t)};function t7(e){return parseFloat(e.trim())}const $l=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Gl=new Set($l),SE=e=>e===ql||e===ze,n7=new Set(["x","y","z"]),r7=$l.filter(e=>!n7.has(e));function a7(e){const t=[];return r7.forEach(n=>{const a=e.getValue(n);a!==void 0&&(t.push([n,a.get()]),a.set(n.startsWith("scale")?1:0))}),t}const mi={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>u0(t,"x"),y:(e,{transform:t})=>u0(t,"y")};mi.translateX=mi.x;mi.translateY=mi.y;const Ji=new Set;let d0=!1,f0=!1,h0=!1;function qP(){if(f0){const e=Array.from(Ji).filter(a=>a.needsMeasurement),t=new Set(e.map(a=>a.element)),n=new Map;t.forEach(a=>{const i=a7(a);i.length&&(n.set(a,i),a.render())}),e.forEach(a=>a.measureInitialState()),t.forEach(a=>{a.render();const i=n.get(a);i&&i.forEach(([l,u])=>{a.getValue(l)?.set(u)})}),e.forEach(a=>a.measureEndState()),e.forEach(a=>{a.suspendedScrollY!==void 0&&window.scrollTo(0,a.suspendedScrollY)})}f0=!1,d0=!1,Ji.forEach(e=>e.complete(h0)),Ji.clear()}function $P(){Ji.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(f0=!0)})}function s7(){h0=!0,$P(),qP(),h0=!1}class Ww{constructor(t,n,a,i,l,u=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=a,this.motionValue=i,this.element=l,this.isAsync=u}scheduleResolve(){this.state="scheduled",this.isAsync?(Ji.add(this),d0||(d0=!0,rn.read($P),rn.resolveKeyframes(qP))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:a,motionValue:i}=this;if(t[0]===null){const l=i?.get(),u=t[t.length-1];if(l!==void 0)t[0]=l;else if(a&&n){const d=a.readValue(n,u);d!=null&&(t[0]=d)}t[0]===void 0&&(t[0]=u),i&&l===void 0&&i.set(t[0])}Q$(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ji.delete(this)}cancel(){this.state==="scheduled"&&(Ji.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const i7=e=>e.startsWith("--");function o7(e,t,n){i7(t)?e.style.setProperty(t,n):e.style[t]=n}const l7=Bw(()=>window.ScrollTimeline!==void 0),c7={};function u7(e,t){const n=Bw(e);return()=>c7[t]??n()}const GP=u7(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),lu=([e,t,n,a])=>`cubic-bezier(${e}, ${t}, ${n}, ${a})`,jE={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:lu([0,.65,.55,1]),circOut:lu([.55,0,1,.45]),backIn:lu([.31,.01,.66,-.59]),backOut:lu([.33,1.53,.69,.99])};function KP(e,t){if(e)return typeof e=="function"?GP()?FP(e,t):"ease-out":RP(e)?lu(e):Array.isArray(e)?e.map(n=>KP(n,t)||jE.easeOut):jE[e]}function d7(e,t,n,{delay:a=0,duration:i=300,repeat:l=0,repeatType:u="loop",ease:d="easeOut",times:h}={},p=void 0){const v={[t]:n};h&&(v.offset=h);const m=KP(d,i);Array.isArray(m)&&(v.easing=m);const b={delay:a,duration:i,easing:Array.isArray(m)?"linear":m,fill:"both",iterations:l+1,direction:u==="reverse"?"alternate":"normal"};return p&&(b.pseudoElement=p),e.animate(v,b)}function YP(e){return typeof e=="function"&&"applyToOptions"in e}function f7({type:e,...t}){return YP(e)&&GP()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class h7 extends Kw{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:a,keyframes:i,pseudoElement:l,allowFlatten:u=!1,finalKeyframe:d,onComplete:h}=t;this.isPseudoElement=!!l,this.allowFlatten=u,this.options=t,Lw(typeof t.type!="string");const p=f7(t);this.animation=d7(n,a,i,p,l),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!l){const v=Gw(i,this.options,d,this.speed);this.updateMotionValue?this.updateMotionValue(v):o7(n,a,v),this.animation.cancel()}h?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Yr(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Yr(t)}get time(){return Yr(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=ws(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&l7()?(this.animation.timeline=t,Xr):n(this)}}const WP={anticipate:NP,backInOut:CP,circInOut:EP};function p7(e){return e in WP}function m7(e){typeof e.ease=="string"&&p7(e.ease)&&(e.ease=WP[e.ease])}const bv=10;class g7 extends h7{constructor(t){m7(t),VP(t),super(t),t.startTime!==void 0&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:a,onComplete:i,element:l,...u}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const d=new Yw({...u,autoplay:!1}),h=Math.max(bv,ar.now()-this.startTime),p=Ua(0,bv,h-bv);n.setWithVelocity(d.sample(Math.max(0,h-p)).value,d.sample(h).value,p),d.stop()}}const CE=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(bi.test(e)||e==="0")&&!e.startsWith("url("));function v7(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function x7(e,t,n,a){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const l=e[e.length-1],u=CE(i,t),d=CE(l,t);return!u||!d?!1:v7(e)||(n==="spring"||YP(n))&&a}function p0(e){e.duration=0,e.type="keyframes"}const y7=new Set(["opacity","clipPath","filter","transform"]),b7=Bw(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function w7(e){const{motionValue:t,name:n,repeatDelay:a,repeatType:i,damping:l,type:u}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:p}=t.owner.getProps();return b7()&&n&&y7.has(n)&&(n!=="transform"||!p)&&!h&&!a&&i!=="mirror"&&l!==0&&u!=="inertia"}const S7=40;class j7 extends Kw{constructor({autoplay:t=!0,delay:n=0,type:a="keyframes",repeat:i=0,repeatDelay:l=0,repeatType:u="loop",keyframes:d,name:h,motionValue:p,element:v,...m}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=ar.now();const b={autoplay:t,delay:n,type:a,repeat:i,repeatDelay:l,repeatType:u,name:h,motionValue:p,element:v,...m},w=v?.KeyframeResolver||Ww;this.keyframeResolver=new w(d,(j,S,C)=>this.onKeyframesResolved(j,S,b,!C),h,p,v),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,a,i){this.keyframeResolver=void 0;const{name:l,type:u,velocity:d,delay:h,isHandoff:p,onUpdate:v}=a;this.resolvedAt=ar.now(),x7(t,l,u,d)||((_s.instantAnimations||!h)&&v?.(Gw(t,a,n)),t[0]=t[t.length-1],p0(a),a.repeat=0);const b={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>S7?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...a,keyframes:t},w=!p&&w7(b),j=b.motionValue?.owner?.current,S=w?new g7({...b,element:j}):new Yw(b);S.finished.then(()=>{this.notifyFinished()}).catch(Xr),this.pendingTimeline&&(this.stopTimeline=S.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=S}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),s7()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function XP(e,t,n,a=0,i=1){const l=Array.from(e).sort((p,v)=>p.sortNodePosition(v)).indexOf(t),u=e.size,d=(u-1)*a;return typeof n=="function"?n(l,u):i===1?l*a:d-l*a}const C7=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function N7(e){const t=C7.exec(e);if(!t)return[,];const[,n,a,i]=t;return[`--${n??a}`,i]}function QP(e,t,n=1){const[a,i]=N7(e);if(!a)return;const l=window.getComputedStyle(t).getPropertyValue(a);if(l){const u=l.trim();return gP(u)?parseFloat(u):u}return Hw(i)?QP(i,t,n+1):i}const _7={type:"spring",stiffness:500,damping:25,restSpeed:10},E7=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),T7={type:"keyframes",duration:.8},R7={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},A7=(e,{keyframes:t})=>t.length>2?T7:Gl.has(e)?e.startsWith("scale")?E7(t[1]):_7:R7,O7=e=>e!==null;function M7(e,{repeat:t,repeatType:n="loop"},a){const i=e.filter(O7),l=t&&n!=="loop"&&t%2===1?0:i.length-1;return i[l]}function Xw(e,t){return e?.[t]??e?.default??e}function D7({when:e,delay:t,delayChildren:n,staggerChildren:a,staggerDirection:i,repeat:l,repeatType:u,repeatDelay:d,from:h,elapsed:p,...v}){return!!Object.keys(v).length}const Qw=(e,t,n,a={},i,l)=>u=>{const d=Xw(a,e)||{},h=d.delay||a.delay||0;let{elapsed:p=0}=a;p=p-ws(h);const v={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...d,delay:-p,onUpdate:b=>{t.set(b),d.onUpdate&&d.onUpdate(b)},onComplete:()=>{u(),d.onComplete&&d.onComplete()},name:e,motionValue:t,element:l?void 0:i};D7(d)||Object.assign(v,A7(e,v)),v.duration&&(v.duration=ws(v.duration)),v.repeatDelay&&(v.repeatDelay=ws(v.repeatDelay)),v.from!==void 0&&(v.keyframes[0]=v.from);let m=!1;if((v.type===!1||v.duration===0&&!v.repeatDelay)&&(p0(v),v.delay===0&&(m=!0)),(_s.instantAnimations||_s.skipAnimations)&&(m=!0,p0(v),v.delay=0),v.allowFlatten=!d.type&&!d.ease,m&&!l&&t.get()!==void 0){const b=M7(v.keyframes,d);if(b!==void 0){rn.update(()=>{v.onUpdate(b),v.onComplete()});return}}return d.isSync?new Yw(v):new j7(v)};function NE(e){const t=[{},{}];return e?.values.forEach((n,a)=>{t[0][a]=n.get(),t[1][a]=n.getVelocity()}),t}function Zw(e,t,n,a){if(typeof t=="function"){const[i,l]=NE(a);t=t(n!==void 0?n:e.custom,i,l)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,l]=NE(a);t=t(n!==void 0?n:e.custom,i,l)}return t}function Nl(e,t,n){const a=e.getProps();return Zw(a,t,n!==void 0?n:a.custom,e)}const ZP=new Set(["width","height","top","left","right","bottom",...$l]),_E=30,P7=e=>!isNaN(parseFloat(e)),ju={current:void 0};class k7{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=a=>{const i=ar.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(a),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const l of this.dependents)l.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=ar.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=P7(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Iw);const a=this.events[t].add(n);return t==="change"?()=>{a(),rn.read(()=>{this.events.change.getSize()||this.stop()})}:a}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,a){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-a}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return ju.current&&ju.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=ar.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>_E)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,_E);return yP(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function no(e,t){return new k7(e,t)}const m0=e=>Array.isArray(e);function L7(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,no(n))}function B7(e){return m0(e)?e[e.length-1]||0:e}function I7(e,t){const n=Nl(e,t);let{transitionEnd:a={},transition:i={},...l}=n||{};l={...l,...a};for(const u in l){const d=B7(l[u]);L7(e,u,d)}}const Qn=e=>!!(e&&e.getVelocity);function z7(e){return!!(Qn(e)&&e.add)}function g0(e,t){const n=e.getValue("willChange");if(z7(n))return n.add(t);if(!n&&_s.WillChange){const a=new _s.WillChange("auto");e.addValue("willChange",a),a.add(t)}}function Jw(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const F7="framerAppearId",JP="data-"+Jw(F7);function ek(e){return e.props[JP]}function H7({protectedKeys:e,needsAnimating:t},n){const a=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,a}function tk(e,t,{delay:n=0,transitionOverride:a,type:i}={}){let{transition:l=e.getDefaultTransition(),transitionEnd:u,...d}=t;a&&(l=a);const h=[],p=i&&e.animationState&&e.animationState.getState()[i];for(const v in d){const m=e.getValue(v,e.latestValues[v]??null),b=d[v];if(b===void 0||p&&H7(p,v))continue;const w={delay:n,...Xw(l||{},v)},j=m.get();if(j!==void 0&&!m.isAnimating&&!Array.isArray(b)&&b===j&&!w.velocity)continue;let S=!1;if(window.MotionHandoffAnimation){const N=ek(e);if(N){const _=window.MotionHandoffAnimation(N,v,rn);_!==null&&(w.startTime=_,S=!0)}}g0(e,v),m.start(Qw(v,m,b,e.shouldReduceMotion&&ZP.has(v)?{type:!1}:w,e,S));const C=m.animation;C&&h.push(C)}return u&&Promise.all(h).then(()=>{rn.update(()=>{u&&I7(e,u)})}),h}function v0(e,t,n={}){const a=Nl(e,t,n.type==="exit"?e.presenceContext?.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=a||{};n.transitionOverride&&(i=n.transitionOverride);const l=a?()=>Promise.all(tk(e,a,n)):()=>Promise.resolve(),u=e.variantChildren&&e.variantChildren.size?(h=0)=>{const{delayChildren:p=0,staggerChildren:v,staggerDirection:m}=i;return U7(e,t,h,p,v,m,n)}:()=>Promise.resolve(),{when:d}=i;if(d){const[h,p]=d==="beforeChildren"?[l,u]:[u,l];return h().then(()=>p())}else return Promise.all([l(),u(n.delay)])}function U7(e,t,n=0,a=0,i=0,l=1,u){const d=[];for(const h of e.variantChildren)h.notify("AnimationStart",t),d.push(v0(h,t,{...u,delay:n+(typeof a=="function"?0:a)+XP(e.variantChildren,h,a,i,l)}).then(()=>h.notify("AnimationComplete",t)));return Promise.all(d)}function V7(e,t,n={}){e.notify("AnimationStart",t);let a;if(Array.isArray(t)){const i=t.map(l=>v0(e,l,n));a=Promise.all(i)}else if(typeof t=="string")a=v0(e,t,n);else{const i=typeof t=="function"?Nl(e,t,n.custom):t;a=Promise.all(tk(e,i,n))}return a.then(()=>{e.notify("AnimationComplete",t)})}const q7={test:e=>e==="auto",parse:e=>e},nk=e=>t=>t.test(e),rk=[ql,ze,Ia,ui,x$,v$,q7],EE=e=>rk.find(nk(e));function $7(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||xP(e):!0}const G7=new Set(["brightness","contrast","saturate","opacity"]);function K7(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[a]=n.match(Uw)||[];if(!a)return e;const i=n.replace(a,"");let l=G7.has(t)?1:0;return a!==n&&(l*=100),t+"("+l+i+")"}const Y7=/\b([a-z-]*)\(.*?\)/gu,x0={...bi,getAnimatableNone:e=>{const t=e.match(Y7);return t?t.map(K7).join(" "):e}},TE={...ql,transform:Math.round},W7={rotate:ui,rotateX:ui,rotateY:ui,rotateZ:ui,scale:$f,scaleX:$f,scaleY:$f,scaleZ:$f,skew:ui,skewX:ui,skewY:ui,distance:ze,translateX:ze,translateY:ze,translateZ:ze,x:ze,y:ze,z:ze,perspective:ze,transformPerspective:ze,opacity:Fu,originX:pE,originY:pE,originZ:ze},eS={borderWidth:ze,borderTopWidth:ze,borderRightWidth:ze,borderBottomWidth:ze,borderLeftWidth:ze,borderRadius:ze,radius:ze,borderTopLeftRadius:ze,borderTopRightRadius:ze,borderBottomRightRadius:ze,borderBottomLeftRadius:ze,width:ze,maxWidth:ze,height:ze,maxHeight:ze,top:ze,right:ze,bottom:ze,left:ze,inset:ze,insetBlock:ze,insetBlockStart:ze,insetBlockEnd:ze,insetInline:ze,insetInlineStart:ze,insetInlineEnd:ze,padding:ze,paddingTop:ze,paddingRight:ze,paddingBottom:ze,paddingLeft:ze,paddingBlock:ze,paddingBlockStart:ze,paddingBlockEnd:ze,paddingInline:ze,paddingInlineStart:ze,paddingInlineEnd:ze,margin:ze,marginTop:ze,marginRight:ze,marginBottom:ze,marginLeft:ze,marginBlock:ze,marginBlockStart:ze,marginBlockEnd:ze,marginInline:ze,marginInlineStart:ze,marginInlineEnd:ze,backgroundPositionX:ze,backgroundPositionY:ze,...W7,zIndex:TE,fillOpacity:Fu,strokeOpacity:Fu,numOctaves:TE},X7={...eS,color:Nn,backgroundColor:Nn,outlineColor:Nn,fill:Nn,stroke:Nn,borderColor:Nn,borderTopColor:Nn,borderRightColor:Nn,borderBottomColor:Nn,borderLeftColor:Nn,filter:x0,WebkitFilter:x0},ak=e=>X7[e];function sk(e,t){let n=ak(e);return n!==x0&&(n=bi),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Q7=new Set(["auto","none","0"]);function Z7(e,t,n){let a=0,i;for(;a<e.length&&!i;){const l=e[a];typeof l=="string"&&!Q7.has(l)&&Hu(l).values.length&&(i=e[a]),a++}if(i&&n)for(const l of t)e[l]=sk(n,i)}class J7 extends Ww{constructor(t,n,a,i,l){super(t,n,a,i,l,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:a}=this;if(!n||!n.current)return;super.readKeyframes();for(let v=0;v<t.length;v++){let m=t[v];if(typeof m=="string"&&(m=m.trim(),Hw(m))){const b=QP(m,n.current);b!==void 0&&(t[v]=b),v===t.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!ZP.has(a)||t.length!==2)return;const[i,l]=t,u=EE(i),d=EE(l),h=hE(i),p=hE(l);if(h!==p&&mi[a]){this.needsMeasurement=!0;return}if(u!==d)if(SE(u)&&SE(d))for(let v=0;v<t.length;v++){const m=t[v];typeof m=="string"&&(t[v]=parseFloat(m))}else mi[a]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,a=[];for(let i=0;i<t.length;i++)(t[i]===null||$7(t[i]))&&a.push(i);a.length&&Z7(t,a,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:a}=this;if(!t||!t.current)return;a==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=mi[a](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&t.getValue(a,i).jump(i,!1)}measureEndState(){const{element:t,name:n,unresolvedKeyframes:a}=this;if(!t||!t.current)return;const i=t.getValue(n);i&&i.jump(this.measuredOrigin,!1);const l=a.length-1,u=a[l];a[l]=mi[n](t.measureViewportBox(),window.getComputedStyle(t.current)),u!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=u),this.removedTransforms?.length&&this.removedTransforms.forEach(([d,h])=>{t.getValue(d).set(h)}),this.resolveNoneKeyframes()}}function eG(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let a=document;const i=n?.[e]??a.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}const ik=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function tG(e){return vP(e)&&"offsetHeight"in e}const{schedule:tS}=AP(queueMicrotask,!1),oa={x:!1,y:!1};function ok(){return oa.x||oa.y}function nG(e){return e==="x"||e==="y"?oa[e]?null:(oa[e]=!0,()=>{oa[e]=!1}):oa.x||oa.y?null:(oa.x=oa.y=!0,()=>{oa.x=oa.y=!1})}function lk(e,t){const n=eG(e),a=new AbortController,i={passive:!0,...t,signal:a.signal};return[n,i,()=>a.abort()]}function RE(e){return!(e.pointerType==="touch"||ok())}function rG(e,t,n={}){const[a,i,l]=lk(e,n),u=d=>{if(!RE(d))return;const{target:h}=d,p=t(h,d);if(typeof p!="function"||!h)return;const v=m=>{RE(m)&&(p(m),h.removeEventListener("pointerleave",v))};h.addEventListener("pointerleave",v,i)};return a.forEach(d=>{d.addEventListener("pointerenter",u,i)}),l}const ck=(e,t)=>t?e===t?!0:ck(e,t.parentElement):!1,nS=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,aG=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function uk(e){return aG.has(e.tagName)||e.isContentEditable===!0}const ih=new WeakSet;function AE(e){return t=>{t.key==="Enter"&&e(t)}}function wv(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const sG=(e,t)=>{const n=e.currentTarget;if(!n)return;const a=AE(()=>{if(ih.has(n))return;wv(n,"down");const i=AE(()=>{wv(n,"up")}),l=()=>wv(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",l,t)});n.addEventListener("keydown",a,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",a),t)};function OE(e){return nS(e)&&!ok()}function iG(e,t,n={}){const[a,i,l]=lk(e,n),u=d=>{const h=d.currentTarget;if(!OE(d))return;ih.add(h);const p=t(h,d),v=(w,j)=>{window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",b),ih.has(h)&&ih.delete(h),OE(w)&&typeof p=="function"&&p(w,{success:j})},m=w=>{v(w,h===window||h===document||n.useGlobalTarget||ck(h,w.target))},b=w=>{v(w,!1)};window.addEventListener("pointerup",m,i),window.addEventListener("pointercancel",b,i)};return a.forEach(d=>{(n.useGlobalTarget?window:d).addEventListener("pointerdown",u,i),tG(d)&&(d.addEventListener("focus",p=>sG(p,i)),!uk(d)&&!d.hasAttribute("tabindex")&&(d.tabIndex=0))}),l}function dk(e){return vP(e)&&"ownerSVGElement"in e}function oG(e){return dk(e)&&e.tagName==="svg"}function lG(...e){const t=!Array.isArray(e[0]),n=t?0:-1,a=e[0+n],i=e[1+n],l=e[2+n],u=e[3+n],d=UP(i,l,u);return t?d(a):d}const cG=[...rk,Nn,bi],uG=e=>cG.find(nk(e)),ME=()=>({translate:0,scale:1,origin:0,originPoint:0}),yl=()=>({x:ME(),y:ME()}),DE=()=>({min:0,max:0}),Rn=()=>({x:DE(),y:DE()}),y0={current:null},fk={current:!1},dG=typeof window<"u";function fG(){if(fk.current=!0,!!dG)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>y0.current=e.matches;e.addEventListener("change",t),t()}else y0.current=!1}const hG=new WeakMap;function fp(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Uu(e){return typeof e=="string"||Array.isArray(e)}const rS=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],aS=["initial",...rS];function hp(e){return fp(e.animate)||aS.some(t=>Uu(e[t]))}function hk(e){return!!(hp(e)||e.variants)}function pG(e,t,n){for(const a in t){const i=t[a],l=n[a];if(Qn(i))e.addValue(a,i);else if(Qn(l))e.addValue(a,no(i,{owner:e}));else if(l!==i)if(e.hasValue(a)){const u=e.getValue(a);u.liveStyle===!0?u.jump(i):u.hasAnimated||u.set(i)}else{const u=e.getStaticValue(a);e.addValue(a,no(u!==void 0?u:i,{owner:e}))}}for(const a in n)t[a]===void 0&&e.removeValue(a);return t}const PE=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Eh={};function pk(e){Eh=e}function mG(){return Eh}class gG{scrapeMotionValuesFromProps(t,n,a){return{}}constructor({parent:t,props:n,presenceContext:a,reducedMotionConfig:i,blockInitialAnimation:l,visualState:u},d={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Ww,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const b=ar.now();this.renderScheduledAt<b&&(this.renderScheduledAt=b,rn.render(this.render,!1,!0))};const{latestValues:h,renderState:p}=u;this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=p,this.parent=t,this.props=n,this.presenceContext=a,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=d,this.blockInitialAnimation=!!l,this.isControllingVariants=hp(n),this.isVariantNode=hk(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:v,...m}=this.scrapeMotionValuesFromProps(n,{},this);for(const b in m){const w=m[b];h[b]!==void 0&&Qn(w)&&w.set(h[b])}}mount(t){this.current=t,hG.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,a)=>this.bindToMotionValue(a,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(fk.current||fG(),this.shouldReduceMotion=y0.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Va(this.notifyUpdate),Va(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const a=Gl.has(t);a&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",u=>{this.latestValues[t]=u,this.props.onUpdate&&rn.preRender(this.notifyUpdate),a&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let l;typeof window<"u"&&window.MotionCheckAppearSync&&(l=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),l&&l(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Eh){const n=Eh[t];if(!n)continue;const{isEnabled:a,Feature:i}=n;if(!this.features[t]&&i&&a(this.props)&&(this.features[t]=new i(this)),this.features[t]){const l=this.features[t];l.isMounted?l.update():(l.mount(),l.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Rn()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let a=0;a<PE.length;a++){const i=PE[a];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const l="on"+i,u=t[l];u&&(this.propEventSubscriptions[i]=this.on(i,u))}this.prevMotionValues=pG(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const a=this.values.get(t);n!==a&&(a&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let a=this.values.get(t);return a===void 0&&n!==void 0&&(a=no(n===null?void 0:n,{owner:this}),this.addValue(t,a)),a}readValue(t,n){let a=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return a!=null&&(typeof a=="string"&&(gP(a)||xP(a))?a=parseFloat(a):!uG(a)&&bi.test(n)&&(a=sk(t,n)),this.setBaseTarget(t,Qn(a)?a.get():a)),Qn(a)?a.get():a}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){const{initial:n}=this.props;let a;if(typeof n=="string"||typeof n=="object"){const l=Zw(this.props,n,this.presenceContext?.custom);l&&(a=l[t])}if(n&&a!==void 0)return a;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!Qn(i)?i:this.initialValues[t]!==void 0&&a===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Iw),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){tS.render(this.render)}}class mk extends gG{constructor(){super(...arguments),this.KeyframeResolver=J7}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const a=t.style;return a?a[n]:void 0}removeValueFromRenderState(t,{vars:n,style:a}){delete n[t],delete a[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Qn(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Ci{constructor(t){this.isMounted=!1,this.node=t}update(){}}function gk({top:e,left:t,right:n,bottom:a}){return{x:{min:t,max:n},y:{min:e,max:a}}}function vG({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function xG(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),a=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:a.y,right:a.x}}function Sv(e){return e===void 0||e===1}function b0({scale:e,scaleX:t,scaleY:n}){return!Sv(e)||!Sv(t)||!Sv(n)}function Wi(e){return b0(e)||vk(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function vk(e){return kE(e.x)||kE(e.y)}function kE(e){return e&&e!=="0%"}function Th(e,t,n){const a=e-n,i=t*a;return n+i}function LE(e,t,n,a,i){return i!==void 0&&(e=Th(e,i,a)),Th(e,n,a)+t}function w0(e,t=0,n=1,a,i){e.min=LE(e.min,t,n,a,i),e.max=LE(e.max,t,n,a,i)}function xk(e,{x:t,y:n}){w0(e.x,t.translate,t.scale,t.originPoint),w0(e.y,n.translate,n.scale,n.originPoint)}const BE=.999999999999,IE=1.0000000000001;function yG(e,t,n,a=!1){const i=n.length;if(!i)return;t.x=t.y=1;let l,u;for(let d=0;d<i;d++){l=n[d],u=l.projectionDelta;const{visualElement:h}=l.options;h&&h.props.style&&h.props.style.display==="contents"||(a&&l.options.layoutScroll&&l.scroll&&l!==l.root&&wl(e,{x:-l.scroll.offset.x,y:-l.scroll.offset.y}),u&&(t.x*=u.x.scale,t.y*=u.y.scale,xk(e,u)),a&&Wi(l.latestValues)&&wl(e,l.latestValues))}t.x<IE&&t.x>BE&&(t.x=1),t.y<IE&&t.y>BE&&(t.y=1)}function bl(e,t){e.min=e.min+t,e.max=e.max+t}function zE(e,t,n,a,i=.5){const l=hn(e.min,e.max,i);w0(e,t,n,l,a)}function wl(e,t){zE(e.x,t.x,t.scaleX,t.scale,t.originX),zE(e.y,t.y,t.scaleY,t.scale,t.originY)}function yk(e,t){return gk(xG(e.getBoundingClientRect(),t))}function bG(e,t,n){const a=yk(e,n),{scroll:i}=t;return i&&(bl(a.x,i.offset.x),bl(a.y,i.offset.y)),a}const wG={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},SG=$l.length;function jG(e,t,n){let a="",i=!0;for(let l=0;l<SG;l++){const u=$l[l],d=e[u];if(d===void 0)continue;let h=!0;if(typeof d=="number"?h=d===(u.startsWith("scale")?1:0):h=parseFloat(d)===0,!h||n){const p=ik(d,eS[u]);if(!h){i=!1;const v=wG[u]||u;a+=`${v}(${p}) `}n&&(t[u]=p)}}return a=a.trim(),n?a=n(t,i?"":a):i&&(a="none"),a}function sS(e,t,n){const{style:a,vars:i,transformOrigin:l}=e;let u=!1,d=!1;for(const h in t){const p=t[h];if(Gl.has(h)){u=!0;continue}else if(MP(h)){i[h]=p;continue}else{const v=ik(p,eS[h]);h.startsWith("origin")?(d=!0,l[h]=v):a[h]=v}}if(t.transform||(u||n?a.transform=jG(t,e.transform,n):a.transform&&(a.transform="none")),d){const{originX:h="50%",originY:p="50%",originZ:v=0}=l;a.transformOrigin=`${h} ${p} ${v}`}}function bk(e,{style:t,vars:n},a,i){const l=e.style;let u;for(u in t)l[u]=t[u];i?.applyProjectionStyles(l,a);for(u in n)l.setProperty(u,n[u])}function FE(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const au={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(ze.test(e))e=parseFloat(e);else return e;const n=FE(e,t.target.x),a=FE(e,t.target.y);return`${n}% ${a}%`}},CG={correct:(e,{treeScale:t,projectionDelta:n})=>{const a=e,i=bi.parse(e);if(i.length>5)return a;const l=bi.createTransformer(e),u=typeof i[0]!="number"?1:0,d=n.x.scale*t.x,h=n.y.scale*t.y;i[0+u]/=d,i[1+u]/=h;const p=hn(d,h,.5);return typeof i[2+u]=="number"&&(i[2+u]/=p),typeof i[3+u]=="number"&&(i[3+u]/=p),l(i)}},S0={borderRadius:{...au,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:au,borderTopRightRadius:au,borderBottomLeftRadius:au,borderBottomRightRadius:au,boxShadow:CG};function wk(e,{layout:t,layoutId:n}){return Gl.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!S0[e]||e==="opacity")}function iS(e,t,n){const a=e.style,i=t?.style,l={};if(!a)return l;for(const u in a)(Qn(a[u])||i&&Qn(i[u])||wk(u,e)||n?.getValue(u)?.liveStyle!==void 0)&&(l[u]=a[u]);return l}function NG(e){return window.getComputedStyle(e)}class _G extends mk{constructor(){super(...arguments),this.type="html",this.renderInstance=bk}readValueFromInstance(t,n){if(Gl.has(n))return this.projection?.isProjecting?c0(n):e7(t,n);{const a=NG(t),i=(MP(n)?a.getPropertyValue(n):a[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return yk(t,n)}build(t,n,a){sS(t,n,a.transformTemplate)}scrapeMotionValuesFromProps(t,n,a){return iS(t,n,a)}}const EG={offset:"stroke-dashoffset",array:"stroke-dasharray"},TG={offset:"strokeDashoffset",array:"strokeDasharray"};function RG(e,t,n=1,a=0,i=!0){e.pathLength=1;const l=i?EG:TG;e[l.offset]=ze.transform(-a);const u=ze.transform(t),d=ze.transform(n);e[l.array]=`${u} ${d}`}const AG=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Sk(e,{attrX:t,attrY:n,attrScale:a,pathLength:i,pathSpacing:l=1,pathOffset:u=0,...d},h,p,v){if(sS(e,d,p),h){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:m,style:b}=e;m.transform&&(b.transform=m.transform,delete m.transform),(b.transform||m.transformOrigin)&&(b.transformOrigin=m.transformOrigin??"50% 50%",delete m.transformOrigin),b.transform&&(b.transformBox=v?.transformBox??"fill-box",delete m.transformBox);for(const w of AG)m[w]!==void 0&&(b[w]=m[w],delete m[w]);t!==void 0&&(m.x=t),n!==void 0&&(m.y=n),a!==void 0&&(m.scale=a),i!==void 0&&RG(m,i,l,u,!1)}const jk=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),Ck=e=>typeof e=="string"&&e.toLowerCase()==="svg";function OG(e,t,n,a){bk(e,t,void 0,a);for(const i in t.attrs)e.setAttribute(jk.has(i)?i:Jw(i),t.attrs[i])}function Nk(e,t,n){const a=iS(e,t,n);for(const i in e)if(Qn(e[i])||Qn(t[i])){const l=$l.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;a[l]=e[i]}return a}class MG extends mk{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Rn}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Gl.has(n)){const a=ak(n);return a&&a.default||0}return n=jk.has(n)?n:Jw(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,a){return Nk(t,n,a)}build(t,n,a){Sk(t,n,this.isSVGTag,a.transformTemplate,a.style)}renderInstance(t,n,a,i){OG(t,n,a,i)}mount(t){this.isSVGTag=Ck(t.tagName),super.mount(t)}}const DG=aS.length;function _k(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?_k(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<DG;n++){const a=aS[n],i=e.props[a];(Uu(i)||i===!1)&&(t[a]=i)}return t}function Ek(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let a=0;a<n;a++)if(t[a]!==e[a])return!1;return!0}const PG=[...rS].reverse(),kG=rS.length;function LG(e){return t=>Promise.all(t.map(({animation:n,options:a})=>V7(e,n,a)))}function BG(e){let t=LG(e),n=HE(),a=!0;const i=h=>(p,v)=>{const m=Nl(e,v,h==="exit"?e.presenceContext?.custom:void 0);if(m){const{transition:b,transitionEnd:w,...j}=m;p={...p,...j,...w}}return p};function l(h){t=h(e)}function u(h){const{props:p}=e,v=_k(e.parent)||{},m=[],b=new Set;let w={},j=1/0;for(let C=0;C<kG;C++){const N=PG[C],_=n[N],T=p[N]!==void 0?p[N]:v[N],R=Uu(T),D=N===h?_.isActive:null;D===!1&&(j=C);let L=T===v[N]&&T!==p[N]&&R;if(L&&a&&e.manuallyAnimateOnMount&&(L=!1),_.protectedKeys={...w},!_.isActive&&D===null||!T&&!_.prevProp||fp(T)||typeof T=="boolean")continue;const k=IG(_.prevProp,T);let P=k||N===h&&_.isActive&&!L&&R||C>j&&R,U=!1;const J=Array.isArray(T)?T:[T];let $=J.reduce(i(N),{});D===!1&&($={});const{prevResolvedValues:W={}}=_,fe={...W,...$},we=V=>{P=!0,b.has(V)&&(U=!0,b.delete(V)),_.needsAnimating[V]=!0;const H=e.getValue(V);H&&(H.liveStyle=!1)};for(const V in fe){const H=$[V],be=W[V];if(w.hasOwnProperty(V))continue;let _e=!1;m0(H)&&m0(be)?_e=!Ek(H,be):_e=H!==be,_e?H!=null?we(V):b.add(V):H!==void 0&&b.has(V)?we(V):_.protectedKeys[V]=!0}_.prevProp=T,_.prevResolvedValues=$,_.isActive&&(w={...w,...$}),a&&e.blockInitialAnimation&&(P=!1);const Ce=L&&k;P&&(!Ce||U)&&m.push(...J.map(V=>{const H={type:N};if(typeof V=="string"&&a&&!Ce&&e.manuallyAnimateOnMount&&e.parent){const{parent:be}=e,_e=Nl(be,V);if(be.enteringChildren&&_e){const{delayChildren:B}=_e.transition||{};H.delay=XP(be.enteringChildren,e,B)}}return{animation:V,options:H}}))}if(b.size){const C={};if(typeof p.initial!="boolean"){const N=Nl(e,Array.isArray(p.initial)?p.initial[0]:p.initial);N&&N.transition&&(C.transition=N.transition)}b.forEach(N=>{const _=e.getBaseTarget(N),T=e.getValue(N);T&&(T.liveStyle=!0),C[N]=_??null}),m.push({animation:C})}let S=!!m.length;return a&&(p.initial===!1||p.initial===p.animate)&&!e.manuallyAnimateOnMount&&(S=!1),a=!1,S?t(m):Promise.resolve()}function d(h,p){if(n[h].isActive===p)return Promise.resolve();e.variantChildren?.forEach(m=>m.animationState?.setActive(h,p)),n[h].isActive=p;const v=u(h);for(const m in n)n[m].protectedKeys={};return v}return{animateChanges:u,setActive:d,setAnimateFunction:l,getState:()=>n,reset:()=>{n=HE()}}}function IG(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Ek(t,e):!1}function Ki(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function HE(){return{animate:Ki(!0),whileInView:Ki(),whileHover:Ki(),whileTap:Ki(),whileDrag:Ki(),whileFocus:Ki(),exit:Ki()}}function UE(e,t){e.min=t.min,e.max=t.max}function sa(e,t){UE(e.x,t.x),UE(e.y,t.y)}function VE(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const Tk=1e-4,zG=1-Tk,FG=1+Tk,Rk=.01,HG=0-Rk,UG=0+Rk;function sr(e){return e.max-e.min}function VG(e,t,n){return Math.abs(e-t)<=n}function qE(e,t,n,a=.5){e.origin=a,e.originPoint=hn(t.min,t.max,e.origin),e.scale=sr(n)/sr(t),e.translate=hn(n.min,n.max,e.origin)-e.originPoint,(e.scale>=zG&&e.scale<=FG||isNaN(e.scale))&&(e.scale=1),(e.translate>=HG&&e.translate<=UG||isNaN(e.translate))&&(e.translate=0)}function Cu(e,t,n,a){qE(e.x,t.x,n.x,a?a.originX:void 0),qE(e.y,t.y,n.y,a?a.originY:void 0)}function $E(e,t,n){e.min=n.min+t.min,e.max=e.min+sr(t)}function qG(e,t,n){$E(e.x,t.x,n.x),$E(e.y,t.y,n.y)}function GE(e,t,n){e.min=t.min-n.min,e.max=e.min+sr(t)}function Rh(e,t,n){GE(e.x,t.x,n.x),GE(e.y,t.y,n.y)}function KE(e,t,n,a,i){return e-=t,e=Th(e,1/n,a),i!==void 0&&(e=Th(e,1/i,a)),e}function $G(e,t=0,n=1,a=.5,i,l=e,u=e){if(Ia.test(t)&&(t=parseFloat(t),t=hn(u.min,u.max,t/100)-u.min),typeof t!="number")return;let d=hn(l.min,l.max,a);e===l&&(d-=t),e.min=KE(e.min,t,n,d,i),e.max=KE(e.max,t,n,d,i)}function YE(e,t,[n,a,i],l,u){$G(e,t[n],t[a],t[i],t.scale,l,u)}const GG=["x","scaleX","originX"],KG=["y","scaleY","originY"];function WE(e,t,n,a){YE(e.x,t,GG,n?n.x:void 0,a?a.x:void 0),YE(e.y,t,KG,n?n.y:void 0,a?a.y:void 0)}function XE(e){return e.translate===0&&e.scale===1}function Ak(e){return XE(e.x)&&XE(e.y)}function QE(e,t){return e.min===t.min&&e.max===t.max}function YG(e,t){return QE(e.x,t.x)&&QE(e.y,t.y)}function ZE(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Ok(e,t){return ZE(e.x,t.x)&&ZE(e.y,t.y)}function JE(e){return sr(e.x)/sr(e.y)}function eT(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Gr(e){return[e("x"),e("y")]}function WG(e,t,n){let a="";const i=e.x.translate/t.x,l=e.y.translate/t.y,u=n?.z||0;if((i||l||u)&&(a=`translate3d(${i}px, ${l}px, ${u}px) `),(t.x!==1||t.y!==1)&&(a+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:p,rotate:v,rotateX:m,rotateY:b,skewX:w,skewY:j}=n;p&&(a=`perspective(${p}px) ${a}`),v&&(a+=`rotate(${v}deg) `),m&&(a+=`rotateX(${m}deg) `),b&&(a+=`rotateY(${b}deg) `),w&&(a+=`skewX(${w}deg) `),j&&(a+=`skewY(${j}deg) `)}const d=e.x.scale*t.x,h=e.y.scale*t.y;return(d!==1||h!==1)&&(a+=`scale(${d}, ${h})`),a||"none"}const Mk=["TopLeft","TopRight","BottomLeft","BottomRight"],XG=Mk.length,tT=e=>typeof e=="string"?parseFloat(e):e,nT=e=>typeof e=="number"||ze.test(e);function QG(e,t,n,a,i,l){i?(e.opacity=hn(0,n.opacity??1,ZG(a)),e.opacityExit=hn(t.opacity??1,0,JG(a))):l&&(e.opacity=hn(t.opacity??1,n.opacity??1,a));for(let u=0;u<XG;u++){const d=`border${Mk[u]}Radius`;let h=rT(t,d),p=rT(n,d);if(h===void 0&&p===void 0)continue;h||(h=0),p||(p=0),h===0||p===0||nT(h)===nT(p)?(e[d]=Math.max(hn(tT(h),tT(p),a),0),(Ia.test(p)||Ia.test(h))&&(e[d]+="%")):e[d]=p}(t.rotate||n.rotate)&&(e.rotate=hn(t.rotate||0,n.rotate||0,a))}function rT(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const ZG=Dk(0,.5,_P),JG=Dk(.5,.95,Xr);function Dk(e,t,n){return a=>a<e?0:a>t?1:n(zu(e,t,a))}function eK(e,t,n){const a=Qn(e)?e:no(e);return a.start(Qw("",a,t,n)),a.animation}function Vu(e,t,n,a={passive:!0}){return e.addEventListener(t,n,a),()=>e.removeEventListener(t,n)}const tK=(e,t)=>e.depth-t.depth;class nK{constructor(){this.children=[],this.isDirty=!1}add(t){Pw(this.children,t),this.isDirty=!0}remove(t){kw(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(tK),this.isDirty=!1,this.children.forEach(t)}}function rK(e,t){const n=ar.now(),a=({timestamp:i})=>{const l=i-n;l>=t&&(Va(a),e(l-t))};return rn.setup(a,!0),()=>Va(a)}function oh(e){return Qn(e)?e.get():e}class aK{constructor(){this.members=[]}add(t){Pw(this.members,t),t.scheduleRender()}remove(t){if(kw(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let a;for(let i=n;i>=0;i--){const l=this.members[i];if(l.isPresent!==!1){a=l;break}}return a?(this.promote(a),!0):!1}promote(t,n){const a=this.lead;if(t!==a&&(this.prevLead=a,this.lead=t,t.show(),a)){a.instance&&a.scheduleRender(),t.scheduleRender(),t.resumeFrom=a,n&&(t.resumeFrom.preserveOpacity=!0),a.snapshot&&(t.snapshot=a.snapshot,t.snapshot.latestValues=a.animationValues||a.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&a.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:a}=t;n.onExitComplete&&n.onExitComplete(),a&&a.options.onExitComplete&&a.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const lh={hasAnimatedSinceResize:!0,hasEverUpdated:!1},jv=["","X","Y","Z"],sK=1e3;let iK=0;function Cv(e,t,n,a){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),a&&(a[e]=0))}function Pk(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=ek(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:l}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",rn,!(i||l))}const{parent:a}=e;a&&!a.hasCheckedOptimisedAppear&&Pk(a)}function kk({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:a,resetTransform:i}){return class{constructor(u={},d=t?.()){this.id=iK++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(cK),this.nodes.forEach(hK),this.nodes.forEach(pK),this.nodes.forEach(uK)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=d?d.root||d:this,this.path=d?[...d.path,d]:[],this.parent=d,this.depth=d?d.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new nK)}addEventListener(u,d){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Iw),this.eventHandlers.get(u).add(d)}notifyListeners(u,...d){const h=this.eventHandlers.get(u);h&&h.notify(...d)}hasListeners(u){return this.eventHandlers.has(u)}mount(u){if(this.instance)return;this.isSVG=dk(u)&&!oG(u),this.instance=u;const{layoutId:d,layout:h,visualElement:p}=this.options;if(p&&!p.current&&p.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(h||d)&&(this.isLayoutDirty=!0),e){let v,m=0;const b=()=>this.root.updateBlockedByResize=!1;rn.read(()=>{m=window.innerWidth}),e(u,()=>{const w=window.innerWidth;w!==m&&(m=w,this.root.updateBlockedByResize=!0,v&&v(),v=rK(b,250),lh.hasAnimatedSinceResize&&(lh.hasAnimatedSinceResize=!1,this.nodes.forEach(iT)))})}d&&this.root.registerSharedNode(d,this),this.options.animate!==!1&&p&&(d||h)&&this.addEventListener("didUpdate",({delta:v,hasLayoutChanged:m,hasRelativeLayoutChanged:b,layout:w})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||p.getDefaultTransition()||yK,{onLayoutAnimationStart:S,onLayoutAnimationComplete:C}=p.getProps(),N=!this.targetLayout||!Ok(this.targetLayout,w),_=!m&&b;if(this.options.layoutRoot||this.resumeFrom||_||m&&(N||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const T={...Xw(j,"layout"),onPlay:S,onComplete:C};(p.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T),this.setAnimationOrigin(v,_)}else m||iT(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=w})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Va(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(mK),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Pk(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let v=0;v<this.path.length;v++){const m=this.path[v];m.shouldResetTransform=!0,m.updateScroll("snapshot"),m.options.layoutRoot&&m.willUpdate(!1)}const{layoutId:d,layout:h}=this.options;if(d===void 0&&!h)return;const p=this.getTransformTemplate();this.prevTransformTemplateValue=p?p(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(aT);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(sT);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(fK),this.nodes.forEach(oK),this.nodes.forEach(lK)):this.nodes.forEach(sT),this.clearAllSnapshots();const d=ar.now();Vn.delta=Ua(0,1e3/60,d-Vn.timestamp),Vn.timestamp=d,Vn.isProcessing=!0,mv.update.process(Vn),mv.preRender.process(Vn),mv.render.process(Vn),Vn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,tS.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(dK),this.sharedNodes.forEach(gK)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,rn.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){rn.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!sr(this.snapshot.measuredBox.x)&&!sr(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let h=0;h<this.path.length;h++)this.path[h].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Rn(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:d}=this.options;d&&d.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let d=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(d=!1),d&&this.instance){const h=a(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:h,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!i)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,d=this.projectionDelta&&!Ak(this.projectionDelta),h=this.getTransformTemplate(),p=h?h(this.latestValues,""):void 0,v=p!==this.prevTransformTemplateValue;u&&this.instance&&(d||Wi(this.latestValues)||v)&&(i(this.instance,p),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const d=this.measurePageBox();let h=this.removeElementScroll(d);return u&&(h=this.removeTransform(h)),bK(h),{animationId:this.root.animationId,measuredBox:d,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:u}=this.options;if(!u)return Rn();const d=u.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(wK))){const{scroll:p}=this.root;p&&(bl(d.x,p.offset.x),bl(d.y,p.offset.y))}return d}removeElementScroll(u){const d=Rn();if(sa(d,u),this.scroll?.wasRoot)return d;for(let h=0;h<this.path.length;h++){const p=this.path[h],{scroll:v,options:m}=p;p!==this.root&&v&&m.layoutScroll&&(v.wasRoot&&sa(d,u),bl(d.x,v.offset.x),bl(d.y,v.offset.y))}return d}applyTransform(u,d=!1){const h=Rn();sa(h,u);for(let p=0;p<this.path.length;p++){const v=this.path[p];!d&&v.options.layoutScroll&&v.scroll&&v!==v.root&&wl(h,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),Wi(v.latestValues)&&wl(h,v.latestValues)}return Wi(this.latestValues)&&wl(h,this.latestValues),h}removeTransform(u){const d=Rn();sa(d,u);for(let h=0;h<this.path.length;h++){const p=this.path[h];if(!p.instance||!Wi(p.latestValues))continue;b0(p.latestValues)&&p.updateSnapshot();const v=Rn(),m=p.measurePageBox();sa(v,m),WE(d,p.latestValues,p.snapshot?p.snapshot.layoutBox:void 0,v)}return Wi(this.latestValues)&&WE(d,this.latestValues),d}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Vn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){const d=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=d.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=d.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=d.isSharedProjectionDirty);const h=!!this.resumingFrom||this!==d;if(!(u||h&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:v,layoutId:m}=this.options;if(!this.layout||!(v||m))return;this.resolvedRelativeTargetAt=Vn.timestamp;const b=this.getClosestProjectingParent();b&&this.linkedParentVersion!==b.layoutVersion&&!b.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(b&&b.layout?this.createRelativeTarget(b,this.layout.layoutBox,b.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Rn(),this.targetWithTransforms=Rn()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),qG(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):sa(this.target,this.layout.layoutBox),xk(this.target,this.targetDelta)):sa(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,b&&!!b.resumingFrom==!!this.resumingFrom&&!b.options.layoutScroll&&b.target&&this.animationProgress!==1?this.createRelativeTarget(b,this.target,b.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||b0(this.parent.latestValues)||vk(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(u,d,h){this.relativeParent=u,this.linkedParentVersion=u.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Rn(),this.relativeTargetOrigin=Rn(),Rh(this.relativeTargetOrigin,d,h),sa(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const u=this.getLead(),d=!!this.resumingFrom||this!==u;let h=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(h=!1),d&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(h=!1),this.resolvedRelativeTargetAt===Vn.timestamp&&(h=!1),h)return;const{layout:p,layoutId:v}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(p||v))return;sa(this.layoutCorrected,this.layout.layoutBox);const m=this.treeScale.x,b=this.treeScale.y;yG(this.layoutCorrected,this.treeScale,this.path,d),u.layout&&!u.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(u.target=u.layout.layoutBox,u.targetWithTransforms=Rn());const{target:w}=u;if(!w){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(VE(this.prevProjectionDelta.x,this.projectionDelta.x),VE(this.prevProjectionDelta.y,this.projectionDelta.y)),Cu(this.projectionDelta,this.layoutCorrected,w,this.latestValues),(this.treeScale.x!==m||this.treeScale.y!==b||!eT(this.projectionDelta.x,this.prevProjectionDelta.x)||!eT(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",w))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){if(this.options.visualElement?.scheduleRender(),u){const d=this.getStack();d&&d.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=yl(),this.projectionDelta=yl(),this.projectionDeltaWithTransform=yl()}setAnimationOrigin(u,d=!1){const h=this.snapshot,p=h?h.latestValues:{},v={...this.latestValues},m=yl();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!d;const b=Rn(),w=h?h.source:void 0,j=this.layout?this.layout.source:void 0,S=w!==j,C=this.getStack(),N=!C||C.members.length<=1,_=!!(S&&!N&&this.options.crossfade===!0&&!this.path.some(xK));this.animationProgress=0;let T;this.mixTargetDelta=R=>{const D=R/1e3;oT(m.x,u.x,D),oT(m.y,u.y,D),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Rh(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox),vK(this.relativeTarget,this.relativeTargetOrigin,b,D),T&&YG(this.relativeTarget,T)&&(this.isProjectionDirty=!1),T||(T=Rn()),sa(T,this.relativeTarget)),S&&(this.animationValues=v,QG(v,p,this.latestValues,D,_,N)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=D},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Va(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=rn.update(()=>{lh.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=no(0)),this.currentAnimation=eK(this.motionValue,[0,1e3],{...u,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),u.onUpdate&&u.onUpdate(d)},onStop:()=>{},onComplete:()=>{u.onComplete&&u.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(sK),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:d,target:h,layout:p,latestValues:v}=u;if(!(!d||!h||!p)){if(this!==u&&this.layout&&p&&Lk(this.options.animationType,this.layout.layoutBox,p.layoutBox)){h=this.target||Rn();const m=sr(this.layout.layoutBox.x);h.x.min=u.target.x.min,h.x.max=h.x.min+m;const b=sr(this.layout.layoutBox.y);h.y.min=u.target.y.min,h.y.max=h.y.min+b}sa(d,h),wl(d,v),Cu(this.projectionDeltaWithTransform,this.layoutCorrected,d,v)}}registerSharedNode(u,d){this.sharedNodes.has(u)||this.sharedNodes.set(u,new aK),this.sharedNodes.get(u).add(d);const p=d.options.initialPromotionConfig;d.promote({transition:p?p.transition:void 0,preserveFollowOpacity:p&&p.shouldPreserveFollowOpacity?p.shouldPreserveFollowOpacity(d):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){const{layoutId:u}=this.options;return u?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:u}=this.options;return u?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:d,preserveFollowOpacity:h}={}){const p=this.getStack();p&&p.promote(this,h),u&&(this.projectionDelta=void 0,this.needsReset=!0),d&&this.setOptions({transition:d})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let d=!1;const{latestValues:h}=u;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(d=!0),!d)return;const p={};h.z&&Cv("z",u,p,this.animationValues);for(let v=0;v<jv.length;v++)Cv(`rotate${jv[v]}`,u,p,this.animationValues),Cv(`skew${jv[v]}`,u,p,this.animationValues);u.render();for(const v in p)u.setStaticValue(v,p[v]),this.animationValues&&(this.animationValues[v]=p[v]);u.scheduleRender()}applyProjectionStyles(u,d){if(!this.instance||this.isSVG)return;if(!this.isVisible){u.visibility="hidden";return}const h=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,u.visibility="",u.opacity="",u.pointerEvents=oh(d?.pointerEvents)||"",u.transform=h?h(this.latestValues,""):"none";return}const p=this.getLead();if(!this.projectionDelta||!this.layout||!p.target){this.options.layoutId&&(u.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,u.pointerEvents=oh(d?.pointerEvents)||""),this.hasProjected&&!Wi(this.latestValues)&&(u.transform=h?h({},""):"none",this.hasProjected=!1);return}u.visibility="";const v=p.animationValues||p.latestValues;this.applyTransformsToTarget();let m=WG(this.projectionDeltaWithTransform,this.treeScale,v);h&&(m=h(v,m)),u.transform=m;const{x:b,y:w}=this.projectionDelta;u.transformOrigin=`${b.origin*100}% ${w.origin*100}% 0`,p.animationValues?u.opacity=p===this?v.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:v.opacityExit:u.opacity=p===this?v.opacity!==void 0?v.opacity:"":v.opacityExit!==void 0?v.opacityExit:0;for(const j in S0){if(v[j]===void 0)continue;const{correct:S,applyTo:C,isCSSVariable:N}=S0[j],_=m==="none"?v[j]:S(v[j],p);if(C){const T=C.length;for(let R=0;R<T;R++)u[C[R]]=_}else N?this.options.visualElement.renderState.vars[j]=_:u[j]=_}this.options.layoutId&&(u.pointerEvents=p===this?oh(d?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>u.currentAnimation?.stop()),this.root.nodes.forEach(aT),this.root.sharedNodes.clear()}}}function oK(e){e.updateLayout()}function lK(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:a}=e.layout,{animationType:i}=e.options,l=t.source!==e.layout.source;i==="size"?Gr(v=>{const m=l?t.measuredBox[v]:t.layoutBox[v],b=sr(m);m.min=n[v].min,m.max=m.min+b}):Lk(i,t.layoutBox,n)&&Gr(v=>{const m=l?t.measuredBox[v]:t.layoutBox[v],b=sr(n[v]);m.max=m.min+b,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[v].max=e.relativeTarget[v].min+b)});const u=yl();Cu(u,n,t.layoutBox);const d=yl();l?Cu(d,e.applyTransform(a,!0),t.measuredBox):Cu(d,n,t.layoutBox);const h=!Ak(u);let p=!1;if(!e.resumeFrom){const v=e.getClosestProjectingParent();if(v&&!v.resumeFrom){const{snapshot:m,layout:b}=v;if(m&&b){const w=Rn();Rh(w,t.layoutBox,m.layoutBox);const j=Rn();Rh(j,n,b.layoutBox),Ok(w,j)||(p=!0),v.options.layoutRoot&&(e.relativeTarget=j,e.relativeTargetOrigin=w,e.relativeParent=v)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:d,layoutDelta:u,hasLayoutChanged:h,hasRelativeLayoutChanged:p})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function cK(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function uK(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function dK(e){e.clearSnapshot()}function aT(e){e.clearMeasurements()}function sT(e){e.isLayoutDirty=!1}function fK(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function iT(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function hK(e){e.resolveTargetDelta()}function pK(e){e.calcProjection()}function mK(e){e.resetSkewAndRotation()}function gK(e){e.removeLeadSnapshot()}function oT(e,t,n){e.translate=hn(t.translate,0,n),e.scale=hn(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function lT(e,t,n,a){e.min=hn(t.min,n.min,a),e.max=hn(t.max,n.max,a)}function vK(e,t,n,a){lT(e.x,t.x,n.x,a),lT(e.y,t.y,n.y,a)}function xK(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const yK={duration:.45,ease:[.4,0,.1,1]},cT=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),uT=cT("applewebkit/")&&!cT("chrome/")?Math.round:Xr;function dT(e){e.min=uT(e.min),e.max=uT(e.max)}function bK(e){dT(e.x),dT(e.y)}function Lk(e,t,n){return e==="position"||e==="preserve-aspect"&&!VG(JE(t),JE(n),.2)}function wK(e){return e!==e.root&&e.scroll?.wasRoot}const SK=kk({attachResizeListener:(e,t)=>Vu(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Nv={current:void 0},Bk=kk({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Nv.current){const e=new SK({});e.mount(window),e.setOptions({layoutScroll:!0}),Nv.current=e}return Nv.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),pp=g.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function jK(e=!0){const t=g.useContext(Dw);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:a,register:i}=t,l=g.useId();g.useEffect(()=>{if(e)return i(l)},[e]);const u=g.useCallback(()=>e&&a&&a(l),[l,a,e]);return!n&&a?[!1,u]:[!0]}const Ik=g.createContext({strict:!1}),fT={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let hT=!1;function CK(){if(hT)return;const e={};for(const t in fT)e[t]={isEnabled:n=>fT[t].some(a=>!!n[a])};pk(e),hT=!0}function zk(){return CK(),mG()}function NK(e){const t=zk();for(const n in e)t[n]={...t[n],...e[n]};pk(t)}const _K=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Ah(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||_K.has(e)}let Fk=e=>!Ah(e);function EK(e){typeof e=="function"&&(Fk=t=>t.startsWith("on")?!Ah(t):e(t))}try{EK(require("@emotion/is-prop-valid").default)}catch{}function TK(e,t,n){const a={};for(const i in e)i==="values"&&typeof e.values=="object"||(Fk(i)||n===!0&&Ah(i)||!t&&!Ah(i)||e.draggable&&i.startsWith("onDrag"))&&(a[i]=e[i]);return a}const mp=g.createContext({});function RK(e,t){if(hp(e)){const{initial:n,animate:a}=e;return{initial:n===!1||Uu(n)?n:void 0,animate:Uu(a)?a:void 0}}return e.inherit!==!1?t:{}}function AK(e){const{initial:t,animate:n}=RK(e,g.useContext(mp));return g.useMemo(()=>({initial:t,animate:n}),[pT(t),pT(n)])}function pT(e){return Array.isArray(e)?e.join(" "):e}const oS=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Hk(e,t,n){for(const a in t)!Qn(t[a])&&!wk(a,n)&&(e[a]=t[a])}function OK({transformTemplate:e},t){return g.useMemo(()=>{const n=oS();return sS(n,t,e),Object.assign({},n.vars,n.style)},[t])}function MK(e,t){const n=e.style||{},a={};return Hk(a,n,e),Object.assign(a,OK(e,t)),a}function DK(e,t){const n={},a=MK(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=a,n}const Uk=()=>({...oS(),attrs:{}});function PK(e,t,n,a){const i=g.useMemo(()=>{const l=Uk();return Sk(l,t,Ck(a),e.transformTemplate,e.style),{...l.attrs,style:{...l.style}}},[t]);if(e.style){const l={};Hk(l,e.style,e),i.style={...l,...i.style}}return i}const kK=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function lS(e){return typeof e!="string"||e.includes("-")?!1:!!(kK.indexOf(e)>-1||/[A-Z]/u.test(e))}function LK(e,t,n,{latestValues:a},i,l=!1,u){const h=(u??lS(e)?PK:DK)(t,a,i,e),p=TK(t,typeof e=="string",l),v=e!==g.Fragment?{...p,...h,ref:n}:{},{children:m}=t,b=g.useMemo(()=>Qn(m)?m.get():m,[m]);return g.createElement(e,{...v,children:b})}function BK({scrapeMotionValuesFromProps:e,createRenderState:t},n,a,i){return{latestValues:IK(n,a,i,e),renderState:t()}}function IK(e,t,n,a){const i={},l=a(e,{});for(const b in l)i[b]=oh(l[b]);let{initial:u,animate:d}=e;const h=hp(e),p=hk(e);t&&p&&!h&&e.inherit!==!1&&(u===void 0&&(u=t.initial),d===void 0&&(d=t.animate));let v=n?n.initial===!1:!1;v=v||u===!1;const m=v?d:u;if(m&&typeof m!="boolean"&&!fp(m)){const b=Array.isArray(m)?m:[m];for(let w=0;w<b.length;w++){const j=Zw(e,b[w]);if(j){const{transitionEnd:S,transition:C,...N}=j;for(const _ in N){let T=N[_];if(Array.isArray(T)){const R=v?T.length-1:0;T=T[R]}T!==null&&(i[_]=T)}for(const _ in S)i[_]=S[_]}}}return i}const Vk=e=>(t,n)=>{const a=g.useContext(mp),i=g.useContext(Dw),l=()=>BK(e,t,a,i);return n?l():Mw(l)},zK=Vk({scrapeMotionValuesFromProps:iS,createRenderState:oS}),FK=Vk({scrapeMotionValuesFromProps:Nk,createRenderState:Uk}),HK=Symbol.for("motionComponentSymbol");function UK(e,t,n){const a=g.useRef(n);g.useInsertionEffect(()=>{a.current=n});const i=g.useRef(null);return g.useCallback(l=>{l&&e.onMount?.(l),t&&(l?t.mount(l):t.unmount());const u=a.current;if(typeof u=="function")if(l){const d=u(l);typeof d=="function"&&(i.current=d)}else i.current?(i.current(),i.current=null):u(l);else u&&(u.current=l)},[t])}const qk=g.createContext({});function cu(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function VK(e,t,n,a,i,l){const{visualElement:u}=g.useContext(mp),d=g.useContext(Ik),h=g.useContext(Dw),p=g.useContext(pp).reducedMotion,v=g.useRef(null);a=a||d.renderer,!v.current&&a&&(v.current=a(e,{visualState:t,parent:u,props:n,presenceContext:h,blockInitialAnimation:h?h.initial===!1:!1,reducedMotionConfig:p,isSVG:l}));const m=v.current,b=g.useContext(qk);m&&!m.projection&&i&&(m.type==="html"||m.type==="svg")&&qK(v.current,n,i,b);const w=g.useRef(!1);g.useInsertionEffect(()=>{m&&w.current&&m.update(n,h)});const j=n[JP],S=g.useRef(!!j&&!window.MotionHandoffIsComplete?.(j)&&window.MotionHasOptimisedAnimation?.(j));return mP(()=>{m&&(w.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),S.current&&m.animationState&&m.animationState.animateChanges())}),g.useEffect(()=>{m&&(!S.current&&m.animationState&&m.animationState.animateChanges(),S.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(j)}),S.current=!1),m.enteringChildren=void 0)}),m}function qK(e,t,n,a){const{layoutId:i,layout:l,drag:u,dragConstraints:d,layoutScroll:h,layoutRoot:p,layoutCrossfade:v}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:$k(e.parent)),e.projection.setOptions({layoutId:i,layout:l,alwaysMeasureLayout:!!u||d&&cu(d),visualElement:e,animationType:typeof l=="string"?l:"both",initialPromotionConfig:a,crossfade:v,layoutScroll:h,layoutRoot:p})}function $k(e){if(e)return e.options.allowProjection!==!1?e.projection:$k(e.parent)}function _v(e,{forwardMotionProps:t=!1,type:n}={},a,i){a&&NK(a);const l=n?n==="svg":lS(e),u=l?FK:zK;function d(p,v){let m;const b={...g.useContext(pp),...p,layoutId:$K(p)},{isStatic:w}=b,j=AK(p),S=u(p,w);if(!w&&pP){GK();const C=KK(b);m=C.MeasureLayout,j.visualElement=VK(e,S,b,i,C.ProjectionNode,l)}return o.jsxs(mp.Provider,{value:j,children:[m&&j.visualElement?o.jsx(m,{visualElement:j.visualElement,...b}):null,LK(e,p,UK(S,j.visualElement,v),S,w,t,l)]})}d.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const h=g.forwardRef(d);return h[HK]=e,h}function $K({layoutId:e}){const t=g.useContext(hP).id;return t&&e!==void 0?t+"-"+e:e}function GK(e,t){g.useContext(Ik).strict}function KK(e){const t=zk(),{drag:n,layout:a}=t;if(!n&&!a)return{};const i={...n,...a};return{MeasureLayout:n?.isEnabled(e)||a?.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function YK(e,t){if(typeof Proxy>"u")return _v;const n=new Map,a=(l,u)=>_v(l,u,e,t),i=(l,u)=>a(l,u);return new Proxy(i,{get:(l,u)=>u==="create"?a:(n.has(u)||n.set(u,_v(u,void 0,e,t)),n.get(u))})}const WK=(e,t)=>t.isSVG??lS(e)?new MG(t):new _G(t,{allowProjection:e!==g.Fragment});class XK extends Ci{constructor(t){super(t),t.animationState||(t.animationState=BG(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();fp(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let QK=0;class ZK extends Ci{constructor(){super(...arguments),this.id=QK++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:a}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===a)return;const i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const JK={animation:{Feature:XK},exit:{Feature:ZK}};function id(e){return{point:{x:e.pageX,y:e.pageY}}}const eY=e=>t=>nS(t)&&e(t,id(t));function Nu(e,t,n,a){return Vu(e,t,eY(n),a)}const Gk=({current:e})=>e?e.ownerDocument.defaultView:null,mT=(e,t)=>Math.abs(e-t);function tY(e,t){const n=mT(e.x,t.x),a=mT(e.y,t.y);return Math.sqrt(n**2+a**2)}const gT=new Set(["auto","scroll"]);class Kk{constructor(t,n,{transformPagePoint:a,contextWindow:i=window,dragSnapToOrigin:l=!1,distanceThreshold:u=3,element:d}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=w=>{this.handleScroll(w.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=Tv(this.lastMoveEventInfo,this.history),j=this.startEvent!==null,S=tY(w.offset,{x:0,y:0})>=this.distanceThreshold;if(!j&&!S)return;const{point:C}=w,{timestamp:N}=Vn;this.history.push({...C,timestamp:N});const{onStart:_,onMove:T}=this.handlers;j||(_&&_(this.lastMoveEvent,w),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,w)},this.handlePointerMove=(w,j)=>{this.lastMoveEvent=w,this.lastMoveEventInfo=Ev(j,this.transformPagePoint),rn.update(this.updatePoint,!0)},this.handlePointerUp=(w,j)=>{this.end();const{onEnd:S,onSessionEnd:C,resumeAnimation:N}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const _=Tv(w.type==="pointercancel"?this.lastMoveEventInfo:Ev(j,this.transformPagePoint),this.history);this.startEvent&&S&&S(w,_),C&&C(w,_)},!nS(t))return;this.dragSnapToOrigin=l,this.handlers=n,this.transformPagePoint=a,this.distanceThreshold=u,this.contextWindow=i||window;const h=id(t),p=Ev(h,this.transformPagePoint),{point:v}=p,{timestamp:m}=Vn;this.history=[{...v,timestamp:m}];const{onSessionStart:b}=n;b&&b(t,Tv(p,this.history)),this.removeListeners=rd(Nu(this.contextWindow,"pointermove",this.handlePointerMove),Nu(this.contextWindow,"pointerup",this.handlePointerUp),Nu(this.contextWindow,"pointercancel",this.handlePointerUp)),d&&this.startScrollTracking(d)}startScrollTracking(t){let n=t.parentElement;for(;n;){const a=getComputedStyle(n);(gT.has(a.overflowX)||gT.has(a.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const a=t===window,i=a?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},l={x:i.x-n.x,y:i.y-n.y};l.x===0&&l.y===0||(a?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=l.x,this.lastMoveEventInfo.point.y+=l.y):this.history.length>0&&(this.history[0].x-=l.x,this.history[0].y-=l.y),this.scrollPositions.set(t,i),rn.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Va(this.updatePoint)}}function Ev(e,t){return t?{point:t(e.point)}:e}function vT(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Tv({point:e},t){return{point:e,delta:vT(e,Yk(t)),offset:vT(e,nY(t)),velocity:rY(t,.1)}}function nY(e){return e[0]}function Yk(e){return e[e.length-1]}function rY(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,a=null;const i=Yk(e);for(;n>=0&&(a=e[n],!(i.timestamp-a.timestamp>ws(t)));)n--;if(!a)return{x:0,y:0};const l=Yr(i.timestamp-a.timestamp);if(l===0)return{x:0,y:0};const u={x:(i.x-a.x)/l,y:(i.y-a.y)/l};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}function aY(e,{min:t,max:n},a){return t!==void 0&&e<t?e=a?hn(t,e,a.min):Math.max(e,t):n!==void 0&&e>n&&(e=a?hn(n,e,a.max):Math.min(e,n)),e}function xT(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function sY(e,{top:t,left:n,bottom:a,right:i}){return{x:xT(e.x,n,i),y:xT(e.y,t,a)}}function yT(e,t){let n=t.min-e.min,a=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,a]=[a,n]),{min:n,max:a}}function iY(e,t){return{x:yT(e.x,t.x),y:yT(e.y,t.y)}}function oY(e,t){let n=.5;const a=sr(e),i=sr(t);return i>a?n=zu(t.min,t.max-a,e.min):a>i&&(n=zu(e.min,e.max-i,t.min)),Ua(0,1,n)}function lY(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const j0=.35;function cY(e=j0){return e===!1?e=0:e===!0&&(e=j0),{x:bT(e,"left","right"),y:bT(e,"top","bottom")}}function bT(e,t,n){return{min:wT(e,t),max:wT(e,n)}}function wT(e,t){return typeof e=="number"?e:e[t]||0}const uY=new WeakMap;class dY{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Rn(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:a}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const l=m=>{n?(this.stopAnimation(),this.snapToCursor(id(m).point)):this.pauseAnimation()},u=(m,b)=>{this.stopAnimation();const{drag:w,dragPropagation:j,onDragStart:S}=this.getProps();if(w&&!j&&(this.openDragLock&&this.openDragLock(),this.openDragLock=nG(w),!this.openDragLock))return;this.latestPointerEvent=m,this.latestPanInfo=b,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Gr(N=>{let _=this.getAxisMotionValue(N).get()||0;if(Ia.test(_)){const{projection:T}=this.visualElement;if(T&&T.layout){const R=T.layout.layoutBox[N];R&&(_=sr(R)*(parseFloat(_)/100))}}this.originPoint[N]=_}),S&&rn.postRender(()=>S(m,b)),g0(this.visualElement,"transform");const{animationState:C}=this.visualElement;C&&C.setActive("whileDrag",!0)},d=(m,b)=>{this.latestPointerEvent=m,this.latestPanInfo=b;const{dragPropagation:w,dragDirectionLock:j,onDirectionLock:S,onDrag:C}=this.getProps();if(!w&&!this.openDragLock)return;const{offset:N}=b;if(j&&this.currentDirection===null){this.currentDirection=fY(N),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",b.point,N),this.updateAxis("y",b.point,N),this.visualElement.render(),C&&C(m,b)},h=(m,b)=>{this.latestPointerEvent=m,this.latestPanInfo=b,this.stop(m,b),this.latestPointerEvent=null,this.latestPanInfo=null},p=()=>Gr(m=>this.getAnimationState(m)==="paused"&&this.getAxisMotionValue(m).animation?.play()),{dragSnapToOrigin:v}=this.getProps();this.panSession=new Kk(t,{onSessionStart:l,onStart:u,onMove:d,onSessionEnd:h,resumeAnimation:p},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:v,distanceThreshold:a,contextWindow:Gk(this.visualElement),element:this.visualElement.current})}stop(t,n){const a=t||this.latestPointerEvent,i=n||this.latestPanInfo,l=this.isDragging;if(this.cancel(),!l||!i||!a)return;const{velocity:u}=i;this.startAnimation(u);const{onDragEnd:d}=this.getProps();d&&rn.postRender(()=>d(a,i))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:a}=this.getProps();!a&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,a){const{drag:i}=this.getProps();if(!a||!Gf(t,i,this.currentDirection))return;const l=this.getAxisMotionValue(t);let u=this.originPoint[t]+a[t];this.constraints&&this.constraints[t]&&(u=aY(u,this.constraints[t],this.elastic[t])),l.set(u)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),a=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;t&&cu(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&a?this.constraints=sY(a.layoutBox,t):this.constraints=!1,this.elastic=cY(n),i!==this.constraints&&a&&this.constraints&&!this.hasMutatedConstraints&&Gr(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=lY(a.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!cu(t))return!1;const a=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const l=bG(a,i.root,this.visualElement.getTransformPagePoint());let u=iY(i.layout.layoutBox,l);if(n){const d=n(vG(u));this.hasMutatedConstraints=!!d,d&&(u=gk(d))}return u}startAnimation(t){const{drag:n,dragMomentum:a,dragElastic:i,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:d}=this.getProps(),h=this.constraints||{},p=Gr(v=>{if(!Gf(v,n,this.currentDirection))return;let m=h&&h[v]||{};u&&(m={min:0,max:0});const b=i?200:1e6,w=i?40:1e7,j={type:"inertia",velocity:a?t[v]:0,bounceStiffness:b,bounceDamping:w,timeConstant:750,restDelta:1,restSpeed:10,...l,...m};return this.startAxisValueAnimation(v,j)});return Promise.all(p).then(d)}startAxisValueAnimation(t,n){const a=this.getAxisMotionValue(t);return g0(this.visualElement,t),a.start(Qw(t,a,0,n,this.visualElement,!1))}stopAnimation(){Gr(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Gr(t=>this.getAxisMotionValue(t).animation?.pause())}getAnimationState(t){return this.getAxisMotionValue(t).animation?.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,a=this.visualElement.getProps(),i=a[n];return i||this.visualElement.getValue(t,(a.initial?a.initial[t]:void 0)||0)}snapToCursor(t){Gr(n=>{const{drag:a}=this.getProps();if(!Gf(n,a,this.currentDirection))return;const{projection:i}=this.visualElement,l=this.getAxisMotionValue(n);if(i&&i.layout){const{min:u,max:d}=i.layout.layoutBox[n],h=l.get()||0;l.set(t[n]-hn(u,d,.5)+h)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:a}=this.visualElement;if(!cu(n)||!a||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Gr(u=>{const d=this.getAxisMotionValue(u);if(d&&this.constraints!==!1){const h=d.get();i[u]=oY({min:h,max:h},this.constraints[u])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",a.root&&a.root.updateScroll(),a.updateLayout(),this.resolveConstraints(),Gr(u=>{if(!Gf(u,t,null))return;const d=this.getAxisMotionValue(u),{min:h,max:p}=this.constraints[u];d.set(hn(h,p,i[u]))})}addListeners(){if(!this.visualElement.current)return;uY.set(this.visualElement,this);const t=this.visualElement.current,n=Nu(t,"pointerdown",h=>{const{drag:p,dragListener:v=!0}=this.getProps();p&&v&&!uk(h.target)&&this.start(h)}),a=()=>{const{dragConstraints:h}=this.getProps();cu(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,l=i.addEventListener("measure",a);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),rn.read(a);const u=Vu(window,"resize",()=>this.scalePositionWithinConstraints()),d=i.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:p})=>{this.isDragging&&p&&(Gr(v=>{const m=this.getAxisMotionValue(v);m&&(this.originPoint[v]+=h[v].translate,m.set(m.get()+h[v].translate))}),this.visualElement.render())}));return()=>{u(),n(),l(),d&&d()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:a=!1,dragPropagation:i=!1,dragConstraints:l=!1,dragElastic:u=j0,dragMomentum:d=!0}=t;return{...t,drag:n,dragDirectionLock:a,dragPropagation:i,dragConstraints:l,dragElastic:u,dragMomentum:d}}}function Gf(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function fY(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class hY extends Ci{constructor(t){super(t),this.removeGroupControls=Xr,this.removeListeners=Xr,this.controls=new dY(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Xr}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners()}}const ST=e=>(t,n)=>{e&&rn.postRender(()=>e(t,n))};class pY extends Ci{constructor(){super(...arguments),this.removePointerDownListener=Xr}onPointerDown(t){this.session=new Kk(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Gk(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:a,onPanEnd:i}=this.node.getProps();return{onSessionStart:ST(t),onStart:ST(n),onMove:a,onEnd:(l,u)=>{delete this.session,i&&rn.postRender(()=>i(l,u))}}}mount(){this.removePointerDownListener=Nu(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Rv=!1;class mY extends g.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:a,layoutId:i}=this.props,{projection:l}=t;l&&(n.group&&n.group.add(l),a&&a.register&&i&&a.register(l),Rv&&l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,onExitComplete:()=>this.safeToRemove()})),lh.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:a,drag:i,isPresent:l}=this.props,{projection:u}=a;return u&&(u.isPresent=l,Rv=!0,i||t.layoutDependency!==n||n===void 0||t.isPresent!==l?u.willUpdate():this.safeToRemove(),t.isPresent!==l&&(l?u.promote():u.relegate()||rn.postRender(()=>{const d=u.getStack();(!d||!d.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),tS.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:a}=this.props,{projection:i}=t;Rv=!0,i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),a&&a.deregister&&a.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function Wk(e){const[t,n]=jK(),a=g.useContext(hP);return o.jsx(mY,{...e,layoutGroup:a,switchLayoutGroup:g.useContext(qk),isPresent:t,safeToRemove:n})}const gY={pan:{Feature:pY},drag:{Feature:hY,ProjectionNode:Bk,MeasureLayout:Wk}};function jT(e,t,n){const{props:a}=e;e.animationState&&a.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,l=a[i];l&&rn.postRender(()=>l(t,id(t)))}class vY extends Ci{mount(){const{current:t}=this.node;t&&(this.unmount=rG(t,(n,a)=>(jT(this.node,a,"Start"),i=>jT(this.node,i,"End"))))}unmount(){}}class xY extends Ci{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=rd(Vu(this.node.current,"focus",()=>this.onFocus()),Vu(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function CT(e,t,n){const{props:a}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&a.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),l=a[i];l&&rn.postRender(()=>l(t,id(t)))}class yY extends Ci{mount(){const{current:t}=this.node;t&&(this.unmount=iG(t,(n,a)=>(CT(this.node,a,"Start"),(i,{success:l})=>CT(this.node,i,l?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const C0=new WeakMap,Av=new WeakMap,bY=e=>{const t=C0.get(e.target);t&&t(e)},wY=e=>{e.forEach(bY)};function SY({root:e,...t}){const n=e||document;Av.has(n)||Av.set(n,{});const a=Av.get(n),i=JSON.stringify(t);return a[i]||(a[i]=new IntersectionObserver(wY,{root:e,...t})),a[i]}function jY(e,t,n){const a=SY(t);return C0.set(e,n),a.observe(e),()=>{C0.delete(e),a.unobserve(e)}}const CY={some:0,all:1};class NY extends Ci{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:a,amount:i="some",once:l}=t,u={root:n?n.current:void 0,rootMargin:a,threshold:typeof i=="number"?i:CY[i]},d=h=>{const{isIntersecting:p}=h;if(this.isInView===p||(this.isInView=p,l&&!p&&this.hasEnteredView))return;p&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",p);const{onViewportEnter:v,onViewportLeave:m}=this.node.getProps(),b=p?v:m;b&&b(h)};return jY(this.node.current,u,d)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(_Y(t,n))&&this.startObserver()}unmount(){}}function _Y({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const EY={inView:{Feature:NY},tap:{Feature:yY},focus:{Feature:xY},hover:{Feature:vY}},TY={layout:{ProjectionNode:Bk,MeasureLayout:Wk}},RY={...JK,...EY,...gY,...TY},AY=YK(RY,WK);function Xk(e){const t=Mw(()=>no(e)),{isStatic:n}=g.useContext(pp);if(n){const[,a]=g.useState(e);g.useEffect(()=>t.on("change",a),[])}return t}function Qk(e,t){const n=Xk(t()),a=()=>n.set(t());return a(),mP(()=>{const i=()=>rn.preRender(a,!1,!0),l=e.map(u=>u.on("change",i));return()=>{l.forEach(u=>u()),Va(a)}}),n}function OY(e){ju.current=[],e();const t=Qk(ju.current,e);return ju.current=void 0,t}function MY(e,t,n,a){if(typeof e=="function")return OY(e);const l=typeof t=="function"?t:lG(t,n,a);return Array.isArray(e)?NT(e,l):NT([e],([u])=>l(u))}function NT(e,t){const n=Mw(()=>[]);return Qk(e,()=>{n.length=0;const a=e.length;for(let i=0;i<a;i++)n[i]=e[i].get();return t(n)})}function DY(e){const t=g.useRef(0),{isStatic:n}=g.useContext(pp);g.useEffect(()=>{if(n)return;const a=({timestamp:i,delta:l})=>{t.current||(t.current=i),e(i-t.current,l)};return rn.update(a,!0),()=>Va(a)},[e])}const PY=({text:e,disabled:t=!1,speed:n=2,className:a="",color:i="#b5b5b5",shineColor:l="#ffffff",spread:u=120,yoyo:d=!1,pauseOnHover:h=!1,direction:p="left",delay:v=0})=>{const[m,b]=g.useState(!1),w=Xk(0),j=g.useRef(0),S=g.useRef(null),C=g.useRef(p==="left"?1:-1),N=n*1e3,_=v*1e3;DY(k=>{if(t||m){S.current=null;return}if(S.current===null){S.current=k;return}const P=k-S.current;if(S.current=k,j.current+=P,d){const U=N+_,J=U*2,$=j.current%J;if($<N){const W=$/N*100;w.set(C.current===1?W:100-W)}else if($<U)w.set(C.current===1?100:0);else if($<U+N){const fe=100-($-U)/N*100;w.set(C.current===1?fe:100-fe)}else w.set(C.current===1?0:100)}else{const U=N+_,J=j.current%U;if(J<N){const $=J/N*100;w.set(C.current===1?$:100-$)}else w.set(C.current===1?100:0)}}),g.useEffect(()=>{C.current=p==="left"?1:-1,j.current=0,w.set(0)},[p]);const T=MY(w,k=>`${150-k*2}% center`),R=g.useCallback(()=>{h&&b(!0)},[h]),D=g.useCallback(()=>{h&&b(!1)},[h]),L={backgroundImage:`linear-gradient(${u}deg, ${i} 0%, ${i} 35%, ${l} 50%, ${i} 65%, ${i} 100%)`,backgroundSize:"200% auto",WebkitBackgroundClip:"text",backgroundClip:"text",WebkitTextFillColor:"transparent"};return o.jsx(AY.span,{className:`inline-block ${a}`,style:{...L,backgroundPosition:T},onMouseEnter:R,onMouseLeave:D,children:e})};let $r=null;const Ov=aD()((e,t)=>({cacheProgress:null,isConnected:!1,connect:()=>{if($r){if($r.readyState===WebSocket.CONNECTING||$r.readyState===WebSocket.OPEN)return;$r=null}const n=new WebSocket(de.getWebSocketUrl("/ws/cache-progress"));$r=n,n.onopen=()=>{if($r!==n){n.close();return}e({isConnected:!0})},n.onmessage=a=>{try{const i=JSON.parse(a.data);if(i.type==="cache_progress"){const l=i.data;l.is_running?e({cacheProgress:l}):l.stage==="complete"?(e({cacheProgress:{...l}}),setTimeout(()=>t().disconnect(),500)):(e({cacheProgress:null}),t().disconnect())}}catch{}},n.onclose=()=>{$r===n&&($r=null),e({isConnected:!1})},n.onerror=()=>{}},disconnect:()=>{$r&&($r.readyState===WebSocket.OPEN&&$r.close(),$r=null),e({isConnected:!1})}})),Mv=[{path:"/",label:"Browse",icon:"grid_view",title:"Browse Patterns"},{path:"/playlists",label:"Playlists",icon:"playlist_play",title:"Playlists"},{path:"/table-control",label:"Control",icon:"tune",title:"Table Control"},{path:"/led",label:"LED",icon:"lightbulb",title:"LED Control"},{path:"/settings",label:"Settings",icon:"settings",title:"Settings"}],_T="Dune Weaver",kY=["captive.apple.com","connectivitycheck.gstatic.com","connectivitycheck.android.com","clients3.google.com","nmcheck.gnome.org","network-test.debian.org","msftconnecttest.com","www.msftconnecttest.com"],Dv=kY.some(e=>window.location.hostname===e||window.location.hostname.endsWith("."+e));function LY(){const e=Es(),t=kl();g.useEffect(()=>{window.scrollTo(0,0)},[e.pathname]),g.useEffect(()=>{Dv&&e.pathname!=="/wifi-setup"&&e.pathname!=="/captive"&&!sessionStorage.getItem("captive-dismissed")&&t("/captive",{replace:!0})},[e.pathname,t]);const{activeTable:n,tables:a}=fP(),i=a.length>1,[l,u]=g.useState(()=>{if(Dv)return!1;if(typeof window<"u"){const ee=localStorage.getItem("theme");return ee?ee==="dark":window.matchMedia("(prefers-color-scheme: dark)").matches}return!1}),[d,h]=g.useState(_T),[p,v]=g.useState(null),b=a.find(ee=>ee.id===n?.id)?.name||n?.name,w=i&&b?b:d,j=un(ee=>ee.isBackendConnected),S=un(ee=>ee.connectionAttempts),C=un(ee=>ee.status?.connection_status??!1),N=un(ee=>ee.status?.is_homing??!1),_=un(ee=>ee.status?.sensor_homing_failed??!1),T=un(ee=>ee.status?.firmware_version??null),R=un(ee=>ee.status?.table_type??null),D=un(ee=>ee.status?.current_file??null),L=un(ee=>ee.status?.is_running??!1),k=un(ee=>ee.status?.is_paused??!1),P=un(ee=>ee.status?.pause_time_remaining??0),[U,J]=g.useState(!1),[$,W]=g.useState(!1),[fe,we]=g.useState(0),[Ce,I]=g.useState(!1),V=g.useRef(!1),[H,be]=g.useState(!1),[_e,B]=g.useState(!1),[G,X]=g.useState("off"),[oe,me]=g.useState(!1),[Z,ne]=g.useState(()=>sessionStorage.getItem("security-unlocked")==="true"),[he,Ee]=g.useState(!1),[je,ke]=g.useState(""),[le,Fe]=g.useState(!1),Ge=R==="dune_weaver_mini"?"v3.8.3":"v3.9.5",He=g.useMemo(()=>T?T!==Ge:!1,[T,Ge]),at=()=>{de.get("/api/settings").then(ee=>{ee.app?.name?h(ee.app.name):h(_T),v(ee.app?.custom_logo||null);const Te=ee.security?.mode;X(Te||"off"),me(ee.security?.has_password||!1)}).catch(()=>{})};g.useEffect(()=>{at();const ee=()=>{at()},Te=()=>{at()};return window.addEventListener("branding-updated",ee),window.addEventListener("security-updated",Te),()=>{window.removeEventListener("branding-updated",ee),window.removeEventListener("security-updated",Te)}},[n?.id]),g.useEffect(()=>{de.get("/api/version").then(ee=>{ee.update_available&&B(!0)}).catch(()=>{})},[n?.id]),g.useEffect(()=>{if(!$||Ce)return;if(fe<=0){W(!1),I(!1);return}const ee=setTimeout(()=>{we(Te=>Te-1)},1e3);return()=>clearTimeout(ee)},[$,fe,Ce]);const[Ke,Mt]=g.useState(!1),[St,_t]=g.useState(!1),[jt,ot]=g.useState(!1),[lt,Ct]=g.useState(256),[Vt,Kt]=g.useState(!1),Wt=g.useRef(!1),te=g.useRef(0),Me=g.useRef(0),[st,nt]=g.useState(""),yt=ee=>{ee.preventDefault(),Wt.current=!0,Kt(!0),te.current="touches"in ee?ee.touches[0].clientY:ee.clientY,Me.current=lt,document.body.style.cursor="ns-resize",document.body.style.userSelect="none"};g.useEffect(()=>{const ee=Tt=>{if(!Wt.current)return;const Dt="touches"in Tt?Tt.touches[0].clientY:Tt.clientY,Lt=te.current-Dt,_n=Math.min(Math.max(Me.current+Lt,150),window.innerHeight-150);Ct(_n)},Te=()=>{Wt.current&&(Wt.current=!1,Kt(!1),document.body.style.cursor="",document.body.style.userSelect="")};return window.addEventListener("mousemove",ee),window.addEventListener("mouseup",Te),window.addEventListener("touchmove",ee),window.addEventListener("touchend",Te),()=>{window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",Te),window.removeEventListener("touchmove",ee),window.removeEventListener("touchend",Te)}},[]),g.useEffect(()=>{const ee=N;!V.current&&ee&&J(!1),V.current&&!ee&&(_||(W(!0),we(5),J(!1))),V.current=ee},[N,_]);const[gt,xt]=g.useState(!1),[qt,ue]=g.useState(!1),Oe=D,[Be,Qe]=g.useState(()=>{if(typeof window<"u"){const ee=localStorage.getItem("nowPlayingButtonPos");if(ee==="left"||ee==="center"||ee==="right")return ee}return"center"}),[Pe,Ze]=g.useState(!1),[ft,pt]=g.useState({x:0,y:0}),z=g.useRef(null),Se=g.useRef(null),Ae=g.useRef(!1),Re=!!Oe,M=g.useRef(null),ge=!!Oe||L||k||P>0;g.useEffect(()=>{M.current!==null&&!ge&&M.current&&xt(!1),M.current=ge},[ge]),g.useEffect(()=>{const ee=()=>{xt(!0),ue(!0),ot(!1),setTimeout(()=>ue(!1),500)};return window.addEventListener("playback-started",ee),()=>window.removeEventListener("playback-started",ee)},[]);const[Ne,mt]=g.useState([]),[Y,xe]=g.useState("ALL"),[Le,Ie]=g.useState(0),[Ue,ut]=g.useState(!1),[Et,Rt]=g.useState(!1),it=g.useRef(null),zt=g.useRef(null),Zn=g.useRef(0);g.useEffect(()=>{if(!jt){it.current&&it.current.readyState===WebSocket.OPEN&&it.current.close(),it.current=null;return}let ee=!0;(async()=>{try{const Lt=await de.get("/api/logs?limit=200"),_n=(Lt.logs||[]).filter(fn=>fn&&fn.message&&fn.message.trim()!=="");mt(_n.reverse()),Ie(Lt.total||0),ut(Lt.has_more||!1),Zn.current=_n.length,setTimeout(()=>{zt.current&&(zt.current.scrollTop=zt.current.scrollHeight)},100)}catch{}})();let Tt=null;const Dt=()=>{if(it.current){if(it.current.readyState===WebSocket.CONNECTING)return;it.current.readyState===WebSocket.OPEN&&it.current.close(),it.current=null}const Lt=new WebSocket(de.getWebSocketUrl("/ws/logs"));it.current=Lt,Lt.onopen=()=>{if(!ee){Lt.close();return}console.log("Logs WebSocket connected")},Lt.onmessage=_n=>{try{const fn=JSON.parse(_n.data);if(fn.type==="heartbeat")return;const an=fn.type==="log_entry"?fn.data:fn;if(!an||!an.message||an.message.trim()==="")return;mt(ta=>[...ta,an]),setTimeout(()=>{if(zt.current){const{scrollTop:ta,scrollHeight:lc,clientHeight:cc}=zt.current;lc-ta-cc<100&&(zt.current.scrollTop=lc)}},10)}catch{}},Lt.onclose=()=>{ee&&(console.log("Logs WebSocket closed, reconnecting..."),Tt=setTimeout(()=>{ee&&it.current===Lt&&Dt()},3e3))},Lt.onerror=_n=>{console.error("Logs WebSocket error:",_n)}};return Dt(),()=>{ee=!1,Tt&&clearTimeout(Tt),it.current&&(it.current.readyState===WebSocket.OPEN&&it.current.close(),it.current=null)}},[jt,n?.id]);const Na=g.useCallback(async()=>{if(!(Et||!Ue)){Rt(!0);try{const ee=Zn.current,Te=await de.get(`/api/logs?limit=100&offset=${ee}`),Tt=(Te.logs||[]).filter(Dt=>Dt&&Dt.message&&Dt.message.trim()!=="");Tt.length>0?(mt(Dt=>[...Tt.reverse(),...Dt]),Zn.current+=Tt.length,ut(Te.has_more||!1),Ie(Te.total||0),setTimeout(()=>{if(zt.current){const Dt=Tt.length*24;zt.current.scrollTop=Dt}},10)):ut(!1)}catch{}finally{Rt(!1)}}},[Et,Ue]);g.useEffect(()=>{const ee=zt.current;if(!ee||!jt)return;const Te=()=>{ee.scrollTop<50&&Ue&&!Et&&Na()};return ee.addEventListener("scroll",Te),()=>ee.removeEventListener("scroll",Te)},[jt,Ue,Et,Na]);const Ti=()=>{ot(ee=>!ee)},Ds=g.useMemo(()=>{let ee=Y==="ALL"?Ne:Ne.filter(Te=>Te.level===Y);if(st){const Te=st.toLowerCase();ee=ee.filter(Tt=>Tt.message?.toLowerCase().includes(Te)||Tt.logger?.toLowerCase().includes(Te))}return ee},[Ne,Y,st]),Ka=ee=>{if(!ee)return"--:--:--";try{const Te=new Date(ee);return isNaN(Te.getTime())?"--:--:--":Te.toLocaleTimeString()}catch{return"--:--:--"}},Jl=()=>{const ee=Ds.map(Te=>`${Ka(Te.timestamp)} [${Te.level}] ${Te.message}`).join(`
  56. `);Ya(ee)},Ya=ee=>{if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(ee).then(()=>{K.success("Logs copied to clipboard")}).catch(()=>{K.error("Failed to copy logs")});else{const Te=document.createElement("textarea");Te.value=ee,Te.style.position="fixed",Te.style.left="-9999px",document.body.appendChild(Te),Te.select();try{document.execCommand("copy"),K.success("Logs copied to clipboard")}catch{K.error("Failed to copy logs")}document.body.removeChild(Te)}},Ps=()=>{const ee=Ds.map(Lt=>`${Lt.timestamp} [${Lt.level}] [${Lt.logger}] ${Lt.message}`).join(`
  57. `),Te=new Blob([ee],{type:"text/plain"}),Tt=URL.createObjectURL(Te),Dt=document.createElement("a");Dt.href=Tt,Dt.download=`dune-weaver-logs-${new Date().toISOString().split("T")[0]}.txt`,Dt.click(),URL.revokeObjectURL(Tt)},ks=async()=>{if(confirm("Are you sure you want to restart Dune Weaver?"))try{await de.post("/api/system/restart"),K.success("Dune Weaver is restarting...")}catch{K.error("Failed to restart Dune Weaver")}},Wa=async()=>{if(confirm("Are you sure you want to shutdown the system?"))try{await de.post("/api/system/shutdown"),K.success("System is shutting down...")}catch{K.error("Failed to shutdown system")}},xn=async ee=>{be(!0);try{const Te=await de.post("/recover_sensor_homing",{switch_to_crash_homing:ee});Te.success?K.success(Te.message||"Homing completed successfully"):Te.sensor_homing_failed?K.error(Te.message||"Sensor homing failed again"):K.error(Te.message||"Recovery failed")}catch{K.error("Failed to recover from sensor homing failure")}finally{be(!1)}},ec=async ee=>{ee.preventDefault(),Fe(!1);try{(await de.post("/api/security/verify",{password:je})).valid?(sessionStorage.setItem("security-unlocked","true"),ne(!0),ke(""),he&&(Ee(!1),t("/settings"))):Fe(!0)}catch{Fe(!0)}},tc=()=>{sessionStorage.removeItem("security-unlocked"),ne(!1),t("/")},Xa=G==="lockdown"&&oe&&!Z,ir=G==="play_only"&&oe&&!Z,hd=G!=="off"&&oe&&Z,pd=["/settings","/table-control","/setup","/wifi-setup"];g.useEffect(()=>{ir&&pd.includes(e.pathname)&&t("/")},[ir,e.pathname,t]);const md=["/settings","/table-control"],gd=g.useMemo(()=>ir?Mv.filter(ee=>!md.includes(ee.path)):Mv,[ir]);g.useEffect(()=>{const ee=Mv.find(Te=>Te.path===e.pathname);ee?document.title=`${ee.title} | ${w}`:document.title=w},[e.pathname,w]),g.useEffect(()=>{l?(document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark")):(document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light"))},[l]);const[Ls,Bs]=g.useState([]),or=g.useRef(null),tn=Ov(ee=>ee.cacheProgress);g.useEffect(()=>(j&&Ov.getState().connect(),()=>Ov.getState().disconnect()),[j]);const[vd,nc]=g.useState(!1),[lr,Qa]=g.useState(null),Yn=g.useRef(null);g.useEffect(()=>{if(!(!j||N||$)){Yn.current&&Yn.current.readyState===WebSocket.OPEN&&Yn.current.close(),Yn.current=null;return}if($&&!N)return;const Te=(Tt,Dt,Lt)=>{Bs(_n=>{const fn={timestamp:Lt||new Date().toISOString(),level:Tt,message:Dt};return[..._n,fn].slice(-100)}),setTimeout(()=>{or.current&&(or.current.scrollTop=or.current.scrollHeight)},10)};if(N&&j){Bs([]),Te("INFO","Homing started...");let Tt=!0;if(Yn.current){if(Yn.current.readyState===WebSocket.CONNECTING)return;Yn.current.readyState===WebSocket.OPEN&&Yn.current.close(),Yn.current=null}const Dt=new WebSocket(de.getWebSocketUrl("/ws/logs"));return Yn.current=Dt,Dt.onopen=()=>{Tt||Dt.close()},Dt.onmessage=Lt=>{try{const _n=JSON.parse(Lt.data);if(_n.type==="heartbeat")return;const fn=_n.type==="log_entry"?_n.data:_n;if(!fn||!fn.message||fn.message.trim()==="")return;const an=fn.message.toLowerCase();(an.includes("homing")||an.includes("home")||an.includes("$h")||an.includes("idle")||an.includes("unlock")||an.includes("alarm")||an.includes("grbl")||an.includes("connect")||an.includes("serial")||an.includes("device")||an.includes("position")||an.includes("zeroing")||an.includes("movement")||fn.logger?.includes("connection"))&&Te(fn.level,fn.message,fn.timestamp)}catch{}},()=>{Tt=!1,Dt.readyState===WebSocket.OPEN&&Dt.close(),Yn.current=null}}if(!j){Bs([]),Te("INFO",`Attempting to connect to backend at ${window.location.host}...`);const Tt=setInterval(()=>{Te("INFO","Retrying connection to WebSocket /ws/status..."),de.get("/api/settings").then(()=>{Te("INFO","HTTP endpoint responding, waiting for WebSocket...")}).catch(()=>{})},3e3);return()=>clearInterval(Tt)}},[j,N,$]);const xd=g.useRef(tn);g.useEffect(()=>{const ee=xd.current;xd.current=tn,ee?.is_running&&tn?.stage==="complete"&&(localStorage.getItem("cacheAllPromptShown")||setTimeout(()=>{Qa(null),nc(!0)},500))},[tn]);const Jn=tn?.total_files?Math.round(tn.processed_files/tn.total_files*100):0,rc=()=>{if(!tn)return"";switch(tn.stage){case"starting":return"Initializing...";case"metadata":return"Processing pattern metadata";case"images":return"Generating pattern previews";default:return"Processing..."}},yd=async()=>{Qa({inProgress:!0,completed:0,total:0,done:!1});const ee=await uP(Te=>{Qa({inProgress:!Te.done,...Te})});ee.success?ee.cached===0?K.success("All patterns are already cached!"):K.success(`Cached ${ee.cached} pattern previews`):(Qa(null),K.error("Failed to cache previews"))},ac=()=>{localStorage.setItem("cacheAllPromptShown","true"),nc(!1),Qa(null)},Is=()=>{localStorage.setItem("cacheAllPromptShown","true"),nc(!1),Qa(null)},Ri=g.useCallback(()=>{const Te=z.current?.offsetWidth||140;return{left:16+Te/2,center:window.innerWidth/2,right:window.innerWidth-16-Te/2}},[]),sc=g.useCallback((ee,Te)=>{if(!z.current)return;const Tt=z.current.getBoundingClientRect(),Dt=Tt.left+Tt.width/2;Se.current={x:ee,y:Te,buttonX:Dt},Ae.current=!1,Ze(!0),pt({x:0,y:0})},[]),_a=g.useCallback(ee=>{if(!Se.current||!Pe)return;const Te=ee-Se.current.x;Math.abs(Te)>8&&(Ae.current=!0),pt({x:Te,y:0})},[Pe]),ic=g.useCallback(()=>{if(!Se.current||!z.current){Ze(!1),pt({x:0,y:0});return}const ee=Se.current.buttonX+ft.x,Te=Ri(),Tt={left:Math.abs(ee-Te.left),center:Math.abs(ee-Te.center),right:Math.abs(ee-Te.right)};let Dt="center",Lt=Tt.center;Tt.left<Lt&&(Dt="left",Lt=Tt.left),Tt.right<Lt&&(Dt="right"),Qe(Dt),localStorage.setItem("nowPlayingButtonPos",Dt),Ze(!1),pt({x:0,y:0}),Se.current=null},[ft.x,Ri]);g.useEffect(()=>{if(!Pe)return;const ee=Tt=>{Tt.preventDefault(),_a(Tt.clientX)},Te=()=>{ic()};return window.addEventListener("mousemove",ee),window.addEventListener("mouseup",Te),()=>{window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",Te)}},[Pe,_a,ic]);const bd=g.useCallback(()=>{const ee={bottom:"calc(4.5rem + env(safe-area-inset-bottom, 0px))"};if(Pe&&Se.current){const Tt=Ri()[Be];return{...ee,left:Tt,transform:`translateX(calc(-50% + ${ft.x}px))`,transition:"none",cursor:"grabbing"}}switch(Be){case"left":return{...ee,left:"1rem",transform:"translateX(0)"};case"right":return{...ee,right:"1rem",left:"auto",transform:"translateX(0)"};default:return{...ee,left:"50%",transform:"translateX(-50%)"}}},[Pe,ft.x,Be,Ri]),oc=lr?.total?Math.round(lr.completed/lr.total*100):0;return o.jsxs("div",{className:"min-h-dvh bg-background flex flex-col",children:[Xa&&o.jsx("div",{className:"fixed inset-0 z-[60] bg-background flex items-center justify-center p-4",children:o.jsxs("div",{className:"w-full max-w-sm space-y-6 text-center",children:[o.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 mb-2",children:o.jsx("span",{className:"material-icons-outlined text-4xl text-primary",children:"lock"})}),o.jsx("h2",{className:"text-2xl font-bold",children:w}),o.jsx("p",{className:"text-muted-foreground",children:"This table is locked. Enter the password to continue."}),o.jsxs("form",{onSubmit:ec,className:"space-y-3",children:[o.jsx(wt,{type:"password",placeholder:"Password",value:je,onChange:ee=>{ke(ee.target.value),Fe(!1)},autoFocus:!0}),le&&o.jsx("p",{className:"text-sm text-destructive",children:"Incorrect password"}),o.jsx(se,{type:"submit",className:"w-full",children:"Unlock"})]})]})}),he&&o.jsx("div",{className:"fixed inset-0 z-[60] bg-black/50 backdrop-blur-sm flex items-center justify-center p-4",children:o.jsx("div",{className:"bg-background rounded-lg shadow-xl w-full max-w-sm",children:o.jsxs("div",{className:"p-6 space-y-4",children:[o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-primary/10 mb-2",children:o.jsx("span",{className:"material-icons-outlined text-2xl text-primary",children:"lock"})}),o.jsx("h3",{className:"text-lg font-semibold",children:"Settings Locked"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter the password to access settings."})]}),o.jsxs("form",{onSubmit:ec,className:"space-y-3",children:[o.jsx(wt,{type:"password",placeholder:"Password",value:je,onChange:ee=>{ke(ee.target.value),Fe(!1)},autoFocus:!0}),le&&o.jsx("p",{className:"text-sm text-destructive",children:"Incorrect password"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(se,{type:"button",variant:"ghost",className:"flex-1",onClick:()=>{Ee(!1),ke(""),Fe(!1)},children:"Cancel"}),o.jsx(se,{type:"submit",className:"flex-1",children:"Unlock"})]})]})]})})}),_&&o.jsx("div",{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm flex items-center justify-center p-4",children:o.jsx("div",{className:"bg-background rounded-lg shadow-xl w-full max-w-md border border-destructive/30",children:o.jsx("div",{className:"p-6",children:o.jsxs("div",{className:"text-center space-y-4",children:[o.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-destructive/10 mb-2",children:o.jsx("span",{className:"material-icons-outlined text-4xl text-destructive",children:"error_outline"})}),o.jsx("h2",{className:"text-xl font-semibold",children:"Sensor Homing Failed"}),o.jsx("p",{className:"text-muted-foreground text-sm",children:"The sensor homing process could not complete. The limit sensors may not be positioned correctly or may be malfunctioning."}),o.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/20 p-3 rounded-lg text-sm text-left",children:[o.jsx("p",{className:"text-amber-600 dark:text-amber-400 font-medium mb-2",children:"Troubleshooting steps:"}),o.jsxs("ul",{className:"text-amber-600 dark:text-amber-400 space-y-1 list-disc list-inside",children:[o.jsx("li",{children:"Check that the limit sensors are properly connected"}),o.jsx("li",{children:"Verify the sensor positions are correct"}),o.jsx("li",{children:"Ensure nothing is blocking the sensor path"}),o.jsx("li",{children:"Check for loose wiring connections"})]})]}),o.jsx("p",{className:"text-muted-foreground text-sm",children:"Connection will not be established until this is resolved."}),H?o.jsxs("div",{className:"flex items-center justify-center gap-2 py-4",children:[o.jsx("span",{className:"material-icons-outlined text-primary animate-spin",children:"sync"}),o.jsx("span",{className:"text-muted-foreground",children:"Attempting recovery..."})]}):o.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[o.jsxs(se,{onClick:()=>xn(!1),className:"w-full gap-2",children:[o.jsx("span",{className:"material-icons text-base",children:"refresh"}),"Retry Sensor Homing"]}),o.jsxs(se,{variant:"secondary",onClick:()=>xn(!0),className:"w-full gap-2",children:[o.jsx("span",{className:"material-icons text-base",children:"sync_alt"}),"Switch to Crash Homing"]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Crash homing moves the arm to a physical stop without using sensors."})]})]})})})}),tn?.is_running&&o.jsx("div",{className:"fixed inset-0 z-50 bg-background/95 backdrop-blur-sm flex flex-col items-center justify-center p-4",children:o.jsxs("div",{className:"w-full max-w-md space-y-6",children:[o.jsxs("div",{className:"text-center space-y-4",children:[o.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 mb-2",children:o.jsx("span",{className:"material-icons-outlined text-4xl text-primary animate-pulse",children:"cached"})}),o.jsx("h2",{className:"text-2xl font-bold",children:"Initializing Pattern Cache"}),o.jsx("p",{className:"text-muted-foreground",children:"Preparing your pattern previews..."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"w-full bg-muted rounded-full h-2 overflow-hidden",children:o.jsx("div",{className:"bg-primary h-2 rounded-full transition-all duration-300",style:{width:`${Jn}%`}})}),o.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[o.jsxs("span",{children:[tn.processed_files," of ",tn.total_files," patterns"]}),o.jsxs("span",{children:[Jn,"%"]})]})]}),o.jsxs("div",{className:"text-center space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:rc()}),tn.current_file&&o.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-full",children:tn.current_file})]}),o.jsx("p",{className:"text-center text-xs text-muted-foreground",children:"This only happens once after updates or when new patterns are added"})]})}),vd&&o.jsx("div",{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm flex items-center justify-center p-4",children:o.jsx("div",{className:"bg-background rounded-lg shadow-xl w-full max-w-md",children:o.jsx("div",{className:"p-6",children:o.jsxs("div",{className:"text-center space-y-4",children:[o.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-primary/10 mb-2",children:o.jsx("span",{className:"material-icons-outlined text-2xl text-primary",children:"download_for_offline"})}),o.jsx("h2",{className:"text-xl font-semibold",children:"Cache All Pattern Previews?"}),o.jsx("p",{className:"text-muted-foreground text-sm",children:"Would you like to cache all pattern previews for faster browsing? This will download and store preview images in your browser for instant loading."}),o.jsx("div",{className:"bg-amber-500/10 border border-amber-500/20 p-3 rounded-lg text-sm",children:o.jsxs("p",{className:"text-amber-600 dark:text-amber-400",children:[o.jsx("strong",{children:"Note:"})," This cache is browser-specific. You'll need to repeat this for each browser you use."]})}),!lr&&o.jsxs("div",{className:"flex gap-3 justify-center",children:[o.jsx(se,{variant:"ghost",onClick:ac,children:"Skip for now"}),o.jsxs(se,{variant:"secondary",onClick:yd,className:"gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-lg",children:"cached"}),"Cache All"]})]}),lr&&!lr.done&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"w-full bg-muted rounded-full h-2 overflow-hidden",children:o.jsx("div",{className:"bg-primary h-2 rounded-full transition-all duration-300",style:{width:`${oc}%`}})}),o.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[o.jsxs("span",{children:[lr.completed," of ",lr.total," previews"]}),o.jsxs("span",{children:[oc,"%"]})]})]}),lr?.done&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("p",{className:"text-green-600 dark:text-green-400 flex items-center justify-center gap-2",children:[o.jsx("span",{className:"material-icons text-base",children:"check_circle"}),"All ",lr.total," previews cached successfully!"]}),o.jsx(se,{onClick:Is,className:"w-full",children:"Done"})]})]})})})}),!Dv&&!_&&(!j||N&&!U||$)&&o.jsx("div",{className:"fixed inset-0 z-50 bg-background/95 backdrop-blur-sm flex flex-col items-center justify-center p-4",children:o.jsxs("div",{className:"w-full max-w-2xl space-y-6",children:[o.jsxs("div",{className:"text-center space-y-4",children:[o.jsx("div",{className:`inline-flex items-center justify-center w-16 h-16 rounded-full mb-2 ${$?"bg-green-500/10":N?"bg-primary/10":"bg-amber-500/10"}`,children:o.jsx("span",{className:`material-icons-outlined text-4xl ${$?"text-green-500":N?"text-primary animate-spin":"text-amber-500 animate-pulse"}`,children:$?"check_circle":"sync"})}),o.jsx("h2",{className:"text-2xl font-bold",children:$?"Homing Complete":N?"Homing in Progress":"Connecting to Backend"}),o.jsx("p",{className:"text-muted-foreground",children:$?"Table is ready to use":N?"Moving to home position... This may take up to 90 seconds.":S===0?"Establishing connection...":`Reconnecting... (attempt ${S})`}),o.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[o.jsx("span",{className:`w-2 h-2 rounded-full ${$?"bg-green-500":N?"bg-primary animate-pulse":"bg-amber-500 animate-pulse"}`}),o.jsx("span",{children:$?Ce?"Viewing logs":`Closing in ${fe}s...`:N?"Do not interrupt the homing process":`Waiting for server at ${window.location.host}`})]})]}),o.jsxs("div",{className:"bg-muted/50 rounded-lg border overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"terminal"}),o.jsx("span",{className:"text-sm font-medium",children:N||$?"Homing Log":"Connection Log"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("button",{onClick:()=>{const ee=Ls.map(Te=>`[${new Date(Te.timestamp).toLocaleTimeString()}] [${Te.level}] ${Te.message}`).join(`
  58. `);Ya(ee)},className:"text-xs text-muted-foreground hover:text-foreground flex items-center gap-1 transition-colors",title:"Copy logs to clipboard",children:[o.jsx("span",{className:"material-icons text-sm",children:"content_copy"}),"Copy"]}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[Ls.length," entries"]})]})]}),o.jsx("div",{ref:or,className:"h-48 overflow-auto p-3 font-mono text-xs space-y-0.5",children:Ls.map((ee,Te)=>o.jsxs("div",{className:"py-0.5 flex gap-2",children:[o.jsx("span",{className:"text-muted-foreground shrink-0",children:Ka(ee.timestamp)}),o.jsxs("span",{className:`shrink-0 font-semibold ${ee.level==="ERROR"?"text-red-500":ee.level==="WARNING"?"text-amber-500":ee.level==="DEBUG"?"text-muted-foreground":"text-foreground"}`,children:["[",ee.level,"]"]}),o.jsx("span",{className:"break-all",children:ee.message})]},Te))})]}),$&&o.jsx("div",{className:"flex justify-center gap-3",children:Ce?o.jsxs(se,{onClick:()=>{W(!1),I(!1)},className:"gap-2",children:[o.jsx("span",{className:"material-icons text-base",children:"close"}),"Close Logs"]}):o.jsxs(o.Fragment,{children:[o.jsxs(se,{variant:"secondary",onClick:()=>I(!0),className:"gap-2",children:[o.jsx("span",{className:"material-icons text-base",children:"visibility"}),"Keep Open"]}),o.jsxs(se,{onClick:()=>{W(!1),I(!1)},className:"gap-2",children:[o.jsx("span",{className:"material-icons text-base",children:"close"}),"Dismiss"]})]})}),N&&!$&&o.jsx("div",{className:"flex justify-center",children:o.jsxs(se,{variant:"ghost",onClick:()=>J(!0),className:"gap-2 text-muted-foreground",children:[o.jsx("span",{className:"material-icons text-base",children:"visibility_off"}),"Dismiss"]})}),!$&&o.jsx("p",{className:"text-center text-xs text-muted-foreground",children:N?"Homing will continue in the background":"Make sure the backend server is running on port 8080"})]})}),o.jsxs("header",{className:"fixed top-0 left-0 right-0 z-40 pt-safe",children:[e.pathname==="/"&&o.jsx("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-md supports-[backdrop-filter]:bg-background/50",style:{height:"calc(5rem + env(safe-area-inset-top, 0px))"}}),o.jsx("div",{className:"relative w-full max-w-5xl mx-auto px-3 sm:px-4 pt-3 pointer-events-none",children:o.jsx("div",{className:"rounded-full bg-card shadow-lg border border-border pointer-events-auto",children:o.jsxs("div",{className:"flex h-12 items-center justify-between px-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(pi,{to:"/",children:o.jsx("img",{src:p?de.getAssetUrl(`/static/custom/${p}`):de.getAssetUrl("/static/android-chrome-192x192.png"),alt:w,className:"w-8 h-8 rounded-full object-cover"})}),o.jsx(Z9,{children:o.jsxs("button",{className:"flex items-center gap-1.5 hover:opacity-80 transition-opacity group",children:[o.jsx(PY,{text:w,className:"font-semibold text-lg",speed:4,color:l?"#a8a8a8":"#555555",shineColor:l?"#ffffff":"#999999",spread:75}),o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-sm group-hover:text-foreground transition-colors",children:"expand_more"}),o.jsx("span",{className:`w-2 h-2 rounded-full ${j?C?"bg-green-500 animate-pulse":"bg-red-500":"bg-gray-400"}`,title:j?C?"Table connected":"Table disconnected":"Backend not connected"})]})})]}),He&&o.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 mx-2 text-amber-500",children:[o.jsx("span",{className:"material-icons-outlined text-base shrink-0",children:"warning"}),o.jsxs("span",{className:"text-xs truncate",children:["FluidNC ",T," — change to ",Ge]})]}),o.jsxs("div",{className:"hidden md:flex items-center gap-0 ml-2",children:[hd&&o.jsx(se,{variant:"ghost",size:"icon",className:"rounded-full",onClick:tc,title:"Lock",children:o.jsx("span",{className:"material-icons-outlined",children:"lock_open"})}),_e&&o.jsx(pi,{to:"/settings?section=version",title:"Software update available",children:o.jsxs("span",{className:"relative flex items-center justify-center w-8 h-8 rounded-full hover:bg-accent transition-colors",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"download"}),o.jsx("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-blue-500 animate-pulse"})]})}),o.jsxs(Bu,{open:St,onOpenChange:_t,children:[o.jsx(Iu,{asChild:!0,children:o.jsx(se,{variant:"ghost",size:"icon",className:"rounded-full","aria-label":"Open menu",children:o.jsx("span",{className:"material-icons-outlined",children:"menu"})})}),o.jsx(Rl,{align:"end",className:"w-56 p-2",children:o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsxs("button",{onClick:()=>u(!l),className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:l?"light_mode":"dark_mode"}),l?"Light Mode":"Dark Mode"]}),o.jsxs("button",{onClick:Ti,className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"article"}),"View Logs"]}),o.jsxs("button",{onClick:()=>{t("/wifi-setup"),_t(!1)},className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"wifi"}),"WiFi Setup"]}),o.jsx(Xn,{className:"my-1"}),o.jsxs("button",{onClick:ks,className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors text-amber-500",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"restart_alt"}),"Restart"]}),o.jsxs("button",{onClick:Wa,className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors text-red-500",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"power_settings_new"}),"Shutdown"]})]})})]})]}),o.jsxs("div",{className:"flex md:hidden items-center gap-0 ml-2",children:[hd&&o.jsx(se,{variant:"ghost",size:"icon",className:"rounded-full",onClick:tc,title:"Lock",children:o.jsx("span",{className:"material-icons-outlined",children:"lock_open"})}),_e&&o.jsx(pi,{to:"/settings?section=version",title:"Software update available",children:o.jsxs("span",{className:"relative flex items-center justify-center w-8 h-8 rounded-full hover:bg-accent transition-colors",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"download"}),o.jsx("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-blue-500 animate-pulse"})]})}),o.jsxs(Bu,{open:Ke,onOpenChange:Mt,children:[o.jsx(Iu,{asChild:!0,children:o.jsx(se,{variant:"ghost",size:"icon",className:"rounded-full","aria-label":"Open menu",children:o.jsx("span",{className:"material-icons-outlined",children:Ke?"close":"menu"})})}),o.jsx(Rl,{align:"end",className:"w-56 p-2",children:o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsxs("button",{onClick:()=>{u(!l),Mt(!1)},className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:l?"light_mode":"dark_mode"}),l?"Light Mode":"Dark Mode"]}),o.jsxs("button",{onClick:()=>{Ti(),Mt(!1)},className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"article"}),"View Logs"]}),o.jsxs("button",{onClick:()=>{t("/wifi-setup"),Mt(!1)},className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"wifi"}),"WiFi Setup"]}),o.jsx(Xn,{className:"my-1"}),o.jsxs("button",{onClick:()=>{ks(),Mt(!1)},className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors text-amber-500",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"restart_alt"}),"Restart"]}),o.jsxs("button",{onClick:()=>{Wa(),Mt(!1)},className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors text-red-500",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"power_settings_new"}),"Shutdown"]})]})})]})]})]})})})]}),o.jsx("main",{className:"container mx-auto px-4 transition-all duration-300",style:{paddingTop:"calc(4.5rem + env(safe-area-inset-top, 0px))",paddingBottom:jt?gt?`calc(${lt+256+64}px + env(safe-area-inset-bottom, 0px))`:`calc(${lt+64}px + env(safe-area-inset-bottom, 0px))`:gt?"calc(20rem + env(safe-area-inset-bottom, 0px))":"calc(8rem + env(safe-area-inset-bottom, 0px))"},children:o.jsx(h6,{context:{isPlayOnlyActive:ir}})}),o.jsx(tq,{isLogsOpen:jt,logsDrawerHeight:lt,isVisible:gt,openExpanded:qt,onClose:()=>xt(!1)}),o.jsx("div",{className:`fixed left-0 right-0 z-30 bg-background border-t border-border ${Vt?"":"transition-[height] duration-300"}`,style:{height:jt?lt:0,bottom:"calc(4rem + env(safe-area-inset-bottom, 0px))"},children:jt&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"absolute top-0 left-0 right-0 h-2 cursor-ns-resize flex items-center justify-center group hover:bg-primary/10 -translate-y-1/2 z-10",onMouseDown:yt,onTouchStart:yt,children:o.jsx("div",{className:"w-12 h-1 rounded-full bg-border group-hover:bg-primary transition-colors"})}),o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted/50 gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 flex-wrap min-w-0",children:[o.jsx("span",{className:"text-sm font-medium whitespace-nowrap",children:"Application Logs"}),o.jsxs("select",{value:Y,onChange:ee=>xe(ee.target.value),className:"text-xs bg-background border rounded px-2 py-1",children:[o.jsx("option",{value:"ALL",children:"All Levels"}),o.jsx("option",{value:"DEBUG",children:"Debug"}),o.jsx("option",{value:"INFO",children:"Info"}),o.jsx("option",{value:"WARNING",children:"Warning"}),o.jsx("option",{value:"ERROR",children:"Error"})]}),o.jsx("input",{type:"text",value:st,onChange:ee=>nt(ee.target.value),placeholder:"Search logs...",className:"text-xs bg-background border rounded px-2 py-1 w-28 sm:w-40"}),st&&o.jsx(se,{variant:"ghost",size:"icon-sm",onClick:()=>nt(""),className:"rounded-full",title:"Clear search",children:o.jsx("span",{className:"material-icons-outlined text-sm",children:"close"})}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[Ds.length,Le>0?` of ${Le}`:""," entries",Ue&&o.jsx("span",{className:"text-primary ml-1",children:"↑ scroll for more"})]})]}),o.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[o.jsx(se,{variant:"ghost",size:"icon-sm",onClick:Jl,className:"rounded-full",title:"Copy logs",children:o.jsx("span",{className:"material-icons-outlined text-base",children:"content_copy"})}),o.jsx(se,{variant:"ghost",size:"icon-sm",onClick:Ps,className:"rounded-full",title:"Download logs",children:o.jsx("span",{className:"material-icons-outlined text-base",children:"download"})}),o.jsx(se,{variant:"ghost",size:"icon-sm",onClick:()=>ot(!1),className:"rounded-full",title:"Close",children:o.jsx("span",{className:"material-icons-outlined text-base",children:"close"})})]})]}),o.jsxs("div",{ref:zt,className:"h-[calc(100%-40px)] overflow-auto overscroll-contain p-3 font-mono text-xs space-y-0.5",children:[Et&&o.jsxs("div",{className:"flex items-center justify-center gap-2 py-2 text-muted-foreground",children:[o.jsx("span",{className:"material-icons-outlined text-sm animate-spin",children:"sync"}),o.jsx("span",{children:"Loading older logs..."})]}),Ue&&!Et&&o.jsx("div",{className:"text-center py-2 text-muted-foreground text-xs",children:"↑ Scroll up to load older logs"}),Ds.length>0?Ds.map((ee,Te)=>o.jsxs("div",{className:"py-0.5 flex gap-2",children:[o.jsx("span",{className:"text-muted-foreground shrink-0",children:Ka(ee.timestamp)}),o.jsxs("span",{className:`shrink-0 font-semibold ${ee.level==="ERROR"?"text-red-500":ee.level==="WARNING"?"text-amber-500":ee.level==="DEBUG"?"text-muted-foreground":"text-foreground"}`,children:["[",ee.level||"LOG","]"]}),o.jsx("span",{className:"break-all",children:ee.message||""})]},Te)):o.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No logs available"})]})]})}),!gt&&o.jsxs("button",{ref:z,onClick:()=>{Ae.current||xt(!0),Ae.current=!1},onMouseDown:ee=>{ee.preventDefault(),sc(ee.clientX,ee.clientY)},onTouchStart:ee=>{const Te=ee.touches[0];sc(Te.clientX,Te.clientY)},onTouchMove:ee=>{const Te=ee.touches[0];_a(Te.clientX)},onTouchEnd:()=>{ic()},className:`fixed z-40 flex items-center gap-2 px-4 py-2 rounded-full bg-card border border-border shadow-lg select-none touch-none ${Pe?"cursor-grabbing scale-105 shadow-xl":"cursor-grab transition-all duration-300 hover:shadow-xl hover:scale-105 active:scale-95"}`,style:bd(),"aria-label":Re?"Now Playing":"Not Playing",children:[o.jsx("span",{className:`material-icons-outlined text-xl ${Re?"text-primary":"text-muted-foreground"}`,children:Re?"play_circle":"stop_circle"}),o.jsx("span",{className:"text-sm font-medium",children:Re?"Now Playing":"Not Playing"})]}),o.jsx("nav",{className:"fixed bottom-0 left-0 right-0 z-40 border-t border-border bg-card pb-safe",children:o.jsxs("div",{className:"max-w-5xl mx-auto grid h-16",style:{gridTemplateColumns:`repeat(${gd.length+(ir?1:0)}, minmax(0, 1fr))`},children:[gd.map(ee=>{const Te=e.pathname===ee.path;return o.jsxs(pi,{to:ee.path,className:`relative flex flex-col items-center justify-center gap-1 transition-all duration-200 ${Te?"text-primary":"text-muted-foreground hover:text-foreground active:scale-95"}`,children:[Te&&o.jsx("span",{className:"absolute -top-0.5 w-8 h-1 rounded-full bg-primary"}),o.jsx("span",{className:`text-xl ${Te?"material-icons":"material-icons-outlined"}`,children:ee.icon}),o.jsx("span",{className:"text-xs font-medium",children:ee.label})]},ee.path)}),ir&&o.jsxs("button",{onClick:()=>{Ee(!0),ke(""),Fe(!1)},className:"relative flex flex-col items-center justify-center gap-1 transition-all duration-200 text-muted-foreground hover:text-foreground active:scale-95",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"lock"}),o.jsx("span",{className:"text-xs font-medium",children:"Settings"})]})]})})]})}function cS(e){const t=g.useRef(e);g.useEffect(()=>{t.current=e},[e]),g.useEffect(()=>{const n=()=>{t.current()};return window.addEventListener("backend-connected",n),()=>{window.removeEventListener("backend-connected",n)}},[])}var BY=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],IY=BY.reduce((e,t)=>{const n=qh(`Primitive.${t}`),a=g.forwardRef((i,l)=>{const{asChild:u,...d}=i,h=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(h,{...d,ref:l})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),zY="Label",Zk=g.forwardRef((e,t)=>o.jsx(IY.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Zk.displayName=zY;var Jk=Zk;const FY=Xu("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ye=g.forwardRef(({className:e,...t},n)=>o.jsx(Jk,{ref:n,className:ct(FY(),e),...t}));Ye.displayName=Jk.displayName;function Oh(e,[t,n]){return Math.min(n,Math.max(t,e))}var HY=g.createContext(void 0);function od(e){const t=g.useContext(HY);return e||t||"ltr"}function gp(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function ET(e){const t=UY(e),n=g.forwardRef((a,i)=>{const{children:l,...u}=a,d=g.Children.toArray(l),h=d.find(qY);if(h){const p=h.props.children,v=d.map(m=>m===h?g.Children.count(p)>1?g.Children.only(null):g.isValidElement(p)?p.props.children:null:m);return o.jsx(t,{...u,ref:i,children:g.isValidElement(p)?g.cloneElement(p,void 0,v):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function UY(e){const t=g.forwardRef((n,a)=>{const{children:i,...l}=n;if(g.isValidElement(i)){const u=GY(i),d=$Y(l,i.props);return i.type!==g.Fragment&&(d.ref=a?oo(a,u):u),g.cloneElement(i,d)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var VY=Symbol("radix.slottable");function qY(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===VY}function $Y(e,t){const n={...t};for(const a in t){const i=e[a],l=t[a];/^on[A-Z]/.test(a)?i&&l?n[a]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(n[a]=i):a==="style"?n[a]={...i,...l}:a==="className"&&(n[a]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function GY(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function vp(e){const t=e+"CollectionProvider",[n,a]=Lr(t),[i,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),u=S=>{const{scope:C,children:N}=S,_=A.useRef(null),T=A.useRef(new Map).current;return o.jsx(i,{scope:C,itemMap:T,collectionRef:_,children:N})};u.displayName=t;const d=e+"CollectionSlot",h=ET(d),p=A.forwardRef((S,C)=>{const{scope:N,children:_}=S,T=l(d,N),R=Ot(C,T.collectionRef);return o.jsx(h,{ref:R,children:_})});p.displayName=d;const v=e+"CollectionItemSlot",m="data-radix-collection-item",b=ET(v),w=A.forwardRef((S,C)=>{const{scope:N,children:_,...T}=S,R=A.useRef(null),D=Ot(C,R),L=l(v,N);return A.useEffect(()=>(L.itemMap.set(R,{ref:R,...T}),()=>{L.itemMap.delete(R)})),o.jsx(b,{[m]:"",ref:D,children:_})});w.displayName=v;function j(S){const C=l(e+"CollectionConsumer",S);return A.useCallback(()=>{const _=C.collectionRef.current;if(!_)return[];const T=Array.from(_.querySelectorAll(`[${m}]`));return Array.from(C.itemMap.values()).sort((L,k)=>T.indexOf(L.ref.current)-T.indexOf(k.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:u,Slot:p,ItemSlot:w},j,a]}var e3=["PageUp","PageDown"],t3=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],n3={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Kl="Slider",[N0,KY,YY]=vp(Kl),[r3]=Lr(Kl,[YY]),[WY,xp]=r3(Kl),a3=g.forwardRef((e,t)=>{const{name:n,min:a=0,max:i=100,step:l=1,orientation:u="horizontal",disabled:d=!1,minStepsBetweenThumbs:h=0,defaultValue:p=[a],value:v,onValueChange:m=()=>{},onValueCommit:b=()=>{},inverted:w=!1,form:j,...S}=e,C=g.useRef(new Set),N=g.useRef(0),T=u==="horizontal"?XY:QY,[R=[],D]=Zr({prop:v,defaultProp:p,onChange:$=>{[...C.current][N.current]?.focus(),m($)}}),L=g.useRef(R);function k($){const W=nW(R,$);J($,W)}function P($){J($,N.current)}function U(){const $=L.current[N.current];R[N.current]!==$&&b(R)}function J($,W,{commit:fe}={commit:!1}){const we=iW(l),Ce=oW(Math.round(($-a)/l)*l+a,we),I=Oh(Ce,[a,i]);D((V=[])=>{const H=eW(V,I,W);if(sW(H,h*l)){N.current=H.indexOf(I);const be=String(H)!==String(V);return be&&fe&&b(H),be?H:V}else return V})}return o.jsx(WY,{scope:e.__scopeSlider,name:n,disabled:d,min:a,max:i,valueIndexToChangeRef:N,thumbs:C.current,values:R,orientation:u,form:j,children:o.jsx(N0.Provider,{scope:e.__scopeSlider,children:o.jsx(N0.Slot,{scope:e.__scopeSlider,children:o.jsx(T,{"aria-disabled":d,"data-disabled":d?"":void 0,...S,ref:t,onPointerDown:et(S.onPointerDown,()=>{d||(L.current=R)}),min:a,max:i,inverted:w,onSlideStart:d?void 0:k,onSlideMove:d?void 0:P,onSlideEnd:d?void 0:U,onHomeKeyDown:()=>!d&&J(a,0,{commit:!0}),onEndKeyDown:()=>!d&&J(i,R.length-1,{commit:!0}),onStepKeyDown:({event:$,direction:W})=>{if(!d){const Ce=e3.includes($.key)||$.shiftKey&&t3.includes($.key)?10:1,I=N.current,V=R[I],H=l*Ce*W;J(V+H,I,{commit:!0})}}})})})})});a3.displayName=Kl;var[s3,i3]=r3(Kl,{startEdge:"left",endEdge:"right",size:"width",direction:1}),XY=g.forwardRef((e,t)=>{const{min:n,max:a,dir:i,inverted:l,onSlideStart:u,onSlideMove:d,onSlideEnd:h,onStepKeyDown:p,...v}=e,[m,b]=g.useState(null),w=Ot(t,T=>b(T)),j=g.useRef(void 0),S=od(i),C=S==="ltr",N=C&&!l||!C&&l;function _(T){const R=j.current||m.getBoundingClientRect(),D=[0,R.width],k=uS(D,N?[n,a]:[a,n]);return j.current=R,k(T-R.left)}return o.jsx(s3,{scope:e.__scopeSlider,startEdge:N?"left":"right",endEdge:N?"right":"left",direction:N?1:-1,size:"width",children:o.jsx(o3,{dir:S,"data-orientation":"horizontal",...v,ref:w,style:{...v.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:T=>{const R=_(T.clientX);u?.(R)},onSlideMove:T=>{const R=_(T.clientX);d?.(R)},onSlideEnd:()=>{j.current=void 0,h?.()},onStepKeyDown:T=>{const D=n3[N?"from-left":"from-right"].includes(T.key);p?.({event:T,direction:D?-1:1})}})})}),QY=g.forwardRef((e,t)=>{const{min:n,max:a,inverted:i,onSlideStart:l,onSlideMove:u,onSlideEnd:d,onStepKeyDown:h,...p}=e,v=g.useRef(null),m=Ot(t,v),b=g.useRef(void 0),w=!i;function j(S){const C=b.current||v.current.getBoundingClientRect(),N=[0,C.height],T=uS(N,w?[a,n]:[n,a]);return b.current=C,T(S-C.top)}return o.jsx(s3,{scope:e.__scopeSlider,startEdge:w?"bottom":"top",endEdge:w?"top":"bottom",size:"height",direction:w?1:-1,children:o.jsx(o3,{"data-orientation":"vertical",...p,ref:m,style:{...p.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:S=>{const C=j(S.clientY);l?.(C)},onSlideMove:S=>{const C=j(S.clientY);u?.(C)},onSlideEnd:()=>{b.current=void 0,d?.()},onStepKeyDown:S=>{const N=n3[w?"from-bottom":"from-top"].includes(S.key);h?.({event:S,direction:N?-1:1})}})})}),o3=g.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:a,onSlideMove:i,onSlideEnd:l,onHomeKeyDown:u,onEndKeyDown:d,onStepKeyDown:h,...p}=e,v=xp(Kl,n);return o.jsx(dt.span,{...p,ref:t,onKeyDown:et(e.onKeyDown,m=>{m.key==="Home"?(u(m),m.preventDefault()):m.key==="End"?(d(m),m.preventDefault()):e3.concat(t3).includes(m.key)&&(h(m),m.preventDefault())}),onPointerDown:et(e.onPointerDown,m=>{const b=m.target;b.setPointerCapture(m.pointerId),m.preventDefault(),v.thumbs.has(b)?b.focus():a(m)}),onPointerMove:et(e.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&i(m)}),onPointerUp:et(e.onPointerUp,m=>{const b=m.target;b.hasPointerCapture(m.pointerId)&&(b.releasePointerCapture(m.pointerId),l(m))})})}),l3="SliderTrack",c3=g.forwardRef((e,t)=>{const{__scopeSlider:n,...a}=e,i=xp(l3,n);return o.jsx(dt.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...a,ref:t})});c3.displayName=l3;var _0="SliderRange",u3=g.forwardRef((e,t)=>{const{__scopeSlider:n,...a}=e,i=xp(_0,n),l=i3(_0,n),u=g.useRef(null),d=Ot(t,u),h=i.values.length,p=i.values.map(b=>h3(b,i.min,i.max)),v=h>1?Math.min(...p):0,m=100-Math.max(...p);return o.jsx(dt.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...a,ref:d,style:{...e.style,[l.startEdge]:v+"%",[l.endEdge]:m+"%"}})});u3.displayName=_0;var E0="SliderThumb",d3=g.forwardRef((e,t)=>{const n=KY(e.__scopeSlider),[a,i]=g.useState(null),l=Ot(t,d=>i(d)),u=g.useMemo(()=>a?n().findIndex(d=>d.ref.current===a):-1,[n,a]);return o.jsx(ZY,{...e,ref:l,index:u})}),ZY=g.forwardRef((e,t)=>{const{__scopeSlider:n,index:a,name:i,...l}=e,u=xp(E0,n),d=i3(E0,n),[h,p]=g.useState(null),v=Ot(t,_=>p(_)),m=h?u.form||!!h.closest("form"):!0,b=lp(h),w=u.values[a],j=w===void 0?0:h3(w,u.min,u.max),S=tW(a,u.values.length),C=b?.[d.size],N=C?rW(C,j,d.direction):0;return g.useEffect(()=>{if(h)return u.thumbs.add(h),()=>{u.thumbs.delete(h)}},[h,u.thumbs]),o.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[d.startEdge]:`calc(${j}% + ${N}px)`},children:[o.jsx(N0.ItemSlot,{scope:e.__scopeSlider,children:o.jsx(dt.span,{role:"slider","aria-label":e["aria-label"]||S,"aria-valuemin":u.min,"aria-valuenow":w,"aria-valuemax":u.max,"aria-orientation":u.orientation,"data-orientation":u.orientation,"data-disabled":u.disabled?"":void 0,tabIndex:u.disabled?void 0:0,...l,ref:v,style:w===void 0?{display:"none"}:e.style,onFocus:et(e.onFocus,()=>{u.valueIndexToChangeRef.current=a})})}),m&&o.jsx(f3,{name:i??(u.name?u.name+(u.values.length>1?"[]":""):void 0),form:u.form,value:w},a)]})});d3.displayName=E0;var JY="RadioBubbleInput",f3=g.forwardRef(({__scopeSlider:e,value:t,...n},a)=>{const i=g.useRef(null),l=Ot(i,a),u=gp(t);return g.useEffect(()=>{const d=i.current;if(!d)return;const h=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(h,"value").set;if(u!==t&&v){const m=new Event("input",{bubbles:!0});v.call(d,t),d.dispatchEvent(m)}},[u,t]),o.jsx(dt.input,{style:{display:"none"},...n,ref:l,defaultValue:t})});f3.displayName=JY;function eW(e=[],t,n){const a=[...e];return a[n]=t,a.sort((i,l)=>i-l)}function h3(e,t,n){const l=100/(n-t)*(e-t);return Oh(l,[0,100])}function tW(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function nW(e,t){if(e.length===1)return 0;const n=e.map(i=>Math.abs(i-t)),a=Math.min(...n);return n.indexOf(a)}function rW(e,t,n){const a=e/2,l=uS([0,50],[0,a]);return(a-l(t)*n)*n}function aW(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function sW(e,t){if(t>0){const n=aW(e);return Math.min(...n)>=t}return!0}function uS(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const a=(t[1]-t[0])/(e[1]-e[0]);return t[0]+a*(n-e[0])}}function iW(e){return(String(e).split(".")[1]||"").length}function oW(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var p3=a3,lW=c3,cW=u3,uW=d3;const _l=g.forwardRef(({className:e,...t},n)=>o.jsxs(p3,{ref:n,className:ct("relative flex w-full touch-none select-none items-center",e),...t,children:[o.jsx(lW,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:o.jsx(cW,{className:"absolute h-full bg-primary"})}),o.jsx(uW,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));_l.displayName=p3.displayName;function dW(e){const t=fW(e),n=g.forwardRef((a,i)=>{const{children:l,...u}=a,d=g.Children.toArray(l),h=d.find(pW);if(h){const p=h.props.children,v=d.map(m=>m===h?g.Children.count(p)>1?g.Children.only(null):g.isValidElement(p)?p.props.children:null:m);return o.jsx(t,{...u,ref:i,children:g.isValidElement(p)?g.cloneElement(p,void 0,v):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function fW(e){const t=g.forwardRef((n,a)=>{const{children:i,...l}=n;if(g.isValidElement(i)){const u=gW(i),d=mW(l,i.props);return i.type!==g.Fragment&&(d.ref=a?oo(a,u):u),g.cloneElement(i,d)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var hW=Symbol("radix.slottable");function pW(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hW}function mW(e,t){const n={...t};for(const a in t){const i=e[a],l=t[a];/^on[A-Z]/.test(a)?i&&l?n[a]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(n[a]=i):a==="style"?n[a]={...i,...l}:a==="className"&&(n[a]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function gW(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var m3=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"}),vW="VisuallyHidden",g3=g.forwardRef((e,t)=>o.jsx(dt.span,{...e,ref:t,style:{...m3,...e.style}}));g3.displayName=vW;var xW=g3,yW=[" ","Enter","ArrowUp","ArrowDown"],bW=[" ","Enter"],ro="Select",[yp,bp,wW]=vp(ro),[Yl]=Lr(ro,[wW,Vl]),wp=Vl(),[SW,Ni]=Yl(ro),[jW,CW]=Yl(ro),v3=e=>{const{__scopeSelect:t,children:n,open:a,defaultOpen:i,onOpenChange:l,value:u,defaultValue:d,onValueChange:h,dir:p,name:v,autoComplete:m,disabled:b,required:w,form:j}=e,S=wp(t),[C,N]=g.useState(null),[_,T]=g.useState(null),[R,D]=g.useState(!1),L=od(p),[k,P]=Zr({prop:a,defaultProp:i??!1,onChange:l,caller:ro}),[U,J]=Zr({prop:u,defaultProp:d,onChange:h,caller:ro}),$=g.useRef(null),W=C?j||!!C.closest("form"):!0,[fe,we]=g.useState(new Set),Ce=Array.from(fe).map(I=>I.props.value).join(";");return o.jsx(Ew,{...S,children:o.jsxs(SW,{required:w,scope:t,trigger:C,onTriggerChange:N,valueNode:_,onValueNodeChange:T,valueNodeHasChildren:R,onValueNodeHasChildrenChange:D,contentId:ma(),value:U,onValueChange:J,open:k,onOpenChange:P,dir:L,triggerPointerDownPosRef:$,disabled:b,children:[o.jsx(yp.Provider,{scope:t,children:o.jsx(jW,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(I=>{we(V=>new Set(V).add(I))},[]),onNativeOptionRemove:g.useCallback(I=>{we(V=>{const H=new Set(V);return H.delete(I),H})},[]),children:n})}),W?o.jsxs(U3,{"aria-hidden":!0,required:w,tabIndex:-1,name:v,autoComplete:m,value:U,onChange:I=>J(I.target.value),disabled:b,form:j,children:[U===void 0?o.jsx("option",{value:""}):null,Array.from(fe)]},Ce):null]})})};v3.displayName=ro;var x3="SelectTrigger",y3=g.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:a=!1,...i}=e,l=wp(n),u=Ni(x3,n),d=u.disabled||a,h=Ot(t,u.onTriggerChange),p=bp(n),v=g.useRef("touch"),[m,b,w]=q3(S=>{const C=p().filter(T=>!T.disabled),N=C.find(T=>T.value===u.value),_=$3(C,S,N);_!==void 0&&u.onValueChange(_.value)}),j=S=>{d||(u.onOpenChange(!0),w()),S&&(u.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return o.jsx(cp,{asChild:!0,...l,children:o.jsx(dt.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":V3(u.value)?"":void 0,...i,ref:h,onClick:et(i.onClick,S=>{S.currentTarget.focus(),v.current!=="mouse"&&j(S)}),onPointerDown:et(i.onPointerDown,S=>{v.current=S.pointerType;const C=S.target;C.hasPointerCapture(S.pointerId)&&C.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(j(S),S.preventDefault())}),onKeyDown:et(i.onKeyDown,S=>{const C=m.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&b(S.key),!(C&&S.key===" ")&&yW.includes(S.key)&&(j(),S.preventDefault())})})})});y3.displayName=x3;var b3="SelectValue",w3=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:i,children:l,placeholder:u="",...d}=e,h=Ni(b3,n),{onValueNodeHasChildrenChange:p}=h,v=l!==void 0,m=Ot(t,h.onValueNodeChange);return Kn(()=>{p(v)},[p,v]),o.jsx(dt.span,{...d,ref:m,style:{pointerEvents:"none"},children:V3(h.value)?o.jsx(o.Fragment,{children:u}):l})});w3.displayName=b3;var NW="SelectIcon",S3=g.forwardRef((e,t)=>{const{__scopeSelect:n,children:a,...i}=e;return o.jsx(dt.span,{"aria-hidden":!0,...i,ref:t,children:a||"▼"})});S3.displayName=NW;var _W="SelectPortal",j3=e=>o.jsx(Gh,{asChild:!0,...e});j3.displayName=_W;var ao="SelectContent",C3=g.forwardRef((e,t)=>{const n=Ni(ao,e.__scopeSelect),[a,i]=g.useState();if(Kn(()=>{i(new DocumentFragment)},[]),!n.open){const l=a;return l?ka.createPortal(o.jsx(N3,{scope:e.__scopeSelect,children:o.jsx(yp.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),l):null}return o.jsx(_3,{...e,ref:t})});C3.displayName=ao;var la=10,[N3,_i]=Yl(ao),EW="SelectContentImpl",TW=dW("SelectContent.RemoveScroll"),_3=g.forwardRef((e,t)=>{const{__scopeSelect:n,position:a="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:l,onPointerDownOutside:u,side:d,sideOffset:h,align:p,alignOffset:v,arrowPadding:m,collisionBoundary:b,collisionPadding:w,sticky:j,hideWhenDetached:S,avoidCollisions:C,...N}=e,_=Ni(ao,n),[T,R]=g.useState(null),[D,L]=g.useState(null),k=Ot(t,ne=>R(ne)),[P,U]=g.useState(null),[J,$]=g.useState(null),W=bp(n),[fe,we]=g.useState(!1),Ce=g.useRef(!1);g.useEffect(()=>{if(T)return sw(T)},[T]),aw();const I=g.useCallback(ne=>{const[he,...Ee]=W().map(le=>le.ref.current),[je]=Ee.slice(-1),ke=document.activeElement;for(const le of ne)if(le===ke||(le?.scrollIntoView({block:"nearest"}),le===he&&D&&(D.scrollTop=0),le===je&&D&&(D.scrollTop=D.scrollHeight),le?.focus(),document.activeElement!==ke))return},[W,D]),V=g.useCallback(()=>I([P,T]),[I,P,T]);g.useEffect(()=>{fe&&V()},[fe,V]);const{onOpenChange:H,triggerPointerDownPosRef:be}=_;g.useEffect(()=>{if(T){let ne={x:0,y:0};const he=je=>{ne={x:Math.abs(Math.round(je.pageX)-(be.current?.x??0)),y:Math.abs(Math.round(je.pageY)-(be.current?.y??0))}},Ee=je=>{ne.x<=10&&ne.y<=10?je.preventDefault():T.contains(je.target)||H(!1),document.removeEventListener("pointermove",he),be.current=null};return be.current!==null&&(document.addEventListener("pointermove",he),document.addEventListener("pointerup",Ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",he),document.removeEventListener("pointerup",Ee,{capture:!0})}}},[T,H,be]),g.useEffect(()=>{const ne=()=>H(!1);return window.addEventListener("blur",ne),window.addEventListener("resize",ne),()=>{window.removeEventListener("blur",ne),window.removeEventListener("resize",ne)}},[H]);const[_e,B]=q3(ne=>{const he=W().filter(ke=>!ke.disabled),Ee=he.find(ke=>ke.ref.current===document.activeElement),je=$3(he,ne,Ee);je&&setTimeout(()=>je.ref.current.focus())}),G=g.useCallback((ne,he,Ee)=>{const je=!Ce.current&&!Ee;(_.value!==void 0&&_.value===he||je)&&(U(ne),je&&(Ce.current=!0))},[_.value]),X=g.useCallback(()=>T?.focus(),[T]),oe=g.useCallback((ne,he,Ee)=>{const je=!Ce.current&&!Ee;(_.value!==void 0&&_.value===he||je)&&$(ne)},[_.value]),me=a==="popper"?T0:E3,Z=me===T0?{side:d,sideOffset:h,align:p,alignOffset:v,arrowPadding:m,collisionBoundary:b,collisionPadding:w,sticky:j,hideWhenDetached:S,avoidCollisions:C}:{};return o.jsx(N3,{scope:n,content:T,viewport:D,onViewportChange:L,itemRefCallback:G,selectedItem:P,onItemLeave:X,itemTextRefCallback:oe,focusSelectedItem:V,selectedItemText:J,position:a,isPositioned:fe,searchRef:_e,children:o.jsx(Yh,{as:TW,allowPinchZoom:!0,children:o.jsx($h,{asChild:!0,trapped:_.open,onMountAutoFocus:ne=>{ne.preventDefault()},onUnmountAutoFocus:et(i,ne=>{_.trigger?.focus({preventScroll:!0}),ne.preventDefault()}),children:o.jsx(Qu,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:ne=>ne.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:o.jsx(me,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:ne=>ne.preventDefault(),...N,...Z,onPlaced:()=>we(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...N.style},onKeyDown:et(N.onKeyDown,ne=>{const he=ne.ctrlKey||ne.altKey||ne.metaKey;if(ne.key==="Tab"&&ne.preventDefault(),!he&&ne.key.length===1&&B(ne.key),["ArrowUp","ArrowDown","Home","End"].includes(ne.key)){let je=W().filter(ke=>!ke.disabled).map(ke=>ke.ref.current);if(["ArrowUp","End"].includes(ne.key)&&(je=je.slice().reverse()),["ArrowUp","ArrowDown"].includes(ne.key)){const ke=ne.target,le=je.indexOf(ke);je=je.slice(le+1)}setTimeout(()=>I(je)),ne.preventDefault()}})})})})})})});_3.displayName=EW;var RW="SelectItemAlignedPosition",E3=g.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:a,...i}=e,l=Ni(ao,n),u=_i(ao,n),[d,h]=g.useState(null),[p,v]=g.useState(null),m=Ot(t,k=>v(k)),b=bp(n),w=g.useRef(!1),j=g.useRef(!0),{viewport:S,selectedItem:C,selectedItemText:N,focusSelectedItem:_}=u,T=g.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&p&&S&&C&&N){const k=l.trigger.getBoundingClientRect(),P=p.getBoundingClientRect(),U=l.valueNode.getBoundingClientRect(),J=N.getBoundingClientRect();if(l.dir!=="rtl"){const ke=J.left-P.left,le=U.left-ke,Fe=k.left-le,Ge=k.width+Fe,He=Math.max(Ge,P.width),at=window.innerWidth-la,Ke=Oh(le,[la,Math.max(la,at-He)]);d.style.minWidth=Ge+"px",d.style.left=Ke+"px"}else{const ke=P.right-J.right,le=window.innerWidth-U.right-ke,Fe=window.innerWidth-k.right-le,Ge=k.width+Fe,He=Math.max(Ge,P.width),at=window.innerWidth-la,Ke=Oh(le,[la,Math.max(la,at-He)]);d.style.minWidth=Ge+"px",d.style.right=Ke+"px"}const $=b(),W=window.innerHeight-la*2,fe=S.scrollHeight,we=window.getComputedStyle(p),Ce=parseInt(we.borderTopWidth,10),I=parseInt(we.paddingTop,10),V=parseInt(we.borderBottomWidth,10),H=parseInt(we.paddingBottom,10),be=Ce+I+fe+H+V,_e=Math.min(C.offsetHeight*5,be),B=window.getComputedStyle(S),G=parseInt(B.paddingTop,10),X=parseInt(B.paddingBottom,10),oe=k.top+k.height/2-la,me=W-oe,Z=C.offsetHeight/2,ne=C.offsetTop+Z,he=Ce+I+ne,Ee=be-he;if(he<=oe){const ke=$.length>0&&C===$[$.length-1].ref.current;d.style.bottom="0px";const le=p.clientHeight-S.offsetTop-S.offsetHeight,Fe=Math.max(me,Z+(ke?X:0)+le+V),Ge=he+Fe;d.style.height=Ge+"px"}else{const ke=$.length>0&&C===$[0].ref.current;d.style.top="0px";const Fe=Math.max(oe,Ce+S.offsetTop+(ke?G:0)+Z)+Ee;d.style.height=Fe+"px",S.scrollTop=he-oe+S.offsetTop}d.style.margin=`${la}px 0`,d.style.minHeight=_e+"px",d.style.maxHeight=W+"px",a?.(),requestAnimationFrame(()=>w.current=!0)}},[b,l.trigger,l.valueNode,d,p,S,C,N,l.dir,a]);Kn(()=>T(),[T]);const[R,D]=g.useState();Kn(()=>{p&&D(window.getComputedStyle(p).zIndex)},[p]);const L=g.useCallback(k=>{k&&j.current===!0&&(T(),_?.(),j.current=!1)},[T,_]);return o.jsx(OW,{scope:n,contentWrapper:d,shouldExpandOnScrollRef:w,onScrollButtonChange:L,children:o.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R},children:o.jsx(dt.div,{...i,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});E3.displayName=RW;var AW="SelectPopperPosition",T0=g.forwardRef((e,t)=>{const{__scopeSelect:n,align:a="start",collisionPadding:i=la,...l}=e,u=wp(n);return o.jsx(Tw,{...u,...l,ref:t,align:a,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)"}})});T0.displayName=AW;var[OW,dS]=Yl(ao,{}),R0="SelectViewport",T3=g.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:a,...i}=e,l=_i(R0,n),u=dS(R0,n),d=Ot(t,l.onViewportChange),h=g.useRef(0);return o.jsxs(o.Fragment,{children:[o.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:a}),o.jsx(yp.Slot,{scope:n,children:o.jsx(dt.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:et(i.onScroll,p=>{const v=p.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:b}=u;if(b?.current&&m){const w=Math.abs(h.current-v.scrollTop);if(w>0){const j=window.innerHeight-la*2,S=parseFloat(m.style.minHeight),C=parseFloat(m.style.height),N=Math.max(S,C);if(N<j){const _=N+w,T=Math.min(j,_),R=_-T;m.style.height=T+"px",m.style.bottom==="0px"&&(v.scrollTop=R>0?R:0,m.style.justifyContent="flex-end")}}}h.current=v.scrollTop})})})]})});T3.displayName=R0;var R3="SelectGroup",[MW,DW]=Yl(R3),A3=g.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,i=ma();return o.jsx(MW,{scope:n,id:i,children:o.jsx(dt.div,{role:"group","aria-labelledby":i,...a,ref:t})})});A3.displayName=R3;var O3="SelectLabel",M3=g.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,i=DW(O3,n);return o.jsx(dt.div,{id:i.id,...a,ref:t})});M3.displayName=O3;var Mh="SelectItem",[PW,D3]=Yl(Mh),P3=g.forwardRef((e,t)=>{const{__scopeSelect:n,value:a,disabled:i=!1,textValue:l,...u}=e,d=Ni(Mh,n),h=_i(Mh,n),p=d.value===a,[v,m]=g.useState(l??""),[b,w]=g.useState(!1),j=Ot(t,_=>h.itemRefCallback?.(_,a,i)),S=ma(),C=g.useRef("touch"),N=()=>{i||(d.onValueChange(a),d.onOpenChange(!1))};if(a==="")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 o.jsx(PW,{scope:n,value:a,disabled:i,textId:S,isSelected:p,onItemTextChange:g.useCallback(_=>{m(T=>T||(_?.textContent??"").trim())},[]),children:o.jsx(yp.ItemSlot,{scope:n,value:a,disabled:i,textValue:v,children:o.jsx(dt.div,{role:"option","aria-labelledby":S,"data-highlighted":b?"":void 0,"aria-selected":p&&b,"data-state":p?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...u,ref:j,onFocus:et(u.onFocus,()=>w(!0)),onBlur:et(u.onBlur,()=>w(!1)),onClick:et(u.onClick,()=>{C.current!=="mouse"&&N()}),onPointerUp:et(u.onPointerUp,()=>{C.current==="mouse"&&N()}),onPointerDown:et(u.onPointerDown,_=>{C.current=_.pointerType}),onPointerMove:et(u.onPointerMove,_=>{C.current=_.pointerType,i?h.onItemLeave?.():C.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:et(u.onPointerLeave,_=>{_.currentTarget===document.activeElement&&h.onItemLeave?.()}),onKeyDown:et(u.onKeyDown,_=>{h.searchRef?.current!==""&&_.key===" "||(bW.includes(_.key)&&N(),_.key===" "&&_.preventDefault())})})})})});P3.displayName=Mh;var uu="SelectItemText",k3=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:i,...l}=e,u=Ni(uu,n),d=_i(uu,n),h=D3(uu,n),p=CW(uu,n),[v,m]=g.useState(null),b=Ot(t,N=>m(N),h.onItemTextChange,N=>d.itemTextRefCallback?.(N,h.value,h.disabled)),w=v?.textContent,j=g.useMemo(()=>o.jsx("option",{value:h.value,disabled:h.disabled,children:w},h.value),[h.disabled,h.value,w]),{onNativeOptionAdd:S,onNativeOptionRemove:C}=p;return Kn(()=>(S(j),()=>C(j)),[S,C,j]),o.jsxs(o.Fragment,{children:[o.jsx(dt.span,{id:h.textId,...l,ref:b}),h.isSelected&&u.valueNode&&!u.valueNodeHasChildren?ka.createPortal(l.children,u.valueNode):null]})});k3.displayName=uu;var L3="SelectItemIndicator",B3=g.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return D3(L3,n).isSelected?o.jsx(dt.span,{"aria-hidden":!0,...a,ref:t}):null});B3.displayName=L3;var A0="SelectScrollUpButton",I3=g.forwardRef((e,t)=>{const n=_i(A0,e.__scopeSelect),a=dS(A0,e.__scopeSelect),[i,l]=g.useState(!1),u=Ot(t,a.onScrollButtonChange);return Kn(()=>{if(n.viewport&&n.isPositioned){let d=function(){const p=h.scrollTop>0;l(p)};const h=n.viewport;return d(),h.addEventListener("scroll",d),()=>h.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),i?o.jsx(F3,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=n;d&&h&&(d.scrollTop=d.scrollTop-h.offsetHeight)}}):null});I3.displayName=A0;var O0="SelectScrollDownButton",z3=g.forwardRef((e,t)=>{const n=_i(O0,e.__scopeSelect),a=dS(O0,e.__scopeSelect),[i,l]=g.useState(!1),u=Ot(t,a.onScrollButtonChange);return Kn(()=>{if(n.viewport&&n.isPositioned){let d=function(){const p=h.scrollHeight-h.clientHeight,v=Math.ceil(h.scrollTop)<p;l(v)};const h=n.viewport;return d(),h.addEventListener("scroll",d),()=>h.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),i?o.jsx(F3,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=n;d&&h&&(d.scrollTop=d.scrollTop+h.offsetHeight)}}):null});z3.displayName=O0;var F3=g.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:a,...i}=e,l=_i("SelectScrollButton",n),u=g.useRef(null),d=bp(n),h=g.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return g.useEffect(()=>()=>h(),[h]),Kn(()=>{d().find(v=>v.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[d]),o.jsx(dt.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:et(i.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(a,50))}),onPointerMove:et(i.onPointerMove,()=>{l.onItemLeave?.(),u.current===null&&(u.current=window.setInterval(a,50))}),onPointerLeave:et(i.onPointerLeave,()=>{h()})})}),kW="SelectSeparator",H3=g.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return o.jsx(dt.div,{"aria-hidden":!0,...a,ref:t})});H3.displayName=kW;var M0="SelectArrow",LW=g.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,i=wp(n),l=Ni(M0,n),u=_i(M0,n);return l.open&&u.position==="popper"?o.jsx(Rw,{...i,...a,ref:t}):null});LW.displayName=M0;var BW="SelectBubbleInput",U3=g.forwardRef(({__scopeSelect:e,value:t,...n},a)=>{const i=g.useRef(null),l=Ot(a,i),u=gp(t);return g.useEffect(()=>{const d=i.current;if(!d)return;const h=window.HTMLSelectElement.prototype,v=Object.getOwnPropertyDescriptor(h,"value").set;if(u!==t&&v){const m=new Event("change",{bubbles:!0});v.call(d,t),d.dispatchEvent(m)}},[u,t]),o.jsx(dt.select,{...n,style:{...m3,...n.style},ref:l,defaultValue:t})});U3.displayName=BW;function V3(e){return e===""||e===void 0}function q3(e){const t=gi(e),n=g.useRef(""),a=g.useRef(0),i=g.useCallback(u=>{const d=n.current+u;t(d),(function h(p){n.current=p,window.clearTimeout(a.current),p!==""&&(a.current=window.setTimeout(()=>h(""),1e3))})(d)},[t]),l=g.useCallback(()=>{n.current="",window.clearTimeout(a.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(a.current),[]),[n,i,l]}function $3(e,t,n){const i=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,l=n?e.indexOf(n):-1;let u=IW(e,Math.max(l,0));i.length===1&&(u=u.filter(p=>p!==n));const h=u.find(p=>p.textValue.toLowerCase().startsWith(i.toLowerCase()));return h!==n?h:void 0}function IW(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var zW=v3,G3=y3,FW=w3,HW=S3,UW=j3,K3=C3,VW=T3,qW=A3,Y3=M3,W3=P3,$W=k3,GW=B3,X3=I3,Q3=z3,Z3=H3;const Pn=zW,TT=qW,qn=FW,An=g.forwardRef(({className:e,children:t,...n},a)=>o.jsxs(G3,{ref:a,className:ct("flex h-10 w-full items-center justify-between rounded-full border border-input bg-background px-4 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,o.jsx(HW,{asChild:!0,children:o.jsx(cw,{className:"h-4 w-4 opacity-50"})})]}));An.displayName=G3.displayName;const J3=g.forwardRef(({className:e,...t},n)=>o.jsx(X3,{ref:n,className:ct("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(WH,{className:"h-4 w-4"})}));J3.displayName=X3.displayName;const e5=g.forwardRef(({className:e,...t},n)=>o.jsx(Q3,{ref:n,className:ct("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(cw,{className:"h-4 w-4"})}));e5.displayName=Q3.displayName;const On=g.forwardRef(({className:e,children:t,position:n="popper",...a},i)=>o.jsx(UW,{children:o.jsxs(K3,{ref:i,className:ct("relative z-[9999] max-h-[min(var(--radix-select-content-available-height,256px),256px)] min-w-[8rem] overflow-hidden rounded-2xl 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]",n==="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:n,...a,children:[o.jsx(J3,{}),o.jsx(VW,{className:ct("p-1 max-h-[inherit] overflow-y-auto",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),o.jsx(e5,{})]})}));On.displayName=K3.displayName;const D0=g.forwardRef(({className:e,...t},n)=>o.jsx(Y3,{ref:n,className:ct("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));D0.displayName=Y3.displayName;const tt=g.forwardRef(({className:e,children:t,...n},a)=>o.jsxs(W3,{ref:a,className:ct("relative flex w-full cursor-default select-none items-center rounded-xl py-1.5 pl-8 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(GW,{children:o.jsx(eD,{className:"h-4 w-4"})})}),o.jsx($W,{children:t})]}));tt.displayName=W3.displayName;const KW=g.forwardRef(({className:e,...t},n)=>o.jsx(Z3,{ref:n,className:ct("-mx-1 my-1 h-px bg-muted",e),...t}));KW.displayName=Z3.displayName;const YW=XM,WW=QM,t5=g.forwardRef(({className:e,...t},n)=>o.jsx(Xh,{className:ct("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,ref:n}));t5.displayName=Xh.displayName;const XW=Xu("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-full border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-md"}},defaultVariants:{side:"right"}}),n5=g.forwardRef(({side:e="right",className:t,children:n,...a},i)=>o.jsxs(WW,{children:[o.jsx(t5,{}),o.jsxs(Qh,{ref:i,className:ct(XW({side:e}),t),...a,children:[n,o.jsxs(ZM,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background 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-secondary",children:[o.jsx(nD,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));n5.displayName=Qh.displayName;const r5=({className:e,...t})=>o.jsx("div",{className:ct("flex flex-col space-y-2 text-center sm:text-left",e),...t});r5.displayName="SheetHeader";const a5=g.forwardRef(({className:e,...t},n)=>o.jsx(Zh,{ref:n,className:ct("text-lg font-semibold text-foreground",e),...t}));a5.displayName=Zh.displayName;const QW=g.forwardRef(({className:e,...t},n)=>o.jsx(Jh,{ref:n,className:ct("text-sm text-muted-foreground",e),...t}));QW.displayName=Jh.displayName;const P0=[{value:"adaptive",label:"Adaptive",description:"Automatically picks the best clear direction based on where the ball is"},{value:"clear_from_in",label:"From Center",description:"Spirals outward from the center to erase the current pattern"},{value:"clear_from_out",label:"From Perimeter",description:"Spirals inward from the edge to erase the current pattern"},{value:"clear_sideway",label:"Sideways",description:"Sweeps side-to-side across the sand to erase the current pattern"},{value:"none",label:"None",description:"Start drawing immediately without clearing the sand first"}],s5=g.createContext(null);function ZW(){const{isPlayOnlyActive:e}=HO()||{},[t,n]=g.useState([]),[a,i]=g.useState({}),[l,u]=g.useState(!0),[d,h]=g.useState(""),[p,v]=g.useState("all"),[m,b]=g.useState("name"),[w,j]=g.useState(!0),[S,C]=g.useState(null),[N,_]=g.useState(!1),[T,R]=g.useState(()=>localStorage.getItem("preExecution")||"adaptive"),[D,L]=g.useState(!1),[k,P]=g.useState(!1),[U,J]=g.useState([]),[$,W]=g.useState(!1),[fe,we]=g.useState(!1),[Ce,I]=g.useState(1),[V,H]=g.useState(0),[be,_e]=g.useState(null),[B,G]=g.useState({}),X=g.useRef(null),oe=g.useRef(null),me=g.useRef(0),Z=g.useRef(new Set),ne=g.useRef(null),he=g.useRef(null),[Ee,je]=g.useState(!1),[ke,le]=g.useState(0),[Fe,Ge]=g.useState(!1),[He,at]=g.useState(new Set),Ke=g.useRef(null),[Mt,St]=g.useState(!1),_t=g.useRef(null),jt=Y=>{_t.current={x:Y.touches[0].clientX,y:Y.touches[0].clientY}},ot=Y=>{if(!_t.current)return;const xe=Y.changedTouches[0].clientX-_t.current.x,Le=Y.changedTouches[0].clientY-_t.current.y;(xe>80&&xe>Math.abs(Le)||Le>80&&Le>Math.abs(xe))&&_(!1),_t.current=null};g.useEffect(()=>{const Y=()=>{_(!1)};return window.addEventListener("playback-started",Y),()=>window.removeEventListener("playback-started",Y)},[]),g.useEffect(()=>{localStorage.setItem("preExecution",T)},[T]),g.useEffect(()=>(dp().then(()=>{Vt()}).catch(()=>{Vt()}),lt(),()=>{ne.current&&clearTimeout(ne.current),he.current&&he.current.abort(),Z.current.clear()}),[]),cS(()=>{Vt(),lt()});const lt=async()=>{try{const Y=await de.get("/get_playlist?name=Favorites");at(new Set(Y.files||[]))}catch{}},Ct=async(Y,xe)=>{xe.stopPropagation();const Le=He.has(Y),Ie=new Set(He);try{if(Le)Ie.delete(Y),await de.post("/modify_playlist",{playlist_name:"Favorites",files:Array.from(Ie)}),at(Ie),K.success("Removed from favorites");else{Ie.add(Y);try{await de.get("/get_playlist?name=Favorites"),await de.post("/add_to_playlist",{playlist_name:"Favorites",pattern:Y})}catch{await de.post("/create_playlist",{playlist_name:"Favorites",files:[Y]})}at(Ie),K.success("Added to favorites")}}catch{K.error("Failed to update favorites")}},Vt=async()=>{u(!0);try{const[Y,xe]=await Promise.all([de.get("/list_theta_rho_files_with_metadata"),de.get("/api/pattern_history_all")]);if(n(Y),G(xe),Y.length>0){const Le=[...Y].sort((it,zt)=>it.name.localeCompare(zt.name)),Ie=Y.map(it=>it.path),Ue=Le.slice(0,30).map(it=>it.path),ut=await bu(Ue);if(ut.size>0){const it={};ut.forEach((zt,Zn)=>{it[Zn]=zt}),i(it)}const Et=Ue.filter(it=>!ut.has(it));Et.length>0&&Kt(Et);const Rt=await bu(Ie);Ge(Rt.size===Ie.length)}}catch(Y){console.error("Error fetching patterns:",Y),K.error("Failed to load patterns")}finally{u(!1)}},Kt=async Y=>{he.current=new AbortController;const Le=he.current.signal;try{const Ie=await bu(Y);if(Ie.size>0){const ut={};Ie.forEach((Et,Rt)=>{ut[Rt]=Et}),i(Et=>({...Et,...ut}))}const Ue=Y.filter(ut=>!Ie.has(ut));if(Ue.length>0)for(let ut=0;ut<Ue.length&&!Le.aborted;ut+=10){const Et=Ue.slice(ut,ut+10);try{const Rt=await de.post("/preview_thr_batch",{file_names:Et},Le);for(const[it,zt]of Object.entries(Rt))zt&&!zt.error&&Ow(it,zt);i(it=>({...it,...Rt}))}catch(Rt){if(Rt instanceof Error&&Rt.name==="AbortError")break}ut+10<Ue.length&&await new Promise(Rt=>setTimeout(Rt,100))}}catch(Ie){if(Ie instanceof Error&&Ie.name==="AbortError")return;console.error("Error fetching previews:",Ie)}},Wt=async Y=>{W(!0);try{const xe=await de.post("/get_theta_rho_coordinates",{file_name:Y});J(xe.coordinates||[])}catch(xe){console.error("Error fetching coordinates:",xe),K.error("Failed to load pattern coordinates")}finally{W(!1)}},te=g.useMemo(()=>{const Y=new Set(t.map(xe=>xe.category));return["all",...Array.from(Y).sort()]},[t]),Me=g.useMemo(()=>{let Y=t;return p!=="all"&&(Y=Y.filter(xe=>xe.category===p)),d&&(Y=Y.filter(xe=>Au(xe.name,d)||Au(xe.category,d))),Y=[...Y].sort((xe,Le)=>{let Ie=0;switch(m){case"name":Ie=xe.name.localeCompare(Le.name);break;case"date":Ie=xe.date_modified-Le.date_modified;break;case"size":Ie=xe.coordinates_count-Le.coordinates_count;break;case"favorites":{const Ue=He.has(xe.path)?1:0;Ie=(He.has(Le.path)?1:0)-Ue,Ie===0&&(Ie=xe.name.localeCompare(Le.name));break}case"plays":{const Ue=xe.path.split("/").pop()||"",ut=Le.path.split("/").pop()||"",Et=B[Ue]?.play_count??0,Rt=B[ut]?.play_count??0;Ie=Et-Rt,Ie===0&&(Ie=xe.name.localeCompare(Le.name));break}case"last_played":{const Ue=xe.path.split("/").pop()||"",ut=Le.path.split("/").pop()||"",Et=B[Ue]?.last_played||"",Rt=B[ut]?.last_played||"";Ie=Et.localeCompare(Rt),Ie===0&&(Ie=xe.name.localeCompare(Le.name));break}default:return 0}return w?Ie:-Ie}),Y},[t,p,d,m,w,He,B]),st=g.useCallback(Y=>{a[Y]||Z.current.has(Y)||(Z.current.add(Y),ne.current&&clearTimeout(ne.current),ne.current=setTimeout(()=>{const xe=Array.from(Z.current);xe.length>0&&(Z.current.clear(),Kt(xe))},50))},[a]),nt=g.useCallback((Y,xe,Le)=>{const Ie=Le/2,Ue=Le/2,ut=Le/2*.9*xe,Et=Ie+ut*Math.cos(Y),Rt=Ue+ut*Math.sin(Y);return{x:Et,y:Rt}},[]),yt=g.useRef(null),gt=g.useRef(-1),xt=g.useRef(null),qt=g.useCallback(()=>{const Y=document.documentElement.classList.contains("dark");return{isDark:Y,bgOuter:Y?"#1a1a1a":"#f5f5f5",bgInner:Y?"#262626":"#ffffff",borderColor:Y?"rgba(255, 255, 255, 0.2)":"rgba(128, 128, 128, 0.3)",lineColor:Y?"#e5e5e5":"#333333",markerBorder:Y?"#333333":"#ffffff"}},[]),ue=g.useCallback((Y,xe)=>{const Le=qt();yt.current||(yt.current=document.createElement("canvas"));const Ie=yt.current;Ie.width=Y,Ie.height=Y;const Ue=Ie.getContext("2d");if(Ue){if(Ue.fillStyle=Le.bgOuter,Ue.fillRect(0,0,Y,Y),Ue.beginPath(),Ue.arc(Y/2,Y/2,Y/2*.95,0,Math.PI*2),Ue.fillStyle=Le.bgInner,Ue.fill(),Ue.strokeStyle=Le.borderColor,Ue.lineWidth=1,Ue.stroke(),Ue.strokeStyle=Le.lineColor,Ue.lineWidth=1,Ue.lineCap="round",Ue.lineJoin="round",xe.length>0){const ut=nt(xe[0][0],xe[0][1],Y);Ue.beginPath(),Ue.moveTo(ut.x,ut.y),Ue.stroke()}gt.current=0,xt.current=Le.isDark}},[qt,nt]),Oe=g.useCallback((Y,xe,Le,Ie=!1)=>{const ut=Y.canvas.width,Et=qt();(Ie||!yt.current||xt.current!==Et.isDark||Le<gt.current)&&ue(ut,xe);const it=yt.current;if(!it)return;const zt=it.getContext("2d");if(zt){if(xe.length>0&&Le>gt.current){zt.strokeStyle=Et.lineColor,zt.lineWidth=1,zt.lineCap="round",zt.lineJoin="round",zt.beginPath();const Zn=nt(xe[gt.current][0],xe[gt.current][1],ut);zt.moveTo(Zn.x,Zn.y);for(let Na=gt.current+1;Na<=Le&&Na<xe.length;Na++){const Ti=nt(xe[Na][0],xe[Na][1],ut);zt.lineTo(Ti.x,Ti.y)}zt.stroke(),gt.current=Le}if(Y.drawImage(it,0,0),Le<xe.length&&xe.length>0){const Zn=nt(xe[Le][0],xe[Le][1],ut);Y.beginPath(),Y.arc(Zn.x,Zn.y,5,0,Math.PI*2),Y.fillStyle="#0b80ee",Y.fill(),Y.strokeStyle=Et.markerBorder,Y.lineWidth=1,Y.stroke()}}},[qt,ue,nt]);g.useEffect(()=>{if(!fe||U.length===0||!X.current)return;const Y=X.current.getContext("2d");if(!Y)return;let xe=performance.now();const Le=100*Ce,Ie=Ue=>{const ut=(Ue-xe)/1e3;xe=Ue;const Et=Math.floor(ut*Le);me.current=Math.min(me.current+Math.max(1,Et),U.length-1),Oe(Y,U,me.current),H(me.current/(U.length-1)*100),me.current<U.length-1?oe.current=requestAnimationFrame(Ie):we(!1)};return oe.current=requestAnimationFrame(Ie),()=>{oe.current&&cancelAnimationFrame(oe.current)}},[fe,U,Ce,Oe]),g.useEffect(()=>{if(U.length>0&&X.current){const Y=X.current.getContext("2d");Y&&(me.current=0,H(0),Oe(Y,U,0,!0))}},[U,Oe]);const Be=async Y=>{C(Y),_(!0),R("adaptive"),_e(null);try{const xe=await de.get(`/api/pattern_history/${encodeURIComponent(Y.path)}`);_e(xe)}catch{}},Qe=async()=>{S&&(_(!1),P(!0),we(!1),H(0),me.current=0,await Wt(S.path),we(!0))},Pe=()=>{P(!1),we(!1),oe.current&&cancelAnimationFrame(oe.current),J([])},Ze=()=>{fe?we(!1):(me.current>=U.length-1&&(me.current=0,H(0)),we(!0))},ft=()=>{if(we(!1),me.current=0,H(0),X.current&&U.length>0){const Y=X.current.getContext("2d");Y&&Oe(Y,U,0,!0)}},pt=Y=>{const xe=Y[0];if(H(xe),me.current=Math.floor(xe/100*(U.length-1)),X.current&&U.length>0){const Le=X.current.getContext("2d");Le&&Oe(Le,U,me.current)}},z=async()=>{if(S){L(!0);try{await de.post("/run_theta_rho",{file_name:S.path,pre_execution:T}),K.success(`Running ${S.name}`),_(!1),window.dispatchEvent(new CustomEvent("playback-started"))}catch(Y){const xe=Y instanceof Error?Y.message:"Failed to run pattern";xe.includes("409")||xe.includes("already running")?K.error("Another pattern is already running"):K.error(xe)}finally{L(!1)}}},Se=async()=>{if(S){if(!S.path.startsWith("custom_patterns/")){K.error("Only custom patterns can be deleted");return}if(confirm(`Delete "${S.name}"? This cannot be undone.`))try{await de.post("/delete_theta_rho_file",{file_name:S.path}),K.success(`Deleted ${S.name}`),_(!1),C(null),Vt()}catch{K.error("Failed to delete pattern")}}},Ae=async Y=>{if(S)try{await de.post("/add_to_queue",{pattern:S.path,position:Y}),K.success(Y==="next"?"Playing next":"Added to queue")}catch(xe){const Le=xe instanceof Error?xe.message:"Failed to add to queue";Le.includes("400")||Le.includes("No playlist")?K.error("No playlist is currently running"):K.error(Le)}},Re=Y=>a[Y]?.image_data||null,M=Y=>Y?`(${Y.x.toFixed(1)}, ${Y.y.toFixed(1)})`:"(-, -)",ge=S?.path.startsWith("custom_patterns/"),Ne=async()=>{if(Ee)return;je(!0),le(0);const Y=await uP(xe=>{const Le=xe.total>0?Math.round(xe.completed/xe.total*100):0;le(Le)});Y.success?(Ge(!0),Y.cached===0?K.success("All patterns are already cached!"):K.success("All pattern previews have been cached!")):K.error("Failed to cache previews"),je(!1),le(0)},mt=async Y=>{const xe=Y.target.files;if(!xe||xe.length===0)return;const Le=Array.from(xe).filter(Ue=>!Ue.name.endsWith(".thr"));if(Le.length>0){K.error(`Invalid file${Le.length>1?"s":""}: ${Le.map(Ue=>Ue.name).join(", ")}. Only .thr files are accepted.`);return}St(!0);let Ie=0;for(const Ue of Array.from(xe))try{await de.uploadFile("/upload_theta_rho",Ue),Ie++}catch(ut){console.error(`Upload error for ${Ue.name}:`,ut),K.error(`Failed to upload "${Ue.name}"`)}Ie>0&&(K.success(Ie===1?`Pattern "${xe[0].name}" uploaded successfully`:`${Ie} pattern${Ie>1?"s":""} uploaded successfully`),await Vt()),St(!1),Ke.current&&(Ke.current.value="")};return l?o.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:o.jsx("span",{className:"material-icons-outlined animate-spin text-4xl text-muted-foreground",children:"sync"})}):o.jsxs("div",{className:"flex flex-col w-full max-w-5xl mx-auto gap-3 sm:gap-6 py-3 sm:py-6 px-0 sm:px-4",children:[!e&&o.jsx("input",{ref:Ke,type:"file",accept:".thr",multiple:!0,onChange:mt,className:"hidden"}),o.jsxs("div",{className:"flex items-start justify-between gap-4 pl-1",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Browse Patterns"}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.length," patterns available"]})]}),!e&&o.jsxs(se,{variant:"ghost",onClick:()=>Ke.current?.click(),disabled:Mt,className:"gap-2 shrink-0 h-9 w-9 sm:h-11 sm:w-auto rounded-full px-0 sm:px-4 justify-center bg-card border border-border shadow-sm hover:bg-accent",children:[Mt?o.jsx("span",{className:"material-icons-outlined animate-spin text-lg",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-lg",children:"add"}),o.jsx("span",{className:"hidden sm:inline",children:"Add Pattern"})]})]}),o.jsx("div",{className:"sticky z-30 py-3 -mx-0 sm:-mx-4 px-0 sm:px-4 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",style:{top:"calc(4.5rem + env(safe-area-inset-top, 0px))"},children:o.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[o.jsxs("div",{className:"relative flex-1 min-w-0",children:[o.jsx("span",{className:"material-icons-outlined absolute left-3 sm:left-4 top-1/2 -translate-y-1/2 text-muted-foreground text-lg sm:text-xl",children:"search"}),o.jsx(wt,{value:d,onChange:Y=>h(Y.target.value),placeholder:"Search...",className:"pl-9 sm:pl-11 pr-10 h-9 sm:h-11 rounded-full bg-card border-border shadow-sm text-xs sm:text-sm focus:ring-2 focus:ring-ring"}),d&&o.jsx(se,{variant:"ghost",size:"icon",onClick:()=>h(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground h-7 w-7 rounded-full",children:o.jsx("span",{className:"material-icons-outlined text-lg",children:"close"})})]}),o.jsxs(Pn,{value:p,onValueChange:v,children:[o.jsxs(An,{className:"h-9 w-9 sm:h-11 sm:w-auto rounded-full bg-card border-border shadow-sm text-xs sm:text-sm shrink-0 [&>svg]:hidden sm:[&>svg]:block px-0 sm:px-3 justify-center sm:justify-between [&>span:last-of-type]:hidden sm:[&>span:last-of-type]:inline gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-lg shrink-0 sm:hidden",children:"folder"}),o.jsx(qn,{placeholder:"All"})]}),o.jsx(On,{children:te.map(Y=>o.jsx(tt,{value:Y,children:Y==="all"?"All":Y==="root"?"Default":Y},Y))})]}),o.jsxs(Pn,{value:m,onValueChange:Y=>{const xe=Y;b(xe),j(xe!=="plays"&&xe!=="last_played")},children:[o.jsxs(An,{className:"h-9 w-9 sm:h-11 sm:w-auto rounded-full bg-card border-border shadow-sm text-xs sm:text-sm shrink-0 [&>svg]:hidden sm:[&>svg]:block px-0 sm:px-3 justify-center sm:justify-between [&>span:last-of-type]:hidden sm:[&>span:last-of-type]:inline gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-lg shrink-0 sm:hidden",children:"sort"}),o.jsx(qn,{placeholder:"Sort"})]}),o.jsxs(On,{children:[o.jsx(tt,{value:"favorites",children:"Favorites"}),o.jsx(tt,{value:"name",children:"Name"}),o.jsx(tt,{value:"date",children:"Modified"}),o.jsx(tt,{value:"size",children:"Size"}),o.jsx(tt,{value:"plays",children:"Most Played"}),o.jsx(tt,{value:"last_played",children:"Last Played"})]})]}),o.jsx(se,{variant:"outline",size:"icon",onClick:()=>j(!w),className:"shrink-0 h-9 w-9 sm:h-11 sm:w-11 rounded-full bg-card shadow-sm",title:w?"Ascending":"Descending",children:o.jsx("span",{className:"material-icons-outlined text-lg sm:text-xl",children:w?"arrow_upward":"arrow_downward"})}),!Fe&&o.jsx(se,{variant:"outline",onClick:Ne,className:`shrink-0 rounded-full bg-card shadow-sm gap-2 ${Ee?"h-9 sm:h-11 w-auto px-3 sm:px-4":"h-9 w-9 sm:h-11 sm:w-auto px-0 sm:px-4 justify-center sm:justify-start"}`,title:"Cache All Previews",children:Ee?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"material-icons-outlined animate-spin text-lg",children:"sync"}),o.jsxs("span",{className:"text-sm",children:[ke,"%"]})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"material-icons-outlined text-lg",children:"cached"}),o.jsx("span",{className:"hidden sm:inline text-sm",children:"Cache"})]})})]})}),(d||p!=="all")&&o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",Me.length," of ",t.length," patterns"]}),Me.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[40vh] gap-4 text-center",children:[o.jsx("div",{className:"p-4 rounded-full bg-muted",children:o.jsx("span",{className:"material-icons-outlined text-5xl text-muted-foreground",children:"search_off"})}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("h2",{className:"text-xl font-semibold",children:"No patterns found"}),o.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your search or filters"})]}),(d||p!=="all")&&o.jsx(se,{variant:"secondary",onClick:()=>{h(""),v("all")},children:"Clear Filters"})]}):o.jsx(s5.Provider,{value:{requestPreview:st,previews:a},children:o.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 gap-2 sm:gap-4",children:Me.map(Y=>o.jsx(JW,{pattern:Y,isSelected:S?.path===Y.path,isFavorite:He.has(Y.path),playTime:B[Y.path.split("/").pop()||""]?.actual_time_formatted||null,playCount:B[Y.path.split("/").pop()||""]?.play_count??0,onToggleFavorite:Ct,onClick:()=>Be(Y)},Y.path))})}),o.jsx("div",{className:"h-48"}),o.jsx(YW,{open:N,onOpenChange:_,children:o.jsxs(n5,{className:"flex flex-col p-0 overflow-hidden pt-safe",onTouchStart:jt,onTouchEnd:ot,children:[o.jsx(r5,{className:"px-6 py-4 shrink-0",children:o.jsxs(a5,{className:"flex items-center gap-2 pr-8",children:[S&&o.jsx("span",{role:"button",tabIndex:0,className:`shrink-0 transition-colors cursor-pointer flex items-center ${He.has(S.path)?"text-red-500 hover:text-red-600":"text-muted-foreground hover:text-red-500"}`,onClick:Y=>Ct(S.path,Y),onKeyDown:Y=>{(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),Ct(S.path,Y))},title:He.has(S.path)?"Remove from favorites":"Add to favorites",children:o.jsx("span",{className:"material-icons",style:{fontSize:"20px"},children:He.has(S.path)?"favorite":"favorite_border"})}),o.jsx("span",{className:"truncate",children:S?.name||"Pattern Details"})]})}),S&&o.jsxs("div",{className:"p-6 overflow-y-auto flex-1",children:[o.jsxs("div",{className:"mb-6",children:[o.jsxs("div",{className:"aspect-square w-full max-w-[280px] mx-auto overflow-hidden rounded-full border bg-muted relative group cursor-pointer",onClick:Qe,children:[Re(S.path)?o.jsx("img",{src:Re(S.path),alt:S.name,className:"w-full h-full object-cover pattern-preview"}):o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:o.jsx("span",{className:"material-icons-outlined text-4xl text-muted-foreground",children:"image"})}),o.jsx("div",{className:"absolute bottom-2 right-2 bg-background/90 backdrop-blur-sm rounded-full w-10 h-10 flex items-center justify-center shadow-md border group-hover:scale-110 transition-transform",children:o.jsx("span",{className:"material-icons text-xl",children:"play_arrow"})}),o.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-200 bg-black/20 rounded-full"})]}),o.jsx("p",{className:"text-xs text-muted-foreground text-center mt-2",children:"Tap to preview animation"})]}),o.jsxs("div",{className:"mb-4 flex justify-between text-sm",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-base",children:"flag"}),o.jsx("span",{className:"text-muted-foreground",children:"First:"}),o.jsx("span",{className:"font-semibold",children:M(a[S.path]?.first_coordinate)})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-base",children:"check"}),o.jsx("span",{className:"text-muted-foreground",children:"Last:"}),o.jsx("span",{className:"font-semibold",children:M(a[S.path]?.last_coordinate)})]})]}),(()=>{const Y=S.path.split("/").pop()||"",xe=B[Y]?.play_count??0;return o.jsx(o.Fragment,{children:(be?.actual_time_formatted||xe>0)&&o.jsxs("div",{className:"mb-4 flex justify-between text-sm",children:[be?.actual_time_formatted&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-base",children:"schedule"}),o.jsx("span",{className:"text-muted-foreground",children:"Last run:"}),o.jsx("span",{className:"font-semibold",children:be.actual_time_formatted})]}),xe>0&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-base",children:"play_circle"}),o.jsx("span",{className:"text-muted-foreground",children:"Plays:"}),o.jsx("span",{className:"font-semibold",children:xe})]})]})})})(),o.jsxs("div",{className:"mb-6",children:[o.jsx(Ye,{className:"text-sm font-semibold mb-3 block",children:"Clear"}),o.jsx("div",{className:"grid grid-cols-2 gap-2",children:P0.map(Y=>o.jsxs("label",{className:`relative flex cursor-pointer items-center justify-center rounded-lg border p-2.5 text-center text-sm font-medium transition-all hover:border-primary ${T===Y.value?"border-primary bg-primary text-primary-foreground ring-2 ring-primary ring-offset-2 ring-offset-background":"border-border text-muted-foreground hover:text-foreground"}`,children:[Y.label,o.jsx("input",{type:"radio",name:"preExecutionAction",value:Y.value,checked:T===Y.value,onChange:()=>R(Y.value),className:"sr-only"})]},Y.value))}),o.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:P0.find(Y=>Y.value===T)?.description})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(se,{onClick:z,disabled:D,className:"flex-1 gap-2",size:"lg",children:[D?o.jsx("span",{className:"material-icons-outlined animate-spin text-lg",children:"sync"}):o.jsx("span",{className:"material-icons text-lg",children:"play_arrow"}),"Play"]}),ge&&o.jsx(se,{variant:"outline",onClick:Se,className:"text-destructive hover:bg-destructive/10 hover:border-destructive px-3",size:"lg",children:o.jsx("span",{className:"material-icons text-lg",children:"delete"})})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(se,{variant:"outline",size:"sm",className:"flex-1 gap-1.5",onClick:()=>Ae("next"),children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"playlist_play"}),"Play Next"]}),o.jsxs(se,{variant:"outline",size:"sm",className:"flex-1 gap-1.5",onClick:()=>Ae("end"),children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"playlist_add"}),"Add to Queue"]})]})]})]})]})}),k&&o.jsx("div",{className:"fixed inset-0 bg-black/80 z-[60] flex items-center justify-center p-4",onClick:Pe,children:o.jsxs("div",{className:"bg-background rounded-lg shadow-xl max-w-4xl w-full max-h-[95vh] flex flex-col overflow-hidden",onClick:Y=>Y.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between p-6 border-b shrink-0",children:[o.jsx("h3",{className:"text-xl font-semibold",children:S?.name||"Animated Preview"}),o.jsx(se,{variant:"ghost",size:"icon",onClick:Pe,className:"rounded-full",children:o.jsx("span",{className:"material-icons text-2xl",children:"close"})})]}),o.jsx("div",{className:"p-6 overflow-y-auto flex-1 flex justify-center items-center",children:$?o.jsx("div",{className:"w-full max-w-[400px] aspect-square flex items-center justify-center rounded-full bg-muted",children:o.jsx("span",{className:"material-icons-outlined animate-spin text-4xl text-muted-foreground",children:"sync"})}):o.jsxs("div",{className:"relative w-full max-w-[400px] aspect-square",children:[o.jsx("canvas",{ref:X,width:400,height:400,className:"rounded-full w-full h-full"}),o.jsx("div",{className:"absolute inset-0 flex items-center justify-center cursor-pointer rounded-full opacity-0 hover:opacity-100 transition-opacity bg-black/10",onClick:Ze,children:o.jsx("div",{className:"bg-background rounded-full w-16 h-16 flex items-center justify-center shadow-lg",children:o.jsx("span",{className:"material-icons text-3xl",children:fe?"pause":"play_arrow"})})})]})}),o.jsxs("div",{className:"p-6 space-y-4 shrink-0 border-t",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex justify-between mb-2",children:[o.jsx(Ye,{className:"text-sm font-medium",children:"Speed"}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[Ce,"x"]})]}),o.jsx(_l,{value:[Ce],onValueChange:Y=>I(Y[0]),min:.1,max:5,step:.1,className:"py-2"})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex justify-between mb-2",children:[o.jsx(Ye,{className:"text-sm font-medium",children:"Progress"}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[V.toFixed(0),"%"]})]}),o.jsx(_l,{value:[V],onValueChange:pt,min:0,max:100,step:.1,className:"py-2"})]}),o.jsxs("div",{className:"flex items-center justify-center gap-4",children:[o.jsxs(se,{onClick:Ze,className:"gap-2",children:[o.jsx("span",{className:"material-icons",children:fe?"pause":"play_arrow"}),fe?"Pause":"Play"]}),o.jsxs(se,{variant:"secondary",onClick:ft,className:"gap-2",children:[o.jsx("span",{className:"material-icons",children:"replay"}),"Reset"]})]})]})]})})]})}function JW({pattern:e,isSelected:t,isFavorite:n,playTime:a,playCount:i,onToggleFavorite:l,onClick:u}){const[d,h]=g.useState(!1),[p,v]=g.useState(!1),m=g.useRef(null),b=g.useContext(s5);g.useEffect(()=>{if(!b||!m.current)return;const j=new IntersectionObserver(S=>{S.forEach(C=>{C.isIntersecting&&(b.requestPreview(e.path),j.disconnect())})},{rootMargin:"100px"});return j.observe(m.current),()=>j.disconnect()},[e.path,b]);const w=b?.previews[e.path]?.image_data||null;return o.jsxs("button",{ref:m,onClick:u,className:`group flex flex-col items-center gap-2 p-2.5 rounded-xl bg-card border border-border transition-all duration-200 ease-out hover:-translate-y-1 hover:shadow-md active:scale-95 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 ${t?"ring-2 ring-primary ring-offset-2 ring-offset-background":""}`,children:[o.jsx("div",{className:"relative w-full aspect-square",children:o.jsx("div",{className:"w-full h-full rounded-full overflow-hidden border border-border bg-muted",children:w&&!p?o.jsxs(o.Fragment,{children:[!d&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsx("span",{className:"material-icons-outlined animate-spin text-xl text-muted-foreground",children:"sync"})}),o.jsx("img",{src:w,alt:e.name,className:`w-full h-full object-cover pattern-preview transition-opacity ${d?"opacity-100":"opacity-0"}`,loading:"lazy",onLoad:()=>h(!0),onError:()=>v(!0)})]}):o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:o.jsx("span",{className:"material-icons-outlined text-2xl text-muted-foreground",children:p?"broken_image":"image"})})})}),(i>0||a)&&o.jsxs("div",{className:"flex items-center w-full px-0.5 -mb-1 justify-between",children:[i>0&&o.jsxs("span",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",title:`Played ${i} time${i!==1?"s":""}`,children:[o.jsx("span",{className:"material-icons-outlined",style:{fontSize:"13px"},children:"play_circle"}),i,"x"]}),a&&o.jsxs("span",{className:"flex items-center gap-0.5 text-xs text-muted-foreground ml-auto",title:`Last run: ${a}`,children:[o.jsx("span",{className:"material-icons-outlined",style:{fontSize:"13px"},children:"schedule"}),(()=>{const j=a.match(/^(?:(\d+):)?(\d+):(\d+)$/);if(j){const C=j[1]?parseInt(j[1]):0,N=parseInt(j[2]),_=parseInt(j[3]),T=C*60+N+(_>=30?1:0);return T>0?`${T}m`:"<1m"}const S=a.match(/(\d+)h\s*(\d+)m|(\d+)\s*min|(\d+)m\s*(\d+)s|(\d+)\s*sec/);if(S){if(S[1]&&S[2])return`${parseInt(S[1])*60+parseInt(S[2])}m`;if(S[3])return`${S[3]}m`;if(S[4]&&S[5]){const C=parseInt(S[4]);return C>0?`${C}m`:"<1m"}else if(S[6])return"<1m"}return a})()]})]}),o.jsxs("div",{className:"flex items-center justify-between w-full gap-1 px-0.5",children:[o.jsx("span",{className:"text-xs font-bold text-foreground truncate",title:e.name,children:e.name}),o.jsx("span",{role:"button",tabIndex:0,className:`shrink-0 transition-colors cursor-pointer ${n?"text-red-500 hover:text-red-600":"text-muted-foreground hover:text-red-500"}`,onClick:j=>{j.stopPropagation(),l(e.path,j)},onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),j.stopPropagation(),l(e.path,j))},title:n?"Remove from favorites":"Add to favorites",children:o.jsx("span",{className:"material-icons",style:{fontSize:"16px"},children:n?"favorite":"favorite_border"})})]})]})}function eX(){const{isPlayOnlyActive:e}=HO()||{},[t,n]=g.useState([]),[a,i]=g.useState(()=>localStorage.getItem("playlist-selected")),[l,u]=g.useState([]),[d,h]=g.useState(!0),[p,v]=g.useState([]),[m,b]=g.useState({}),[w,j]=g.useState({}),[S,C]=g.useState(!1),[N,_]=g.useState(new Set),[T,R]=g.useState(""),[D,L]=g.useState("all"),[k,P]=g.useState("name"),[U,J]=g.useState(!0),[$,W]=g.useState(new Set),[fe,we]=g.useState(!1),[Ce,I]=g.useState(!1),[V,H]=g.useState(""),[be,_e]=g.useState(null),[B,G]=g.useState(!1),X=g.useRef(null),oe=z=>{X.current={x:z.touches[0].clientX,y:z.touches[0].clientY}},me=z=>{if(!X.current||!B)return;const Se=z.changedTouches[0].clientX-X.current.x,Ae=z.changedTouches[0].clientY-X.current.y;Se>80&&Se>Math.abs(Ae)&&G(!1),X.current=null},[Z,ne]=g.useState(()=>{const z=localStorage.getItem("playlist-runMode");return z==="single"||z==="indefinite"?z:"single"}),[he,Ee]=g.useState(()=>localStorage.getItem("playlist-shuffle")==="true"),[je,ke]=g.useState(()=>{const z=localStorage.getItem("playlist-pauseTime");return z?Number(z):5}),[le,Fe]=g.useState(()=>{const z=localStorage.getItem("playlist-pauseUnit");return z==="sec"||z==="min"||z==="hr"||z==="per_day"?z:"min"}),[Ge,He]=g.useState(()=>localStorage.getItem("preExecution")||"adaptive");g.useEffect(()=>{localStorage.setItem("playlist-runMode",Z)},[Z]),g.useEffect(()=>{localStorage.setItem("playlist-shuffle",String(he))},[he]),g.useEffect(()=>{localStorage.setItem("playlist-pauseTime",String(je))},[je]),g.useEffect(()=>{localStorage.setItem("playlist-pauseUnit",le)},[le]),g.useEffect(()=>{localStorage.setItem("preExecution",Ge)},[Ge]),g.useEffect(()=>{a?localStorage.setItem("playlist-selected",a):localStorage.removeItem("playlist-selected")},[a]);const at=g.useRef(!1);g.useEffect(()=>{d||a&&(t.includes(a)?at.current||(at.current=!0,Ct(a)):i(null))},[d,t,a]),g.useEffect(()=>{const z=()=>{C(!1),we(!1),I(!1)};return window.addEventListener("playback-started",z),()=>window.removeEventListener("playback-started",z)},[]);const[Ke,Mt]=g.useState(!1),St=()=>{switch(le){case"per_day":return Math.floor(86400/Math.max(1,je));case"hr":return je*3600;case"min":return je*60;default:return je}},_t=g.useRef(new Set),jt=g.useRef(null),ot=g.useRef(null);g.useEffect(()=>(dp().catch(()=>{}),lt(),Vt(),Kt(),()=>{jt.current&&clearTimeout(jt.current),ot.current&&ot.current.abort(),_t.current.clear()}),[]),cS(()=>{lt(),Vt(),Kt()});const lt=async()=>{h(!0);try{const z=await de.get("/list_all_playlists");n(Array.isArray(z)?z:[])}catch(z){console.error("Error fetching playlists:",z),K.error("Failed to load playlists")}finally{h(!1)}},Ct=async z=>{try{const Se=await de.get(`/get_playlist?name=${encodeURIComponent(z)}`);u(Se.files||[])}catch(Se){console.error("Error fetching playlist:",Se),K.error("Failed to load playlist"),u([])}},Vt=async()=>{try{const[z,Se]=await Promise.all([de.get("/list_theta_rho_files_with_metadata"),de.get("/api/pattern_history_all")]);v(z),b(Se)}catch(z){console.error("Error fetching patterns:",z)}},Kt=async()=>{try{const z=await de.get("/get_playlist?name=Favorites");W(new Set(z.files||[]))}catch{}},Wt=async z=>{const Se=await bu(z);if(Se.size>0){const Re={};Se.forEach((M,ge)=>{Re[ge]=M}),j(M=>({...M,...Re}))}const Ae=z.filter(Re=>!Se.has(Re));Ae.length>0&&te(Ae)},te=async z=>{ot.current=new AbortController;const Ae=ot.current.signal;for(let Re=0;Re<z.length&&!Ae.aborted;Re+=10){const M=z.slice(Re,Re+10);try{const ge=await de.post("/preview_thr_batch",{file_names:M},Ae),Ne={};for(const[mt,Y]of Object.entries(ge))Ne[mt]=Y,Y&&!Y.error&&Ow(mt,Y);j(mt=>({...mt,...Ne}))}catch(ge){if(ge instanceof Error&&ge.name==="AbortError")break;console.error("Error fetching previews batch:",ge)}Re+10<z.length&&await new Promise(ge=>setTimeout(ge,100))}},Me=g.useCallback(z=>{w[z]||_t.current.has(z)||(_t.current.add(z),jt.current&&clearTimeout(jt.current),jt.current=setTimeout(()=>{const Se=Array.from(_t.current);_t.current.clear(),Se.length>0&&Wt(Se)},100))},[w]),st=z=>{i(z),Ct(z),G(!0)},nt=()=>{G(!1)},yt=async()=>{if(!V.trim()){K.error("Please enter a playlist name");return}const z=V.trim();try{await de.post("/create_playlist",{playlist_name:z,files:[]}),K.success("Playlist created"),we(!1),H(""),await lt(),st(z)}catch(Se){console.error("Create playlist error:",Se),K.error(Se instanceof Error?Se.message:"Failed to create playlist")}},gt=async()=>{if(!(!be||!V.trim()))try{await de.post("/rename_playlist",{old_name:be,new_name:V.trim()}),K.success("Playlist renamed"),I(!1),H(""),_e(null),lt(),a===be&&i(V.trim())}catch{K.error("Failed to rename playlist")}},xt=async z=>{if(confirm(`Delete playlist "${z}"?`))try{await de.delete("/delete_playlist",{playlist_name:z}),K.success("Playlist deleted"),lt(),a===z&&(i(null),u([]))}catch{K.error("Failed to delete playlist")}},qt=async z=>{if(!a)return;const Se=l.filter(Ae=>Ae!==z);try{await de.post("/modify_playlist",{playlist_name:a,files:Se}),u(Se),K.success("Pattern removed")}catch{K.error("Failed to remove pattern")}},ue=()=>{_(new Set(l)),R(""),C(!0)},Oe=async()=>{if(!a)return;const z=Array.from(N);try{await de.post("/modify_playlist",{playlist_name:a,files:z}),u(z),C(!1),K.success("Playlist updated")}catch{K.error("Failed to update playlist")}},Be=z=>{_(Se=>{const Ae=new Set(Se);return Ae.has(z)?Ae.delete(z):Ae.add(z),Ae})},Qe=async()=>{if(!(!a||l.length===0)){Mt(!0);try{await de.post("/run_playlist",{playlist_name:a,run_mode:Z==="indefinite"?"indefinite":"single",pause_time:St(),clear_pattern:Ge,shuffle:he,pause_from_start:le==="per_day"}),K.success(`Started playlist: ${a}`),window.dispatchEvent(new CustomEvent("playback-started"))}catch(z){K.error(z instanceof Error?z.message:"Failed to run playlist")}finally{Mt(!1)}}},Pe=g.useMemo(()=>{const z=new Set(p.map(Se=>Se.category));return["all",...Array.from(z).sort()]},[p]),Ze=g.useMemo(()=>{let z=p;return T&&(z=z.filter(Se=>Au(Se.name,T))),D!=="all"&&(z=z.filter(Se=>Se.category===D)),z=[...z].sort((Se,Ae)=>{let Re=0;switch(k){case"name":Re=Se.name.localeCompare(Ae.name);break;case"date":Re=Se.date_modified-Ae.date_modified;break;case"size":Re=Se.coordinates_count-Ae.coordinates_count;break;case"favorites":{const M=$.has(Se.path)?1:0;Re=($.has(Ae.path)?1:0)-M,Re===0&&(Re=Se.name.localeCompare(Ae.name));break}case"plays":{const M=Se.path.split("/").pop()||"",ge=Ae.path.split("/").pop()||"",Ne=m[M]?.play_count??0,mt=m[ge]?.play_count??0;Re=Ne-mt,Re===0&&(Re=Se.name.localeCompare(Ae.name));break}case"last_played":{const M=Se.path.split("/").pop()||"",ge=Ae.path.split("/").pop()||"",Ne=m[M]?.last_played||"",mt=m[ge]?.last_played||"";Re=Ne.localeCompare(mt),Re===0&&(Re=Se.name.localeCompare(Ae.name));break}}return U?Re:-Re}),z},[p,T,D,k,U,$,m]),ft=z=>p.find(Ae=>Ae.path===z)?.name||z.split("/").pop()?.replace(".thr","")||z,pt=z=>w[z]?.image_data||null;return o.jsxs("div",{className:"flex flex-col w-full max-w-5xl mx-auto gap-4 sm:gap-6 py-3 sm:py-6 px-0 sm:px-4 overflow-hidden",style:{height:"calc(100dvh - 14rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))"},children:[o.jsxs("div",{className:"space-y-0.5 sm:space-y-1 shrink-0 pl-1",children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Playlists"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Create and manage pattern playlists"})]}),o.jsx(Xn,{className:"shrink-0"}),o.jsxs("div",{className:"flex flex-col lg:flex-row gap-4 flex-1 min-h-0 relative overflow-hidden",children:[o.jsxs("aside",{className:`w-full lg:w-64 shrink-0 bg-card border rounded-lg flex flex-col h-full overflow-hidden transition-transform duration-300 ease-in-out ${B?"-translate-x-full lg:translate-x-0 absolute lg:relative inset-0 lg:inset-auto":"translate-x-0"}`,children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-2.5 border-b shrink-0",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold",children:"My Playlists"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.length," playlist",t.length!==1?"s":""]})]}),!e&&o.jsx(se,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{H(""),we(!0)},children:o.jsx("span",{className:"material-icons-outlined text-xl",children:"add"})})]}),o.jsx("nav",{className:"flex-1 overflow-y-auto p-2 space-y-1 min-h-0",children:d?o.jsx("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:o.jsx("span",{className:"text-sm",children:"Loading..."})}):t.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-3xl",children:"playlist_add"}),o.jsx("span",{className:"text-sm",children:"No playlists yet"})]}):t.map(z=>o.jsxs("div",{className:`group flex items-center justify-between rounded-lg px-3 py-2 cursor-pointer transition-colors ${a===z?"bg-accent text-accent-foreground":"hover:bg-muted text-muted-foreground"}`,onClick:()=>st(z),children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx("span",{className:"material-icons-outlined text-lg",children:"playlist_play"}),o.jsx("span",{className:"truncate text-sm font-medium",children:z})]}),!e&&o.jsxs("div",{className:"flex items-center gap-1 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[o.jsx(se,{variant:"ghost",size:"icon-sm",className:"h-7 w-7",onClick:Se=>{Se.stopPropagation(),_e(z),H(z),I(!0)},children:o.jsx("span",{className:"material-icons-outlined text-base",children:"edit"})}),o.jsx(se,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 text-destructive hover:text-destructive hover:bg-destructive/20",onClick:Se=>{Se.stopPropagation(),xt(z)},children:o.jsx(tD,{className:"h-4 w-4"})})]})]},z))})]}),o.jsxs("main",{className:`flex-1 bg-card border rounded-lg flex flex-col overflow-hidden min-h-0 relative transition-transform duration-300 ease-in-out ${B?"translate-x-0":"translate-x-full lg:translate-x-0 absolute lg:relative inset-0 lg:inset-auto"}`,onTouchStart:oe,onTouchEnd:me,children:[o.jsxs("header",{className:"flex items-center justify-between px-3 py-2.5 border-b shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx(se,{variant:"ghost",size:"icon",className:"h-8 w-8 lg:hidden shrink-0",onClick:nt,children:o.jsx("span",{className:"material-icons-outlined",children:"arrow_back"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"text-lg font-semibold truncate",children:a||"Select a Playlist"}),a&&l.length>0&&o.jsxs("p",{className:"text-sm text-muted-foreground",children:[l.length," pattern",l.length!==1?"s":""]})]})]}),!e&&o.jsxs(se,{onClick:ue,disabled:!a,size:"sm",className:"gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"add"}),o.jsx("span",{className:"hidden sm:inline",children:"Add Patterns"})]})]}),o.jsx("div",{className:`flex-1 overflow-y-auto p-4 min-h-0 ${a?"pb-28 sm:pb-24":""}`,children:a?l.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground gap-3",children:[o.jsx("div",{className:"p-4 rounded-full bg-muted",children:o.jsx("span",{className:"material-icons-outlined text-5xl",children:"library_music"})}),o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"font-medium",children:"Empty playlist"}),o.jsx("p",{className:"text-sm",children:"Add patterns to get started"})]}),!e&&o.jsxs(se,{variant:"secondary",className:"mt-2 gap-2",onClick:ue,children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"add"}),"Add Patterns"]})]}):o.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 gap-3 sm:gap-4",children:l.map((z,Se)=>o.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2 group",children:[o.jsxs("div",{className:"relative w-full aspect-square",children:[o.jsx("div",{className:"w-full h-full rounded-full overflow-hidden border bg-muted hover:ring-2 hover:ring-primary hover:ring-offset-2 hover:ring-offset-background transition-all cursor-pointer",children:o.jsx(RT,{path:z,previewUrl:pt(z),requestPreview:Me,alt:ft(z)})}),!e&&o.jsx("button",{className:"absolute -top-0.5 -right-0.5 sm:-top-1 sm:-right-1 w-5 h-5 rounded-full bg-destructive hover:bg-destructive/90 text-destructive-foreground flex items-center justify-center opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity shadow-sm z-10",onClick:()=>qt(z),title:"Remove from playlist",children:o.jsx("span",{className:"material-icons",style:{fontSize:"12px"},children:"close"})})]}),o.jsx("p",{className:"text-[10px] sm:text-xs truncate font-medium w-full text-center",children:ft(z)})]},`${z}-${Se}`))}):o.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground gap-3",children:[o.jsx("div",{className:"p-4 rounded-full bg-muted",children:o.jsx("span",{className:"material-icons-outlined text-5xl",children:"touch_app"})}),o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"font-medium",children:"No playlist selected"}),o.jsx("p",{className:"text-sm",children:"Select a playlist from the sidebar to view its patterns"})]})]})}),a&&o.jsxs("div",{className:"absolute bottom-0 left-0 right-0 pointer-events-none z-20",children:[o.jsx("div",{className:"h-20 bg-gradient-to-t"}),o.jsxs("div",{className:"absolute bottom-4 left-0 right-0 flex items-center justify-center gap-3 px-4 pointer-events-auto",children:[o.jsxs("div",{className:"flex items-center h-12 sm:h-14 bg-card rounded-full shadow-xl border px-1.5 sm:px-2",children:[o.jsxs("div",{className:"flex items-center px-1 sm:px-2 border-r border-border gap-0.5 sm:gap-1",children:[o.jsx("button",{onClick:()=>Ee(!he),className:`w-9 h-9 sm:w-10 sm:h-10 rounded-full flex items-center justify-center transition ${he?"text-primary bg-primary/10":"text-muted-foreground hover:bg-muted"}`,title:"Shuffle",children:o.jsx("span",{className:"material-icons-outlined text-lg sm:text-xl",children:"shuffle"})}),o.jsx("button",{onClick:()=>ne(Z==="indefinite"?"single":"indefinite"),className:`w-9 h-9 sm:w-10 sm:h-10 rounded-full flex items-center justify-center transition ${Z==="indefinite"?"text-primary bg-primary/10":"text-muted-foreground hover:bg-muted"}`,title:Z==="indefinite"?"Loop mode":"Play once mode",children:o.jsx("span",{className:"material-icons-outlined text-lg sm:text-xl",children:"repeat"})})]}),o.jsxs("div",{className:"flex items-center px-2 sm:px-3 gap-2 sm:gap-3 border-r border-border",children:[o.jsx("span",{className:"text-[10px] sm:text-xs font-semibold text-muted-foreground tracking-wider hidden sm:block",children:"Pause"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(se,{variant:"secondary",size:"icon",className:"w-7 h-7 sm:w-8 sm:h-8",onClick:()=>{ke(Math.max(le==="per_day"?1:0,je-(le==="hr"?.5:1)))},children:o.jsx("span",{className:"material-icons-outlined text-sm",children:"remove"})}),o.jsxs("button",{onClick:()=>{const z=["sec","min","hr","per_day"],Se=z.indexOf(le),Ae=z[(Se+1)%z.length];Ae==="per_day"&&je<1&&ke(1),Fe(Ae)},className:"relative flex items-center justify-center min-w-14 sm:min-w-16 px-1 text-xs sm:text-sm font-bold hover:text-primary transition",title:le==="per_day"?"Plays per day (timed from pattern start). Click to change unit.":"Click to change unit",children:[le==="per_day"?`${je}/day`:`${je}${le==="sec"?"s":le==="min"?"m":"h"}`,o.jsx("span",{className:"material-icons-outlined text-xs opacity-50 scale-75 ml-0.5",children:"swap_vert"})]}),o.jsx(se,{variant:"secondary",size:"icon",className:"w-7 h-7 sm:w-8 sm:h-8",onClick:()=>{const z=le==="hr"?.5:1,Se=le==="per_day"?24:Number.POSITIVE_INFINITY;ke(Math.min(Se,je+z))},children:o.jsx("span",{className:"material-icons-outlined text-sm",children:"add"})})]})]}),o.jsx("div",{className:"flex items-center px-1 sm:px-2",children:o.jsxs(Pn,{value:Ge,onValueChange:z=>He(z),children:[o.jsx(An,{className:`w-9 h-9 sm:w-10 sm:h-10 rounded-full border-0 p-0 shadow-none focus:ring-0 justify-center [&>svg]:hidden transition ${Ge!=="none"?"!bg-primary/10":"!bg-transparent hover:!bg-muted"}`,children:o.jsx("span",{className:`material-icons-outlined text-lg sm:text-xl ${Ge!=="none"?"text-primary":"text-muted-foreground"}`,children:"cleaning_services"})}),o.jsx(On,{children:P0.map(z=>o.jsx(tt,{value:z.value,children:o.jsxs("div",{children:[o.jsx("div",{children:z.label}),o.jsx("div",{className:"text-xs text-muted-foreground font-normal",children:z.description})]})},z.value))})]})})]}),o.jsx("button",{onClick:Qe,disabled:Ke||l.length===0,className:"w-10 h-10 sm:w-12 sm:h-12 rounded-full bg-primary hover:bg-primary/90 disabled:bg-muted disabled:text-muted-foreground text-primary-foreground shadow-lg shadow-primary/30 hover:shadow-primary/50 hover:scale-105 disabled:shadow-none disabled:hover:scale-100 transition-all duration-200 flex items-center justify-center",title:"Run Playlist",children:Ke?o.jsx("span",{className:"material-icons-outlined text-xl sm:text-2xl animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons text-xl sm:text-2xl ml-0.5",children:"play_arrow"})})]})]})]})]}),o.jsx(ga,{open:fe,onOpenChange:we,children:o.jsxs(Wr,{className:"sm:max-w-md",children:[o.jsx(Mr,{children:o.jsxs(Dr,{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-primary",children:"playlist_add"}),"Create New Playlist"]})}),o.jsx("div",{className:"space-y-4 py-4",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{htmlFor:"playlistName",children:"Playlist Name"}),o.jsx(wt,{id:"playlistName",value:V,onChange:z=>H(z.target.value),placeholder:"e.g., Favorites, Morning Patterns...",onKeyDown:z=>z.key==="Enter"&&yt(),autoFocus:!0})]})}),o.jsxs(va,{className:"gap-2 sm:gap-0",children:[o.jsx(se,{variant:"secondary",onClick:()=>we(!1),children:"Cancel"}),o.jsxs(se,{onClick:yt,className:"gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"add"}),"Create Playlist"]})]})]})}),o.jsx(ga,{open:Ce,onOpenChange:I,children:o.jsxs(Wr,{className:"sm:max-w-md",children:[o.jsx(Mr,{children:o.jsxs(Dr,{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-primary",children:"edit"}),"Rename Playlist"]})}),o.jsx("div",{className:"space-y-4 py-4",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{htmlFor:"renamePlaylist",children:"New Name"}),o.jsx(wt,{id:"renamePlaylist",value:V,onChange:z=>H(z.target.value),placeholder:"Enter new name",onKeyDown:z=>z.key==="Enter"&&gt(),autoFocus:!0})]})}),o.jsxs(va,{className:"gap-2 sm:gap-0",children:[o.jsx(se,{variant:"secondary",onClick:()=>I(!1),children:"Cancel"}),o.jsxs(se,{onClick:gt,className:"gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"save"}),"Save Name"]})]})]})}),o.jsx(ga,{open:S,onOpenChange:C,children:o.jsxs(Wr,{className:"max-w-4xl max-h-[90vh] flex flex-col",children:[o.jsx(Mr,{children:o.jsxs(Dr,{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-primary",children:"playlist_add"}),"Add Patterns to ",a]})}),o.jsxs("div",{className:"space-y-3 py-2",children:[o.jsxs("div",{className:"relative",children:[o.jsx("span",{className:"material-icons-outlined absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-lg",children:"search"}),o.jsx(wt,{value:T,onChange:z=>R(z.target.value),placeholder:"Search patterns...",className:"pl-10 pr-10 h-10"}),T&&o.jsx("button",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",onClick:()=>R(""),children:o.jsx("span",{className:"material-icons-outlined text-lg",children:"close"})})]}),o.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[o.jsxs(Pn,{value:D,onValueChange:L,children:[o.jsxs(An,{className:"h-9 w-9 sm:w-auto rounded-full bg-card border-border shadow-sm text-sm px-0 sm:px-3 justify-center sm:justify-between [&>svg]:hidden sm:[&>svg]:block [&>span:last-of-type]:hidden sm:[&>span:last-of-type]:inline gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-lg shrink-0",children:"folder"}),o.jsx(qn,{})]}),o.jsx(On,{children:Pe.map(z=>o.jsx(tt,{value:z,children:z==="all"?"All Folders":z},z))})]}),o.jsxs(Pn,{value:k,onValueChange:z=>P(z),children:[o.jsxs(An,{className:"h-9 w-9 sm:w-auto rounded-full bg-card border-border shadow-sm text-sm px-0 sm:px-3 justify-center sm:justify-between [&>svg]:hidden sm:[&>svg]:block [&>span:last-of-type]:hidden sm:[&>span:last-of-type]:inline gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-lg shrink-0",children:"sort"}),o.jsx(qn,{})]}),o.jsxs(On,{children:[o.jsx(tt,{value:"favorites",children:"Favorites"}),o.jsx(tt,{value:"name",children:"Name"}),o.jsx(tt,{value:"date",children:"Modified"}),o.jsx(tt,{value:"size",children:"Size"}),o.jsx(tt,{value:"plays",children:"Most Played"}),o.jsx(tt,{value:"last_played",children:"Last Played"})]})]}),o.jsx(se,{variant:"outline",size:"icon",className:"h-9 w-9 rounded-full bg-card shadow-sm",onClick:()=>J(!U),title:U?"Ascending":"Descending",children:o.jsx("span",{className:"material-icons-outlined text-lg",children:U?"arrow_upward":"arrow_downward"})}),o.jsx("div",{className:"flex-1"}),o.jsxs(se,{variant:"outline",size:"sm",className:"h-9 rounded-full bg-card shadow-sm text-sm gap-1.5",onClick:()=>{const z=Ze.map(Ae=>Ae.path),Se=z.every(Ae=>N.has(Ae));_(Ae=>{const Re=new Set(Ae);return Se?z.forEach(M=>Re.delete(M)):z.forEach(M=>Re.add(M)),Re})},children:[o.jsx("span",{className:"material-icons-outlined text-base",children:Ze.length>0&&Ze.every(z=>N.has(z.path))?"deselect":"select_all"}),o.jsx("span",{className:"hidden sm:inline",children:Ze.length>0&&Ze.every(z=>N.has(z.path))?"Deselect All":"Select All"})]}),o.jsxs("div",{className:"flex items-center gap-1 sm:gap-2 text-sm bg-card rounded-full px-2 sm:px-3 py-2 shadow-sm border",children:[o.jsx("span",{className:"material-icons-outlined text-base text-primary",children:"check_circle"}),o.jsx("span",{className:"font-medium",children:N.size}),o.jsx("span",{className:"hidden sm:inline text-muted-foreground",children:"selected"})]})]})]}),o.jsx("div",{className:"flex-1 overflow-y-auto border rounded-lg p-4 min-h-[300px] bg-muted/20",children:Ze.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground gap-3",children:[o.jsx("div",{className:"p-4 rounded-full bg-muted",children:o.jsx("span",{className:"material-icons-outlined text-5xl",children:"search_off"})}),o.jsx("span",{className:"text-sm",children:"No patterns found"})]}):o.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 gap-4",children:Ze.map(z=>{const Se=N.has(z.path);return o.jsxs("div",{className:"flex flex-col items-center gap-2 cursor-pointer",onClick:()=>Be(z.path),children:[o.jsxs("div",{className:`relative w-full aspect-square rounded-full overflow-hidden border-2 bg-muted transition-all ${Se?"border-primary ring-2 ring-primary/20":"border-transparent hover:border-muted-foreground/30"}`,children:[o.jsx(RT,{path:z.path,previewUrl:pt(z.path),requestPreview:Me,alt:z.name}),Se&&o.jsx("div",{className:"absolute -top-1 -right-1 w-5 h-5 rounded-full bg-primary flex items-center justify-center shadow-md",children:o.jsx("span",{className:"material-icons text-primary-foreground",style:{fontSize:"14px"},children:"check"})})]}),o.jsx("p",{className:`text-xs truncate font-medium w-full text-center ${Se?"text-primary":""}`,children:z.name})]},z.path)})})}),o.jsxs(va,{className:"gap-2 sm:gap-0",children:[o.jsx(se,{variant:"secondary",onClick:()=>C(!1),children:"Cancel"}),o.jsxs(se,{onClick:Oe,className:"gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"save"}),"Save Selection"]})]})]})})]})}function RT({path:e,previewUrl:t,requestPreview:n,alt:a,className:i=""}){const l=g.useRef(null),u=g.useRef(!1);return g.useEffect(()=>{if(!l.current||t||u.current)return;const d=new IntersectionObserver(h=>{h.forEach(p=>{p.isIntersecting&&!u.current&&(u.current=!0,n(e),d.disconnect())})},{rootMargin:"100px"});return d.observe(l.current),()=>d.disconnect()},[e,t,n]),o.jsx("div",{ref:l,className:`w-full h-full flex items-center justify-center ${i}`,children:t?o.jsx("img",{src:t,alt:a,loading:"lazy",className:"w-full h-full object-cover pattern-preview"}):o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-sm sm:text-base",children:"image"})})}const $n=g.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:ct("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));$n.displayName="Card";const da=g.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:ct("flex flex-col space-y-1.5 p-6",e),...t}));da.displayName="CardHeader";const fa=g.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:ct("text-2xl font-semibold leading-none tracking-tight",e),...t}));fa.displayName="CardTitle";const hi=g.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:ct("text-sm text-muted-foreground",e),...t}));hi.displayName="CardDescription";const Gn=g.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:ct("p-6 pt-0",e),...t}));Gn.displayName="CardContent";const tX=g.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:ct("flex items-center p-6 pt-0",e),...t}));tX.displayName="CardFooter";const nX=Xu("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-muted/50 text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),nr=g.forwardRef(({className:e,variant:t,...n},a)=>o.jsx("div",{ref:a,role:"alert",className:ct(nX({variant:t}),e),...n}));nr.displayName="Alert";const rX=g.forwardRef(({className:e,...t},n)=>o.jsx("h5",{ref:n,className:ct("mb-1 font-medium leading-none tracking-tight",e),...t}));rX.displayName="AlertTitle";const rr=g.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:ct("text-sm [&_p]:leading-relaxed",e),...t}));rr.displayName="AlertDescription";var aX=Symbol("radix.slottable");function sX(e){const t=({children:n})=>o.jsx(o.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=aX,t}var[Sp]=Lr("Tooltip",[Vl]),jp=Vl(),i5="TooltipProvider",iX=700,k0="tooltip.open",[oX,fS]=Sp(i5),o5=e=>{const{__scopeTooltip:t,delayDuration:n=iX,skipDelayDuration:a=300,disableHoverableContent:i=!1,children:l}=e,u=g.useRef(!0),d=g.useRef(!1),h=g.useRef(0);return g.useEffect(()=>{const p=h.current;return()=>window.clearTimeout(p)},[]),o.jsx(oX,{scope:t,isOpenDelayedRef:u,delayDuration:n,onOpen:g.useCallback(()=>{window.clearTimeout(h.current),u.current=!1},[]),onClose:g.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>u.current=!0,a)},[a]),isPointerInTransitRef:d,onPointerInTransitChange:g.useCallback(p=>{d.current=p},[]),disableHoverableContent:i,children:l})};o5.displayName=i5;var qu="Tooltip",[lX,Cp]=Sp(qu),l5=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:i,onOpenChange:l,disableHoverableContent:u,delayDuration:d}=e,h=fS(qu,e.__scopeTooltip),p=jp(t),[v,m]=g.useState(null),b=ma(),w=g.useRef(0),j=u??h.disableHoverableContent,S=d??h.delayDuration,C=g.useRef(!1),[N,_]=Zr({prop:a,defaultProp:i??!1,onChange:k=>{k?(h.onOpen(),document.dispatchEvent(new CustomEvent(k0))):h.onClose(),l?.(k)},caller:qu}),T=g.useMemo(()=>N?C.current?"delayed-open":"instant-open":"closed",[N]),R=g.useCallback(()=>{window.clearTimeout(w.current),w.current=0,C.current=!1,_(!0)},[_]),D=g.useCallback(()=>{window.clearTimeout(w.current),w.current=0,_(!1)},[_]),L=g.useCallback(()=>{window.clearTimeout(w.current),w.current=window.setTimeout(()=>{C.current=!0,_(!0),w.current=0},S)},[S,_]);return g.useEffect(()=>()=>{w.current&&(window.clearTimeout(w.current),w.current=0)},[]),o.jsx(Ew,{...p,children:o.jsx(lX,{scope:t,contentId:b,open:N,stateAttribute:T,trigger:v,onTriggerChange:m,onTriggerEnter:g.useCallback(()=>{h.isOpenDelayedRef.current?L():R()},[h.isOpenDelayedRef,L,R]),onTriggerLeave:g.useCallback(()=>{j?D():(window.clearTimeout(w.current),w.current=0)},[D,j]),onOpen:R,onClose:D,disableHoverableContent:j,children:n})})};l5.displayName=qu;var L0="TooltipTrigger",c5=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,i=Cp(L0,n),l=fS(L0,n),u=jp(n),d=g.useRef(null),h=Ot(t,d,i.onTriggerChange),p=g.useRef(!1),v=g.useRef(!1),m=g.useCallback(()=>p.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),o.jsx(cp,{asChild:!0,...u,children:o.jsx(dt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...a,ref:h,onPointerMove:et(e.onPointerMove,b=>{b.pointerType!=="touch"&&!v.current&&!l.isPointerInTransitRef.current&&(i.onTriggerEnter(),v.current=!0)}),onPointerLeave:et(e.onPointerLeave,()=>{i.onTriggerLeave(),v.current=!1}),onPointerDown:et(e.onPointerDown,()=>{i.open&&i.onClose(),p.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:et(e.onFocus,()=>{p.current||i.onOpen()}),onBlur:et(e.onBlur,i.onClose),onClick:et(e.onClick,i.onClose)})})});c5.displayName=L0;var cX="TooltipPortal",[Use,uX]=Sp(cX,{forceMount:void 0}),Ol="TooltipContent",u5=g.forwardRef((e,t)=>{const n=uX(Ol,e.__scopeTooltip),{forceMount:a=n.forceMount,side:i="top",...l}=e,u=Cp(Ol,e.__scopeTooltip);return o.jsx(Ts,{present:a||u.open,children:u.disableHoverableContent?o.jsx(d5,{side:i,...l,ref:t}):o.jsx(dX,{side:i,...l,ref:t})})}),dX=g.forwardRef((e,t)=>{const n=Cp(Ol,e.__scopeTooltip),a=fS(Ol,e.__scopeTooltip),i=g.useRef(null),l=Ot(t,i),[u,d]=g.useState(null),{trigger:h,onClose:p}=n,v=i.current,{onPointerInTransitChange:m}=a,b=g.useCallback(()=>{d(null),m(!1)},[m]),w=g.useCallback((j,S)=>{const C=j.currentTarget,N={x:j.clientX,y:j.clientY},_=gX(N,C.getBoundingClientRect()),T=vX(N,_),R=xX(S.getBoundingClientRect()),D=bX([...T,...R]);d(D),m(!0)},[m]);return g.useEffect(()=>()=>b(),[b]),g.useEffect(()=>{if(h&&v){const j=C=>w(C,v),S=C=>w(C,h);return h.addEventListener("pointerleave",j),v.addEventListener("pointerleave",S),()=>{h.removeEventListener("pointerleave",j),v.removeEventListener("pointerleave",S)}}},[h,v,w,b]),g.useEffect(()=>{if(u){const j=S=>{const C=S.target,N={x:S.clientX,y:S.clientY},_=h?.contains(C)||v?.contains(C),T=!yX(N,u);_?b():T&&(b(),p())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[h,v,u,p,b]),o.jsx(d5,{...e,ref:l})}),[fX,hX]=Sp(qu,{isInside:!1}),pX=sX("TooltipContent"),d5=g.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":i,onEscapeKeyDown:l,onPointerDownOutside:u,...d}=e,h=Cp(Ol,n),p=jp(n),{onClose:v}=h;return g.useEffect(()=>(document.addEventListener(k0,v),()=>document.removeEventListener(k0,v)),[v]),g.useEffect(()=>{if(h.trigger){const m=b=>{b.target?.contains(h.trigger)&&v()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[h.trigger,v]),o.jsx(Qu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:m=>m.preventDefault(),onDismiss:v,children:o.jsxs(Tw,{"data-state":h.stateAttribute,...p,...d,ref:t,style:{...d.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(pX,{children:a}),o.jsx(fX,{scope:n,isInside:!0,children:o.jsx(xW,{id:h.contentId,role:"tooltip",children:i||a})})]})})});u5.displayName=Ol;var f5="TooltipArrow",mX=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,i=jp(n);return hX(f5,n).isInside?null:o.jsx(Rw,{...i,...a,ref:t})});mX.displayName=f5;function gX(e,t){const n=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(n,a,i,l)){case l:return"left";case i:return"right";case n:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function vX(e,t,n=5){const a=[];switch(t){case"top":a.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":a.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":a.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":a.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return a}function xX(e){const{top:t,right:n,bottom:a,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:a},{x:i,y:a}]}function yX(e,t){const{x:n,y:a}=e;let i=!1;for(let l=0,u=t.length-1;l<t.length;u=l++){const d=t[l],h=t[u],p=d.x,v=d.y,m=h.x,b=h.y;v>a!=b>a&&n<(m-p)*(a-v)/(b-v)+p&&(i=!i)}return i}function bX(e){const t=e.slice();return t.sort((n,a)=>n.x<a.x?-1:n.x>a.x?1:n.y<a.y?-1:n.y>a.y?1:0),wX(t)}function wX(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a<e.length;a++){const i=e[a];for(;t.length>=2;){const l=t[t.length-1],u=t[t.length-2];if((l.x-u.x)*(i.y-u.y)>=(l.y-u.y)*(i.x-u.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let a=e.length-1;a>=0;a--){const i=e[a];for(;n.length>=2;){const l=n[n.length-1],u=n[n.length-2];if((l.x-u.x)*(i.y-u.y)>=(l.y-u.y)*(i.x-u.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var SX=o5,jX=l5,CX=c5,h5=u5;const NX=SX,gs=jX,vs=CX,Da=g.forwardRef(({className:e,sideOffset:t=4,...n},a)=>o.jsx(h5,{ref:a,sideOffset:t,className:ct("z-[100] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...n}));Da.displayName=h5.displayName;function _X(){const[e,t]=g.useState(""),[n,a]=g.useState(null),[i,l]=g.useState(0),[u,d]=g.useState(null),h=un(Z=>Z.status?.speed??null),p=un(Z=>(Z.status?.is_running||Z.status?.is_paused)??!1);g.useEffect(()=>{h!==null&&a(h)},[h]);const[v,m]=g.useState([]),[b,w]=g.useState(""),[j,S]=g.useState(!1),[C,N]=g.useState(""),[_,T]=g.useState([]),[R,D]=g.useState(!1),L=g.useRef(null),k=g.useRef(null),P=async(Z,ne,he)=>{d(Z);try{const Ee=await de.post(ne,he);if(Ee.success!==!1)return{success:!0,data:Ee};throw new Error(Ee.detail||"Action failed")}catch(Ee){throw console.error(`Error with ${Z}:`,Ee),Ee}finally{d(null)}},U=Z=>p?(K.error(`Cannot ${Z} while a pattern is running. Stop the pattern first.`,{action:{label:"Stop",onClick:()=>$()}}),!0):!1,J=async()=>{try{await P("home","/send_home"),K.success("Moving to home position...")}catch{K.error("Failed to move to home position")}},$=async()=>{try{await P("stop","/stop_execution"),K.success("Execution stopped")}catch{try{await P("stop","/force_stop"),K.success("Force stopped")}catch{K.error("Failed to stop execution")}}},W=async()=>{try{await P("reset","/soft_reset"),K.success("Reset sent. Please home the table.")}catch{K.error("Failed to send reset command")}},fe=async()=>{if(!U("move to center"))try{await P("center","/move_to_center"),K.success("Moving to center...")}catch{K.error("Failed to move to center")}},we=async()=>{if(!U("move to perimeter"))try{await P("perimeter","/move_to_perimeter"),K.success("Moving to perimeter...")}catch{K.error("Failed to move to perimeter")}},Ce=async()=>{const Z=parseFloat(e);if(isNaN(Z)||Z<=0){K.error("Please enter a valid speed value");return}try{await P("speed","/set_speed",{speed:Z}),a(Z),K.success(`Speed set to ${Z} mm/s`),t("")}catch{K.error("Failed to set speed")}},I=async(Z,ne)=>{try{await P(Z,"/run_theta_rho",{file_name:Z,pre_execution:"none"}),K.success(`Running ${ne}...`)}catch(he){he instanceof Error&&he.message.includes("409")?K.error("Another pattern is already running"):K.error(`Failed to run ${ne}`)}},V=async Z=>{if(!U("align"))try{const ne=Z*(Math.PI/180),he=i+ne;await P("rotate","/send_coordinate",{theta:he,rho:1}),l(he),K.info(`Rotated ${Z}°`)}catch{K.error("Failed to rotate")}},H=async()=>{try{const Z=await de.get("/list_serial_ports");m(Array.isArray(Z)?Z:[])}catch{K.error("Failed to fetch serial ports")}},be=async()=>{try{const Z=await de.get("/list_serial_ports"),ne=Array.isArray(Z)?Z:[],he=await de.get("/serial_status");he.connected&&he.port&&(ne.includes(he.port)?w(he.port):console.warn(`Port ${he.port} from status not in available ports, ignoring`))}catch{}},_e=async(Z=!1)=>{if(!b){Z||K.error("Please select a serial port");return}D(!0);try{await de.post("/api/debug-serial/open",{port:b}),S(!0),G("resp",`Connected to ${b}`),Z||K.success(`Connected to ${b}`)}catch(ne){const he=ne instanceof Error?ne.message:"Unknown error";G("error",`Failed to connect: ${he}`),Z||K.error("Failed to connect to serial port")}finally{D(!1)}},B=async()=>{D(!0);try{await de.post("/api/debug-serial/close",{port:b}),S(!1),G("resp","Disconnected"),K.success("Disconnected from serial port")}catch{K.error("Failed to disconnect")}finally{D(!1)}},G=(Z,ne)=>{const he=new Date().toLocaleTimeString();T(Ee=>[...Ee.slice(-200),{type:Z,text:ne,time:he}]),setTimeout(()=>{L.current&&(L.current.scrollTop=L.current.scrollHeight)},10)},X=async()=>{if(!C.trim()||!j||R)return;const Z=C.trim();N(""),D(!0),G("cmd",Z);try{const ne=await de.post("/api/debug-serial/send",{port:b,command:Z});ne.responses?ne.responses.length>0?ne.responses.forEach(he=>G("resp",he)):G("resp","(no response)"):ne.detail&&G("error",ne.detail||"Command failed")}catch(ne){G("error",`Error: ${ne}`)}finally{D(!1),setTimeout(()=>k.current?.focus(),0)}},oe=async()=>{if(!(!j||R)){D(!0),G("cmd","[Soft Reset]");try{const Z=await de.post("/api/debug-serial/send",{port:b,command:""});Z.responses&&Z.responses.length>0?Z.responses.forEach(ne=>G("resp",ne)):G("resp","Reset sent"),K.success("Reset command sent")}catch(Z){G("error",`Reset failed: ${Z}`),K.error("Failed to send reset")}finally{D(!1)}}},me=Z=>{Z.key==="Enter"&&!Z.shiftKey&&(Z.preventDefault(),R||X())};return g.useEffect(()=>{H(),be()},[]),o.jsx(NX,{children:o.jsxs("div",{className:"flex flex-col w-full max-w-5xl mx-auto gap-6 py-3 sm:py-6 px-0 sm:px-4",children:[o.jsxs("div",{className:"space-y-0.5 sm:space-y-1 pl-1",children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Table Control"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Manual controls for your sand table"})]}),o.jsx(Xn,{}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[o.jsxs($n,{className:"transition-all duration-200 hover:shadow-md hover:border-primary/20",children:[o.jsxs(da,{className:"pb-3",children:[o.jsx(fa,{className:"text-lg",children:"Primary Actions"}),o.jsx(hi,{children:"Calibrate or stop the table"})]}),o.jsx(Gn,{children:o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs(gs,{children:[o.jsx(vs,{asChild:!0,children:o.jsxs(se,{onClick:J,disabled:u==="home",variant:"primary",className:"h-16 gap-1 flex-col items-center justify-center",children:[u==="home"?o.jsx("span",{className:"material-icons-outlined animate-spin text-2xl",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-2xl",children:"home"}),o.jsx("span",{className:"text-xs",children:"Home"})]})}),o.jsx(Da,{children:"Return to home position"})]}),o.jsxs(gs,{children:[o.jsx(vs,{asChild:!0,children:o.jsxs(se,{onClick:$,disabled:u==="stop",variant:"destructive",className:"h-16 gap-1 flex-col items-center justify-center",children:[u==="stop"?o.jsx("span",{className:"material-icons-outlined animate-spin text-2xl",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-2xl",children:"stop_circle"}),o.jsx("span",{className:"text-xs",children:"Stop"})]})}),o.jsx(Da,{children:"Gracefully stop"})]}),o.jsxs(ga,{children:[o.jsxs(gs,{children:[o.jsx(vs,{asChild:!0,children:o.jsx(tu,{asChild:!0,children:o.jsxs(se,{disabled:u==="reset",variant:"secondary",className:"h-16 gap-1 flex-col items-center justify-center",children:[u==="reset"?o.jsx("span",{className:"material-icons-outlined animate-spin text-2xl",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-2xl",children:"restart_alt"}),o.jsx("span",{className:"text-xs",children:"Reset"})]})})}),o.jsx(Da,{children:"Send soft reset to controller"})]}),o.jsxs(Wr,{className:"sm:max-w-md",children:[o.jsxs(Mr,{children:[o.jsx(Dr,{children:"Reset Controller?"}),o.jsx(vi,{children:"This will send a soft reset to the controller."})]}),o.jsxs(nr,{className:"flex items-center border-amber-500/50",children:[o.jsx("span",{className:"material-icons-outlined text-amber-500 text-base mr-2 shrink-0",children:"warning"}),o.jsx(rr,{className:"text-amber-600 dark:text-amber-400",children:"Homing is required after resetting. The table will lose its position reference."})]}),o.jsxs(va,{className:"gap-2 sm:gap-0",children:[o.jsx(tu,{asChild:!0,children:o.jsx(se,{variant:"outline",children:"Cancel"})}),o.jsx(tu,{asChild:!0,children:o.jsx(se,{variant:"destructive",onClick:W,children:"Reset Controller"})})]})]})]})]})})]}),o.jsxs($n,{className:"transition-all duration-200 hover:shadow-md hover:border-primary/20",children:[o.jsx(da,{className:"pb-3",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(fa,{className:"text-lg",children:"Speed"}),o.jsx(hi,{children:"Ball movement speed"})]}),o.jsx(Al,{variant:"secondary",className:"font-mono",children:n!==null?`${n} mm/s`:"-- mm/s"})]})}),o.jsx(Gn,{children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx(wt,{type:"number",value:e,onChange:Z=>t(Z.target.value),placeholder:"mm/s",min:"1",step:"1",className:"flex-1",onKeyDown:Z=>Z.key==="Enter"&&Ce()}),o.jsxs(se,{onClick:Ce,disabled:u==="speed"||!e,className:"gap-2",children:[u==="speed"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"check"}),"Set"]})]})})]}),o.jsxs($n,{className:"transition-all duration-200 hover:shadow-md hover:border-primary/20",children:[o.jsxs(da,{className:"pb-3",children:[o.jsx(fa,{className:"text-lg",children:"Position"}),o.jsx(hi,{children:"Move ball to a specific location"})]}),o.jsx(Gn,{children:o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs(gs,{children:[o.jsx(vs,{asChild:!0,children:o.jsxs(se,{onClick:fe,disabled:u==="center",variant:"secondary",className:"h-16 gap-1 flex-col items-center justify-center",children:[u==="center"?o.jsx("span",{className:"material-icons-outlined animate-spin text-2xl",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-2xl",children:"center_focus_strong"}),o.jsx("span",{className:"text-xs",children:"Center"})]})}),o.jsx(Da,{children:"Move ball to center"})]}),o.jsxs(gs,{children:[o.jsx(vs,{asChild:!0,children:o.jsxs(se,{onClick:we,disabled:u==="perimeter",variant:"secondary",className:"h-16 gap-1 flex-col items-center justify-center",children:[u==="perimeter"?o.jsx("span",{className:"material-icons-outlined animate-spin text-2xl",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-2xl",children:"trip_origin"}),o.jsx("span",{className:"text-xs",children:"Perimeter"})]})}),o.jsx(Da,{children:"Move ball to edge"})]}),o.jsxs(ga,{children:[o.jsxs(gs,{children:[o.jsx(vs,{asChild:!0,children:o.jsx(tu,{asChild:!0,children:o.jsxs(se,{variant:"secondary",className:"h-16 gap-1 flex-col items-center justify-center",children:[o.jsx("span",{className:"material-icons-outlined text-2xl",children:"screen_rotation"}),o.jsx("span",{className:"text-xs",children:"Align"})]})})}),o.jsx(Da,{children:"Align pattern orientation"})]}),o.jsxs(Wr,{className:"sm:max-w-md",children:[o.jsxs(Mr,{children:[o.jsx(Dr,{children:"Pattern Orientation Alignment"}),o.jsx(vi,{children:"Follow these steps to align your patterns with their previews"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsx("ol",{className:"space-y-3 text-sm",children:['Home the table then select move to perimeter. Look at your pattern preview and decide where the "bottom" should be.',"Manually move the radial arm or use the rotation buttons below to point 90° to the right of where you want the pattern bottom.",'Click the "Home" button to establish this as the reference position.',"All patterns will now be oriented according to their previews!"].map((Z,ne)=>o.jsxs("li",{className:"flex gap-3",children:[o.jsx(Al,{variant:"secondary",className:"h-6 w-6 shrink-0 items-center justify-center rounded-full p-0",children:ne+1}),o.jsx("span",{className:"text-muted-foreground",children:Z})]},ne))}),o.jsx(Xn,{}),o.jsxs(nr,{className:"flex items-start border-amber-500/50",children:[o.jsx("span",{className:"material-icons-outlined text-amber-500 text-base mr-2 shrink-0",children:"warning"}),o.jsx(rr,{className:"text-amber-600 dark:text-amber-400",children:"Only perform this when you want to change the orientation reference."})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-sm font-medium text-center",children:"Fine Adjustment"}),o.jsxs("div",{className:"flex justify-center gap-2",children:[o.jsxs(se,{variant:"secondary",onClick:()=>V(-10),disabled:u==="rotate",children:[o.jsx("span",{className:"material-icons text-lg mr-1",children:"rotate_left"}),"CCW 10°"]}),o.jsxs(se,{variant:"secondary",onClick:()=>V(10),disabled:u==="rotate",children:["CW 10°",o.jsx("span",{className:"material-icons text-lg ml-1",children:"rotate_right"})]})]}),o.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Each click rotates 10 degrees"})]})]}),o.jsx(va,{children:o.jsx(tu,{asChild:!0,children:o.jsx(se,{children:"Got it"})})})]})]})]})})]}),o.jsxs($n,{className:"transition-all duration-200 hover:shadow-md hover:border-primary/20",children:[o.jsxs(da,{className:"pb-3",children:[o.jsx(fa,{className:"text-lg",children:"Clear Sand"}),o.jsx(hi,{children:"Erase current pattern from the table"})]}),o.jsx(Gn,{children:o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs(gs,{children:[o.jsx(vs,{asChild:!0,children:o.jsxs(se,{onClick:()=>I("clear_from_in.thr","clear from center"),disabled:u==="clear_from_in.thr",variant:"secondary",className:"h-16 gap-1 flex-col items-center justify-center",children:[u==="clear_from_in.thr"?o.jsx("span",{className:"material-icons-outlined animate-spin text-2xl",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-2xl",children:"center_focus_strong"}),o.jsx("span",{className:"text-xs",children:"Clear Center"})]})}),o.jsx(Da,{children:"Spiral outward from center"})]}),o.jsxs(gs,{children:[o.jsx(vs,{asChild:!0,children:o.jsxs(se,{onClick:()=>I("clear_from_out.thr","clear from perimeter"),disabled:u==="clear_from_out.thr",variant:"secondary",className:"h-16 gap-1 flex-col items-center justify-center",children:[u==="clear_from_out.thr"?o.jsx("span",{className:"material-icons-outlined animate-spin text-2xl",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-2xl",children:"all_out"}),o.jsx("span",{className:"text-xs",children:"Clear Edge"})]})}),o.jsx(Da,{children:"Spiral inward from edge"})]}),o.jsxs(gs,{children:[o.jsx(vs,{asChild:!0,children:o.jsxs(se,{onClick:()=>I("clear_sideway.thr","clear sideways"),disabled:u==="clear_sideway.thr",variant:"secondary",className:"h-16 gap-1 flex-col items-center justify-center",children:[u==="clear_sideway.thr"?o.jsx("span",{className:"material-icons-outlined animate-spin text-2xl",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-2xl",children:"swap_horiz"}),o.jsx("span",{className:"text-xs",children:"Clear Sideways"})]})}),o.jsx(Da,{children:"Clear with side-to-side motion"})]})]})})]})]}),o.jsxs($n,{className:"transition-all duration-200 hover:shadow-md hover:border-primary/20",children:[o.jsxs(da,{className:"pb-3 space-y-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{className:"min-w-0 space-y-2",children:[o.jsxs(fa,{className:"text-lg flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"terminal"}),"Serial Terminal"]}),o.jsx(hi,{className:"hidden sm:block",children:"Send raw commands to the table controller"}),o.jsxs(nr,{className:"flex items-center border-amber-500/50 py-2",children:[o.jsx("span",{className:"material-icons-outlined text-amber-500 text-base mr-2 shrink-0",children:"warning"}),o.jsx(rr,{className:"text-xs text-amber-600 dark:text-amber-400",children:"Do not use while a pattern is running. This will interfere with the main connection."})]})]}),o.jsx("div",{className:"hidden sm:flex items-center gap-1",children:_.length>0&&o.jsx(se,{variant:"ghost",size:"icon",onClick:()=>T([]),title:"Clear history",children:o.jsx("span",{className:"material-icons-outlined",children:"delete_sweep"})})})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs(Pn,{value:b,onValueChange:w,onOpenChange:Z=>Z&&H(),disabled:j||R,children:[o.jsx(An,{className:"h-9 flex-1 min-w-[180px] max-w-[280px]",children:o.jsx(qn,{placeholder:"Select port..."})}),o.jsx(On,{children:v.map(Z=>o.jsx(tt,{value:Z,children:Z},Z))})]}),j?o.jsxs(o.Fragment,{children:[o.jsxs(se,{size:"sm",variant:"destructive",onClick:B,disabled:R,title:"Disconnect",children:[o.jsx("span",{className:"material-icons-outlined sm:mr-1",children:"power_off"}),o.jsx("span",{className:"hidden sm:inline",children:"Disconnect"})]}),o.jsxs(se,{size:"sm",variant:"secondary",onClick:oe,disabled:R,title:"Send soft reset to controller",children:[o.jsx("span",{className:"material-icons-outlined sm:mr-1",children:"restart_alt"}),o.jsx("span",{className:"hidden sm:inline",children:"Reset"})]})]}):o.jsxs(se,{size:"sm",onClick:()=>_e(),disabled:!b||R,title:"Connect",children:[R?o.jsx("span",{className:"material-icons-outlined animate-spin sm:mr-1",children:"sync"}):o.jsx("span",{className:"material-icons-outlined sm:mr-1",children:"power"}),o.jsx("span",{className:"hidden sm:inline",children:"Connect"})]}),_.length>0&&o.jsx(se,{variant:"ghost",size:"icon",className:"sm:hidden",onClick:()=>T([]),title:"Clear history",children:o.jsx("span",{className:"material-icons-outlined",children:"delete"})})]})]}),o.jsxs(Gn,{children:[o.jsx("div",{ref:L,className:"bg-black/90 rounded-md p-3 h-48 overflow-y-auto font-mono text-sm mb-3",children:_.length>0?_.map((Z,ne)=>o.jsxs("div",{className:`${Z.type==="cmd"?"text-cyan-400":Z.type==="error"?"text-red-400":"text-green-400"}`,children:[o.jsx("span",{className:"text-gray-500 text-xs mr-2",children:Z.time}),Z.type==="cmd"?"> ":"",Z.text]},ne)):o.jsx("div",{className:"text-gray-500 italic",children:j?"Ready. Enter a command below (e.g., $, $$, ?, $H)":"Connect to a serial port to send commands"})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(wt,{ref:k,value:C,onChange:Z=>N(Z.target.value),onKeyDown:me,disabled:!j,readOnly:R,placeholder:j?"Enter command (e.g., $, $$, ?, $H)":"Connect to send commands",className:"font-mono text-base h-11"}),o.jsx(se,{onClick:X,disabled:!j||!C.trim()||R,className:"h-11 px-6",children:R?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"send"})})]})]})]})]})})}var Np="Switch",[EX]=Lr(Np),[TX,RX]=EX(Np),p5=g.forwardRef((e,t)=>{const{__scopeSwitch:n,name:a,checked:i,defaultChecked:l,required:u,disabled:d,value:h="on",onCheckedChange:p,form:v,...m}=e,[b,w]=g.useState(null),j=Ot(t,T=>w(T)),S=g.useRef(!1),C=b?v||!!b.closest("form"):!0,[N,_]=Zr({prop:i,defaultProp:l??!1,onChange:p,caller:Np});return o.jsxs(TX,{scope:n,checked:N,disabled:d,children:[o.jsx(dt.button,{type:"button",role:"switch","aria-checked":N,"aria-required":u,"data-state":x5(N),"data-disabled":d?"":void 0,disabled:d,value:h,...m,ref:j,onClick:et(e.onClick,T=>{_(R=>!R),C&&(S.current=T.isPropagationStopped(),S.current||T.stopPropagation())})}),C&&o.jsx(v5,{control:b,bubbles:!S.current,name:a,value:h,checked:N,required:u,disabled:d,form:v,style:{transform:"translateX(-100%)"}})]})});p5.displayName=Np;var m5="SwitchThumb",g5=g.forwardRef((e,t)=>{const{__scopeSwitch:n,...a}=e,i=RX(m5,n);return o.jsx(dt.span,{"data-state":x5(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t})});g5.displayName=m5;var AX="SwitchBubbleInput",v5=g.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:a=!0,...i},l)=>{const u=g.useRef(null),d=Ot(u,l),h=gp(n),p=lp(t);return g.useEffect(()=>{const v=u.current;if(!v)return;const m=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(m,"checked").set;if(h!==n&&w){const j=new Event("click",{bubbles:a});w.call(v,n),v.dispatchEvent(j)}},[h,n,a]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:d,style:{...i.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});v5.displayName=AX;function x5(e){return e?"checked":"unchecked"}var y5=p5,OX=g5;const gr=g.forwardRef(({className:e,...t},n)=>o.jsx(y5,{className:ct("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent 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-secondary",e),...t,ref:n,children:o.jsx(OX,{className:ct("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));gr.displayName=y5.displayName;var mr={},Wo={},Pv,AT;function b5(){if(AT)return Pv;AT=1;var e=typeof Af=="object"&&Af&&Af.Object===Object&&Af;return Pv=e,Pv}var kv,OT;function Ga(){if(OT)return kv;OT=1;var e=b5(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return kv=n,kv}var Lv,MT;function ld(){if(MT)return Lv;MT=1;var e=Ga(),t=e.Symbol;return Lv=t,Lv}var Bv,DT;function MX(){if(DT)return Bv;DT=1;var e=ld(),t=Object.prototype,n=t.hasOwnProperty,a=t.toString,i=e?e.toStringTag:void 0;function l(u){var d=n.call(u,i),h=u[i];try{u[i]=void 0;var p=!0}catch{}var v=a.call(u);return p&&(d?u[i]=h:delete u[i]),v}return Bv=l,Bv}var Iv,PT;function DX(){if(PT)return Iv;PT=1;var e=Object.prototype,t=e.toString;function n(a){return t.call(a)}return Iv=n,Iv}var zv,kT;function lo(){if(kT)return zv;kT=1;var e=ld(),t=MX(),n=DX(),a="[object Null]",i="[object Undefined]",l=e?e.toStringTag:void 0;function u(d){return d==null?d===void 0?i:a:l&&l in Object(d)?t(d):n(d)}return zv=u,zv}var Fv,LT;function Sa(){if(LT)return Fv;LT=1;var e=Array.isArray;return Fv=e,Fv}var Hv,BT;function As(){if(BT)return Hv;BT=1;function e(t){return t!=null&&typeof t=="object"}return Hv=e,Hv}var Uv,IT;function PX(){if(IT)return Uv;IT=1;var e=lo(),t=Sa(),n=As(),a="[object String]";function i(l){return typeof l=="string"||!t(l)&&n(l)&&e(l)==a}return Uv=i,Uv}var Vv,zT;function kX(){if(zT)return Vv;zT=1;function e(t){return function(n,a,i){for(var l=-1,u=Object(n),d=i(n),h=d.length;h--;){var p=d[t?h:++l];if(a(u[p],p,u)===!1)break}return n}}return Vv=e,Vv}var qv,FT;function LX(){if(FT)return qv;FT=1;var e=kX(),t=e();return qv=t,qv}var $v,HT;function BX(){if(HT)return $v;HT=1;function e(t,n){for(var a=-1,i=Array(t);++a<t;)i[a]=n(a);return i}return $v=e,$v}var Gv,UT;function IX(){if(UT)return Gv;UT=1;var e=lo(),t=As(),n="[object Arguments]";function a(i){return t(i)&&e(i)==n}return Gv=a,Gv}var Kv,VT;function w5(){if(VT)return Kv;VT=1;var e=IX(),t=As(),n=Object.prototype,a=n.hasOwnProperty,i=n.propertyIsEnumerable,l=e((function(){return arguments})())?e:function(u){return t(u)&&a.call(u,"callee")&&!i.call(u,"callee")};return Kv=l,Kv}var du={exports:{}},Yv,qT;function zX(){if(qT)return Yv;qT=1;function e(){return!1}return Yv=e,Yv}du.exports;var $T;function hS(){return $T||($T=1,(function(e,t){var n=Ga(),a=zX(),i=t&&!t.nodeType&&t,l=i&&!0&&e&&!e.nodeType&&e,u=l&&l.exports===i,d=u?n.Buffer:void 0,h=d?d.isBuffer:void 0,p=h||a;e.exports=p})(du,du.exports)),du.exports}var Wv,GT;function S5(){if(GT)return Wv;GT=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(a,i){var l=typeof a;return i=i??e,!!i&&(l=="number"||l!="symbol"&&t.test(a))&&a>-1&&a%1==0&&a<i}return Wv=n,Wv}var Xv,KT;function pS(){if(KT)return Xv;KT=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Xv=t,Xv}var Qv,YT;function FX(){if(YT)return Qv;YT=1;var e=lo(),t=pS(),n=As(),a="[object Arguments]",i="[object Array]",l="[object Boolean]",u="[object Date]",d="[object Error]",h="[object Function]",p="[object Map]",v="[object Number]",m="[object Object]",b="[object RegExp]",w="[object Set]",j="[object String]",S="[object WeakMap]",C="[object ArrayBuffer]",N="[object DataView]",_="[object Float32Array]",T="[object Float64Array]",R="[object Int8Array]",D="[object Int16Array]",L="[object Int32Array]",k="[object Uint8Array]",P="[object Uint8ClampedArray]",U="[object Uint16Array]",J="[object Uint32Array]",$={};$[_]=$[T]=$[R]=$[D]=$[L]=$[k]=$[P]=$[U]=$[J]=!0,$[a]=$[i]=$[C]=$[l]=$[N]=$[u]=$[d]=$[h]=$[p]=$[v]=$[m]=$[b]=$[w]=$[j]=$[S]=!1;function W(fe){return n(fe)&&t(fe.length)&&!!$[e(fe)]}return Qv=W,Qv}var Zv,WT;function mS(){if(WT)return Zv;WT=1;function e(t){return function(n){return t(n)}}return Zv=e,Zv}var fu={exports:{}};fu.exports;var XT;function gS(){return XT||(XT=1,(function(e,t){var n=b5(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,l=i&&i.exports===a,u=l&&n.process,d=(function(){try{var h=i&&i.require&&i.require("util").types;return h||u&&u.binding&&u.binding("util")}catch{}})();e.exports=d})(fu,fu.exports)),fu.exports}var Jv,QT;function j5(){if(QT)return Jv;QT=1;var e=FX(),t=mS(),n=gS(),a=n&&n.isTypedArray,i=a?t(a):e;return Jv=i,Jv}var ex,ZT;function C5(){if(ZT)return ex;ZT=1;var e=BX(),t=w5(),n=Sa(),a=hS(),i=S5(),l=j5(),u=Object.prototype,d=u.hasOwnProperty;function h(p,v){var m=n(p),b=!m&&t(p),w=!m&&!b&&a(p),j=!m&&!b&&!w&&l(p),S=m||b||w||j,C=S?e(p.length,String):[],N=C.length;for(var _ in p)(v||d.call(p,_))&&!(S&&(_=="length"||w&&(_=="offset"||_=="parent")||j&&(_=="buffer"||_=="byteLength"||_=="byteOffset")||i(_,N)))&&C.push(_);return C}return ex=h,ex}var tx,JT;function vS(){if(JT)return tx;JT=1;var e=Object.prototype;function t(n){var a=n&&n.constructor,i=typeof a=="function"&&a.prototype||e;return n===i}return tx=t,tx}var nx,eR;function N5(){if(eR)return nx;eR=1;function e(t,n){return function(a){return t(n(a))}}return nx=e,nx}var rx,tR;function HX(){if(tR)return rx;tR=1;var e=N5(),t=e(Object.keys,Object);return rx=t,rx}var ax,nR;function UX(){if(nR)return ax;nR=1;var e=vS(),t=HX(),n=Object.prototype,a=n.hasOwnProperty;function i(l){if(!e(l))return t(l);var u=[];for(var d in Object(l))a.call(l,d)&&d!="constructor"&&u.push(d);return u}return ax=i,ax}var sx,rR;function Wl(){if(rR)return sx;rR=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return sx=e,sx}var ix,aR;function _5(){if(aR)return ix;aR=1;var e=lo(),t=Wl(),n="[object AsyncFunction]",a="[object Function]",i="[object GeneratorFunction]",l="[object Proxy]";function u(d){if(!t(d))return!1;var h=e(d);return h==a||h==i||h==n||h==l}return ix=u,ix}var ox,sR;function _p(){if(sR)return ox;sR=1;var e=_5(),t=pS();function n(a){return a!=null&&t(a.length)&&!e(a)}return ox=n,ox}var lx,iR;function cd(){if(iR)return lx;iR=1;var e=C5(),t=UX(),n=_p();function a(i){return n(i)?e(i):t(i)}return lx=a,lx}var cx,oR;function E5(){if(oR)return cx;oR=1;var e=LX(),t=cd();function n(a,i){return a&&e(a,i,t)}return cx=n,cx}var ux,lR;function T5(){if(lR)return ux;lR=1;function e(t){return t}return ux=e,ux}var dx,cR;function VX(){if(cR)return dx;cR=1;var e=T5();function t(n){return typeof n=="function"?n:e}return dx=t,dx}var fx,uR;function xS(){if(uR)return fx;uR=1;var e=E5(),t=VX();function n(a,i){return a&&e(a,t(i))}return fx=n,fx}var hx,dR;function yS(){if(dR)return hx;dR=1;var e=N5(),t=e(Object.getPrototypeOf,Object);return hx=t,hx}var px,fR;function qX(){if(fR)return px;fR=1;var e=lo(),t=yS(),n=As(),a="[object Object]",i=Function.prototype,l=Object.prototype,u=i.toString,d=l.hasOwnProperty,h=u.call(Object);function p(v){if(!n(v)||e(v)!=a)return!1;var m=t(v);if(m===null)return!0;var b=d.call(m,"constructor")&&m.constructor;return typeof b=="function"&&b instanceof b&&u.call(b)==h}return px=p,px}var mx,hR;function R5(){if(hR)return mx;hR=1;function e(t,n){for(var a=-1,i=t==null?0:t.length,l=Array(i);++a<i;)l[a]=n(t[a],a,t);return l}return mx=e,mx}var gx,pR;function $X(){if(pR)return gx;pR=1;function e(){this.__data__=[],this.size=0}return gx=e,gx}var vx,mR;function bS(){if(mR)return vx;mR=1;function e(t,n){return t===n||t!==t&&n!==n}return vx=e,vx}var xx,gR;function Ep(){if(gR)return xx;gR=1;var e=bS();function t(n,a){for(var i=n.length;i--;)if(e(n[i][0],a))return i;return-1}return xx=t,xx}var yx,vR;function GX(){if(vR)return yx;vR=1;var e=Ep(),t=Array.prototype,n=t.splice;function a(i){var l=this.__data__,u=e(l,i);if(u<0)return!1;var d=l.length-1;return u==d?l.pop():n.call(l,u,1),--this.size,!0}return yx=a,yx}var bx,xR;function KX(){if(xR)return bx;xR=1;var e=Ep();function t(n){var a=this.__data__,i=e(a,n);return i<0?void 0:a[i][1]}return bx=t,bx}var wx,yR;function YX(){if(yR)return wx;yR=1;var e=Ep();function t(n){return e(this.__data__,n)>-1}return wx=t,wx}var Sx,bR;function WX(){if(bR)return Sx;bR=1;var e=Ep();function t(n,a){var i=this.__data__,l=e(i,n);return l<0?(++this.size,i.push([n,a])):i[l][1]=a,this}return Sx=t,Sx}var jx,wR;function Tp(){if(wR)return jx;wR=1;var e=$X(),t=GX(),n=KX(),a=YX(),i=WX();function l(u){var d=-1,h=u==null?0:u.length;for(this.clear();++d<h;){var p=u[d];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=a,l.prototype.set=i,jx=l,jx}var Cx,SR;function XX(){if(SR)return Cx;SR=1;var e=Tp();function t(){this.__data__=new e,this.size=0}return Cx=t,Cx}var Nx,jR;function QX(){if(jR)return Nx;jR=1;function e(t){var n=this.__data__,a=n.delete(t);return this.size=n.size,a}return Nx=e,Nx}var _x,CR;function ZX(){if(CR)return _x;CR=1;function e(t){return this.__data__.get(t)}return _x=e,_x}var Ex,NR;function JX(){if(NR)return Ex;NR=1;function e(t){return this.__data__.has(t)}return Ex=e,Ex}var Tx,_R;function eQ(){if(_R)return Tx;_R=1;var e=Ga(),t=e["__core-js_shared__"];return Tx=t,Tx}var Rx,ER;function tQ(){if(ER)return Rx;ER=1;var e=eQ(),t=(function(){var a=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})();function n(a){return!!t&&t in a}return Rx=n,Rx}var Ax,TR;function A5(){if(TR)return Ax;TR=1;var e=Function.prototype,t=e.toString;function n(a){if(a!=null){try{return t.call(a)}catch{}try{return a+""}catch{}}return""}return Ax=n,Ax}var Ox,RR;function nQ(){if(RR)return Ox;RR=1;var e=_5(),t=tQ(),n=Wl(),a=A5(),i=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,u=Function.prototype,d=Object.prototype,h=u.toString,p=d.hasOwnProperty,v=RegExp("^"+h.call(p).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(b){if(!n(b)||t(b))return!1;var w=e(b)?v:l;return w.test(a(b))}return Ox=m,Ox}var Mx,AR;function rQ(){if(AR)return Mx;AR=1;function e(t,n){return t?.[n]}return Mx=e,Mx}var Dx,OR;function co(){if(OR)return Dx;OR=1;var e=nQ(),t=rQ();function n(a,i){var l=t(a,i);return e(l)?l:void 0}return Dx=n,Dx}var Px,MR;function wS(){if(MR)return Px;MR=1;var e=co(),t=Ga(),n=e(t,"Map");return Px=n,Px}var kx,DR;function Rp(){if(DR)return kx;DR=1;var e=co(),t=e(Object,"create");return kx=t,kx}var Lx,PR;function aQ(){if(PR)return Lx;PR=1;var e=Rp();function t(){this.__data__=e?e(null):{},this.size=0}return Lx=t,Lx}var Bx,kR;function sQ(){if(kR)return Bx;kR=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Bx=e,Bx}var Ix,LR;function iQ(){if(LR)return Ix;LR=1;var e=Rp(),t="__lodash_hash_undefined__",n=Object.prototype,a=n.hasOwnProperty;function i(l){var u=this.__data__;if(e){var d=u[l];return d===t?void 0:d}return a.call(u,l)?u[l]:void 0}return Ix=i,Ix}var zx,BR;function oQ(){if(BR)return zx;BR=1;var e=Rp(),t=Object.prototype,n=t.hasOwnProperty;function a(i){var l=this.__data__;return e?l[i]!==void 0:n.call(l,i)}return zx=a,zx}var Fx,IR;function lQ(){if(IR)return Fx;IR=1;var e=Rp(),t="__lodash_hash_undefined__";function n(a,i){var l=this.__data__;return this.size+=this.has(a)?0:1,l[a]=e&&i===void 0?t:i,this}return Fx=n,Fx}var Hx,zR;function cQ(){if(zR)return Hx;zR=1;var e=aQ(),t=sQ(),n=iQ(),a=oQ(),i=lQ();function l(u){var d=-1,h=u==null?0:u.length;for(this.clear();++d<h;){var p=u[d];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=a,l.prototype.set=i,Hx=l,Hx}var Ux,FR;function uQ(){if(FR)return Ux;FR=1;var e=cQ(),t=Tp(),n=wS();function a(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Ux=a,Ux}var Vx,HR;function dQ(){if(HR)return Vx;HR=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Vx=e,Vx}var qx,UR;function Ap(){if(UR)return qx;UR=1;var e=dQ();function t(n,a){var i=n.__data__;return e(a)?i[typeof a=="string"?"string":"hash"]:i.map}return qx=t,qx}var $x,VR;function fQ(){if(VR)return $x;VR=1;var e=Ap();function t(n){var a=e(this,n).delete(n);return this.size-=a?1:0,a}return $x=t,$x}var Gx,qR;function hQ(){if(qR)return Gx;qR=1;var e=Ap();function t(n){return e(this,n).get(n)}return Gx=t,Gx}var Kx,$R;function pQ(){if($R)return Kx;$R=1;var e=Ap();function t(n){return e(this,n).has(n)}return Kx=t,Kx}var Yx,GR;function mQ(){if(GR)return Yx;GR=1;var e=Ap();function t(n,a){var i=e(this,n),l=i.size;return i.set(n,a),this.size+=i.size==l?0:1,this}return Yx=t,Yx}var Wx,KR;function SS(){if(KR)return Wx;KR=1;var e=uQ(),t=fQ(),n=hQ(),a=pQ(),i=mQ();function l(u){var d=-1,h=u==null?0:u.length;for(this.clear();++d<h;){var p=u[d];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=a,l.prototype.set=i,Wx=l,Wx}var Xx,YR;function gQ(){if(YR)return Xx;YR=1;var e=Tp(),t=wS(),n=SS(),a=200;function i(l,u){var d=this.__data__;if(d instanceof e){var h=d.__data__;if(!t||h.length<a-1)return h.push([l,u]),this.size=++d.size,this;d=this.__data__=new n(h)}return d.set(l,u),this.size=d.size,this}return Xx=i,Xx}var Qx,WR;function jS(){if(WR)return Qx;WR=1;var e=Tp(),t=XX(),n=QX(),a=ZX(),i=JX(),l=gQ();function u(d){var h=this.__data__=new e(d);this.size=h.size}return u.prototype.clear=t,u.prototype.delete=n,u.prototype.get=a,u.prototype.has=i,u.prototype.set=l,Qx=u,Qx}var Zx,XR;function vQ(){if(XR)return Zx;XR=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return Zx=t,Zx}var Jx,QR;function xQ(){if(QR)return Jx;QR=1;function e(t){return this.__data__.has(t)}return Jx=e,Jx}var ey,ZR;function yQ(){if(ZR)return ey;ZR=1;var e=SS(),t=vQ(),n=xQ();function a(i){var l=-1,u=i==null?0:i.length;for(this.__data__=new e;++l<u;)this.add(i[l])}return a.prototype.add=a.prototype.push=t,a.prototype.has=n,ey=a,ey}var ty,JR;function bQ(){if(JR)return ty;JR=1;function e(t,n){for(var a=-1,i=t==null?0:t.length;++a<i;)if(n(t[a],a,t))return!0;return!1}return ty=e,ty}var ny,eA;function wQ(){if(eA)return ny;eA=1;function e(t,n){return t.has(n)}return ny=e,ny}var ry,tA;function O5(){if(tA)return ry;tA=1;var e=yQ(),t=bQ(),n=wQ(),a=1,i=2;function l(u,d,h,p,v,m){var b=h&a,w=u.length,j=d.length;if(w!=j&&!(b&&j>w))return!1;var S=m.get(u),C=m.get(d);if(S&&C)return S==d&&C==u;var N=-1,_=!0,T=h&i?new e:void 0;for(m.set(u,d),m.set(d,u);++N<w;){var R=u[N],D=d[N];if(p)var L=b?p(D,R,N,d,u,m):p(R,D,N,u,d,m);if(L!==void 0){if(L)continue;_=!1;break}if(T){if(!t(d,function(k,P){if(!n(T,P)&&(R===k||v(R,k,h,p,m)))return T.push(P)})){_=!1;break}}else if(!(R===D||v(R,D,h,p,m))){_=!1;break}}return m.delete(u),m.delete(d),_}return ry=l,ry}var ay,nA;function M5(){if(nA)return ay;nA=1;var e=Ga(),t=e.Uint8Array;return ay=t,ay}var sy,rA;function SQ(){if(rA)return sy;rA=1;function e(t){var n=-1,a=Array(t.size);return t.forEach(function(i,l){a[++n]=[l,i]}),a}return sy=e,sy}var iy,aA;function jQ(){if(aA)return iy;aA=1;function e(t){var n=-1,a=Array(t.size);return t.forEach(function(i){a[++n]=i}),a}return iy=e,iy}var oy,sA;function CQ(){if(sA)return oy;sA=1;var e=ld(),t=M5(),n=bS(),a=O5(),i=SQ(),l=jQ(),u=1,d=2,h="[object Boolean]",p="[object Date]",v="[object Error]",m="[object Map]",b="[object Number]",w="[object RegExp]",j="[object Set]",S="[object String]",C="[object Symbol]",N="[object ArrayBuffer]",_="[object DataView]",T=e?e.prototype:void 0,R=T?T.valueOf:void 0;function D(L,k,P,U,J,$,W){switch(P){case _:if(L.byteLength!=k.byteLength||L.byteOffset!=k.byteOffset)return!1;L=L.buffer,k=k.buffer;case N:return!(L.byteLength!=k.byteLength||!$(new t(L),new t(k)));case h:case p:case b:return n(+L,+k);case v:return L.name==k.name&&L.message==k.message;case w:case S:return L==k+"";case m:var fe=i;case j:var we=U&u;if(fe||(fe=l),L.size!=k.size&&!we)return!1;var Ce=W.get(L);if(Ce)return Ce==k;U|=d,W.set(L,k);var I=a(fe(L),fe(k),U,J,$,W);return W.delete(L),I;case C:if(R)return R.call(L)==R.call(k)}return!1}return oy=D,oy}var ly,iA;function D5(){if(iA)return ly;iA=1;function e(t,n){for(var a=-1,i=n.length,l=t.length;++a<i;)t[l+a]=n[a];return t}return ly=e,ly}var cy,oA;function P5(){if(oA)return cy;oA=1;var e=D5(),t=Sa();function n(a,i,l){var u=i(a);return t(a)?u:e(u,l(a))}return cy=n,cy}var uy,lA;function NQ(){if(lA)return uy;lA=1;function e(t,n){for(var a=-1,i=t==null?0:t.length,l=0,u=[];++a<i;){var d=t[a];n(d,a,t)&&(u[l++]=d)}return u}return uy=e,uy}var dy,cA;function k5(){if(cA)return dy;cA=1;function e(){return[]}return dy=e,dy}var fy,uA;function CS(){if(uA)return fy;uA=1;var e=NQ(),t=k5(),n=Object.prototype,a=n.propertyIsEnumerable,i=Object.getOwnPropertySymbols,l=i?function(u){return u==null?[]:(u=Object(u),e(i(u),function(d){return a.call(u,d)}))}:t;return fy=l,fy}var hy,dA;function L5(){if(dA)return hy;dA=1;var e=P5(),t=CS(),n=cd();function a(i){return e(i,n,t)}return hy=a,hy}var py,fA;function _Q(){if(fA)return py;fA=1;var e=L5(),t=1,n=Object.prototype,a=n.hasOwnProperty;function i(l,u,d,h,p,v){var m=d&t,b=e(l),w=b.length,j=e(u),S=j.length;if(w!=S&&!m)return!1;for(var C=w;C--;){var N=b[C];if(!(m?N in u:a.call(u,N)))return!1}var _=v.get(l),T=v.get(u);if(_&&T)return _==u&&T==l;var R=!0;v.set(l,u),v.set(u,l);for(var D=m;++C<w;){N=b[C];var L=l[N],k=u[N];if(h)var P=m?h(k,L,N,u,l,v):h(L,k,N,l,u,v);if(!(P===void 0?L===k||p(L,k,d,h,v):P)){R=!1;break}D||(D=N=="constructor")}if(R&&!D){var U=l.constructor,J=u.constructor;U!=J&&"constructor"in l&&"constructor"in u&&!(typeof U=="function"&&U instanceof U&&typeof J=="function"&&J instanceof J)&&(R=!1)}return v.delete(l),v.delete(u),R}return py=i,py}var my,hA;function EQ(){if(hA)return my;hA=1;var e=co(),t=Ga(),n=e(t,"DataView");return my=n,my}var gy,pA;function TQ(){if(pA)return gy;pA=1;var e=co(),t=Ga(),n=e(t,"Promise");return gy=n,gy}var vy,mA;function RQ(){if(mA)return vy;mA=1;var e=co(),t=Ga(),n=e(t,"Set");return vy=n,vy}var xy,gA;function AQ(){if(gA)return xy;gA=1;var e=co(),t=Ga(),n=e(t,"WeakMap");return xy=n,xy}var yy,vA;function Op(){if(vA)return yy;vA=1;var e=EQ(),t=wS(),n=TQ(),a=RQ(),i=AQ(),l=lo(),u=A5(),d="[object Map]",h="[object Object]",p="[object Promise]",v="[object Set]",m="[object WeakMap]",b="[object DataView]",w=u(e),j=u(t),S=u(n),C=u(a),N=u(i),_=l;return(e&&_(new e(new ArrayBuffer(1)))!=b||t&&_(new t)!=d||n&&_(n.resolve())!=p||a&&_(new a)!=v||i&&_(new i)!=m)&&(_=function(T){var R=l(T),D=R==h?T.constructor:void 0,L=D?u(D):"";if(L)switch(L){case w:return b;case j:return d;case S:return p;case C:return v;case N:return m}return R}),yy=_,yy}var by,xA;function OQ(){if(xA)return by;xA=1;var e=jS(),t=O5(),n=CQ(),a=_Q(),i=Op(),l=Sa(),u=hS(),d=j5(),h=1,p="[object Arguments]",v="[object Array]",m="[object Object]",b=Object.prototype,w=b.hasOwnProperty;function j(S,C,N,_,T,R){var D=l(S),L=l(C),k=D?v:i(S),P=L?v:i(C);k=k==p?m:k,P=P==p?m:P;var U=k==m,J=P==m,$=k==P;if($&&u(S)){if(!u(C))return!1;D=!0,U=!1}if($&&!U)return R||(R=new e),D||d(S)?t(S,C,N,_,T,R):n(S,C,k,N,_,T,R);if(!(N&h)){var W=U&&w.call(S,"__wrapped__"),fe=J&&w.call(C,"__wrapped__");if(W||fe){var we=W?S.value():S,Ce=fe?C.value():C;return R||(R=new e),T(we,Ce,N,_,R)}}return $?(R||(R=new e),a(S,C,N,_,T,R)):!1}return by=j,by}var wy,yA;function B5(){if(yA)return wy;yA=1;var e=OQ(),t=As();function n(a,i,l,u,d){return a===i?!0:a==null||i==null||!t(a)&&!t(i)?a!==a&&i!==i:e(a,i,l,u,n,d)}return wy=n,wy}var Sy,bA;function MQ(){if(bA)return Sy;bA=1;var e=jS(),t=B5(),n=1,a=2;function i(l,u,d,h){var p=d.length,v=p,m=!h;if(l==null)return!v;for(l=Object(l);p--;){var b=d[p];if(m&&b[2]?b[1]!==l[b[0]]:!(b[0]in l))return!1}for(;++p<v;){b=d[p];var w=b[0],j=l[w],S=b[1];if(m&&b[2]){if(j===void 0&&!(w in l))return!1}else{var C=new e;if(h)var N=h(j,S,w,l,u,C);if(!(N===void 0?t(S,j,n|a,h,C):N))return!1}}return!0}return Sy=i,Sy}var jy,wA;function I5(){if(wA)return jy;wA=1;var e=Wl();function t(n){return n===n&&!e(n)}return jy=t,jy}var Cy,SA;function DQ(){if(SA)return Cy;SA=1;var e=I5(),t=cd();function n(a){for(var i=t(a),l=i.length;l--;){var u=i[l],d=a[u];i[l]=[u,d,e(d)]}return i}return Cy=n,Cy}var Ny,jA;function z5(){if(jA)return Ny;jA=1;function e(t,n){return function(a){return a==null?!1:a[t]===n&&(n!==void 0||t in Object(a))}}return Ny=e,Ny}var _y,CA;function PQ(){if(CA)return _y;CA=1;var e=MQ(),t=DQ(),n=z5();function a(i){var l=t(i);return l.length==1&&l[0][2]?n(l[0][0],l[0][1]):function(u){return u===i||e(u,i,l)}}return _y=a,_y}var Ey,NA;function NS(){if(NA)return Ey;NA=1;var e=lo(),t=As(),n="[object Symbol]";function a(i){return typeof i=="symbol"||t(i)&&e(i)==n}return Ey=a,Ey}var Ty,_A;function _S(){if(_A)return Ty;_A=1;var e=Sa(),t=NS(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function i(l,u){if(e(l))return!1;var d=typeof l;return d=="number"||d=="symbol"||d=="boolean"||l==null||t(l)?!0:a.test(l)||!n.test(l)||u!=null&&l in Object(u)}return Ty=i,Ty}var Ry,EA;function kQ(){if(EA)return Ry;EA=1;var e=SS(),t="Expected a function";function n(a,i){if(typeof a!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var l=function(){var u=arguments,d=i?i.apply(this,u):u[0],h=l.cache;if(h.has(d))return h.get(d);var p=a.apply(this,u);return l.cache=h.set(d,p)||h,p};return l.cache=new(n.Cache||e),l}return n.Cache=e,Ry=n,Ry}var Ay,TA;function LQ(){if(TA)return Ay;TA=1;var e=kQ(),t=500;function n(a){var i=e(a,function(u){return l.size===t&&l.clear(),u}),l=i.cache;return i}return Ay=n,Ay}var Oy,RA;function BQ(){if(RA)return Oy;RA=1;var e=LQ(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,a=e(function(i){var l=[];return i.charCodeAt(0)===46&&l.push(""),i.replace(t,function(u,d,h,p){l.push(h?p.replace(n,"$1"):d||u)}),l});return Oy=a,Oy}var My,AA;function IQ(){if(AA)return My;AA=1;var e=ld(),t=R5(),n=Sa(),a=NS(),i=e?e.prototype:void 0,l=i?i.toString:void 0;function u(d){if(typeof d=="string")return d;if(n(d))return t(d,u)+"";if(a(d))return l?l.call(d):"";var h=d+"";return h=="0"&&1/d==-1/0?"-0":h}return My=u,My}var Dy,OA;function zQ(){if(OA)return Dy;OA=1;var e=IQ();function t(n){return n==null?"":e(n)}return Dy=t,Dy}var Py,MA;function F5(){if(MA)return Py;MA=1;var e=Sa(),t=_S(),n=BQ(),a=zQ();function i(l,u){return e(l)?l:t(l,u)?[l]:n(a(l))}return Py=i,Py}var ky,DA;function Mp(){if(DA)return ky;DA=1;var e=NS();function t(n){if(typeof n=="string"||e(n))return n;var a=n+"";return a=="0"&&1/n==-1/0?"-0":a}return ky=t,ky}var Ly,PA;function H5(){if(PA)return Ly;PA=1;var e=F5(),t=Mp();function n(a,i){i=e(i,a);for(var l=0,u=i.length;a!=null&&l<u;)a=a[t(i[l++])];return l&&l==u?a:void 0}return Ly=n,Ly}var By,kA;function FQ(){if(kA)return By;kA=1;var e=H5();function t(n,a,i){var l=n==null?void 0:e(n,a);return l===void 0?i:l}return By=t,By}var Iy,LA;function HQ(){if(LA)return Iy;LA=1;function e(t,n){return t!=null&&n in Object(t)}return Iy=e,Iy}var zy,BA;function UQ(){if(BA)return zy;BA=1;var e=F5(),t=w5(),n=Sa(),a=S5(),i=pS(),l=Mp();function u(d,h,p){h=e(h,d);for(var v=-1,m=h.length,b=!1;++v<m;){var w=l(h[v]);if(!(b=d!=null&&p(d,w)))break;d=d[w]}return b||++v!=m?b:(m=d==null?0:d.length,!!m&&i(m)&&a(w,m)&&(n(d)||t(d)))}return zy=u,zy}var Fy,IA;function VQ(){if(IA)return Fy;IA=1;var e=HQ(),t=UQ();function n(a,i){return a!=null&&t(a,i,e)}return Fy=n,Fy}var Hy,zA;function qQ(){if(zA)return Hy;zA=1;var e=B5(),t=FQ(),n=VQ(),a=_S(),i=I5(),l=z5(),u=Mp(),d=1,h=2;function p(v,m){return a(v)&&i(m)?l(u(v),m):function(b){var w=t(b,v);return w===void 0&&w===m?n(b,v):e(m,w,d|h)}}return Hy=p,Hy}var Uy,FA;function $Q(){if(FA)return Uy;FA=1;function e(t){return function(n){return n?.[t]}}return Uy=e,Uy}var Vy,HA;function GQ(){if(HA)return Vy;HA=1;var e=H5();function t(n){return function(a){return e(a,n)}}return Vy=t,Vy}var qy,UA;function KQ(){if(UA)return qy;UA=1;var e=$Q(),t=GQ(),n=_S(),a=Mp();function i(l){return n(l)?e(a(l)):t(l)}return qy=i,qy}var $y,VA;function YQ(){if(VA)return $y;VA=1;var e=PQ(),t=qQ(),n=T5(),a=Sa(),i=KQ();function l(u){return typeof u=="function"?u:u==null?n:typeof u=="object"?a(u)?t(u[0],u[1]):e(u):i(u)}return $y=l,$y}var Gy,qA;function WQ(){if(qA)return Gy;qA=1;var e=_p();function t(n,a){return function(i,l){if(i==null)return i;if(!e(i))return n(i,l);for(var u=i.length,d=a?u:-1,h=Object(i);(a?d--:++d<u)&&l(h[d],d,h)!==!1;);return i}}return Gy=t,Gy}var Ky,$A;function XQ(){if($A)return Ky;$A=1;var e=E5(),t=WQ(),n=t(e);return Ky=n,Ky}var Yy,GA;function QQ(){if(GA)return Yy;GA=1;var e=XQ(),t=_p();function n(a,i){var l=-1,u=t(a)?Array(a.length):[];return e(a,function(d,h,p){u[++l]=i(d,h,p)}),u}return Yy=n,Yy}var Wy,KA;function ZQ(){if(KA)return Wy;KA=1;var e=R5(),t=YQ(),n=QQ(),a=Sa();function i(l,u){var d=a(l)?e:n;return d(l,t(u,3))}return Wy=i,Wy}var YA;function JQ(){if(YA)return Wo;YA=1,Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.flattenNames=void 0;var e=PX(),t=h(e),n=xS(),a=h(n),i=qX(),l=h(i),u=ZQ(),d=h(u);function h(v){return v&&v.__esModule?v:{default:v}}var p=Wo.flattenNames=function v(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],b=[];return(0,d.default)(m,function(w){Array.isArray(w)?v(w).map(function(j){return b.push(j)}):(0,l.default)(w)?(0,a.default)(w,function(j,S){j===!0&&b.push(S),b.push(S+"-"+j)}):(0,t.default)(w)&&b.push(w)}),b};return Wo.default=p,Wo}var Xo={},Xy,WA;function eZ(){if(WA)return Xy;WA=1;function e(t,n){for(var a=-1,i=t==null?0:t.length;++a<i&&n(t[a],a,t)!==!1;);return t}return Xy=e,Xy}var Qy,XA;function tZ(){if(XA)return Qy;XA=1;var e=co(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return Qy=t,Qy}var Zy,QA;function U5(){if(QA)return Zy;QA=1;var e=tZ();function t(n,a,i){a=="__proto__"&&e?e(n,a,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[a]=i}return Zy=t,Zy}var Jy,ZA;function V5(){if(ZA)return Jy;ZA=1;var e=U5(),t=bS(),n=Object.prototype,a=n.hasOwnProperty;function i(l,u,d){var h=l[u];(!(a.call(l,u)&&t(h,d))||d===void 0&&!(u in l))&&e(l,u,d)}return Jy=i,Jy}var eb,JA;function Dp(){if(JA)return eb;JA=1;var e=V5(),t=U5();function n(a,i,l,u){var d=!l;l||(l={});for(var h=-1,p=i.length;++h<p;){var v=i[h],m=u?u(l[v],a[v],v,l,a):void 0;m===void 0&&(m=a[v]),d?t(l,v,m):e(l,v,m)}return l}return eb=n,eb}var tb,e2;function nZ(){if(e2)return tb;e2=1;var e=Dp(),t=cd();function n(a,i){return a&&e(i,t(i),a)}return tb=n,tb}var nb,t2;function rZ(){if(t2)return nb;t2=1;function e(t){var n=[];if(t!=null)for(var a in Object(t))n.push(a);return n}return nb=e,nb}var rb,n2;function aZ(){if(n2)return rb;n2=1;var e=Wl(),t=vS(),n=rZ(),a=Object.prototype,i=a.hasOwnProperty;function l(u){if(!e(u))return n(u);var d=t(u),h=[];for(var p in u)p=="constructor"&&(d||!i.call(u,p))||h.push(p);return h}return rb=l,rb}var ab,r2;function ES(){if(r2)return ab;r2=1;var e=C5(),t=aZ(),n=_p();function a(i){return n(i)?e(i,!0):t(i)}return ab=a,ab}var sb,a2;function sZ(){if(a2)return sb;a2=1;var e=Dp(),t=ES();function n(a,i){return a&&e(i,t(i),a)}return sb=n,sb}var hu={exports:{}};hu.exports;var s2;function iZ(){return s2||(s2=1,(function(e,t){var n=Ga(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,l=i&&i.exports===a,u=l?n.Buffer:void 0,d=u?u.allocUnsafe:void 0;function h(p,v){if(v)return p.slice();var m=p.length,b=d?d(m):new p.constructor(m);return p.copy(b),b}e.exports=h})(hu,hu.exports)),hu.exports}var ib,i2;function oZ(){if(i2)return ib;i2=1;function e(t,n){var a=-1,i=t.length;for(n||(n=Array(i));++a<i;)n[a]=t[a];return n}return ib=e,ib}var ob,o2;function lZ(){if(o2)return ob;o2=1;var e=Dp(),t=CS();function n(a,i){return e(a,t(a),i)}return ob=n,ob}var lb,l2;function q5(){if(l2)return lb;l2=1;var e=D5(),t=yS(),n=CS(),a=k5(),i=Object.getOwnPropertySymbols,l=i?function(u){for(var d=[];u;)e(d,n(u)),u=t(u);return d}:a;return lb=l,lb}var cb,c2;function cZ(){if(c2)return cb;c2=1;var e=Dp(),t=q5();function n(a,i){return e(a,t(a),i)}return cb=n,cb}var ub,u2;function uZ(){if(u2)return ub;u2=1;var e=P5(),t=q5(),n=ES();function a(i){return e(i,n,t)}return ub=a,ub}var db,d2;function dZ(){if(d2)return db;d2=1;var e=Object.prototype,t=e.hasOwnProperty;function n(a){var i=a.length,l=new a.constructor(i);return i&&typeof a[0]=="string"&&t.call(a,"index")&&(l.index=a.index,l.input=a.input),l}return db=n,db}var fb,f2;function TS(){if(f2)return fb;f2=1;var e=M5();function t(n){var a=new n.constructor(n.byteLength);return new e(a).set(new e(n)),a}return fb=t,fb}var hb,h2;function fZ(){if(h2)return hb;h2=1;var e=TS();function t(n,a){var i=a?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.byteLength)}return hb=t,hb}var pb,p2;function hZ(){if(p2)return pb;p2=1;var e=/\w*$/;function t(n){var a=new n.constructor(n.source,e.exec(n));return a.lastIndex=n.lastIndex,a}return pb=t,pb}var mb,m2;function pZ(){if(m2)return mb;m2=1;var e=ld(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function a(i){return n?Object(n.call(i)):{}}return mb=a,mb}var gb,g2;function mZ(){if(g2)return gb;g2=1;var e=TS();function t(n,a){var i=a?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.length)}return gb=t,gb}var vb,v2;function gZ(){if(v2)return vb;v2=1;var e=TS(),t=fZ(),n=hZ(),a=pZ(),i=mZ(),l="[object Boolean]",u="[object Date]",d="[object Map]",h="[object Number]",p="[object RegExp]",v="[object Set]",m="[object String]",b="[object Symbol]",w="[object ArrayBuffer]",j="[object DataView]",S="[object Float32Array]",C="[object Float64Array]",N="[object Int8Array]",_="[object Int16Array]",T="[object Int32Array]",R="[object Uint8Array]",D="[object Uint8ClampedArray]",L="[object Uint16Array]",k="[object Uint32Array]";function P(U,J,$){var W=U.constructor;switch(J){case w:return e(U);case l:case u:return new W(+U);case j:return t(U,$);case S:case C:case N:case _:case T:case R:case D:case L:case k:return i(U,$);case d:return new W;case h:case m:return new W(U);case p:return n(U);case v:return new W;case b:return a(U)}}return vb=P,vb}var xb,x2;function vZ(){if(x2)return xb;x2=1;var e=Wl(),t=Object.create,n=(function(){function a(){}return function(i){if(!e(i))return{};if(t)return t(i);a.prototype=i;var l=new a;return a.prototype=void 0,l}})();return xb=n,xb}var yb,y2;function xZ(){if(y2)return yb;y2=1;var e=vZ(),t=yS(),n=vS();function a(i){return typeof i.constructor=="function"&&!n(i)?e(t(i)):{}}return yb=a,yb}var bb,b2;function yZ(){if(b2)return bb;b2=1;var e=Op(),t=As(),n="[object Map]";function a(i){return t(i)&&e(i)==n}return bb=a,bb}var wb,w2;function bZ(){if(w2)return wb;w2=1;var e=yZ(),t=mS(),n=gS(),a=n&&n.isMap,i=a?t(a):e;return wb=i,wb}var Sb,S2;function wZ(){if(S2)return Sb;S2=1;var e=Op(),t=As(),n="[object Set]";function a(i){return t(i)&&e(i)==n}return Sb=a,Sb}var jb,j2;function SZ(){if(j2)return jb;j2=1;var e=wZ(),t=mS(),n=gS(),a=n&&n.isSet,i=a?t(a):e;return jb=i,jb}var Cb,C2;function jZ(){if(C2)return Cb;C2=1;var e=jS(),t=eZ(),n=V5(),a=nZ(),i=sZ(),l=iZ(),u=oZ(),d=lZ(),h=cZ(),p=L5(),v=uZ(),m=Op(),b=dZ(),w=gZ(),j=xZ(),S=Sa(),C=hS(),N=bZ(),_=Wl(),T=SZ(),R=cd(),D=ES(),L=1,k=2,P=4,U="[object Arguments]",J="[object Array]",$="[object Boolean]",W="[object Date]",fe="[object Error]",we="[object Function]",Ce="[object GeneratorFunction]",I="[object Map]",V="[object Number]",H="[object Object]",be="[object RegExp]",_e="[object Set]",B="[object String]",G="[object Symbol]",X="[object WeakMap]",oe="[object ArrayBuffer]",me="[object DataView]",Z="[object Float32Array]",ne="[object Float64Array]",he="[object Int8Array]",Ee="[object Int16Array]",je="[object Int32Array]",ke="[object Uint8Array]",le="[object Uint8ClampedArray]",Fe="[object Uint16Array]",Ge="[object Uint32Array]",He={};He[U]=He[J]=He[oe]=He[me]=He[$]=He[W]=He[Z]=He[ne]=He[he]=He[Ee]=He[je]=He[I]=He[V]=He[H]=He[be]=He[_e]=He[B]=He[G]=He[ke]=He[le]=He[Fe]=He[Ge]=!0,He[fe]=He[we]=He[X]=!1;function at(Ke,Mt,St,_t,jt,ot){var lt,Ct=Mt&L,Vt=Mt&k,Kt=Mt&P;if(St&&(lt=jt?St(Ke,_t,jt,ot):St(Ke)),lt!==void 0)return lt;if(!_(Ke))return Ke;var Wt=S(Ke);if(Wt){if(lt=b(Ke),!Ct)return u(Ke,lt)}else{var te=m(Ke),Me=te==we||te==Ce;if(C(Ke))return l(Ke,Ct);if(te==H||te==U||Me&&!jt){if(lt=Vt||Me?{}:j(Ke),!Ct)return Vt?h(Ke,i(lt,Ke)):d(Ke,a(lt,Ke))}else{if(!He[te])return jt?Ke:{};lt=w(Ke,te,Ct)}}ot||(ot=new e);var st=ot.get(Ke);if(st)return st;ot.set(Ke,lt),T(Ke)?Ke.forEach(function(gt){lt.add(at(gt,Mt,St,gt,Ke,ot))}):N(Ke)&&Ke.forEach(function(gt,xt){lt.set(xt,at(gt,Mt,St,xt,Ke,ot))});var nt=Kt?Vt?v:p:Vt?D:R,yt=Wt?void 0:nt(Ke);return t(yt||Ke,function(gt,xt){yt&&(xt=gt,gt=Ke[xt]),n(lt,xt,at(gt,Mt,St,xt,Ke,ot))}),lt}return Cb=at,Cb}var Nb,N2;function CZ(){if(N2)return Nb;N2=1;var e=jZ(),t=1,n=4;function a(i){return e(i,t|n)}return Nb=a,Nb}var _2;function NZ(){if(_2)return Xo;_2=1,Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.mergeClasses=void 0;var e=xS(),t=l(e),n=CZ(),a=l(n),i=Object.assign||function(d){for(var h=1;h<arguments.length;h++){var p=arguments[h];for(var v in p)Object.prototype.hasOwnProperty.call(p,v)&&(d[v]=p[v])}return d};function l(d){return d&&d.__esModule?d:{default:d}}var u=Xo.mergeClasses=function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],v=h.default&&(0,a.default)(h.default)||{};return p.map(function(m){var b=h[m];return b&&(0,t.default)(b,function(w,j){v[j]||(v[j]={}),v[j]=i({},v[j],b[j])}),m}),v};return Xo.default=u,Xo}var Qo={},E2;function _Z(){if(E2)return Qo;E2=1,Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.autoprefix=void 0;var e=xS(),t=a(e),n=Object.assign||function(u){for(var d=1;d<arguments.length;d++){var h=arguments[d];for(var p in h)Object.prototype.hasOwnProperty.call(h,p)&&(u[p]=h[p])}return u};function a(u){return u&&u.__esModule?u:{default:u}}var i={borderRadius:function(d){return{msBorderRadius:d,MozBorderRadius:d,OBorderRadius:d,WebkitBorderRadius:d,borderRadius:d}},boxShadow:function(d){return{msBoxShadow:d,MozBoxShadow:d,OBoxShadow:d,WebkitBoxShadow:d,boxShadow:d}},userSelect:function(d){return{WebkitTouchCallout:d,KhtmlUserSelect:d,MozUserSelect:d,msUserSelect:d,WebkitUserSelect:d,userSelect:d}},flex:function(d){return{WebkitBoxFlex:d,MozBoxFlex:d,WebkitFlex:d,msFlex:d,flex:d}},flexBasis:function(d){return{WebkitFlexBasis:d,flexBasis:d}},justifyContent:function(d){return{WebkitJustifyContent:d,justifyContent:d}},transition:function(d){return{msTransition:d,MozTransition:d,OTransition:d,WebkitTransition:d,transition:d}},transform:function(d){return{msTransform:d,MozTransform:d,OTransform:d,WebkitTransform:d,transform:d}},absolute:function(d){var h=d&&d.split(" ");return{position:"absolute",top:h&&h[0],right:h&&h[1],bottom:h&&h[2],left:h&&h[3]}},extend:function(d,h){var p=h[d];return p||{extend:d}}},l=Qo.autoprefix=function(d){var h={};return(0,t.default)(d,function(p,v){var m={};(0,t.default)(p,function(b,w){var j=i[w];j?m=n({},m,j(b)):m[w]=b}),h[v]=m}),h};return Qo.default=l,Qo}var Zo={},T2;function EZ(){if(T2)return Zo;T2=1,Object.defineProperty(Zo,"__esModule",{value:!0}),Zo.hover=void 0;var e=Object.assign||function(h){for(var p=1;p<arguments.length;p++){var v=arguments[p];for(var m in v)Object.prototype.hasOwnProperty.call(v,m)&&(h[m]=v[m])}return h},t=io(),n=a(t);function a(h){return h&&h.__esModule?h:{default:h}}function i(h,p){if(!(h instanceof p))throw new TypeError("Cannot call a class as a function")}function l(h,p){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:h}function u(h,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);h.prototype=Object.create(p&&p.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(h,p):h.__proto__=p)}var d=Zo.hover=function(p){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return(function(m){u(b,m);function b(){var w,j,S,C;i(this,b);for(var N=arguments.length,_=Array(N),T=0;T<N;T++)_[T]=arguments[T];return C=(j=(S=l(this,(w=b.__proto__||Object.getPrototypeOf(b)).call.apply(w,[this].concat(_))),S),S.state={hover:!1},S.handleMouseOver=function(){return S.setState({hover:!0})},S.handleMouseOut=function(){return S.setState({hover:!1})},S.render=function(){return n.default.createElement(v,{onMouseOver:S.handleMouseOver,onMouseOut:S.handleMouseOut},n.default.createElement(p,e({},S.props,S.state)))},j),l(S,C)}return b})(n.default.Component)};return Zo.default=d,Zo}var Jo={},R2;function TZ(){if(R2)return Jo;R2=1,Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.active=void 0;var e=Object.assign||function(h){for(var p=1;p<arguments.length;p++){var v=arguments[p];for(var m in v)Object.prototype.hasOwnProperty.call(v,m)&&(h[m]=v[m])}return h},t=io(),n=a(t);function a(h){return h&&h.__esModule?h:{default:h}}function i(h,p){if(!(h instanceof p))throw new TypeError("Cannot call a class as a function")}function l(h,p){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:h}function u(h,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);h.prototype=Object.create(p&&p.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(h,p):h.__proto__=p)}var d=Jo.active=function(p){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return(function(m){u(b,m);function b(){var w,j,S,C;i(this,b);for(var N=arguments.length,_=Array(N),T=0;T<N;T++)_[T]=arguments[T];return C=(j=(S=l(this,(w=b.__proto__||Object.getPrototypeOf(b)).call.apply(w,[this].concat(_))),S),S.state={active:!1},S.handleMouseDown=function(){return S.setState({active:!0})},S.handleMouseUp=function(){return S.setState({active:!1})},S.render=function(){return n.default.createElement(v,{onMouseDown:S.handleMouseDown,onMouseUp:S.handleMouseUp},n.default.createElement(p,e({},S.props,S.state)))},j),l(S,C)}return b})(n.default.Component)};return Jo.default=d,Jo}var Kf={},A2;function RZ(){if(A2)return Kf;A2=1,Object.defineProperty(Kf,"__esModule",{value:!0});var e=function(n,a){var i={},l=function(d){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i[d]=h};return n===0&&l("first-child"),n===a-1&&l("last-child"),(n===0||n%2===0)&&l("even"),Math.abs(n%2)===1&&l("odd"),l("nth-child",n),i};return Kf.default=e,Kf}var O2;function AZ(){if(O2)return mr;O2=1,Object.defineProperty(mr,"__esModule",{value:!0}),mr.ReactCSS=mr.loop=mr.handleActive=mr.handleHover=mr.hover=void 0;var e=JQ(),t=b(e),n=NZ(),a=b(n),i=_Z(),l=b(i),u=EZ(),d=b(u),h=TZ(),p=b(h),v=RZ(),m=b(v);function b(j){return j&&j.__esModule?j:{default:j}}mr.hover=d.default,mr.handleHover=d.default,mr.handleActive=p.default,mr.loop=m.default;var w=mr.ReactCSS=function(S){for(var C=arguments.length,N=Array(C>1?C-1:0),_=1;_<C;_++)N[_-1]=arguments[_];var T=(0,t.default)(N),R=(0,a.default)(S,T);return(0,l.default)(R)};return mr.default=w,mr}var RS=AZ();const ht=Ml(RS);var OZ=function(t,n,a,i,l){var u=l.clientWidth,d=l.clientHeight,h=typeof t.pageX=="number"?t.pageX:t.touches[0].pageX,p=typeof t.pageY=="number"?t.pageY:t.touches[0].pageY,v=h-(l.getBoundingClientRect().left+window.pageXOffset),m=p-(l.getBoundingClientRect().top+window.pageYOffset);if(a==="vertical"){var b=void 0;if(m<0?b=0:m>d?b=1:b=Math.round(m*100/d)/100,n.a!==b)return{h:n.h,s:n.s,l:n.l,a:b,source:"rgb"}}else{var w=void 0;if(v<0?w=0:v>u?w=1:w=Math.round(v*100/u)/100,i!==w)return{h:n.h,s:n.s,l:n.l,a:w,source:"rgb"}}return null},_b={},MZ=function(t,n,a,i){if(typeof document>"u"&&!i)return null;var l=i?new i:document.createElement("canvas");l.width=a*2,l.height=a*2;var u=l.getContext("2d");return u?(u.fillStyle=t,u.fillRect(0,0,l.width,l.height),u.fillStyle=n,u.fillRect(0,0,a,a),u.translate(a,a),u.fillRect(0,0,a,a),l.toDataURL()):null},DZ=function(t,n,a,i){var l=t+"-"+n+"-"+a+(i?"-server":"");if(_b[l])return _b[l];var u=MZ(t,n,a,i);return _b[l]=u,u},M2=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Xl=function(t){var n=t.white,a=t.grey,i=t.size,l=t.renderers,u=t.borderRadius,d=t.boxShadow,h=t.children,p=ht({default:{grid:{borderRadius:u,boxShadow:d,absolute:"0px 0px 0px 0px",background:"url("+DZ(n,a,i,l.canvas)+") center left"}}});return g.isValidElement(h)?A.cloneElement(h,M2({},h.props,{style:M2({},h.props.style,p.grid)})):A.createElement("div",{style:p.grid})};Xl.defaultProps={size:8,white:"transparent",grey:"rgba(0,0,0,.08)",renderers:{}};var PZ=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},kZ=(function(){function e(t,n){for(var a=0;a<n.length;a++){var i=n[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}})();function LZ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D2(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function BZ(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var AS=(function(e){BZ(t,e);function t(){var n,a,i,l;LZ(this,t);for(var u=arguments.length,d=Array(u),h=0;h<u;h++)d[h]=arguments[h];return l=(a=(i=D2(this,(n=t.__proto__||Object.getPrototypeOf(t)).call.apply(n,[this].concat(d))),i),i.handleChange=function(p){var v=OZ(p,i.props.hsl,i.props.direction,i.props.a,i.container);v&&typeof i.props.onChange=="function"&&i.props.onChange(v,p)},i.handleMouseDown=function(p){i.handleChange(p),window.addEventListener("mousemove",i.handleChange),window.addEventListener("mouseup",i.handleMouseUp)},i.handleMouseUp=function(){i.unbindEventListeners()},i.unbindEventListeners=function(){window.removeEventListener("mousemove",i.handleChange),window.removeEventListener("mouseup",i.handleMouseUp)},a),D2(i,l)}return kZ(t,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"render",value:function(){var a=this,i=this.props.rgb,l=ht({default:{alpha:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius},checkboard:{absolute:"0px 0px 0px 0px",overflow:"hidden",borderRadius:this.props.radius},gradient:{absolute:"0px 0px 0px 0px",background:"linear-gradient(to right, rgba("+i.r+","+i.g+","+i.b+`, 0) 0%,
  59. rgba(`+i.r+","+i.g+","+i.b+", 1) 100%)",boxShadow:this.props.shadow,borderRadius:this.props.radius},container:{position:"relative",height:"100%",margin:"0 3px"},pointer:{position:"absolute",left:i.a*100+"%"},slider:{width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",marginTop:"1px",transform:"translateX(-2px)"}},vertical:{gradient:{background:"linear-gradient(to bottom, rgba("+i.r+","+i.g+","+i.b+`, 0) 0%,
  60. rgba(`+i.r+","+i.g+","+i.b+", 1) 100%)"},pointer:{left:0,top:i.a*100+"%"}},overwrite:PZ({},this.props.style)},{vertical:this.props.direction==="vertical",overwrite:!0});return A.createElement("div",{style:l.alpha},A.createElement("div",{style:l.checkboard},A.createElement(Xl,{renderers:this.props.renderers})),A.createElement("div",{style:l.gradient}),A.createElement("div",{style:l.container,ref:function(d){return a.container=d},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},A.createElement("div",{style:l.pointer},this.props.pointer?A.createElement(this.props.pointer,this.props):A.createElement("div",{style:l.slider}))))}}]),t})(g.PureComponent||g.Component),IZ=(function(){function e(t,n){for(var a=0;a<n.length;a++){var i=n[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}})();function zZ(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function FZ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function HZ(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function UZ(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var VZ=1,$5=38,qZ=40,$Z=[$5,qZ],GZ=function(t){return $Z.indexOf(t)>-1},KZ=function(t){return Number(String(t).replace(/%/g,""))},YZ=1,Ut=(function(e){UZ(t,e);function t(n){FZ(this,t);var a=HZ(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.handleBlur=function(){a.state.blurValue&&a.setState({value:a.state.blurValue,blurValue:null})},a.handleChange=function(i){a.setUpdatedValue(i.target.value,i)},a.handleKeyDown=function(i){var l=KZ(i.target.value);if(!isNaN(l)&&GZ(i.keyCode)){var u=a.getArrowOffset(),d=i.keyCode===$5?l+u:l-u;a.setUpdatedValue(d,i)}},a.handleDrag=function(i){if(a.props.dragLabel){var l=Math.round(a.props.value+i.movementX);l>=0&&l<=a.props.dragMax&&a.props.onChange&&a.props.onChange(a.getValueObjectWithLabel(l),i)}},a.handleMouseDown=function(i){a.props.dragLabel&&(i.preventDefault(),a.handleDrag(i),window.addEventListener("mousemove",a.handleDrag),window.addEventListener("mouseup",a.handleMouseUp))},a.handleMouseUp=function(){a.unbindEventListeners()},a.unbindEventListeners=function(){window.removeEventListener("mousemove",a.handleDrag),window.removeEventListener("mouseup",a.handleMouseUp)},a.state={value:String(n.value).toUpperCase(),blurValue:String(n.value).toUpperCase()},a.inputId="rc-editable-input-"+YZ++,a}return IZ(t,[{key:"componentDidUpdate",value:function(a,i){this.props.value!==this.state.value&&(a.value!==this.props.value||i.value!==this.state.value)&&(this.input===document.activeElement?this.setState({blurValue:String(this.props.value).toUpperCase()}):this.setState({value:String(this.props.value).toUpperCase(),blurValue:!this.state.blurValue&&String(this.props.value).toUpperCase()}))}},{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"getValueObjectWithLabel",value:function(a){return zZ({},this.props.label,a)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||VZ}},{key:"setUpdatedValue",value:function(a,i){var l=this.props.label?this.getValueObjectWithLabel(a):a;this.props.onChange&&this.props.onChange(l,i),this.setState({value:a})}},{key:"render",value:function(){var a=this,i=ht({default:{wrap:{position:"relative"}},"user-override":{wrap:this.props.style&&this.props.style.wrap?this.props.style.wrap:{},input:this.props.style&&this.props.style.input?this.props.style.input:{},label:this.props.style&&this.props.style.label?this.props.style.label:{}},"dragLabel-true":{label:{cursor:"ew-resize"}}},{"user-override":!0},this.props);return A.createElement("div",{style:i.wrap},A.createElement("input",{id:this.inputId,style:i.input,ref:function(u){return a.input=u},value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,onBlur:this.handleBlur,placeholder:this.props.placeholder,spellCheck:"false"}),this.props.label&&!this.props.hideLabel?A.createElement("label",{htmlFor:this.inputId,style:i.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),t})(g.PureComponent||g.Component),WZ=function(t,n,a,i){var l=i.clientWidth,u=i.clientHeight,d=typeof t.pageX=="number"?t.pageX:t.touches[0].pageX,h=typeof t.pageY=="number"?t.pageY:t.touches[0].pageY,p=d-(i.getBoundingClientRect().left+window.pageXOffset),v=h-(i.getBoundingClientRect().top+window.pageYOffset);if(n==="vertical"){var m=void 0;if(v<0)m=359;else if(v>u)m=0;else{var b=-(v*100/u)+100;m=360*b/100}if(a.h!==m)return{h:m,s:a.s,l:a.l,a:a.a,source:"hsl"}}else{var w=void 0;if(p<0)w=0;else if(p>l)w=359;else{var j=p*100/l;w=360*j/100}if(a.h!==w)return{h:w,s:a.s,l:a.l,a:a.a,source:"hsl"}}return null},XZ=(function(){function e(t,n){for(var a=0;a<n.length;a++){var i=n[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}})();function QZ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P2(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function ZZ(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var Ql=(function(e){ZZ(t,e);function t(){var n,a,i,l;QZ(this,t);for(var u=arguments.length,d=Array(u),h=0;h<u;h++)d[h]=arguments[h];return l=(a=(i=P2(this,(n=t.__proto__||Object.getPrototypeOf(t)).call.apply(n,[this].concat(d))),i),i.handleChange=function(p){var v=WZ(p,i.props.direction,i.props.hsl,i.container);v&&typeof i.props.onChange=="function"&&i.props.onChange(v,p)},i.handleMouseDown=function(p){i.handleChange(p),window.addEventListener("mousemove",i.handleChange),window.addEventListener("mouseup",i.handleMouseUp)},i.handleMouseUp=function(){i.unbindEventListeners()},a),P2(i,l)}return XZ(t,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"unbindEventListeners",value:function(){window.removeEventListener("mousemove",this.handleChange),window.removeEventListener("mouseup",this.handleMouseUp)}},{key:"render",value:function(){var a=this,i=this.props.direction,l=i===void 0?"horizontal":i,u=ht({default:{hue:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius,boxShadow:this.props.shadow},container:{padding:"0 2px",position:"relative",height:"100%",borderRadius:this.props.radius},pointer:{position:"absolute",left:this.props.hsl.h*100/360+"%"},slider:{marginTop:"1px",width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",transform:"translateX(-2px)"}},vertical:{pointer:{left:"0px",top:-(this.props.hsl.h*100/360)+100+"%"}}},{vertical:l==="vertical"});return A.createElement("div",{style:u.hue},A.createElement("div",{className:"hue-"+l,style:u.container,ref:function(h){return a.container=h},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},A.createElement("style",null,`
  61. .hue-horizontal {
  62. background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0
  63. 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
  64. background: -webkit-linear-gradient(to right, #f00 0%, #ff0
  65. 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
  66. }
  67. .hue-vertical {
  68. background: linear-gradient(to top, #f00 0%, #ff0 17%, #0f0 33%,
  69. #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
  70. background: -webkit-linear-gradient(to top, #f00 0%, #ff0 17%,
  71. #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
  72. }
  73. `),A.createElement("div",{style:u.pointer},this.props.pointer?A.createElement(this.props.pointer,this.props):A.createElement("div",{style:u.slider}))))}}]),t})(g.PureComponent||g.Component),Eb={exports:{}},Tb,k2;function JZ(){if(k2)return Tb;k2=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Tb=e,Tb}var Rb,L2;function eJ(){if(L2)return Rb;L2=1;var e=JZ();function t(){}function n(){}return n.resetWarningCache=t,Rb=function(){function a(u,d,h,p,v,m){if(m!==e){var b=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw b.name="Invariant Violation",b}}a.isRequired=a;function i(){return a}var l={array:a,bigint:a,bool:a,func:a,number:a,object:a,string:a,symbol:a,any:a,arrayOf:i,element:a,elementType:a,instanceOf:i,node:a,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return l.PropTypes=l,l},Rb}var B2;function tJ(){return B2||(B2=1,Eb.exports=eJ()()),Eb.exports}var nJ=tJ();const De=Ml(nJ);function rJ(){this.__data__=[],this.size=0}function ud(e,t){return e===t||e!==e&&t!==t}function Pp(e,t){for(var n=e.length;n--;)if(ud(e[n][0],t))return n;return-1}var aJ=Array.prototype,sJ=aJ.splice;function iJ(e){var t=this.__data__,n=Pp(t,e);if(n<0)return!1;var a=t.length-1;return n==a?t.pop():sJ.call(t,n,1),--this.size,!0}function oJ(e){var t=this.__data__,n=Pp(t,e);return n<0?void 0:t[n][1]}function lJ(e){return Pp(this.__data__,e)>-1}function cJ(e,t){var n=this.__data__,a=Pp(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this}function Os(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var a=e[t];this.set(a[0],a[1])}}Os.prototype.clear=rJ;Os.prototype.delete=iJ;Os.prototype.get=oJ;Os.prototype.has=lJ;Os.prototype.set=cJ;function uJ(){this.__data__=new Os,this.size=0}function dJ(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function fJ(e){return this.__data__.get(e)}function hJ(e){return this.__data__.has(e)}var G5=typeof global=="object"&&global&&global.Object===Object&&global,pJ=typeof self=="object"&&self&&self.Object===Object&&self,ja=G5||pJ||Function("return this")(),wi=ja.Symbol,K5=Object.prototype,mJ=K5.hasOwnProperty,gJ=K5.toString,su=wi?wi.toStringTag:void 0;function vJ(e){var t=mJ.call(e,su),n=e[su];try{e[su]=void 0;var a=!0}catch{}var i=gJ.call(e);return a&&(t?e[su]=n:delete e[su]),i}var xJ=Object.prototype,yJ=xJ.toString;function bJ(e){return yJ.call(e)}var wJ="[object Null]",SJ="[object Undefined]",I2=wi?wi.toStringTag:void 0;function uo(e){return e==null?e===void 0?SJ:wJ:I2&&I2 in Object(e)?vJ(e):bJ(e)}function Jr(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var jJ="[object AsyncFunction]",CJ="[object Function]",NJ="[object GeneratorFunction]",_J="[object Proxy]";function OS(e){if(!Jr(e))return!1;var t=uo(e);return t==CJ||t==NJ||t==jJ||t==_J}var Ab=ja["__core-js_shared__"],z2=(function(){var e=/[^.]+$/.exec(Ab&&Ab.keys&&Ab.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function EJ(e){return!!z2&&z2 in e}var TJ=Function.prototype,RJ=TJ.toString;function fo(e){if(e!=null){try{return RJ.call(e)}catch{}try{return e+""}catch{}}return""}var AJ=/[\\^$.*+?()[\]{}|]/g,OJ=/^\[object .+?Constructor\]$/,MJ=Function.prototype,DJ=Object.prototype,PJ=MJ.toString,kJ=DJ.hasOwnProperty,LJ=RegExp("^"+PJ.call(kJ).replace(AJ,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function BJ(e){if(!Jr(e)||EJ(e))return!1;var t=OS(e)?LJ:OJ;return t.test(fo(e))}function IJ(e,t){return e?.[t]}function ho(e,t){var n=IJ(e,t);return BJ(n)?n:void 0}var $u=ho(ja,"Map"),Gu=ho(Object,"create");function zJ(){this.__data__=Gu?Gu(null):{},this.size=0}function FJ(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var HJ="__lodash_hash_undefined__",UJ=Object.prototype,VJ=UJ.hasOwnProperty;function qJ(e){var t=this.__data__;if(Gu){var n=t[e];return n===HJ?void 0:n}return VJ.call(t,e)?t[e]:void 0}var $J=Object.prototype,GJ=$J.hasOwnProperty;function KJ(e){var t=this.__data__;return Gu?t[e]!==void 0:GJ.call(t,e)}var YJ="__lodash_hash_undefined__";function WJ(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Gu&&t===void 0?YJ:t,this}function so(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var a=e[t];this.set(a[0],a[1])}}so.prototype.clear=zJ;so.prototype.delete=FJ;so.prototype.get=qJ;so.prototype.has=KJ;so.prototype.set=WJ;function XJ(){this.size=0,this.__data__={hash:new so,map:new($u||Os),string:new so}}function QJ(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function kp(e,t){var n=e.__data__;return QJ(t)?n[typeof t=="string"?"string":"hash"]:n.map}function ZJ(e){var t=kp(this,e).delete(e);return this.size-=t?1:0,t}function JJ(e){return kp(this,e).get(e)}function eee(e){return kp(this,e).has(e)}function tee(e,t){var n=kp(this,e),a=n.size;return n.set(e,t),this.size+=n.size==a?0:1,this}function Ms(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var a=e[t];this.set(a[0],a[1])}}Ms.prototype.clear=XJ;Ms.prototype.delete=ZJ;Ms.prototype.get=JJ;Ms.prototype.has=eee;Ms.prototype.set=tee;var nee=200;function ree(e,t){var n=this.__data__;if(n instanceof Os){var a=n.__data__;if(!$u||a.length<nee-1)return a.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ms(a)}return n.set(e,t),this.size=n.size,this}function za(e){var t=this.__data__=new Os(e);this.size=t.size}za.prototype.clear=uJ;za.prototype.delete=dJ;za.prototype.get=fJ;za.prototype.has=hJ;za.prototype.set=ree;var Dh=(function(){try{var e=ho(Object,"defineProperty");return e({},"",{}),e}catch{}})();function MS(e,t,n){t=="__proto__"&&Dh?Dh(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function B0(e,t,n){(n!==void 0&&!ud(e[t],n)||n===void 0&&!(t in e))&&MS(e,t,n)}function aee(e){return function(t,n,a){for(var i=-1,l=Object(t),u=a(t),d=u.length;d--;){var h=u[++i];if(n(l[h],h,l)===!1)break}return t}}var Y5=aee(),W5=typeof Ar=="object"&&Ar&&!Ar.nodeType&&Ar,F2=W5&&typeof Or=="object"&&Or&&!Or.nodeType&&Or,see=F2&&F2.exports===W5,H2=see?ja.Buffer:void 0;H2&&H2.allocUnsafe;function iee(e,t){return e.slice()}var Ph=ja.Uint8Array;function oee(e){var t=new e.constructor(e.byteLength);return new Ph(t).set(new Ph(e)),t}function lee(e,t){var n=oee(e.buffer);return new e.constructor(n,e.byteOffset,e.length)}function cee(e,t){var n=-1,a=e.length;for(t||(t=Array(a));++n<a;)t[n]=e[n];return t}var U2=Object.create,uee=(function(){function e(){}return function(t){if(!Jr(t))return{};if(U2)return U2(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}})();function X5(e,t){return function(n){return e(t(n))}}var Q5=X5(Object.getPrototypeOf,Object),dee=Object.prototype;function DS(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||dee;return e===n}function fee(e){return typeof e.constructor=="function"&&!DS(e)?uee(Q5(e)):{}}function Si(e){return e!=null&&typeof e=="object"}var hee="[object Arguments]";function V2(e){return Si(e)&&uo(e)==hee}var Z5=Object.prototype,pee=Z5.hasOwnProperty,mee=Z5.propertyIsEnumerable,kh=V2((function(){return arguments})())?V2:function(e){return Si(e)&&pee.call(e,"callee")&&!mee.call(e,"callee")},kr=Array.isArray,gee=9007199254740991;function PS(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=gee}function Zl(e){return e!=null&&PS(e.length)&&!OS(e)}function vee(e){return Si(e)&&Zl(e)}function xee(){return!1}var J5=typeof Ar=="object"&&Ar&&!Ar.nodeType&&Ar,q2=J5&&typeof Or=="object"&&Or&&!Or.nodeType&&Or,yee=q2&&q2.exports===J5,$2=yee?ja.Buffer:void 0,bee=$2?$2.isBuffer:void 0,Lh=bee||xee,wee="[object Object]",See=Function.prototype,jee=Object.prototype,eL=See.toString,Cee=jee.hasOwnProperty,Nee=eL.call(Object);function _ee(e){if(!Si(e)||uo(e)!=wee)return!1;var t=Q5(e);if(t===null)return!0;var n=Cee.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&eL.call(n)==Nee}var Eee="[object Arguments]",Tee="[object Array]",Ree="[object Boolean]",Aee="[object Date]",Oee="[object Error]",Mee="[object Function]",Dee="[object Map]",Pee="[object Number]",kee="[object Object]",Lee="[object RegExp]",Bee="[object Set]",Iee="[object String]",zee="[object WeakMap]",Fee="[object ArrayBuffer]",Hee="[object DataView]",Uee="[object Float32Array]",Vee="[object Float64Array]",qee="[object Int8Array]",$ee="[object Int16Array]",Gee="[object Int32Array]",Kee="[object Uint8Array]",Yee="[object Uint8ClampedArray]",Wee="[object Uint16Array]",Xee="[object Uint32Array]",ln={};ln[Uee]=ln[Vee]=ln[qee]=ln[$ee]=ln[Gee]=ln[Kee]=ln[Yee]=ln[Wee]=ln[Xee]=!0;ln[Eee]=ln[Tee]=ln[Fee]=ln[Ree]=ln[Hee]=ln[Aee]=ln[Oee]=ln[Mee]=ln[Dee]=ln[Pee]=ln[kee]=ln[Lee]=ln[Bee]=ln[Iee]=ln[zee]=!1;function Qee(e){return Si(e)&&PS(e.length)&&!!ln[uo(e)]}function Zee(e){return function(t){return e(t)}}var tL=typeof Ar=="object"&&Ar&&!Ar.nodeType&&Ar,_u=tL&&typeof Or=="object"&&Or&&!Or.nodeType&&Or,Jee=_u&&_u.exports===tL,Ob=Jee&&G5.process,G2=(function(){try{var e=_u&&_u.require&&_u.require("util").types;return e||Ob&&Ob.binding&&Ob.binding("util")}catch{}})(),K2=G2&&G2.isTypedArray,kS=K2?Zee(K2):Qee;function I0(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var ete=Object.prototype,tte=ete.hasOwnProperty;function nte(e,t,n){var a=e[t];(!(tte.call(e,t)&&ud(a,n))||n===void 0&&!(t in e))&&MS(e,t,n)}function rte(e,t,n,a){var i=!n;n||(n={});for(var l=-1,u=t.length;++l<u;){var d=t[l],h=void 0;h===void 0&&(h=e[d]),i?MS(n,d,h):nte(n,d,h)}return n}function ate(e,t){for(var n=-1,a=Array(e);++n<e;)a[n]=t(n);return a}var ste=9007199254740991,ite=/^(?:0|[1-9]\d*)$/;function LS(e,t){var n=typeof e;return t=t??ste,!!t&&(n=="number"||n!="symbol"&&ite.test(e))&&e>-1&&e%1==0&&e<t}var ote=Object.prototype,lte=ote.hasOwnProperty;function nL(e,t){var n=kr(e),a=!n&&kh(e),i=!n&&!a&&Lh(e),l=!n&&!a&&!i&&kS(e),u=n||a||i||l,d=u?ate(e.length,String):[],h=d.length;for(var p in e)(t||lte.call(e,p))&&!(u&&(p=="length"||i&&(p=="offset"||p=="parent")||l&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||LS(p,h)))&&d.push(p);return d}function cte(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var ute=Object.prototype,dte=ute.hasOwnProperty;function fte(e){if(!Jr(e))return cte(e);var t=DS(e),n=[];for(var a in e)a=="constructor"&&(t||!dte.call(e,a))||n.push(a);return n}function rL(e){return Zl(e)?nL(e,!0):fte(e)}function hte(e){return rte(e,rL(e))}function pte(e,t,n,a,i,l,u){var d=I0(e,n),h=I0(t,n),p=u.get(h);if(p){B0(e,n,p);return}var v=l?l(d,h,n+"",e,t,u):void 0,m=v===void 0;if(m){var b=kr(h),w=!b&&Lh(h),j=!b&&!w&&kS(h);v=h,b||w||j?kr(d)?v=d:vee(d)?v=cee(d):w?(m=!1,v=iee(h)):j?(m=!1,v=lee(h)):v=[]:_ee(h)||kh(h)?(v=d,kh(d)?v=hte(d):(!Jr(d)||OS(d))&&(v=fee(h))):m=!1}m&&(u.set(h,v),i(v,h,a,l,u),u.delete(h)),B0(e,n,v)}function aL(e,t,n,a,i){e!==t&&Y5(t,function(l,u){if(i||(i=new za),Jr(l))pte(e,t,u,n,aL,a,i);else{var d=a?a(I0(e,u),l,u+"",e,t,i):void 0;d===void 0&&(d=l),B0(e,u,d)}},rL)}function Lp(e){return e}function mte(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var Y2=Math.max;function gte(e,t,n){return t=Y2(t===void 0?e.length-1:t,0),function(){for(var a=arguments,i=-1,l=Y2(a.length-t,0),u=Array(l);++i<l;)u[i]=a[t+i];i=-1;for(var d=Array(t+1);++i<t;)d[i]=a[i];return d[t]=n(u),mte(e,this,d)}}function vte(e){return function(){return e}}var xte=Dh?function(e,t){return Dh(e,"toString",{configurable:!0,enumerable:!1,value:vte(t),writable:!0})}:Lp,yte=800,bte=16,wte=Date.now;function Ste(e){var t=0,n=0;return function(){var a=wte(),i=bte-(a-n);if(n=a,i>0){if(++t>=yte)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var jte=Ste(xte);function Cte(e,t){return jte(gte(e,t,Lp),e+"")}function Nte(e,t,n){if(!Jr(n))return!1;var a=typeof t;return(a=="number"?Zl(n)&&LS(t,n.length):a=="string"&&t in n)?ud(n[t],e):!1}function _te(e){return Cte(function(t,n){var a=-1,i=n.length,l=i>1?n[i-1]:void 0,u=i>2?n[2]:void 0;for(l=e.length>3&&typeof l=="function"?(i--,l):void 0,u&&Nte(n[0],n[1],u)&&(l=i<3?void 0:l,i=1),t=Object(t);++a<i;){var d=n[a];d&&e(t,d,a,l)}return t})}var yr=_te(function(e,t,n){aL(e,t,n)}),dd=function(t){var n=t.zDepth,a=t.radius,i=t.background,l=t.children,u=t.styles,d=u===void 0?{}:u,h=ht(yr({default:{wrap:{position:"relative",display:"inline-block"},content:{position:"relative"},bg:{absolute:"0px 0px 0px 0px",boxShadow:"0 "+n+"px "+n*4+"px rgba(0,0,0,.24)",borderRadius:a,background:i}},"zDepth-0":{bg:{boxShadow:"none"}},"zDepth-1":{bg:{boxShadow:"0 2px 10px rgba(0,0,0,.12), 0 2px 5px rgba(0,0,0,.16)"}},"zDepth-2":{bg:{boxShadow:"0 6px 20px rgba(0,0,0,.19), 0 8px 17px rgba(0,0,0,.2)"}},"zDepth-3":{bg:{boxShadow:"0 17px 50px rgba(0,0,0,.19), 0 12px 15px rgba(0,0,0,.24)"}},"zDepth-4":{bg:{boxShadow:"0 25px 55px rgba(0,0,0,.21), 0 16px 28px rgba(0,0,0,.22)"}},"zDepth-5":{bg:{boxShadow:"0 40px 77px rgba(0,0,0,.22), 0 27px 24px rgba(0,0,0,.2)"}},square:{bg:{borderRadius:"0"}},circle:{bg:{borderRadius:"50%"}}},d),{"zDepth-1":n===1});return A.createElement("div",{style:h.wrap},A.createElement("div",{style:h.bg}),A.createElement("div",{style:h.content},l))};dd.propTypes={background:De.string,zDepth:De.oneOf([0,1,2,3,4,5]),radius:De.number,styles:De.object};dd.defaultProps={background:"#fff",zDepth:1,radius:2,styles:{}};var Mb=function(){return ja.Date.now()},Ete=/\s/;function Tte(e){for(var t=e.length;t--&&Ete.test(e.charAt(t)););return t}var Rte=/^\s+/;function Ate(e){return e&&e.slice(0,Tte(e)+1).replace(Rte,"")}var Ote="[object Symbol]";function Bp(e){return typeof e=="symbol"||Si(e)&&uo(e)==Ote}var W2=NaN,Mte=/^[-+]0x[0-9a-f]+$/i,Dte=/^0b[01]+$/i,Pte=/^0o[0-7]+$/i,kte=parseInt;function X2(e){if(typeof e=="number")return e;if(Bp(e))return W2;if(Jr(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Jr(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Ate(e);var n=Dte.test(e);return n||Pte.test(e)?kte(e.slice(2),n?2:8):Mte.test(e)?W2:+e}var Lte="Expected a function",Bte=Math.max,Ite=Math.min;function sL(e,t,n){var a,i,l,u,d,h,p=0,v=!1,m=!1,b=!0;if(typeof e!="function")throw new TypeError(Lte);t=X2(t)||0,Jr(n)&&(v=!!n.leading,m="maxWait"in n,l=m?Bte(X2(n.maxWait)||0,t):l,b="trailing"in n?!!n.trailing:b);function w(L){var k=a,P=i;return a=i=void 0,p=L,u=e.apply(P,k),u}function j(L){return p=L,d=setTimeout(N,t),v?w(L):u}function S(L){var k=L-h,P=L-p,U=t-k;return m?Ite(U,l-P):U}function C(L){var k=L-h,P=L-p;return h===void 0||k>=t||k<0||m&&P>=l}function N(){var L=Mb();if(C(L))return _(L);d=setTimeout(N,S(L))}function _(L){return d=void 0,b&&a?w(L):(a=i=void 0,u)}function T(){d!==void 0&&clearTimeout(d),p=0,a=h=i=d=void 0}function R(){return d===void 0?u:_(Mb())}function D(){var L=Mb(),k=C(L);if(a=arguments,i=this,h=L,k){if(d===void 0)return j(h);if(m)return clearTimeout(d),d=setTimeout(N,t),w(h)}return d===void 0&&(d=setTimeout(N,t)),u}return D.cancel=T,D.flush=R,D}var zte="Expected a function";function Fte(e,t,n){var a=!0,i=!0;if(typeof e!="function")throw new TypeError(zte);return Jr(n)&&(a="leading"in n?!!n.leading:a,i="trailing"in n?!!n.trailing:i),sL(e,t,{leading:a,maxWait:t,trailing:i})}var Hte=function(t,n,a){var i=a.getBoundingClientRect(),l=i.width,u=i.height,d=typeof t.pageX=="number"?t.pageX:t.touches[0].pageX,h=typeof t.pageY=="number"?t.pageY:t.touches[0].pageY,p=d-(a.getBoundingClientRect().left+window.pageXOffset),v=h-(a.getBoundingClientRect().top+window.pageYOffset);p<0?p=0:p>l&&(p=l),v<0?v=0:v>u&&(v=u);var m=p/l,b=1-v/u;return{h:n.h,s:m,v:b,a:n.a,source:"hsv"}},Ute=(function(){function e(t,n){for(var a=0;a<n.length;a++){var i=n[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}})();function Vte(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qte(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function $te(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var Ip=(function(e){$te(t,e);function t(n){Vte(this,t);var a=qte(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,n));return a.handleChange=function(i){typeof a.props.onChange=="function"&&a.throttle(a.props.onChange,Hte(i,a.props.hsl,a.container),i)},a.handleMouseDown=function(i){a.handleChange(i);var l=a.getContainerRenderWindow();l.addEventListener("mousemove",a.handleChange),l.addEventListener("mouseup",a.handleMouseUp)},a.handleMouseUp=function(){a.unbindEventListeners()},a.throttle=Fte(function(i,l,u){i(l,u)},50),a}return Ute(t,[{key:"componentWillUnmount",value:function(){this.throttle.cancel(),this.unbindEventListeners()}},{key:"getContainerRenderWindow",value:function(){for(var a=this.container,i=window;!i.document.contains(a)&&i.parent!==i;)i=i.parent;return i}},{key:"unbindEventListeners",value:function(){var a=this.getContainerRenderWindow();a.removeEventListener("mousemove",this.handleChange),a.removeEventListener("mouseup",this.handleMouseUp)}},{key:"render",value:function(){var a=this,i=this.props.style||{},l=i.color,u=i.white,d=i.black,h=i.pointer,p=i.circle,v=ht({default:{color:{absolute:"0px 0px 0px 0px",background:"hsl("+this.props.hsl.h+",100%, 50%)",borderRadius:this.props.radius},white:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius},black:{absolute:"0px 0px 0px 0px",boxShadow:this.props.shadow,borderRadius:this.props.radius},pointer:{position:"absolute",top:-(this.props.hsv.v*100)+100+"%",left:this.props.hsv.s*100+"%",cursor:"default"},circle:{width:"4px",height:"4px",boxShadow:`0 0 0 1.5px #fff, inset 0 0 1px 1px rgba(0,0,0,.3),
  74. 0 0 1px 2px rgba(0,0,0,.4)`,borderRadius:"50%",cursor:"hand",transform:"translate(-2px, -2px)"}},custom:{color:l,white:u,black:d,pointer:h,circle:p}},{custom:!!this.props.style});return A.createElement("div",{style:v.color,ref:function(b){return a.container=b},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},A.createElement("style",null,`
  75. .saturation-white {
  76. background: -webkit-linear-gradient(to right, #fff, rgba(255,255,255,0));
  77. background: linear-gradient(to right, #fff, rgba(255,255,255,0));
  78. }
  79. .saturation-black {
  80. background: -webkit-linear-gradient(to top, #000, rgba(0,0,0,0));
  81. background: linear-gradient(to top, #000, rgba(0,0,0,0));
  82. }
  83. `),A.createElement("div",{style:v.white,className:"saturation-white"},A.createElement("div",{style:v.black,className:"saturation-black"}),A.createElement("div",{style:v.pointer},this.props.pointer?A.createElement(this.props.pointer,this.props):A.createElement("div",{style:v.circle}))))}}]),t})(g.PureComponent||g.Component);function Gte(e,t){for(var n=-1,a=e==null?0:e.length;++n<a&&t(e[n],n,e)!==!1;);return e}var Kte=X5(Object.keys,Object),Yte=Object.prototype,Wte=Yte.hasOwnProperty;function Xte(e){if(!DS(e))return Kte(e);var t=[];for(var n in Object(e))Wte.call(e,n)&&n!="constructor"&&t.push(n);return t}function BS(e){return Zl(e)?nL(e):Xte(e)}function Qte(e,t){return e&&Y5(e,t,BS)}function Zte(e,t){return function(n,a){if(n==null)return n;if(!Zl(n))return e(n,a);for(var i=n.length,l=-1,u=Object(n);++l<i&&a(u[l],l,u)!==!1;);return n}}var iL=Zte(Qte);function Jte(e){return typeof e=="function"?e:Lp}function ene(e,t){var n=kr(e)?Gte:iL;return n(e,Jte(t))}function Bh(e){"@babel/helpers - typeof";return Bh=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},Bh(e)}var tne=/^\s+/,nne=/\s+$/;function Xe(e,t){if(e=e||"",t=t||{},e instanceof Xe)return e;if(!(this instanceof Xe))return new Xe(e,t);var n=rne(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}Xe.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),n,a,i,l,u,d;return n=t.r/255,a=t.g/255,i=t.b/255,n<=.03928?l=n/12.92:l=Math.pow((n+.055)/1.055,2.4),a<=.03928?u=a/12.92:u=Math.pow((a+.055)/1.055,2.4),i<=.03928?d=i/12.92:d=Math.pow((i+.055)/1.055,2.4),.2126*l+.7152*u+.0722*d},setAlpha:function(t){return this._a=oL(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=Z2(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=Z2(this._r,this._g,this._b),n=Math.round(t.h*360),a=Math.round(t.s*100),i=Math.round(t.v*100);return this._a==1?"hsv("+n+", "+a+"%, "+i+"%)":"hsva("+n+", "+a+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var t=Q2(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=Q2(this._r,this._g,this._b),n=Math.round(t.h*360),a=Math.round(t.s*100),i=Math.round(t.l*100);return this._a==1?"hsl("+n+", "+a+"%, "+i+"%)":"hsla("+n+", "+a+"%, "+i+"%, "+this._roundA+")"},toHex:function(t){return J2(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return one(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(dn(this._r,255)*100)+"%",g:Math.round(dn(this._g,255)*100)+"%",b:Math.round(dn(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(dn(this._r,255)*100)+"%, "+Math.round(dn(this._g,255)*100)+"%, "+Math.round(dn(this._b,255)*100)+"%)":"rgba("+Math.round(dn(this._r,255)*100)+"%, "+Math.round(dn(this._g,255)*100)+"%, "+Math.round(dn(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:yne[J2(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var n="#"+eO(this._r,this._g,this._b,this._a),a=n,i=this._gradientType?"GradientType = 1, ":"";if(t){var l=Xe(t);a="#"+eO(l._r,l._g,l._b,l._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+n+",endColorstr="+a+")"},toString:function(t){var n=!!t;t=t||this._format;var a=!1,i=this._a<1&&this._a>=0,l=!n&&i&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return l?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(a=this.toRgbString()),t==="prgb"&&(a=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(a=this.toHexString()),t==="hex3"&&(a=this.toHexString(!0)),t==="hex4"&&(a=this.toHex8String(!0)),t==="hex8"&&(a=this.toHex8String()),t==="name"&&(a=this.toName()),t==="hsl"&&(a=this.toHslString()),t==="hsv"&&(a=this.toHsvString()),a||this.toHexString())},clone:function(){return Xe(this.toString())},_applyModification:function(t,n){var a=t.apply(null,[this].concat([].slice.call(n)));return this._r=a._r,this._g=a._g,this._b=a._b,this.setAlpha(a._a),this},lighten:function(){return this._applyModification(dne,arguments)},brighten:function(){return this._applyModification(fne,arguments)},darken:function(){return this._applyModification(hne,arguments)},desaturate:function(){return this._applyModification(lne,arguments)},saturate:function(){return this._applyModification(cne,arguments)},greyscale:function(){return this._applyModification(une,arguments)},spin:function(){return this._applyModification(pne,arguments)},_applyCombination:function(t,n){return t.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(vne,arguments)},complement:function(){return this._applyCombination(mne,arguments)},monochromatic:function(){return this._applyCombination(xne,arguments)},splitcomplement:function(){return this._applyCombination(gne,arguments)},triad:function(){return this._applyCombination(tO,[3])},tetrad:function(){return this._applyCombination(tO,[4])}};Xe.fromRatio=function(e,t){if(Bh(e)=="object"){var n={};for(var a in e)e.hasOwnProperty(a)&&(a==="a"?n[a]=e[a]:n[a]=pu(e[a]));e=n}return Xe(e,t)};function rne(e){var t={r:0,g:0,b:0},n=1,a=null,i=null,l=null,u=!1,d=!1;return typeof e=="string"&&(e=jne(e)),Bh(e)=="object"&&(xs(e.r)&&xs(e.g)&&xs(e.b)?(t=ane(e.r,e.g,e.b),u=!0,d=String(e.r).substr(-1)==="%"?"prgb":"rgb"):xs(e.h)&&xs(e.s)&&xs(e.v)?(a=pu(e.s),i=pu(e.v),t=ine(e.h,a,i),u=!0,d="hsv"):xs(e.h)&&xs(e.s)&&xs(e.l)&&(a=pu(e.s),l=pu(e.l),t=sne(e.h,a,l),u=!0,d="hsl"),e.hasOwnProperty("a")&&(n=e.a)),n=oL(n),{ok:u,format:e.format||d,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}function ane(e,t,n){return{r:dn(e,255)*255,g:dn(t,255)*255,b:dn(n,255)*255}}function Q2(e,t,n){e=dn(e,255),t=dn(t,255),n=dn(n,255);var a=Math.max(e,t,n),i=Math.min(e,t,n),l,u,d=(a+i)/2;if(a==i)l=u=0;else{var h=a-i;switch(u=d>.5?h/(2-a-i):h/(a+i),a){case e:l=(t-n)/h+(t<n?6:0);break;case t:l=(n-e)/h+2;break;case n:l=(e-t)/h+4;break}l/=6}return{h:l,s:u,l:d}}function sne(e,t,n){var a,i,l;e=dn(e,360),t=dn(t,100),n=dn(n,100);function u(p,v,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?p+(v-p)*6*m:m<1/2?v:m<2/3?p+(v-p)*(2/3-m)*6:p}if(t===0)a=i=l=n;else{var d=n<.5?n*(1+t):n+t-n*t,h=2*n-d;a=u(h,d,e+1/3),i=u(h,d,e),l=u(h,d,e-1/3)}return{r:a*255,g:i*255,b:l*255}}function Z2(e,t,n){e=dn(e,255),t=dn(t,255),n=dn(n,255);var a=Math.max(e,t,n),i=Math.min(e,t,n),l,u,d=a,h=a-i;if(u=a===0?0:h/a,a==i)l=0;else{switch(a){case e:l=(t-n)/h+(t<n?6:0);break;case t:l=(n-e)/h+2;break;case n:l=(e-t)/h+4;break}l/=6}return{h:l,s:u,v:d}}function ine(e,t,n){e=dn(e,360)*6,t=dn(t,100),n=dn(n,100);var a=Math.floor(e),i=e-a,l=n*(1-t),u=n*(1-i*t),d=n*(1-(1-i)*t),h=a%6,p=[n,u,l,l,d,n][h],v=[d,n,n,u,l,l][h],m=[l,l,d,n,n,u][h];return{r:p*255,g:v*255,b:m*255}}function J2(e,t,n,a){var i=[pa(Math.round(e).toString(16)),pa(Math.round(t).toString(16)),pa(Math.round(n).toString(16))];return a&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function one(e,t,n,a,i){var l=[pa(Math.round(e).toString(16)),pa(Math.round(t).toString(16)),pa(Math.round(n).toString(16)),pa(lL(a))];return i&&l[0].charAt(0)==l[0].charAt(1)&&l[1].charAt(0)==l[1].charAt(1)&&l[2].charAt(0)==l[2].charAt(1)&&l[3].charAt(0)==l[3].charAt(1)?l[0].charAt(0)+l[1].charAt(0)+l[2].charAt(0)+l[3].charAt(0):l.join("")}function eO(e,t,n,a){var i=[pa(lL(a)),pa(Math.round(e).toString(16)),pa(Math.round(t).toString(16)),pa(Math.round(n).toString(16))];return i.join("")}Xe.equals=function(e,t){return!e||!t?!1:Xe(e).toRgbString()==Xe(t).toRgbString()};Xe.random=function(){return Xe.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function lne(e,t){t=t===0?0:t||10;var n=Xe(e).toHsl();return n.s-=t/100,n.s=zp(n.s),Xe(n)}function cne(e,t){t=t===0?0:t||10;var n=Xe(e).toHsl();return n.s+=t/100,n.s=zp(n.s),Xe(n)}function une(e){return Xe(e).desaturate(100)}function dne(e,t){t=t===0?0:t||10;var n=Xe(e).toHsl();return n.l+=t/100,n.l=zp(n.l),Xe(n)}function fne(e,t){t=t===0?0:t||10;var n=Xe(e).toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),Xe(n)}function hne(e,t){t=t===0?0:t||10;var n=Xe(e).toHsl();return n.l-=t/100,n.l=zp(n.l),Xe(n)}function pne(e,t){var n=Xe(e).toHsl(),a=(n.h+t)%360;return n.h=a<0?360+a:a,Xe(n)}function mne(e){var t=Xe(e).toHsl();return t.h=(t.h+180)%360,Xe(t)}function tO(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var n=Xe(e).toHsl(),a=[Xe(e)],i=360/t,l=1;l<t;l++)a.push(Xe({h:(n.h+l*i)%360,s:n.s,l:n.l}));return a}function gne(e){var t=Xe(e).toHsl(),n=t.h;return[Xe(e),Xe({h:(n+72)%360,s:t.s,l:t.l}),Xe({h:(n+216)%360,s:t.s,l:t.l})]}function vne(e,t,n){t=t||6,n=n||30;var a=Xe(e).toHsl(),i=360/n,l=[Xe(e)];for(a.h=(a.h-(i*t>>1)+720)%360;--t;)a.h=(a.h+i)%360,l.push(Xe(a));return l}function xne(e,t){t=t||6;for(var n=Xe(e).toHsv(),a=n.h,i=n.s,l=n.v,u=[],d=1/t;t--;)u.push(Xe({h:a,s:i,v:l})),l=(l+d)%1;return u}Xe.mix=function(e,t,n){n=n===0?0:n||50;var a=Xe(e).toRgb(),i=Xe(t).toRgb(),l=n/100,u={r:(i.r-a.r)*l+a.r,g:(i.g-a.g)*l+a.g,b:(i.b-a.b)*l+a.b,a:(i.a-a.a)*l+a.a};return Xe(u)};Xe.readability=function(e,t){var n=Xe(e),a=Xe(t);return(Math.max(n.getLuminance(),a.getLuminance())+.05)/(Math.min(n.getLuminance(),a.getLuminance())+.05)};Xe.isReadable=function(e,t,n){var a=Xe.readability(e,t),i,l;switch(l=!1,i=Cne(n),i.level+i.size){case"AAsmall":case"AAAlarge":l=a>=4.5;break;case"AAlarge":l=a>=3;break;case"AAAsmall":l=a>=7;break}return l};Xe.mostReadable=function(e,t,n){var a=null,i=0,l,u,d,h;n=n||{},u=n.includeFallbackColors,d=n.level,h=n.size;for(var p=0;p<t.length;p++)l=Xe.readability(e,t[p]),l>i&&(i=l,a=Xe(t[p]));return Xe.isReadable(e,a,{level:d,size:h})||!u?a:(n.includeFallbackColors=!1,Xe.mostReadable(e,["#fff","#000"],n))};var z0=Xe.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},yne=Xe.hexNames=bne(z0);function bne(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function oL(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function dn(e,t){wne(e)&&(e="100%");var n=Sne(e);return e=Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function zp(e){return Math.min(1,Math.max(0,e))}function Tr(e){return parseInt(e,16)}function wne(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function Sne(e){return typeof e=="string"&&e.indexOf("%")!=-1}function pa(e){return e.length==1?"0"+e:""+e}function pu(e){return e<=1&&(e=e*100+"%"),e}function lL(e){return Math.round(parseFloat(e)*255).toString(16)}function nO(e){return Tr(e)/255}var ia=(function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",n="(?:"+t+")|(?:"+e+")",a="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",i="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+a),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+a),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+a),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function xs(e){return!!ia.CSS_UNIT.exec(e)}function jne(e){e=e.replace(tne,"").replace(nne,"").toLowerCase();var t=!1;if(z0[e])e=z0[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=ia.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=ia.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=ia.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=ia.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=ia.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=ia.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=ia.hex8.exec(e))?{r:Tr(n[1]),g:Tr(n[2]),b:Tr(n[3]),a:nO(n[4]),format:t?"name":"hex8"}:(n=ia.hex6.exec(e))?{r:Tr(n[1]),g:Tr(n[2]),b:Tr(n[3]),format:t?"name":"hex"}:(n=ia.hex4.exec(e))?{r:Tr(n[1]+""+n[1]),g:Tr(n[2]+""+n[2]),b:Tr(n[3]+""+n[3]),a:nO(n[4]+""+n[4]),format:t?"name":"hex8"}:(n=ia.hex3.exec(e))?{r:Tr(n[1]+""+n[1]),g:Tr(n[2]+""+n[2]),b:Tr(n[3]+""+n[3]),format:t?"name":"hex"}:!1}function Cne(e){var t,n;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),n=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),n!=="small"&&n!=="large"&&(n="small"),{level:t,size:n}}var rO=function(t){var n=["r","g","b","a","h","s","l","v"],a=0,i=0;return ene(n,function(l){if(t[l]&&(a+=1,isNaN(t[l])||(i+=1),l==="s"||l==="l")){var u=/^\d+%$/;u.test(t[l])&&(i+=1)}}),a===i?t:!1},mu=function(t,n){var a=t.hex?Xe(t.hex):Xe(t),i=a.toHsl(),l=a.toHsv(),u=a.toRgb(),d=a.toHex();i.s===0&&(i.h=n||0,l.h=n||0);var h=d==="000000"&&u.a===0;return{hsl:i,hex:h?"transparent":"#"+d,rgb:u,hsv:l,oldHue:t.h||n||i.h,source:t.source}},Ei=function(t){if(t==="transparent")return!0;var n=String(t).charAt(0)==="#"?1:0;return t.length!==4+n&&t.length<7+n&&Xe(t).isValid()},IS=function(t){if(!t)return"#fff";var n=mu(t);if(n.hex==="transparent")return"rgba(0,0,0,0.4)";var a=(n.rgb.r*299+n.rgb.g*587+n.rgb.b*114)/1e3;return a>=128?"#000":"#fff"},Db=function(t,n){var a=t.replace("°","");return Xe(n+" ("+a+")")._ok},iu=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Nne=(function(){function e(t,n){for(var a=0;a<n.length;a++){var i=n[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}})();function _ne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ene(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function Tne(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var br=function(t){var n=(function(a){Tne(i,a);function i(l){_ne(this,i);var u=Ene(this,(i.__proto__||Object.getPrototypeOf(i)).call(this));return u.handleChange=function(d,h){var p=rO(d);if(p){var v=mu(d,d.h||u.state.oldHue);u.setState(v),u.props.onChangeComplete&&u.debounce(u.props.onChangeComplete,v,h),u.props.onChange&&u.props.onChange(v,h)}},u.handleSwatchHover=function(d,h){var p=rO(d);if(p){var v=mu(d,d.h||u.state.oldHue);u.props.onSwatchHover&&u.props.onSwatchHover(v,h)}},u.state=iu({},mu(l.color,0)),u.debounce=sL(function(d,h,p){d(h,p)},100),u}return Nne(i,[{key:"render",value:function(){var u={};return this.props.onSwatchHover&&(u.onSwatchHover=this.handleSwatchHover),A.createElement(t,iu({},this.props,this.state,{onChange:this.handleChange},u))}}],[{key:"getDerivedStateFromProps",value:function(u,d){return iu({},mu(u.color,d.oldHue))}}]),i})(g.PureComponent||g.Component);return n.propTypes=iu({},t.propTypes),n.defaultProps=iu({},t.defaultProps,{color:{h:250,s:.5,l:.2,a:1}}),n},Rne=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Ane=(function(){function e(t,n){for(var a=0;a<n.length;a++){var i=n[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}})();function One(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function aO(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function Mne(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var Dne=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return(function(a){Mne(i,a);function i(){var l,u,d,h;One(this,i);for(var p=arguments.length,v=Array(p),m=0;m<p;m++)v[m]=arguments[m];return h=(u=(d=aO(this,(l=i.__proto__||Object.getPrototypeOf(i)).call.apply(l,[this].concat(v))),d),d.state={focus:!1},d.handleFocus=function(){return d.setState({focus:!0})},d.handleBlur=function(){return d.setState({focus:!1})},u),aO(d,h)}return Ane(i,[{key:"render",value:function(){return A.createElement(n,{onFocus:this.handleFocus,onBlur:this.handleBlur},A.createElement(t,Rne({},this.props,this.state)))}}]),i})(A.Component)},sO=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Pne=13,kne=function(t){var n=t.color,a=t.style,i=t.onClick,l=i===void 0?function(){}:i,u=t.onHover,d=t.title,h=d===void 0?n:d,p=t.children,v=t.focus,m=t.focusStyle,b=m===void 0?{}:m,w=n==="transparent",j=ht({default:{swatch:sO({background:n,height:"100%",width:"100%",cursor:"pointer",position:"relative",outline:"none"},a,v?b:{})}}),S=function(R){return l(n,R)},C=function(R){return R.keyCode===Pne&&l(n,R)},N=function(R){return u(n,R)},_={};return u&&(_.onMouseOver=N),A.createElement("div",sO({style:j.swatch,onClick:S,title:h,tabIndex:0,onKeyDown:C},_),p,w&&A.createElement(Xl,{borderRadius:j.swatch.borderRadius,boxShadow:"inset 0 0 0 1px rgba(0,0,0,0.1)"}))};const po=Dne(kne);var Lne=function(t){var n=t.direction,a=ht({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:n==="vertical"});return A.createElement("div",{style:a.picker})},Bne=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},cL=function(t){var n=t.rgb,a=t.hsl,i=t.width,l=t.height,u=t.onChange,d=t.direction,h=t.style,p=t.renderers,v=t.pointer,m=t.className,b=m===void 0?"":m,w=ht({default:{picker:{position:"relative",width:i,height:l},alpha:{radius:"2px",style:h}}});return A.createElement("div",{style:w.picker,className:"alpha-picker "+b},A.createElement(AS,Bne({},w.alpha,{rgb:n,hsl:a,pointer:v,renderers:p,onChange:u,direction:d})))};cL.defaultProps={width:"316px",height:"16px",direction:"horizontal",pointer:Lne};br(cL);function uL(e,t){for(var n=-1,a=e==null?0:e.length,i=Array(a);++n<a;)i[n]=t(e[n],n,e);return i}var Ine="__lodash_hash_undefined__";function zne(e){return this.__data__.set(e,Ine),this}function Fne(e){return this.__data__.has(e)}function Ih(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Ms;++t<n;)this.add(e[t])}Ih.prototype.add=Ih.prototype.push=zne;Ih.prototype.has=Fne;function Hne(e,t){for(var n=-1,a=e==null?0:e.length;++n<a;)if(t(e[n],n,e))return!0;return!1}function Une(e,t){return e.has(t)}var Vne=1,qne=2;function dL(e,t,n,a,i,l){var u=n&Vne,d=e.length,h=t.length;if(d!=h&&!(u&&h>d))return!1;var p=l.get(e),v=l.get(t);if(p&&v)return p==t&&v==e;var m=-1,b=!0,w=n&qne?new Ih:void 0;for(l.set(e,t),l.set(t,e);++m<d;){var j=e[m],S=t[m];if(a)var C=u?a(S,j,m,t,e,l):a(j,S,m,e,t,l);if(C!==void 0){if(C)continue;b=!1;break}if(w){if(!Hne(t,function(N,_){if(!Une(w,_)&&(j===N||i(j,N,n,a,l)))return w.push(_)})){b=!1;break}}else if(!(j===S||i(j,S,n,a,l))){b=!1;break}}return l.delete(e),l.delete(t),b}function $ne(e){var t=-1,n=Array(e.size);return e.forEach(function(a,i){n[++t]=[i,a]}),n}function Gne(e){var t=-1,n=Array(e.size);return e.forEach(function(a){n[++t]=a}),n}var Kne=1,Yne=2,Wne="[object Boolean]",Xne="[object Date]",Qne="[object Error]",Zne="[object Map]",Jne="[object Number]",ere="[object RegExp]",tre="[object Set]",nre="[object String]",rre="[object Symbol]",are="[object ArrayBuffer]",sre="[object DataView]",iO=wi?wi.prototype:void 0,Pb=iO?iO.valueOf:void 0;function ire(e,t,n,a,i,l,u){switch(n){case sre:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case are:return!(e.byteLength!=t.byteLength||!l(new Ph(e),new Ph(t)));case Wne:case Xne:case Jne:return ud(+e,+t);case Qne:return e.name==t.name&&e.message==t.message;case ere:case nre:return e==t+"";case Zne:var d=$ne;case tre:var h=a&Kne;if(d||(d=Gne),e.size!=t.size&&!h)return!1;var p=u.get(e);if(p)return p==t;a|=Yne,u.set(e,t);var v=dL(d(e),d(t),a,i,l,u);return u.delete(e),v;case rre:if(Pb)return Pb.call(e)==Pb.call(t)}return!1}function ore(e,t){for(var n=-1,a=t.length,i=e.length;++n<a;)e[i+n]=t[n];return e}function lre(e,t,n){var a=t(e);return kr(e)?a:ore(a,n(e))}function cre(e,t){for(var n=-1,a=e==null?0:e.length,i=0,l=[];++n<a;){var u=e[n];t(u,n,e)&&(l[i++]=u)}return l}function ure(){return[]}var dre=Object.prototype,fre=dre.propertyIsEnumerable,oO=Object.getOwnPropertySymbols,hre=oO?function(e){return e==null?[]:(e=Object(e),cre(oO(e),function(t){return fre.call(e,t)}))}:ure;function lO(e){return lre(e,BS,hre)}var pre=1,mre=Object.prototype,gre=mre.hasOwnProperty;function vre(e,t,n,a,i,l){var u=n&pre,d=lO(e),h=d.length,p=lO(t),v=p.length;if(h!=v&&!u)return!1;for(var m=h;m--;){var b=d[m];if(!(u?b in t:gre.call(t,b)))return!1}var w=l.get(e),j=l.get(t);if(w&&j)return w==t&&j==e;var S=!0;l.set(e,t),l.set(t,e);for(var C=u;++m<h;){b=d[m];var N=e[b],_=t[b];if(a)var T=u?a(_,N,b,t,e,l):a(N,_,b,e,t,l);if(!(T===void 0?N===_||i(N,_,n,a,l):T)){S=!1;break}C||(C=b=="constructor")}if(S&&!C){var R=e.constructor,D=t.constructor;R!=D&&"constructor"in e&&"constructor"in t&&!(typeof R=="function"&&R instanceof R&&typeof D=="function"&&D instanceof D)&&(S=!1)}return l.delete(e),l.delete(t),S}var F0=ho(ja,"DataView"),H0=ho(ja,"Promise"),U0=ho(ja,"Set"),V0=ho(ja,"WeakMap"),cO="[object Map]",xre="[object Object]",uO="[object Promise]",dO="[object Set]",fO="[object WeakMap]",hO="[object DataView]",yre=fo(F0),bre=fo($u),wre=fo(H0),Sre=fo(U0),jre=fo(V0),fi=uo;(F0&&fi(new F0(new ArrayBuffer(1)))!=hO||$u&&fi(new $u)!=cO||H0&&fi(H0.resolve())!=uO||U0&&fi(new U0)!=dO||V0&&fi(new V0)!=fO)&&(fi=function(e){var t=uo(e),n=t==xre?e.constructor:void 0,a=n?fo(n):"";if(a)switch(a){case yre:return hO;case bre:return cO;case wre:return uO;case Sre:return dO;case jre:return fO}return t});var Cre=1,pO="[object Arguments]",mO="[object Array]",Yf="[object Object]",Nre=Object.prototype,gO=Nre.hasOwnProperty;function _re(e,t,n,a,i,l){var u=kr(e),d=kr(t),h=u?mO:fi(e),p=d?mO:fi(t);h=h==pO?Yf:h,p=p==pO?Yf:p;var v=h==Yf,m=p==Yf,b=h==p;if(b&&Lh(e)){if(!Lh(t))return!1;u=!0,v=!1}if(b&&!v)return l||(l=new za),u||kS(e)?dL(e,t,n,a,i,l):ire(e,t,h,n,a,i,l);if(!(n&Cre)){var w=v&&gO.call(e,"__wrapped__"),j=m&&gO.call(t,"__wrapped__");if(w||j){var S=w?e.value():e,C=j?t.value():t;return l||(l=new za),i(S,C,n,a,l)}}return b?(l||(l=new za),vre(e,t,n,a,i,l)):!1}function zS(e,t,n,a,i){return e===t?!0:e==null||t==null||!Si(e)&&!Si(t)?e!==e&&t!==t:_re(e,t,n,a,zS,i)}var Ere=1,Tre=2;function Rre(e,t,n,a){var i=n.length,l=i;if(e==null)return!l;for(e=Object(e);i--;){var u=n[i];if(u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++i<l;){u=n[i];var d=u[0],h=e[d],p=u[1];if(u[2]){if(h===void 0&&!(d in e))return!1}else{var v=new za,m;if(!(m===void 0?zS(p,h,Ere|Tre,a,v):m))return!1}}return!0}function fL(e){return e===e&&!Jr(e)}function Are(e){for(var t=BS(e),n=t.length;n--;){var a=t[n],i=e[a];t[n]=[a,i,fL(i)]}return t}function hL(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function Ore(e){var t=Are(e);return t.length==1&&t[0][2]?hL(t[0][0],t[0][1]):function(n){return n===e||Rre(n,e,t)}}var Mre=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Dre=/^\w*$/;function FS(e,t){if(kr(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Bp(e)?!0:Dre.test(e)||!Mre.test(e)||t!=null&&e in Object(t)}var Pre="Expected a function";function HS(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Pre);var n=function(){var a=arguments,i=t?t.apply(this,a):a[0],l=n.cache;if(l.has(i))return l.get(i);var u=e.apply(this,a);return n.cache=l.set(i,u)||l,u};return n.cache=new(HS.Cache||Ms),n}HS.Cache=Ms;var kre=500;function Lre(e){var t=HS(e,function(a){return n.size===kre&&n.clear(),a}),n=t.cache;return t}var Bre=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ire=/\\(\\)?/g,zre=Lre(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Bre,function(n,a,i,l){t.push(i?l.replace(Ire,"$1"):a||n)}),t}),vO=wi?wi.prototype:void 0,xO=vO?vO.toString:void 0;function pL(e){if(typeof e=="string")return e;if(kr(e))return uL(e,pL)+"";if(Bp(e))return xO?xO.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Fre(e){return e==null?"":pL(e)}function mL(e,t){return kr(e)?e:FS(e,t)?[e]:zre(Fre(e))}function Fp(e){if(typeof e=="string"||Bp(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function gL(e,t){t=mL(t,e);for(var n=0,a=t.length;e!=null&&n<a;)e=e[Fp(t[n++])];return n&&n==a?e:void 0}function Hre(e,t,n){var a=e==null?void 0:gL(e,t);return a===void 0?n:a}function Ure(e,t){return e!=null&&t in Object(e)}function Vre(e,t,n){t=mL(t,e);for(var a=-1,i=t.length,l=!1;++a<i;){var u=Fp(t[a]);if(!(l=e!=null&&n(e,u)))break;e=e[u]}return l||++a!=i?l:(i=e==null?0:e.length,!!i&&PS(i)&&LS(u,i)&&(kr(e)||kh(e)))}function qre(e,t){return e!=null&&Vre(e,t,Ure)}var $re=1,Gre=2;function Kre(e,t){return FS(e)&&fL(t)?hL(Fp(e),t):function(n){var a=Hre(n,e);return a===void 0&&a===t?qre(n,e):zS(t,a,$re|Gre)}}function Yre(e){return function(t){return t?.[e]}}function Wre(e){return function(t){return gL(t,e)}}function Xre(e){return FS(e)?Yre(Fp(e)):Wre(e)}function Qre(e){return typeof e=="function"?e:e==null?Lp:typeof e=="object"?kr(e)?Kre(e[0],e[1]):Ore(e):Xre(e)}function Zre(e,t){var n=-1,a=Zl(e)?Array(e.length):[];return iL(e,function(i,l,u){a[++n]=t(i,l,u)}),a}function mo(e,t){var n=kr(e)?uL:Zre;return n(e,Qre(t))}var Jre=function(t){var n=t.colors,a=t.onClick,i=t.onSwatchHover,l=ht({default:{swatches:{marginRight:"-10px"},swatch:{width:"22px",height:"22px",float:"left",marginRight:"10px",marginBottom:"10px",borderRadius:"4px"},clear:{clear:"both"}}});return A.createElement("div",{style:l.swatches},mo(n,function(u){return A.createElement(po,{key:u,color:u,style:l.swatch,onClick:a,onHover:i,focusStyle:{boxShadow:"0 0 4px "+u}})}),A.createElement("div",{style:l.clear}))},US=function(t){var n=t.onChange,a=t.onSwatchHover,i=t.hex,l=t.colors,u=t.width,d=t.triangle,h=t.styles,p=h===void 0?{}:h,v=t.className,m=v===void 0?"":v,b=i==="transparent",w=function(C,N){Ei(C)&&n({hex:C,source:"hex"},N)},j=ht(yr({default:{card:{width:u,background:"#fff",boxShadow:"0 1px rgba(0,0,0,.1)",borderRadius:"6px",position:"relative"},head:{height:"110px",background:i,borderRadius:"6px 6px 0 0",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"},body:{padding:"10px"},label:{fontSize:"18px",color:IS(i),position:"relative"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 10px 10px 10px",borderColor:"transparent transparent "+i+" transparent",position:"absolute",top:"-10px",left:"50%",marginLeft:"-10px"},input:{width:"100%",fontSize:"12px",color:"#666",border:"0px",outline:"none",height:"22px",boxShadow:"inset 0 0 0 1px #ddd",borderRadius:"4px",padding:"0 7px",boxSizing:"border-box"}},"hide-triangle":{triangle:{display:"none"}}},p),{"hide-triangle":d==="hide"});return A.createElement("div",{style:j.card,className:"block-picker "+m},A.createElement("div",{style:j.triangle}),A.createElement("div",{style:j.head},b&&A.createElement(Xl,{borderRadius:"6px 6px 0 0"}),A.createElement("div",{style:j.label},i)),A.createElement("div",{style:j.body},A.createElement(Jre,{colors:l,onClick:w,onSwatchHover:a}),A.createElement(Ut,{style:{input:j.input},value:i,onChange:w})))};US.propTypes={width:De.oneOfType([De.string,De.number]),colors:De.arrayOf(De.string),triangle:De.oneOf(["top","hide"]),styles:De.object};US.defaultProps={width:170,colors:["#D9E3F0","#F47373","#697689","#37D67A","#2CCCE4","#555555","#dce775","#ff8a65","#ba68c8"],triangle:"top",styles:{}};br(US);var tl={100:"#ffcdd2",300:"#e57373",500:"#f44336",700:"#d32f2f",900:"#b71c1c"},nl={100:"#f8bbd0",300:"#f06292",500:"#e91e63",700:"#c2185b",900:"#880e4f"},rl={100:"#e1bee7",300:"#ba68c8",500:"#9c27b0",700:"#7b1fa2",900:"#4a148c"},al={100:"#d1c4e9",300:"#9575cd",500:"#673ab7",700:"#512da8",900:"#311b92"},sl={100:"#c5cae9",300:"#7986cb",500:"#3f51b5",700:"#303f9f",900:"#1a237e"},il={100:"#bbdefb",300:"#64b5f6",500:"#2196f3",700:"#1976d2",900:"#0d47a1"},ol={100:"#b3e5fc",300:"#4fc3f7",500:"#03a9f4",700:"#0288d1",900:"#01579b"},ll={100:"#b2ebf2",300:"#4dd0e1",500:"#00bcd4",700:"#0097a7",900:"#006064"},cl={100:"#b2dfdb",300:"#4db6ac",500:"#009688",700:"#00796b",900:"#004d40"},gu={100:"#c8e6c9",300:"#81c784",500:"#4caf50",700:"#388e3c"},ul={100:"#dcedc8",300:"#aed581",500:"#8bc34a",700:"#689f38",900:"#33691e"},dl={100:"#f0f4c3",300:"#dce775",500:"#cddc39",700:"#afb42b",900:"#827717"},fl={100:"#fff9c4",300:"#fff176",500:"#ffeb3b",700:"#fbc02d",900:"#f57f17"},hl={100:"#ffecb3",300:"#ffd54f",500:"#ffc107",700:"#ffa000",900:"#ff6f00"},pl={100:"#ffe0b2",300:"#ffb74d",500:"#ff9800",700:"#f57c00",900:"#e65100"},ml={100:"#ffccbc",300:"#ff8a65",500:"#ff5722",700:"#e64a19",900:"#bf360c"},gl={100:"#d7ccc8",300:"#a1887f",500:"#795548",700:"#5d4037",900:"#3e2723"},vl={100:"#cfd8dc",300:"#90a4ae",500:"#607d8b",700:"#455a64",900:"#263238"},vL=function(t){var n=t.color,a=t.onClick,i=t.onSwatchHover,l=t.hover,u=t.active,d=t.circleSize,h=t.circleSpacing,p=ht({default:{swatch:{width:d,height:d,marginRight:h,marginBottom:h,transform:"scale(1)",transition:"100ms transform ease"},Swatch:{borderRadius:"50%",background:"transparent",boxShadow:"inset 0 0 0 "+(d/2+1)+"px "+n,transition:"100ms box-shadow ease"}},hover:{swatch:{transform:"scale(1.2)"}},active:{Swatch:{boxShadow:"inset 0 0 0 3px "+n}}},{hover:l,active:u});return A.createElement("div",{style:p.swatch},A.createElement(po,{style:p.Swatch,color:n,onClick:a,onHover:i,focusStyle:{boxShadow:p.Swatch.boxShadow+", 0 0 5px "+n}}))};vL.defaultProps={circleSize:28,circleSpacing:14};const eae=RS.handleHover(vL);var VS=function(t){var n=t.width,a=t.onChange,i=t.onSwatchHover,l=t.colors,u=t.hex,d=t.circleSize,h=t.styles,p=h===void 0?{}:h,v=t.circleSpacing,m=t.className,b=m===void 0?"":m,w=ht(yr({default:{card:{width:n,display:"flex",flexWrap:"wrap",marginRight:-v,marginBottom:-v}}},p)),j=function(C,N){return a({hex:C,source:"hex"},N)};return A.createElement("div",{style:w.card,className:"circle-picker "+b},mo(l,function(S){return A.createElement(eae,{key:S,color:S,onClick:j,onSwatchHover:i,active:u===S.toLowerCase(),circleSize:d,circleSpacing:v})}))};VS.propTypes={width:De.oneOfType([De.string,De.number]),circleSize:De.number,circleSpacing:De.number,styles:De.object};VS.defaultProps={width:252,circleSize:28,circleSpacing:14,colors:[tl[500],nl[500],rl[500],al[500],sl[500],il[500],ol[500],ll[500],cl[500],gu[500],ul[500],dl[500],fl[500],hl[500],pl[500],ml[500],gl[500],vl[500]],styles:{}};br(VS);function yO(e){return e===void 0}var Wf={},bO;function tae(){if(bO)return Wf;bO=1,Object.defineProperty(Wf,"__esModule",{value:!0});var e=Object.assign||function(u){for(var d=1;d<arguments.length;d++){var h=arguments[d];for(var p in h)Object.prototype.hasOwnProperty.call(h,p)&&(u[p]=h[p])}return u},t=io(),n=a(t);function a(u){return u&&u.__esModule?u:{default:u}}function i(u,d){var h={};for(var p in u)d.indexOf(p)>=0||Object.prototype.hasOwnProperty.call(u,p)&&(h[p]=u[p]);return h}var l=24;return Wf.default=function(u){var d=u.fill,h=d===void 0?"currentColor":d,p=u.width,v=p===void 0?l:p,m=u.height,b=m===void 0?l:m,w=u.style,j=w===void 0?{}:w,S=i(u,["fill","width","height","style"]);return n.default.createElement("svg",e({viewBox:"0 0 "+l+" "+l,style:e({fill:h,width:v,height:b},j)},S),n.default.createElement("path",{d:"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}))},Wf}var nae=tae();const rae=Ml(nae);var aae=(function(){function e(t,n){for(var a=0;a<n.length;a++){var i=n[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}})();function sae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function iae(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function oae(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var xL=(function(e){oae(t,e);function t(n){sae(this,t);var a=iae(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.toggleViews=function(){a.state.view==="hex"?a.setState({view:"rgb"}):a.state.view==="rgb"?a.setState({view:"hsl"}):a.state.view==="hsl"&&(a.props.hsl.a===1?a.setState({view:"hex"}):a.setState({view:"rgb"}))},a.handleChange=function(i,l){i.hex?Ei(i.hex)&&a.props.onChange({hex:i.hex,source:"hex"},l):i.r||i.g||i.b?a.props.onChange({r:i.r||a.props.rgb.r,g:i.g||a.props.rgb.g,b:i.b||a.props.rgb.b,source:"rgb"},l):i.a?(i.a<0?i.a=0:i.a>1&&(i.a=1),a.props.onChange({h:a.props.hsl.h,s:a.props.hsl.s,l:a.props.hsl.l,a:Math.round(i.a*100)/100,source:"rgb"},l)):(i.h||i.s||i.l)&&(typeof i.s=="string"&&i.s.includes("%")&&(i.s=i.s.replace("%","")),typeof i.l=="string"&&i.l.includes("%")&&(i.l=i.l.replace("%","")),i.s==1?i.s=.01:i.l==1&&(i.l=.01),a.props.onChange({h:i.h||a.props.hsl.h,s:Number(yO(i.s)?a.props.hsl.s:i.s),l:Number(yO(i.l)?a.props.hsl.l:i.l),source:"hsl"},l))},a.showHighlight=function(i){i.currentTarget.style.background="#eee"},a.hideHighlight=function(i){i.currentTarget.style.background="transparent"},n.hsl.a!==1&&n.view==="hex"?a.state={view:"rgb"}:a.state={view:n.view},a}return aae(t,[{key:"render",value:function(){var a=this,i=ht({default:{wrap:{paddingTop:"16px",display:"flex"},fields:{flex:"1",display:"flex",marginLeft:"-6px"},field:{paddingLeft:"6px",width:"100%"},alpha:{paddingLeft:"6px",width:"100%"},toggle:{width:"32px",textAlign:"right",position:"relative"},icon:{marginRight:"-4px",marginTop:"12px",cursor:"pointer",position:"relative"},iconHighlight:{position:"absolute",width:"24px",height:"28px",background:"#eee",borderRadius:"4px",top:"10px",left:"12px",display:"none"},input:{fontSize:"11px",color:"#333",width:"100%",borderRadius:"2px",border:"none",boxShadow:"inset 0 0 0 1px #dadada",height:"21px",textAlign:"center"},label:{textTransform:"uppercase",fontSize:"11px",lineHeight:"11px",color:"#969696",textAlign:"center",display:"block",marginTop:"12px"},svg:{fill:"#333",width:"24px",height:"24px",border:"1px transparent solid",borderRadius:"5px"}},disableAlpha:{alpha:{display:"none"}}},this.props,this.state),l=void 0;return this.state.view==="hex"?l=A.createElement("div",{style:i.fields,className:"flexbox-fix"},A.createElement("div",{style:i.field},A.createElement(Ut,{style:{input:i.input,label:i.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?l=A.createElement("div",{style:i.fields,className:"flexbox-fix"},A.createElement("div",{style:i.field},A.createElement(Ut,{style:{input:i.input,label:i.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),A.createElement("div",{style:i.field},A.createElement(Ut,{style:{input:i.input,label:i.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),A.createElement("div",{style:i.field},A.createElement(Ut,{style:{input:i.input,label:i.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),A.createElement("div",{style:i.alpha},A.createElement(Ut,{style:{input:i.input,label:i.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(l=A.createElement("div",{style:i.fields,className:"flexbox-fix"},A.createElement("div",{style:i.field},A.createElement(Ut,{style:{input:i.input,label:i.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),A.createElement("div",{style:i.field},A.createElement(Ut,{style:{input:i.input,label:i.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),A.createElement("div",{style:i.field},A.createElement(Ut,{style:{input:i.input,label:i.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),A.createElement("div",{style:i.alpha},A.createElement(Ut,{style:{input:i.input,label:i.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),A.createElement("div",{style:i.wrap,className:"flexbox-fix"},l,A.createElement("div",{style:i.toggle},A.createElement("div",{style:i.icon,onClick:this.toggleViews,ref:function(d){return a.icon=d}},A.createElement(rae,{style:i.svg,onMouseOver:this.showHighlight,onMouseEnter:this.showHighlight,onMouseOut:this.hideHighlight}))))}}],[{key:"getDerivedStateFromProps",value:function(a,i){return a.hsl.a!==1&&i.view==="hex"?{view:"rgb"}:null}}]),t})(A.Component);xL.defaultProps={view:"hex"};var wO=function(){var t=ht({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",transform:"translate(-6px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return A.createElement("div",{style:t.picker})},lae=function(){var t=ht({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return A.createElement("div",{style:t.picker})},qS=function(t){var n=t.width,a=t.onChange,i=t.disableAlpha,l=t.rgb,u=t.hsl,d=t.hsv,h=t.hex,p=t.renderers,v=t.styles,m=v===void 0?{}:v,b=t.className,w=b===void 0?"":b,j=t.defaultView,S=ht(yr({default:{picker:{width:n,background:"#fff",borderRadius:"2px",boxShadow:"0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",boxSizing:"initial",fontFamily:"Menlo"},saturation:{width:"100%",paddingBottom:"55%",position:"relative",borderRadius:"2px 2px 0 0",overflow:"hidden"},Saturation:{radius:"2px 2px 0 0"},body:{padding:"16px 16px 12px"},controls:{display:"flex"},color:{width:"32px"},swatch:{marginTop:"6px",width:"16px",height:"16px",borderRadius:"8px",position:"relative",overflow:"hidden"},active:{absolute:"0px 0px 0px 0px",borderRadius:"8px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",background:"rgba("+l.r+", "+l.g+", "+l.b+", "+l.a+")",zIndex:"2"},toggles:{flex:"1"},hue:{height:"10px",position:"relative",marginBottom:"8px"},Hue:{radius:"2px"},alpha:{height:"10px",position:"relative"},Alpha:{radius:"2px"}},disableAlpha:{color:{width:"22px"},alpha:{display:"none"},hue:{marginBottom:"0px"},swatch:{width:"10px",height:"10px",marginTop:"0px"}}},m),{disableAlpha:i});return A.createElement("div",{style:S.picker,className:"chrome-picker "+w},A.createElement("div",{style:S.saturation},A.createElement(Ip,{style:S.Saturation,hsl:u,hsv:d,pointer:lae,onChange:a})),A.createElement("div",{style:S.body},A.createElement("div",{style:S.controls,className:"flexbox-fix"},A.createElement("div",{style:S.color},A.createElement("div",{style:S.swatch},A.createElement("div",{style:S.active}),A.createElement(Xl,{renderers:p}))),A.createElement("div",{style:S.toggles},A.createElement("div",{style:S.hue},A.createElement(Ql,{style:S.Hue,hsl:u,pointer:wO,onChange:a})),A.createElement("div",{style:S.alpha},A.createElement(AS,{style:S.Alpha,rgb:l,hsl:u,pointer:wO,renderers:p,onChange:a})))),A.createElement(xL,{rgb:l,hsl:u,hex:h,view:j,onChange:a,disableAlpha:i})))};qS.propTypes={width:De.oneOfType([De.string,De.number]),disableAlpha:De.bool,styles:De.object,defaultView:De.oneOf(["hex","rgb","hsl"])};qS.defaultProps={width:225,disableAlpha:!1,styles:{}};br(qS);var cae=function(t){var n=t.color,a=t.onClick,i=a===void 0?function(){}:a,l=t.onSwatchHover,u=t.active,d=ht({default:{color:{background:n,width:"15px",height:"15px",float:"left",marginRight:"5px",marginBottom:"5px",position:"relative",cursor:"pointer"},dot:{absolute:"5px 5px 5px 5px",background:IS(n),borderRadius:"50%",opacity:"0"}},active:{dot:{opacity:"1"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},dot:{background:"#000"}},transparent:{dot:{background:"#000"}}},{active:u,"color-#FFFFFF":n==="#FFFFFF",transparent:n==="transparent"});return A.createElement(po,{style:d.color,color:n,onClick:i,onHover:l,focusStyle:{boxShadow:"0 0 4px "+n}},A.createElement("div",{style:d.dot}))},uae=function(t){var n=t.hex,a=t.rgb,i=t.onChange,l=ht({default:{fields:{display:"flex",paddingBottom:"6px",paddingRight:"5px",position:"relative"},active:{position:"absolute",top:"6px",left:"5px",height:"9px",width:"9px",background:n},HEXwrap:{flex:"6",position:"relative"},HEXinput:{width:"80%",padding:"0px",paddingLeft:"20%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},HEXlabel:{display:"none"},RGBwrap:{flex:"3",position:"relative"},RGBinput:{width:"70%",padding:"0px",paddingLeft:"30%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},RGBlabel:{position:"absolute",top:"3px",left:"0px",lineHeight:"16px",textTransform:"uppercase",fontSize:"12px",color:"#999"}}}),u=function(h,p){h.r||h.g||h.b?i({r:h.r||a.r,g:h.g||a.g,b:h.b||a.b,source:"rgb"},p):i({hex:h.hex,source:"hex"},p)};return A.createElement("div",{style:l.fields,className:"flexbox-fix"},A.createElement("div",{style:l.active}),A.createElement(Ut,{style:{wrap:l.HEXwrap,input:l.HEXinput,label:l.HEXlabel},label:"hex",value:n,onChange:u}),A.createElement(Ut,{style:{wrap:l.RGBwrap,input:l.RGBinput,label:l.RGBlabel},label:"r",value:a.r,onChange:u}),A.createElement(Ut,{style:{wrap:l.RGBwrap,input:l.RGBinput,label:l.RGBlabel},label:"g",value:a.g,onChange:u}),A.createElement(Ut,{style:{wrap:l.RGBwrap,input:l.RGBinput,label:l.RGBlabel},label:"b",value:a.b,onChange:u}))},$S=function(t){var n=t.onChange,a=t.onSwatchHover,i=t.colors,l=t.hex,u=t.rgb,d=t.styles,h=d===void 0?{}:d,p=t.className,v=p===void 0?"":p,m=ht(yr({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},h)),b=function(j,S){j.hex?Ei(j.hex)&&n({hex:j.hex,source:"hex"},S):n(j,S)};return A.createElement(dd,{style:m.Compact,styles:h},A.createElement("div",{style:m.compact,className:"compact-picker "+v},A.createElement("div",null,mo(i,function(w){return A.createElement(cae,{key:w,color:w,active:w.toLowerCase()===l,onClick:b,onSwatchHover:a})}),A.createElement("div",{style:m.clear})),A.createElement(uae,{hex:l,rgb:u,onChange:b})))};$S.propTypes={colors:De.arrayOf(De.string),styles:De.object};$S.defaultProps={colors:["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"],styles:{}};br($S);var dae=function(t){var n=t.hover,a=t.color,i=t.onClick,l=t.onSwatchHover,u={position:"relative",zIndex:"2",outline:"2px solid #fff",boxShadow:"0 0 5px 2px rgba(0,0,0,0.25)"},d=ht({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:u}},{hover:n});return A.createElement("div",{style:d.swatch},A.createElement(po,{color:a,onClick:i,onHover:l,focusStyle:u}))};const fae=RS.handleHover(dae);var GS=function(t){var n=t.width,a=t.colors,i=t.onChange,l=t.onSwatchHover,u=t.triangle,d=t.styles,h=d===void 0?{}:d,p=t.className,v=p===void 0?"":p,m=ht(yr({default:{card:{width:n,background:"#fff",border:"1px solid rgba(0,0,0,0.2)",boxShadow:"0 3px 12px rgba(0,0,0,0.15)",borderRadius:"4px",position:"relative",padding:"5px",display:"flex",flexWrap:"wrap"},triangle:{position:"absolute",border:"7px solid transparent",borderBottomColor:"#fff"},triangleShadow:{position:"absolute",border:"8px solid transparent",borderBottomColor:"rgba(0,0,0,0.15)"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-14px",left:"10px"},triangleShadow:{top:"-16px",left:"9px"}},"top-right-triangle":{triangle:{top:"-14px",right:"10px"},triangleShadow:{top:"-16px",right:"9px"}},"bottom-left-triangle":{triangle:{top:"35px",left:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",left:"9px",transform:"rotate(180deg)"}},"bottom-right-triangle":{triangle:{top:"35px",right:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",right:"9px",transform:"rotate(180deg)"}}},h),{"hide-triangle":u==="hide","top-left-triangle":u==="top-left","top-right-triangle":u==="top-right","bottom-left-triangle":u==="bottom-left","bottom-right-triangle":u==="bottom-right"}),b=function(j,S){return i({hex:j,source:"hex"},S)};return A.createElement("div",{style:m.card,className:"github-picker "+v},A.createElement("div",{style:m.triangleShadow}),A.createElement("div",{style:m.triangle}),mo(a,function(w){return A.createElement(fae,{color:w,key:w,onClick:b,onSwatchHover:l})}))};GS.propTypes={width:De.oneOfType([De.string,De.number]),colors:De.arrayOf(De.string),triangle:De.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:De.object};GS.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};br(GS);var hae=function(t){var n=t.direction,a=ht({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:n==="vertical"});return A.createElement("div",{style:a.picker})},pae=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},KS=function(t){var n=t.width,a=t.height,i=t.onChange,l=t.hsl,u=t.direction,d=t.pointer,h=t.styles,p=h===void 0?{}:h,v=t.className,m=v===void 0?"":v,b=ht(yr({default:{picker:{position:"relative",width:n,height:a},hue:{radius:"2px"}}},p)),w=function(S){return i({a:1,h:S.h,l:.5,s:1})};return A.createElement("div",{style:b.picker,className:"hue-picker "+m},A.createElement(Ql,pae({},b.hue,{hsl:l,pointer:d,onChange:w,direction:u})))};KS.propTypes={styles:De.object};KS.defaultProps={width:"316px",height:"16px",direction:"horizontal",pointer:hae,styles:{}};br(KS);var mae=function(t){var n=t.onChange,a=t.hex,i=t.rgb,l=t.styles,u=l===void 0?{}:l,d=t.className,h=d===void 0?"":d,p=ht(yr({default:{material:{width:"98px",height:"98px",padding:"16px",fontFamily:"Roboto"},HEXwrap:{position:"relative"},HEXinput:{width:"100%",marginTop:"12px",fontSize:"15px",color:"#333",padding:"0px",border:"0px",borderBottom:"2px solid "+a,outline:"none",height:"30px"},HEXlabel:{position:"absolute",top:"0px",left:"0px",fontSize:"11px",color:"#999999",textTransform:"capitalize"},Hex:{style:{}},RGBwrap:{position:"relative"},RGBinput:{width:"100%",marginTop:"12px",fontSize:"15px",color:"#333",padding:"0px",border:"0px",borderBottom:"1px solid #eee",outline:"none",height:"30px"},RGBlabel:{position:"absolute",top:"0px",left:"0px",fontSize:"11px",color:"#999999",textTransform:"capitalize"},split:{display:"flex",marginRight:"-10px",paddingTop:"11px"},third:{flex:"1",paddingRight:"10px"}}},u)),v=function(b,w){b.hex?Ei(b.hex)&&n({hex:b.hex,source:"hex"},w):(b.r||b.g||b.b)&&n({r:b.r||i.r,g:b.g||i.g,b:b.b||i.b,source:"rgb"},w)};return A.createElement(dd,{styles:u},A.createElement("div",{style:p.material,className:"material-picker "+h},A.createElement(Ut,{style:{wrap:p.HEXwrap,input:p.HEXinput,label:p.HEXlabel},label:"hex",value:a,onChange:v}),A.createElement("div",{style:p.split,className:"flexbox-fix"},A.createElement("div",{style:p.third},A.createElement(Ut,{style:{wrap:p.RGBwrap,input:p.RGBinput,label:p.RGBlabel},label:"r",value:i.r,onChange:v})),A.createElement("div",{style:p.third},A.createElement(Ut,{style:{wrap:p.RGBwrap,input:p.RGBinput,label:p.RGBlabel},label:"g",value:i.g,onChange:v})),A.createElement("div",{style:p.third},A.createElement(Ut,{style:{wrap:p.RGBwrap,input:p.RGBinput,label:p.RGBlabel},label:"b",value:i.b,onChange:v})))))};br(mae);var gae=function(t){var n=t.onChange,a=t.rgb,i=t.hsv,l=t.hex,u=ht({default:{fields:{paddingTop:"5px",paddingBottom:"9px",width:"80px",position:"relative"},divider:{height:"5px"},RGBwrap:{position:"relative"},RGBinput:{marginLeft:"40%",width:"40%",height:"18px",border:"1px solid #888888",boxShadow:"inset 0 1px 1px rgba(0,0,0,.1), 0 1px 0 0 #ECECEC",marginBottom:"5px",fontSize:"13px",paddingLeft:"3px",marginRight:"10px"},RGBlabel:{left:"0px",top:"0px",width:"34px",textTransform:"uppercase",fontSize:"13px",height:"18px",lineHeight:"22px",position:"absolute"},HEXwrap:{position:"relative"},HEXinput:{marginLeft:"20%",width:"80%",height:"18px",border:"1px solid #888888",boxShadow:"inset 0 1px 1px rgba(0,0,0,.1), 0 1px 0 0 #ECECEC",marginBottom:"6px",fontSize:"13px",paddingLeft:"3px"},HEXlabel:{position:"absolute",top:"0px",left:"0px",width:"14px",textTransform:"uppercase",fontSize:"13px",height:"18px",lineHeight:"22px"},fieldSymbols:{position:"absolute",top:"5px",right:"-7px",fontSize:"13px"},symbol:{height:"20px",lineHeight:"22px",paddingBottom:"7px"}}}),d=function(p,v){p["#"]?Ei(p["#"])&&n({hex:p["#"],source:"hex"},v):p.r||p.g||p.b?n({r:p.r||a.r,g:p.g||a.g,b:p.b||a.b,source:"rgb"},v):(p.h||p.s||p.v)&&n({h:p.h||i.h,s:p.s||i.s,v:p.v||i.v,source:"hsv"},v)};return A.createElement("div",{style:u.fields},A.createElement(Ut,{style:{wrap:u.RGBwrap,input:u.RGBinput,label:u.RGBlabel},label:"h",value:Math.round(i.h),onChange:d}),A.createElement(Ut,{style:{wrap:u.RGBwrap,input:u.RGBinput,label:u.RGBlabel},label:"s",value:Math.round(i.s*100),onChange:d}),A.createElement(Ut,{style:{wrap:u.RGBwrap,input:u.RGBinput,label:u.RGBlabel},label:"v",value:Math.round(i.v*100),onChange:d}),A.createElement("div",{style:u.divider}),A.createElement(Ut,{style:{wrap:u.RGBwrap,input:u.RGBinput,label:u.RGBlabel},label:"r",value:a.r,onChange:d}),A.createElement(Ut,{style:{wrap:u.RGBwrap,input:u.RGBinput,label:u.RGBlabel},label:"g",value:a.g,onChange:d}),A.createElement(Ut,{style:{wrap:u.RGBwrap,input:u.RGBinput,label:u.RGBlabel},label:"b",value:a.b,onChange:d}),A.createElement("div",{style:u.divider}),A.createElement(Ut,{style:{wrap:u.HEXwrap,input:u.HEXinput,label:u.HEXlabel},label:"#",value:l.replace("#",""),onChange:d}),A.createElement("div",{style:u.fieldSymbols},A.createElement("div",{style:u.symbol},"°"),A.createElement("div",{style:u.symbol},"%"),A.createElement("div",{style:u.symbol},"%")))},vae=function(t){var n=t.hsl,a=ht({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}},"black-outline":{picker:{boxShadow:"inset 0 0 0 1px #000"}}},{"black-outline":n.l>.5});return A.createElement("div",{style:a.picker})},xae=function(){var t=ht({default:{triangle:{width:0,height:0,borderStyle:"solid",borderWidth:"4px 0 4px 6px",borderColor:"transparent transparent transparent #fff",position:"absolute",top:"1px",left:"1px"},triangleBorder:{width:0,height:0,borderStyle:"solid",borderWidth:"5px 0 5px 8px",borderColor:"transparent transparent transparent #555"},left:{Extend:"triangleBorder",transform:"translate(-13px, -4px)"},leftInside:{Extend:"triangle",transform:"translate(-8px, -5px)"},right:{Extend:"triangleBorder",transform:"translate(20px, -14px) rotate(180deg)"},rightInside:{Extend:"triangle",transform:"translate(-8px, -5px)"}}});return A.createElement("div",{style:t.pointer},A.createElement("div",{style:t.left},A.createElement("div",{style:t.leftInside})),A.createElement("div",{style:t.right},A.createElement("div",{style:t.rightInside})))},SO=function(t){var n=t.onClick,a=t.label,i=t.children,l=t.active,u=ht({default:{button:{backgroundImage:"linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",border:"1px solid #878787",borderRadius:"2px",height:"20px",boxShadow:"0 1px 0 0 #EAEAEA",fontSize:"14px",color:"#000",lineHeight:"20px",textAlign:"center",marginBottom:"10px",cursor:"pointer"}},active:{button:{boxShadow:"0 0 0 1px #878787"}}},{active:l});return A.createElement("div",{style:u.button,onClick:n},a||i)},yae=function(t){var n=t.rgb,a=t.currentColor,i=ht({default:{swatches:{border:"1px solid #B3B3B3",borderBottom:"1px solid #F0F0F0",marginBottom:"2px",marginTop:"1px"},new:{height:"34px",background:"rgb("+n.r+","+n.g+", "+n.b+")",boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"},current:{height:"34px",background:a,boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"},label:{fontSize:"14px",color:"#000",textAlign:"center"}}});return A.createElement("div",null,A.createElement("div",{style:i.label},"new"),A.createElement("div",{style:i.swatches},A.createElement("div",{style:i.new}),A.createElement("div",{style:i.current})),A.createElement("div",{style:i.label},"current"))},bae=(function(){function e(t,n){for(var a=0;a<n.length;a++){var i=n[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}})();function wae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Sae(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function jae(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var YS=(function(e){jae(t,e);function t(n){wae(this,t);var a=Sae(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.state={currentColor:n.hex},a}return bae(t,[{key:"render",value:function(){var a=this.props,i=a.styles,l=i===void 0?{}:i,u=a.className,d=u===void 0?"":u,h=ht(yr({default:{picker:{background:"#DCDCDC",borderRadius:"4px",boxShadow:"0 0 0 1px rgba(0,0,0,.25), 0 8px 16px rgba(0,0,0,.15)",boxSizing:"initial",width:"513px"},head:{backgroundImage:"linear-gradient(-180deg, #F0F0F0 0%, #D4D4D4 100%)",borderBottom:"1px solid #B1B1B1",boxShadow:"inset 0 1px 0 0 rgba(255,255,255,.2), inset 0 -1px 0 0 rgba(0,0,0,.02)",height:"23px",lineHeight:"24px",borderRadius:"4px 4px 0 0",fontSize:"13px",color:"#4D4D4D",textAlign:"center"},body:{padding:"15px 15px 0",display:"flex"},saturation:{width:"256px",height:"256px",position:"relative",border:"2px solid #B3B3B3",borderBottom:"2px solid #F0F0F0",overflow:"hidden"},hue:{position:"relative",height:"256px",width:"19px",marginLeft:"10px",border:"2px solid #B3B3B3",borderBottom:"2px solid #F0F0F0"},controls:{width:"180px",marginLeft:"10px"},top:{display:"flex"},previews:{width:"60px"},actions:{flex:"1",marginLeft:"20px"}}},l));return A.createElement("div",{style:h.picker,className:"photoshop-picker "+d},A.createElement("div",{style:h.head},this.props.header),A.createElement("div",{style:h.body,className:"flexbox-fix"},A.createElement("div",{style:h.saturation},A.createElement(Ip,{hsl:this.props.hsl,hsv:this.props.hsv,pointer:vae,onChange:this.props.onChange})),A.createElement("div",{style:h.hue},A.createElement(Ql,{direction:"vertical",hsl:this.props.hsl,pointer:xae,onChange:this.props.onChange})),A.createElement("div",{style:h.controls},A.createElement("div",{style:h.top,className:"flexbox-fix"},A.createElement("div",{style:h.previews},A.createElement(yae,{rgb:this.props.rgb,currentColor:this.state.currentColor})),A.createElement("div",{style:h.actions},A.createElement(SO,{label:"OK",onClick:this.props.onAccept,active:!0}),A.createElement(SO,{label:"Cancel",onClick:this.props.onCancel}),A.createElement(gae,{onChange:this.props.onChange,rgb:this.props.rgb,hsv:this.props.hsv,hex:this.props.hex}))))))}}]),t})(A.Component);YS.propTypes={header:De.string,styles:De.object};YS.defaultProps={header:"Color Picker",styles:{}};br(YS);var Cae=function(t){var n=t.onChange,a=t.rgb,i=t.hsl,l=t.hex,u=t.disableAlpha,d=ht({default:{fields:{display:"flex",paddingTop:"4px"},single:{flex:"1",paddingLeft:"6px"},alpha:{flex:"1",paddingLeft:"6px"},double:{flex:"2"},input:{width:"80%",padding:"4px 10% 3px",border:"none",boxShadow:"inset 0 0 0 1px #ccc",fontSize:"11px"},label:{display:"block",textAlign:"center",fontSize:"11px",color:"#222",paddingTop:"3px",paddingBottom:"4px",textTransform:"capitalize"}},disableAlpha:{alpha:{display:"none"}}},{disableAlpha:u}),h=function(v,m){v.hex?Ei(v.hex)&&n({hex:v.hex,source:"hex"},m):v.r||v.g||v.b?n({r:v.r||a.r,g:v.g||a.g,b:v.b||a.b,a:a.a,source:"rgb"},m):v.a&&(v.a<0?v.a=0:v.a>100&&(v.a=100),v.a/=100,n({h:i.h,s:i.s,l:i.l,a:v.a,source:"rgb"},m))};return A.createElement("div",{style:d.fields,className:"flexbox-fix"},A.createElement("div",{style:d.double},A.createElement(Ut,{style:{input:d.input,label:d.label},label:"hex",value:l.replace("#",""),onChange:h})),A.createElement("div",{style:d.single},A.createElement(Ut,{style:{input:d.input,label:d.label},label:"r",value:a.r,onChange:h,dragLabel:"true",dragMax:"255"})),A.createElement("div",{style:d.single},A.createElement(Ut,{style:{input:d.input,label:d.label},label:"g",value:a.g,onChange:h,dragLabel:"true",dragMax:"255"})),A.createElement("div",{style:d.single},A.createElement(Ut,{style:{input:d.input,label:d.label},label:"b",value:a.b,onChange:h,dragLabel:"true",dragMax:"255"})),A.createElement("div",{style:d.alpha},A.createElement(Ut,{style:{input:d.input,label:d.label},label:"a",value:Math.round(a.a*100),onChange:h,dragLabel:"true",dragMax:"100"})))},Nae=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},yL=function(t){var n=t.colors,a=t.onClick,i=a===void 0?function(){}:a,l=t.onSwatchHover,u=ht({default:{colors:{margin:"0 -10px",padding:"10px 0 0 10px",borderTop:"1px solid #eee",display:"flex",flexWrap:"wrap",position:"relative"},swatchWrap:{width:"16px",height:"16px",margin:"0 10px 10px 0"},swatch:{borderRadius:"3px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.15)"}},"no-presets":{colors:{display:"none"}}},{"no-presets":!n||!n.length}),d=function(p,v){i({hex:p,source:"hex"},v)};return A.createElement("div",{style:u.colors,className:"flexbox-fix"},n.map(function(h){var p=typeof h=="string"?{color:h}:h,v=""+p.color+(p.title||"");return A.createElement("div",{key:v,style:u.swatchWrap},A.createElement(po,Nae({},p,{style:u.swatch,onClick:d,onHover:l,focusStyle:{boxShadow:"inset 0 0 0 1px rgba(0,0,0,.15), 0 0 4px "+p.color}})))}))};yL.propTypes={colors:De.arrayOf(De.oneOfType([De.string,De.shape({color:De.string,title:De.string})])).isRequired};var _ae=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},WS=function(t){var n=t.width,a=t.rgb,i=t.hex,l=t.hsv,u=t.hsl,d=t.onChange,h=t.onSwatchHover,p=t.disableAlpha,v=t.presetColors,m=t.renderers,b=t.styles,w=b===void 0?{}:b,j=t.className,S=j===void 0?"":j,C=ht(yr({default:_ae({picker:{width:n,padding:"10px 10px 0",boxSizing:"initial",background:"#fff",borderRadius:"4px",boxShadow:"0 0 0 1px rgba(0,0,0,.15), 0 8px 16px rgba(0,0,0,.15)"},saturation:{width:"100%",paddingBottom:"75%",position:"relative",overflow:"hidden"},Saturation:{radius:"3px",shadow:"inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"},controls:{display:"flex"},sliders:{padding:"4px 0",flex:"1"},color:{width:"24px",height:"24px",position:"relative",marginTop:"4px",marginLeft:"4px",borderRadius:"3px"},activeColor:{absolute:"0px 0px 0px 0px",borderRadius:"2px",background:"rgba("+a.r+","+a.g+","+a.b+","+a.a+")",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"},hue:{position:"relative",height:"10px",overflow:"hidden"},Hue:{radius:"2px",shadow:"inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"},alpha:{position:"relative",height:"10px",marginTop:"4px",overflow:"hidden"},Alpha:{radius:"2px",shadow:"inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"}},w),disableAlpha:{color:{height:"10px"},hue:{height:"10px"},alpha:{display:"none"}}},w),{disableAlpha:p});return A.createElement("div",{style:C.picker,className:"sketch-picker "+S},A.createElement("div",{style:C.saturation},A.createElement(Ip,{style:C.Saturation,hsl:u,hsv:l,onChange:d})),A.createElement("div",{style:C.controls,className:"flexbox-fix"},A.createElement("div",{style:C.sliders},A.createElement("div",{style:C.hue},A.createElement(Ql,{style:C.Hue,hsl:u,onChange:d})),A.createElement("div",{style:C.alpha},A.createElement(AS,{style:C.Alpha,rgb:a,hsl:u,renderers:m,onChange:d}))),A.createElement("div",{style:C.color},A.createElement(Xl,null),A.createElement("div",{style:C.activeColor}))),A.createElement(Cae,{rgb:a,hsl:u,hex:i,onChange:d,disableAlpha:p}),A.createElement(yL,{colors:v,onClick:d,onSwatchHover:h}))};WS.propTypes={disableAlpha:De.bool,width:De.oneOfType([De.string,De.number]),styles:De.object};WS.defaultProps={disableAlpha:!1,width:200,styles:{},presetColors:["#D0021B","#F5A623","#F8E71C","#8B572A","#7ED321","#417505","#BD10E0","#9013FE","#4A90E2","#50E3C2","#B8E986","#000000","#4A4A4A","#9B9B9B","#FFFFFF"]};const Eae=br(WS);var ou=function(t){var n=t.hsl,a=t.offset,i=t.onClick,l=i===void 0?function(){}:i,u=t.active,d=t.first,h=t.last,p=ht({default:{swatch:{height:"12px",background:"hsl("+n.h+", 50%, "+a*100+"%)",cursor:"pointer"}},first:{swatch:{borderRadius:"2px 0 0 2px"}},last:{swatch:{borderRadius:"0 2px 2px 0"}},active:{swatch:{transform:"scaleY(1.8)",borderRadius:"3.6px/2px"}}},{active:u,first:d,last:h}),v=function(b){return l({h:n.h,s:.5,l:a,source:"hsl"},b)};return A.createElement("div",{style:p.swatch,onClick:v})},Tae=function(t){var n=t.onClick,a=t.hsl,i=ht({default:{swatches:{marginTop:"20px"},swatch:{boxSizing:"border-box",width:"20%",paddingRight:"1px",float:"left"},clear:{clear:"both"}}}),l=.1;return A.createElement("div",{style:i.swatches},A.createElement("div",{style:i.swatch},A.createElement(ou,{hsl:a,offset:".80",active:Math.abs(a.l-.8)<l&&Math.abs(a.s-.5)<l,onClick:n,first:!0})),A.createElement("div",{style:i.swatch},A.createElement(ou,{hsl:a,offset:".65",active:Math.abs(a.l-.65)<l&&Math.abs(a.s-.5)<l,onClick:n})),A.createElement("div",{style:i.swatch},A.createElement(ou,{hsl:a,offset:".50",active:Math.abs(a.l-.5)<l&&Math.abs(a.s-.5)<l,onClick:n})),A.createElement("div",{style:i.swatch},A.createElement(ou,{hsl:a,offset:".35",active:Math.abs(a.l-.35)<l&&Math.abs(a.s-.5)<l,onClick:n})),A.createElement("div",{style:i.swatch},A.createElement(ou,{hsl:a,offset:".20",active:Math.abs(a.l-.2)<l&&Math.abs(a.s-.5)<l,onClick:n,last:!0})),A.createElement("div",{style:i.clear}))},Rae=function(){var t=ht({default:{picker:{width:"14px",height:"14px",borderRadius:"6px",transform:"translate(-7px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return A.createElement("div",{style:t.picker})},XS=function(t){var n=t.hsl,a=t.onChange,i=t.pointer,l=t.styles,u=l===void 0?{}:l,d=t.className,h=d===void 0?"":d,p=ht(yr({default:{hue:{height:"12px",position:"relative"},Hue:{radius:"2px"}}},u));return A.createElement("div",{style:p.wrap||{},className:"slider-picker "+h},A.createElement("div",{style:p.hue},A.createElement(Ql,{style:p.Hue,hsl:n,pointer:i,onChange:a})),A.createElement("div",{style:p.swatches},A.createElement(Tae,{hsl:n,onClick:a})))};XS.propTypes={styles:De.object};XS.defaultProps={pointer:Rae,styles:{}};br(XS);var Xf={},jO;function Aae(){if(jO)return Xf;jO=1,Object.defineProperty(Xf,"__esModule",{value:!0});var e=Object.assign||function(u){for(var d=1;d<arguments.length;d++){var h=arguments[d];for(var p in h)Object.prototype.hasOwnProperty.call(h,p)&&(u[p]=h[p])}return u},t=io(),n=a(t);function a(u){return u&&u.__esModule?u:{default:u}}function i(u,d){var h={};for(var p in u)d.indexOf(p)>=0||Object.prototype.hasOwnProperty.call(u,p)&&(h[p]=u[p]);return h}var l=24;return Xf.default=function(u){var d=u.fill,h=d===void 0?"currentColor":d,p=u.width,v=p===void 0?l:p,m=u.height,b=m===void 0?l:m,w=u.style,j=w===void 0?{}:w,S=i(u,["fill","width","height","style"]);return n.default.createElement("svg",e({viewBox:"0 0 "+l+" "+l,style:e({fill:h,width:v,height:b},j)},S),n.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},Xf}var Oae=Aae();const Mae=Ml(Oae);var Dae=function(t){var n=t.color,a=t.onClick,i=a===void 0?function(){}:a,l=t.onSwatchHover,u=t.first,d=t.last,h=t.active,p=ht({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:n,marginBottom:"1px"},check:{color:IS(n),marginLeft:"8px",display:"none"}},first:{color:{overflow:"hidden",borderRadius:"2px 2px 0 0"}},last:{color:{overflow:"hidden",borderRadius:"0 0 2px 2px"}},active:{check:{display:"block"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},check:{color:"#333"}},transparent:{check:{color:"#333"}}},{first:u,last:d,active:h,"color-#FFFFFF":n==="#FFFFFF",transparent:n==="transparent"});return A.createElement(po,{color:n,style:p.color,onClick:i,onHover:l,focusStyle:{boxShadow:"0 0 4px "+n}},A.createElement("div",{style:p.check},A.createElement(Mae,null)))},Pae=function(t){var n=t.onClick,a=t.onSwatchHover,i=t.group,l=t.active,u=ht({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return A.createElement("div",{style:u.group},mo(i,function(d,h){return A.createElement(Dae,{key:d,color:d,active:d.toLowerCase()===l,first:h===0,last:h===i.length-1,onClick:n,onSwatchHover:a})}))},QS=function(t){var n=t.width,a=t.height,i=t.onChange,l=t.onSwatchHover,u=t.colors,d=t.hex,h=t.styles,p=h===void 0?{}:h,v=t.className,m=v===void 0?"":v,b=ht(yr({default:{picker:{width:n,height:a},overflow:{height:a,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},p)),w=function(S,C){return i({hex:S,source:"hex"},C)};return A.createElement("div",{style:b.picker,className:"swatches-picker "+m},A.createElement(dd,null,A.createElement("div",{style:b.overflow},A.createElement("div",{style:b.body},mo(u,function(j){return A.createElement(Pae,{key:j.toString(),group:j,active:d,onClick:w,onSwatchHover:l})}),A.createElement("div",{style:b.clear})))))};QS.propTypes={width:De.oneOfType([De.string,De.number]),height:De.oneOfType([De.string,De.number]),colors:De.arrayOf(De.arrayOf(De.string)),styles:De.object};QS.defaultProps={width:320,height:240,colors:[[tl[900],tl[700],tl[500],tl[300],tl[100]],[nl[900],nl[700],nl[500],nl[300],nl[100]],[rl[900],rl[700],rl[500],rl[300],rl[100]],[al[900],al[700],al[500],al[300],al[100]],[sl[900],sl[700],sl[500],sl[300],sl[100]],[il[900],il[700],il[500],il[300],il[100]],[ol[900],ol[700],ol[500],ol[300],ol[100]],[ll[900],ll[700],ll[500],ll[300],ll[100]],[cl[900],cl[700],cl[500],cl[300],cl[100]],["#194D33",gu[700],gu[500],gu[300],gu[100]],[ul[900],ul[700],ul[500],ul[300],ul[100]],[dl[900],dl[700],dl[500],dl[300],dl[100]],[fl[900],fl[700],fl[500],fl[300],fl[100]],[hl[900],hl[700],hl[500],hl[300],hl[100]],[pl[900],pl[700],pl[500],pl[300],pl[100]],[ml[900],ml[700],ml[500],ml[300],ml[100]],[gl[900],gl[700],gl[500],gl[300],gl[100]],[vl[900],vl[700],vl[500],vl[300],vl[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};br(QS);var ZS=function(t){var n=t.onChange,a=t.onSwatchHover,i=t.hex,l=t.colors,u=t.width,d=t.triangle,h=t.styles,p=h===void 0?{}:h,v=t.className,m=v===void 0?"":v,b=ht(yr({default:{card:{width:u,background:"#fff",border:"0 solid rgba(0,0,0,0.25)",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",borderRadius:"4px",position:"relative"},body:{padding:"15px 9px 9px 15px"},label:{fontSize:"18px",color:"#fff"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent #fff transparent",position:"absolute"},triangleShadow:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent rgba(0,0,0,.1) transparent",position:"absolute"},hash:{background:"#F0F0F0",height:"30px",width:"30px",borderRadius:"4px 0 0 4px",float:"left",color:"#98A1A4",display:"flex",alignItems:"center",justifyContent:"center"},input:{width:"100px",fontSize:"14px",color:"#666",border:"0px",outline:"none",height:"28px",boxShadow:"inset 0 0 0 1px #F0F0F0",boxSizing:"content-box",borderRadius:"0 4px 4px 0",float:"left",paddingLeft:"8px"},swatch:{width:"30px",height:"30px",float:"left",borderRadius:"4px",margin:"0 6px 6px 0"},clear:{clear:"both"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-10px",left:"12px"},triangleShadow:{top:"-11px",left:"12px"}},"top-right-triangle":{triangle:{top:"-10px",right:"12px"},triangleShadow:{top:"-11px",right:"12px"}}},p),{"hide-triangle":d==="hide","top-left-triangle":d==="top-left","top-right-triangle":d==="top-right"}),w=function(S,C){Ei(S)&&n({hex:S,source:"hex"},C)};return A.createElement("div",{style:b.card,className:"twitter-picker "+m},A.createElement("div",{style:b.triangleShadow}),A.createElement("div",{style:b.triangle}),A.createElement("div",{style:b.body},mo(l,function(j,S){return A.createElement(po,{key:S,color:j,hex:j,style:b.swatch,onClick:w,onHover:a,focusStyle:{boxShadow:"0 0 4px "+j}})}),A.createElement("div",{style:b.hash},"#"),A.createElement(Ut,{label:null,style:{input:b.input},value:i.replace("#",""),onChange:w}),A.createElement("div",{style:b.clear})))};ZS.propTypes={width:De.oneOfType([De.string,De.number]),triangle:De.oneOf(["hide","top-left","top-right"]),colors:De.arrayOf(De.string),styles:De.object};ZS.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};br(ZS);var JS=function(t){var n=ht({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",border:"2px #fff solid",transform:"translate(-12px, -13px)",background:"hsl("+Math.round(t.hsl.h)+", "+Math.round(t.hsl.s*100)+"%, "+Math.round(t.hsl.l*100)+"%)"}}});return A.createElement("div",{style:n.picker})};JS.propTypes={hsl:De.shape({h:De.number,s:De.number,l:De.number,a:De.number})};JS.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var e1=function(t){var n=ht({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",transform:"translate(-10px, -7px)",background:"hsl("+Math.round(t.hsl.h)+", 100%, 50%)",border:"2px white solid"}}});return A.createElement("div",{style:n.picker})};e1.propTypes={hsl:De.shape({h:De.number,s:De.number,l:De.number,a:De.number})};e1.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var kae=function(t){var n=t.onChange,a=t.rgb,i=t.hsl,l=t.hex,u=t.hsv,d=function(w,j){if(w.hex)Ei(w.hex)&&n({hex:w.hex,source:"hex"},j);else if(w.rgb){var S=w.rgb.split(",");Db(w.rgb,"rgb")&&n({r:S[0],g:S[1],b:S[2],a:1,source:"rgb"},j)}else if(w.hsv){var C=w.hsv.split(",");Db(w.hsv,"hsv")&&(C[2]=C[2].replace("%",""),C[1]=C[1].replace("%",""),C[0]=C[0].replace("°",""),C[1]==1?C[1]=.01:C[2]==1&&(C[2]=.01),n({h:Number(C[0]),s:Number(C[1]),v:Number(C[2]),source:"hsv"},j))}else if(w.hsl){var N=w.hsl.split(",");Db(w.hsl,"hsl")&&(N[2]=N[2].replace("%",""),N[1]=N[1].replace("%",""),N[0]=N[0].replace("°",""),m[1]==1?m[1]=.01:m[2]==1&&(m[2]=.01),n({h:Number(N[0]),s:Number(N[1]),v:Number(N[2]),source:"hsl"},j))}},h=ht({default:{wrap:{display:"flex",height:"100px",marginTop:"4px"},fields:{width:"100%"},column:{paddingTop:"10px",display:"flex",justifyContent:"space-between"},double:{padding:"0px 4.4px",boxSizing:"border-box"},input:{width:"100%",height:"38px",boxSizing:"border-box",padding:"4px 10% 3px",textAlign:"center",border:"1px solid #dadce0",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",fontFamily:"Roboto,Arial,sans-serif"},input2:{height:"38px",width:"100%",border:"1px solid #dadce0",boxSizing:"border-box",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",paddingLeft:"10px",fontFamily:"Roboto,Arial,sans-serif"},label:{textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"35px",top:"-6px",left:"0",right:"0",marginLeft:"auto",marginRight:"auto",fontFamily:"Roboto,Arial,sans-serif"},label2:{left:"10px",textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"32px",top:"-6px",fontFamily:"Roboto,Arial,sans-serif"},single:{flexGrow:"1",margin:"0px 4.4px"}}}),p=a.r+", "+a.g+", "+a.b,v=Math.round(i.h)+"°, "+Math.round(i.s*100)+"%, "+Math.round(i.l*100)+"%",m=Math.round(u.h)+"°, "+Math.round(u.s*100)+"%, "+Math.round(u.v*100)+"%";return A.createElement("div",{style:h.wrap,className:"flexbox-fix"},A.createElement("div",{style:h.fields},A.createElement("div",{style:h.double},A.createElement(Ut,{style:{input:h.input,label:h.label},label:"hex",value:l,onChange:d})),A.createElement("div",{style:h.column},A.createElement("div",{style:h.single},A.createElement(Ut,{style:{input:h.input2,label:h.label2},label:"rgb",value:p,onChange:d})),A.createElement("div",{style:h.single},A.createElement(Ut,{style:{input:h.input2,label:h.label2},label:"hsv",value:m,onChange:d})),A.createElement("div",{style:h.single},A.createElement(Ut,{style:{input:h.input2,label:h.label2},label:"hsl",value:v,onChange:d})))))},t1=function(t){var n=t.width,a=t.onChange,i=t.rgb,l=t.hsl,u=t.hsv,d=t.hex,h=t.header,p=t.styles,v=p===void 0?{}:p,m=t.className,b=m===void 0?"":m,w=ht(yr({default:{picker:{width:n,background:"#fff",border:"1px solid #dfe1e5",boxSizing:"initial",display:"flex",flexWrap:"wrap",borderRadius:"8px 8px 0px 0px"},head:{height:"57px",width:"100%",paddingTop:"16px",paddingBottom:"16px",paddingLeft:"16px",fontSize:"20px",boxSizing:"border-box",fontFamily:"Roboto-Regular,HelveticaNeue,Arial,sans-serif"},saturation:{width:"70%",padding:"0px",position:"relative",overflow:"hidden"},swatch:{width:"30%",height:"228px",padding:"0px",background:"rgba("+i.r+", "+i.g+", "+i.b+", 1)",position:"relative",overflow:"hidden"},body:{margin:"auto",width:"95%"},controls:{display:"flex",boxSizing:"border-box",height:"52px",paddingTop:"22px"},color:{width:"32px"},hue:{height:"8px",position:"relative",margin:"0px 16px 0px 16px",width:"100%"},Hue:{radius:"2px"}}},v));return A.createElement("div",{style:w.picker,className:"google-picker "+b},A.createElement("div",{style:w.head},h),A.createElement("div",{style:w.swatch}),A.createElement("div",{style:w.saturation},A.createElement(Ip,{hsl:l,hsv:u,pointer:JS,onChange:a})),A.createElement("div",{style:w.body},A.createElement("div",{style:w.controls,className:"flexbox-fix"},A.createElement("div",{style:w.hue},A.createElement(Ql,{style:w.Hue,hsl:l,radius:"4px",pointer:e1,onChange:a}))),A.createElement(kae,{rgb:i,hsl:l,hex:d,hsv:u,onChange:a})))};t1.propTypes={width:De.oneOfType([De.string,De.number]),styles:De.object,header:De.string};t1.defaultProps={width:652,styles:{},header:"Color picker"};br(t1);const Lae=["#ff0000","#ff8000","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff","#ffffff","#2a9d8f","#e9c46a","#dc143c","#000000"];function kb({value:e,onChange:t,className:n,presets:a=Lae}){const[i,l]=g.useState(!1),u=d=>{t(d.hex)};return o.jsxs(Bu,{open:i,onOpenChange:l,children:[o.jsx(Iu,{asChild:!0,children:o.jsx(se,{variant:"secondary",className:ct("w-12 h-12 rounded-full p-1 border-2",n),style:{backgroundColor:e},children:o.jsx("span",{className:"sr-only",children:"Pick a color"})})}),o.jsx(Rl,{className:"w-auto p-0",align:"start",children:o.jsx(Eae,{color:e,onChange:u,presetColors:a,disableAlpha:!0})})]})}function Bae(){const[e,t]=g.useState(null),[n,a]=g.useState(!0),[i,l]=g.useState(null),[u,d]=g.useState([]),[h,p]=g.useState([]),[v,m]=g.useState(35),[b,w]=g.useState(128),[j,S]=g.useState("128"),[C,N]=g.useState(128),[_,T]=g.useState("128"),[R,D]=g.useState(""),[L,k]=g.useState(""),[P,U]=g.useState("#ff0000"),[J,$]=g.useState("#000000"),[W,fe]=g.useState("#0000ff"),we=g.useRef(null),[Ce,I]=g.useState("automated"),[V,H]=g.useState(null),[be,_e]=g.useState(null),[B,G]=g.useState(!1),[X,oe]=g.useState(30),[me,Z]=g.useState("30");g.useEffect(()=>{(async()=>{try{const[Me,st]=await Promise.all([de.get("/get_led_config"),de.get("/api/settings")]);t({provider:Me.provider||"none",wled_ip:Me.wled_ip,num_leds:Me.dw_led_num_leds,gpio_pin:Me.dw_led_gpio_pin}),st.led?.control_mode&&I(st.led.control_mode)}catch(Me){console.error("Error fetching LED config:",Me)}finally{a(!1)}})()},[]),g.useEffect(()=>{e?.provider==="dw_leds"&&(ne(),he(),Ee(),je())},[e]);const ne=async()=>{try{const te=await de.get("/api/dw_leds/status");l(te),te.connected&&(m(te.brightness||35),w(te.speed||128),S(String(te.speed||128)),N(te.intensity||128),T(String(te.intensity||128)),D(String(te.current_effect||0)),k(String(te.current_palette||0)),te.colors&&(U(te.colors[0]||"#ff0000"),$(te.colors[1]||"#000000"),fe(te.colors[2]||"#0000ff")))}catch(te){console.error("Error fetching DW LEDs status:",te)}},he=async()=>{try{const[te,Me]=await Promise.all([de.get("/api/dw_leds/effects"),de.get("/api/dw_leds/palettes")]);if(te.effects){const st=[...te.effects].sort((nt,yt)=>nt[1].localeCompare(yt[1]));d(st)}if(Me.palettes){const st=[...Me.palettes].sort((nt,yt)=>nt[1].localeCompare(yt[1]));p(st)}}catch(te){console.error("Error fetching effects/palettes:",te)}},Ee=async()=>{try{const te=await de.get("/api/dw_leds/get_effect_settings");H(te.idle_effect||null),_e(te.playing_effect||null)}catch(te){console.error("Error fetching effect settings:",te)}},je=async()=>{try{const te=await de.get("/api/dw_leds/idle_timeout");G(te.enabled||!1),oe(te.minutes||30),Z(String(te.minutes||30))}catch(te){console.error("Error fetching idle timeout:",te)}},ke=async te=>{I(te);try{await de.patch("/api/settings",{led:{control_mode:te}}),K.success(te==="manual"?"Manual / HA mode":"DW Automated mode")}catch{K.error("Failed to update control mode")}},le=async()=>{try{const te=await de.post("/api/dw_leds/power",{state:2});te.connected?(K.success(`Power ${te.power_on?"ON":"OFF"}`),await ne()):K.error(te.error||"Failed to toggle power")}catch{K.error("Failed to toggle power")}},Fe=g.useCallback(async te=>{m(te[0])},[]),Ge=async te=>{try{(await de.post("/api/dw_leds/brightness",{value:te[0]})).connected&&K.success(`Brightness: ${te[0]}%`)}catch{K.error("Failed to set brightness")}},He=g.useCallback(te=>{w(te[0]),S(String(te[0]))},[]),at=async te=>{try{await de.post("/api/dw_leds/speed",{speed:te[0]}),K.success(`Speed: ${te[0]}`)}catch{K.error("Failed to set speed")}},Ke=g.useCallback(te=>{N(te[0]),T(String(te[0]))},[]),Mt=async te=>{try{await de.post("/api/dw_leds/intensity",{intensity:te[0]}),K.success(`Intensity: ${te[0]}`)}catch{K.error("Failed to set intensity")}},St=async te=>{D(te);try{const Me=await de.post("/api/dw_leds/effect",{effect_id:parseInt(te)});if(Me.connected&&(K.success("Effect changed"),Me.power_on!==void 0)){const st=Me.power_on;l(nt=>nt?{...nt,power_on:st}:null)}}catch{K.error("Failed to set effect")}},_t=async te=>{k(te);try{(await de.post("/api/dw_leds/palette",{palette_id:parseInt(te)})).connected&&K.success("Palette changed")}catch{K.error("Failed to set palette")}},jt=(te,Me)=>{te===1?U(Me):te===2?$(Me):fe(Me),we.current&&clearTimeout(we.current),we.current=setTimeout(async()=>{try{const st=yt=>{const gt=parseInt(yt.slice(1,3),16),xt=parseInt(yt.slice(3,5),16),qt=parseInt(yt.slice(5,7),16);return[gt,xt,qt]},nt={};nt[`color${te}`]=st(Me),await de.post("/api/dw_leds/colors",nt)}catch(st){console.error("Failed to set color:",st)}},300)},ot=async te=>{try{const Me={type:te,effect_id:parseInt(R)||0,palette_id:parseInt(L)||0,speed:b,intensity:C,color1:P,color2:J,color3:W};await de.post("/api/dw_leds/save_effect_settings",Me),K.success(`${te.charAt(0).toUpperCase()+te.slice(1)} effect saved`),await Ee()}catch{K.error(`Failed to save ${te} effect`)}},lt=async te=>{try{await de.post("/api/dw_leds/clear_effect_settings",{type:te}),K.success(`${te.charAt(0).toUpperCase()+te.slice(1)} effect cleared`),await Ee()}catch{K.error(`Failed to clear ${te} effect`)}},Ct=async(te,Me)=>{const st=te!==void 0?te:B,nt=Me!==void 0?Me:X;try{await de.post("/api/dw_leds/idle_timeout",{enabled:st,minutes:nt}),K.success(`Idle timeout ${st?"enabled":"disabled"}`)}catch{K.error("Failed to save idle timeout")}},Vt=async te=>{G(te),await Ct(te,X)},Kt=te=>{if(!te)return"Not configured";const Me=u.find(nt=>nt[0]===te.effect_id)?.[1]||te.effect_id,st=h.find(nt=>nt[0]===te.palette_id)?.[1]||te.palette_id;return`${Me} | ${st} | Speed: ${te.speed} | Intensity: ${te.intensity}`};if(n)return o.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:o.jsx("span",{className:"material-icons-outlined animate-spin text-4xl text-muted-foreground",children:"sync"})});if(!e||e.provider==="none")return o.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh] gap-6 text-center px-4",children:[o.jsx("div",{className:"p-4 rounded-full bg-muted",children:o.jsx("span",{className:"material-icons-outlined text-5xl text-muted-foreground",children:"lightbulb"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h1",{className:"text-xl sm:text-2xl font-bold",children:"LED Controller Not Configured"}),o.jsx("p",{className:"text-sm sm:text-base text-muted-foreground max-w-md",children:"Configure your LED controller (WLED or DW LEDs) in the Settings page to control your lights."})]}),o.jsx(se,{asChild:!0,className:"gap-2",children:o.jsxs(pi,{to:"/settings?section=led",children:[o.jsx("span",{className:"material-icons-outlined",children:"settings"}),"Go to Settings"]})})]});const Wt=o.jsxs($n,{children:[o.jsxs(da,{className:"pb-3",children:[o.jsxs(fa,{className:"text-lg flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"tune"}),"LED Control Mode"]}),o.jsx(hi,{children:"Choose how Dune Weaver manages LED effects during playback and idle states"})]}),o.jsx(Gn,{children:o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[o.jsxs("button",{onClick:()=>ke("manual"),className:`p-4 rounded-lg border-2 text-left transition-all ${Ce==="manual"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/30"}`,children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"front_hand"}),o.jsx("span",{className:"font-medium text-sm",children:"Manual / Home Assistant"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Effects persist until changed. Still Sands turns off only."})]}),o.jsxs("button",{onClick:()=>ke("automated"),className:`p-4 rounded-lg border-2 text-left transition-all ${Ce==="automated"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/30"}`,children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"smart_toy"}),o.jsx("span",{className:"font-medium text-sm",children:"DW Automated"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Auto-switch effects on play/idle. Still Sands turns off and on."})]})]})})]});return e.provider==="wled"&&e.wled_ip?o.jsxs("div",{className:"flex flex-col w-full max-w-5xl mx-auto gap-4 py-3 sm:py-6 px-0 sm:px-4",children:[Wt,o.jsx("div",{style:{height:"calc(100vh - 380px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))"},children:o.jsx("iframe",{src:`http://${e.wled_ip}`,className:"w-full h-full rounded-lg border border-border",title:"WLED Control"})})]}):o.jsxs("div",{className:"flex flex-col w-full max-w-5xl mx-auto gap-6 py-3 sm:py-6 px-0 sm:px-4",children:[o.jsxs("div",{className:"space-y-0.5 sm:space-y-1 pl-1",children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"LED Control"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"DW LEDs - GPIO controlled LED strip"})]}),o.jsx(Xn,{}),Wt,o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[o.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[o.jsx($n,{children:o.jsx(Gn,{className:"pt-6",children:o.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-6",children:[o.jsxs("div",{className:"flex flex-col items-center gap-3",children:[o.jsx("button",{onClick:le,className:`w-24 h-24 rounded-full flex items-center justify-center transition-all shadow-lg ${i?.power_on?"bg-green-500 hover:bg-green-600 shadow-green-500/30":"bg-muted hover:bg-muted/80"}`,children:o.jsx("span",{className:`material-icons text-4xl ${i?.power_on?"text-white":"text-muted-foreground"}`,children:"power_settings_new"})}),o.jsx("span",{className:`text-sm font-medium ${i?.power_on?"text-green-600":"text-muted-foreground"}`,children:i?.power_on?"ON":"OFF"})]}),o.jsxs("div",{className:"flex-1 w-full space-y-4",children:[o.jsxs("div",{className:`flex items-center gap-2 text-sm ${i?.connected?"text-green-600":"text-destructive"}`,children:[o.jsx("span",{className:"material-icons-outlined text-base",children:i?.connected?"check_circle":"error"}),i?.connected?`${i.num_leds} LEDs on GPIO ${i.gpio_pin}`:"Not connected"]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsxs(Ye,{children:[o.jsx("span",{className:"material-icons-outlined text-sm mr-2 align-[-6px] text-muted-foreground",children:"brightness_6"}),"Brightness"]}),o.jsxs("span",{className:"text-sm font-medium",children:[v,"%"]})]}),o.jsx(_l,{value:[v],onValueChange:Fe,onValueCommit:Ge,max:100,step:1})]})]})]})})}),o.jsxs($n,{children:[o.jsx(da,{className:"pb-3",children:o.jsxs(fa,{className:"text-lg flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"auto_awesome"}),"Effects & Palettes"]})}),o.jsxs(Gn,{className:"space-y-6",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{children:"Effect"}),o.jsxs(Pn,{value:R,onValueChange:St,children:[o.jsx(An,{children:o.jsx(qn,{placeholder:"Select effect..."})}),o.jsx(On,{children:u.map(([te,Me])=>o.jsx(tt,{value:String(te),children:Me},te))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{children:"Palette"}),o.jsxs(Pn,{value:L,onValueChange:_t,children:[o.jsx(An,{children:o.jsx(qn,{placeholder:"Select palette..."})}),o.jsx(On,{children:h.map(([te,Me])=>o.jsx(tt,{value:String(te),children:Me},te))})]})]})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsxs(Ye,{children:[o.jsx("span",{className:"material-icons-outlined text-sm mr-2 align-[-6px] text-muted-foreground",children:"speed"}),"Speed"]}),o.jsx(wt,{type:"text",inputMode:"numeric",value:j,onChange:te=>{const Me=te.target.value.replace(/[^0-9]/g,"");S(Me)},onBlur:()=>{const te=Math.min(255,Math.max(0,parseInt(j)||0));w(te),S(String(te)),at([te])},onKeyDown:te=>{if(te.key==="Enter"){const Me=Math.min(255,Math.max(0,parseInt(j)||0));w(Me),S(String(Me)),at([Me])}},className:"w-16 h-7 text-center text-sm font-medium px-2"})]}),o.jsx(_l,{value:[b],onValueChange:He,onValueCommit:at,max:255,step:1})]}),o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsxs(Ye,{children:[o.jsx("span",{className:"material-icons-outlined text-sm mr-2 align-[-6px] text-muted-foreground",children:"tungsten"}),"Intensity"]}),o.jsx(wt,{type:"text",inputMode:"numeric",value:_,onChange:te=>{const Me=te.target.value.replace(/[^0-9]/g,"");T(Me)},onBlur:()=>{const te=Math.min(255,Math.max(0,parseInt(_)||0));N(te),T(String(te)),Mt([te])},onKeyDown:te=>{if(te.key==="Enter"){const Me=Math.min(255,Math.max(0,parseInt(_)||0));N(Me),T(String(Me)),Mt([Me])}},className:"w-16 h-7 text-center text-sm font-medium px-2"})]}),o.jsx(_l,{value:[C],onValueChange:Ke,onValueCommit:Mt,max:255,step:1})]})]})]})]})]}),o.jsxs("div",{className:"flex flex-col gap-6",children:[o.jsxs($n,{className:"flex-1 flex flex-col",children:[o.jsx(da,{className:"pb-3",children:o.jsxs(fa,{className:"text-lg flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"palette"}),"Colors"]})}),o.jsx(Gn,{className:"flex-1 flex items-center justify-center",children:o.jsxs("div",{className:"flex justify-around w-full",children:[o.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o.jsx(kb,{value:P,onChange:te=>jt(1,te)}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"Primary"})]}),o.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o.jsx(kb,{value:J,onChange:te=>jt(2,te)}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"Secondary"})]}),o.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o.jsx(kb,{value:W,onChange:te=>jt(3,te)}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"Accent"})]})]})})]}),Ce==="automated"&&o.jsxs($n,{className:"flex-1 flex flex-col",children:[o.jsx(da,{className:"pb-3",children:o.jsxs(fa,{className:"text-lg flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"schedule"}),"Auto Turn Off"]})}),o.jsxs(Gn,{className:"flex-1 flex flex-col justify-center space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Enable timeout"}),o.jsx(gr,{checked:B,onCheckedChange:Vt})]}),B&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(wt,{type:"text",inputMode:"numeric",value:me,onChange:te=>{const Me=te.target.value.replace(/[^0-9]/g,"");Z(Me)},onBlur:()=>{const te=Math.min(1440,Math.max(1,parseInt(me)||30));oe(te),Z(String(te))},onKeyDown:te=>{if(te.key==="Enter"){const Me=Math.min(1440,Math.max(1,parseInt(me)||30));oe(Me),Z(String(Me)),Ct(B,Me)}},className:"w-20"}),o.jsx("span",{className:"text-sm text-muted-foreground flex-1",children:"minutes"}),o.jsx(se,{size:"sm",onClick:()=>Ct(),children:"Save"})]})]})]})]})]}),Ce==="automated"&&o.jsxs($n,{children:[o.jsxs(da,{className:"pb-3",children:[o.jsxs(fa,{className:"text-lg flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"smart_toy"}),"Effect Automation"]}),o.jsx(hi,{children:"Save current settings to automatically apply when table state changes"})]}),o.jsx(Gn,{children:o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons text-green-600",children:"play_circle"}),o.jsx("span",{className:"font-medium",children:"While Playing"})]})}),o.jsx("div",{className:"text-xs text-muted-foreground p-2 bg-muted/50 rounded border min-h-[40px]",children:Kt(be)}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(se,{size:"sm",onClick:()=>ot("playing"),className:"flex-1 gap-1",children:[o.jsx("span",{className:"material-icons text-sm",children:"save"}),"Save Current"]}),o.jsx(se,{size:"sm",variant:"secondary",onClick:()=>lt("playing"),children:"Clear"})]})]}),o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons text-blue-600",children:"bedtime"}),o.jsx("span",{className:"font-medium",children:"When Idle"})]})}),o.jsx("div",{className:"text-xs text-muted-foreground p-2 bg-muted/50 rounded border min-h-[40px]",children:Kt(V)}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(se,{size:"sm",onClick:()=>ot("idle"),className:"flex-1 gap-1",children:[o.jsx("span",{className:"material-icons text-sm",children:"save"}),"Save Current"]}),o.jsx(se,{size:"sm",variant:"secondary",onClick:()=>lt("idle"),children:"Clear"})]})]})]})})]})]})}var Hp="Collapsible",[Iae,bL]=Lr(Hp),[zae,n1]=Iae(Hp),wL=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:a,defaultOpen:i,disabled:l,onOpenChange:u,...d}=e,[h,p]=Zr({prop:a,defaultProp:i??!1,onChange:u,caller:Hp});return o.jsx(zae,{scope:n,disabled:l,contentId:ma(),open:h,onOpenToggle:g.useCallback(()=>p(v=>!v),[p]),children:o.jsx(dt.div,{"data-state":a1(h),"data-disabled":l?"":void 0,...d,ref:t})})});wL.displayName=Hp;var SL="CollapsibleTrigger",jL=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,...a}=e,i=n1(SL,n);return o.jsx(dt.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":a1(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...a,ref:t,onClick:et(e.onClick,i.onOpenToggle)})});jL.displayName=SL;var r1="CollapsibleContent",CL=g.forwardRef((e,t)=>{const{forceMount:n,...a}=e,i=n1(r1,e.__scopeCollapsible);return o.jsx(Ts,{present:n||i.open,children:({present:l})=>o.jsx(Fae,{...a,ref:t,present:l})})});CL.displayName=r1;var Fae=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:a,children:i,...l}=e,u=n1(r1,n),[d,h]=g.useState(a),p=g.useRef(null),v=Ot(t,p),m=g.useRef(0),b=m.current,w=g.useRef(0),j=w.current,S=u.open||d,C=g.useRef(S),N=g.useRef(void 0);return g.useEffect(()=>{const _=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(_)},[]),Kn(()=>{const _=p.current;if(_){N.current=N.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";const T=_.getBoundingClientRect();m.current=T.height,w.current=T.width,C.current||(_.style.transitionDuration=N.current.transitionDuration,_.style.animationName=N.current.animationName),h(a)}},[u.open,a]),o.jsx(dt.div,{"data-state":a1(u.open),"data-disabled":u.disabled?"":void 0,id:u.contentId,hidden:!S,...l,ref:v,style:{"--radix-collapsible-content-height":b?`${b}px`:void 0,"--radix-collapsible-content-width":j?`${j}px`:void 0,...e.style},children:S&&i})});function a1(e){return e?"open":"closed"}var Hae=wL,Uae=jL,Vae=CL,Ca="Accordion",qae=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[s1,$ae,Gae]=vp(Ca),[Up]=Lr(Ca,[Gae,bL]),i1=bL(),NL=A.forwardRef((e,t)=>{const{type:n,...a}=e,i=a,l=a;return o.jsx(s1.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?o.jsx(Xae,{...l,ref:t}):o.jsx(Wae,{...i,ref:t})})});NL.displayName=Ca;var[_L,Kae]=Up(Ca),[EL,Yae]=Up(Ca,{collapsible:!1}),Wae=A.forwardRef((e,t)=>{const{value:n,defaultValue:a,onValueChange:i=()=>{},collapsible:l=!1,...u}=e,[d,h]=Zr({prop:n,defaultProp:a??"",onChange:i,caller:Ca});return o.jsx(_L,{scope:e.__scopeAccordion,value:A.useMemo(()=>d?[d]:[],[d]),onItemOpen:h,onItemClose:A.useCallback(()=>l&&h(""),[l,h]),children:o.jsx(EL,{scope:e.__scopeAccordion,collapsible:l,children:o.jsx(TL,{...u,ref:t})})})}),Xae=A.forwardRef((e,t)=>{const{value:n,defaultValue:a,onValueChange:i=()=>{},...l}=e,[u,d]=Zr({prop:n,defaultProp:a??[],onChange:i,caller:Ca}),h=A.useCallback(v=>d((m=[])=>[...m,v]),[d]),p=A.useCallback(v=>d((m=[])=>m.filter(b=>b!==v)),[d]);return o.jsx(_L,{scope:e.__scopeAccordion,value:u,onItemOpen:h,onItemClose:p,children:o.jsx(EL,{scope:e.__scopeAccordion,collapsible:!0,children:o.jsx(TL,{...l,ref:t})})})}),[Qae,Vp]=Up(Ca),TL=A.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:a,dir:i,orientation:l="vertical",...u}=e,d=A.useRef(null),h=Ot(d,t),p=$ae(n),m=od(i)==="ltr",b=et(e.onKeyDown,w=>{if(!qae.includes(w.key))return;const j=w.target,S=p().filter(P=>!P.ref.current?.disabled),C=S.findIndex(P=>P.ref.current===j),N=S.length;if(C===-1)return;w.preventDefault();let _=C;const T=0,R=N-1,D=()=>{_=C+1,_>R&&(_=T)},L=()=>{_=C-1,_<T&&(_=R)};switch(w.key){case"Home":_=T;break;case"End":_=R;break;case"ArrowRight":l==="horizontal"&&(m?D():L());break;case"ArrowDown":l==="vertical"&&D();break;case"ArrowLeft":l==="horizontal"&&(m?L():D());break;case"ArrowUp":l==="vertical"&&L();break}const k=_%N;S[k].ref.current?.focus()});return o.jsx(Qae,{scope:n,disabled:a,direction:i,orientation:l,children:o.jsx(s1.Slot,{scope:n,children:o.jsx(dt.div,{...u,"data-orientation":l,ref:h,onKeyDown:a?void 0:b})})})}),zh="AccordionItem",[Zae,o1]=Up(zh),RL=A.forwardRef((e,t)=>{const{__scopeAccordion:n,value:a,...i}=e,l=Vp(zh,n),u=Kae(zh,n),d=i1(n),h=ma(),p=a&&u.value.includes(a)||!1,v=l.disabled||e.disabled;return o.jsx(Zae,{scope:n,open:p,disabled:v,triggerId:h,children:o.jsx(Hae,{"data-orientation":l.orientation,"data-state":kL(p),...d,...i,ref:t,disabled:v,open:p,onOpenChange:m=>{m?u.onItemOpen(a):u.onItemClose(a)}})})});RL.displayName=zh;var AL="AccordionHeader",OL=A.forwardRef((e,t)=>{const{__scopeAccordion:n,...a}=e,i=Vp(Ca,n),l=o1(AL,n);return o.jsx(dt.h3,{"data-orientation":i.orientation,"data-state":kL(l.open),"data-disabled":l.disabled?"":void 0,...a,ref:t})});OL.displayName=AL;var q0="AccordionTrigger",ML=A.forwardRef((e,t)=>{const{__scopeAccordion:n,...a}=e,i=Vp(Ca,n),l=o1(q0,n),u=Yae(q0,n),d=i1(n);return o.jsx(s1.ItemSlot,{scope:n,children:o.jsx(Uae,{"aria-disabled":l.open&&!u.collapsible||void 0,"data-orientation":i.orientation,id:l.triggerId,...d,...a,ref:t})})});ML.displayName=q0;var DL="AccordionContent",PL=A.forwardRef((e,t)=>{const{__scopeAccordion:n,...a}=e,i=Vp(Ca,n),l=o1(DL,n),u=i1(n);return o.jsx(Vae,{role:"region","aria-labelledby":l.triggerId,"data-orientation":i.orientation,...u,...a,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});PL.displayName=DL;function kL(e){return e?"open":"closed"}var Jae=NL,ese=RL,tse=OL,LL=ML,BL=PL;const l1=Jae,Fn=g.forwardRef(({className:e,...t},n)=>o.jsx(ese,{ref:n,className:ct("border-b",e),...t}));Fn.displayName="AccordionItem";const Hn=g.forwardRef(({className:e,children:t,...n},a)=>o.jsx(tse,{className:"flex",children:o.jsxs(LL,{ref:a,className:ct("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,o.jsx(cw,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Hn.displayName=LL.displayName;const Un=g.forwardRef(({className:e,children:t,...n},a)=>o.jsx(BL,{ref:a,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:o.jsx("div",{className:ct("pb-4 pt-0 px-2",e),children:t})}));Un.displayName=BL.displayName;var Lb="rovingFocusGroup.onEntryFocus",nse={bubbles:!1,cancelable:!0},fd="RovingFocusGroup",[$0,IL,rse]=vp(fd),[ase,zL]=Lr(fd,[rse]),[sse,ise]=ase(fd),FL=g.forwardRef((e,t)=>o.jsx($0.Provider,{scope:e.__scopeRovingFocusGroup,children:o.jsx($0.Slot,{scope:e.__scopeRovingFocusGroup,children:o.jsx(ose,{...e,ref:t})})}));FL.displayName=fd;var ose=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:a,loop:i=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:h,onEntryFocus:p,preventScrollOnEntryFocus:v=!1,...m}=e,b=g.useRef(null),w=Ot(t,b),j=od(l),[S,C]=Zr({prop:u,defaultProp:d??null,onChange:h,caller:fd}),[N,_]=g.useState(!1),T=gi(p),R=IL(n),D=g.useRef(!1),[L,k]=g.useState(0);return g.useEffect(()=>{const P=b.current;if(P)return P.addEventListener(Lb,T),()=>P.removeEventListener(Lb,T)},[T]),o.jsx(sse,{scope:n,orientation:a,dir:j,loop:i,currentTabStopId:S,onItemFocus:g.useCallback(P=>C(P),[C]),onItemShiftTab:g.useCallback(()=>_(!0),[]),onFocusableItemAdd:g.useCallback(()=>k(P=>P+1),[]),onFocusableItemRemove:g.useCallback(()=>k(P=>P-1),[]),children:o.jsx(dt.div,{tabIndex:N||L===0?-1:0,"data-orientation":a,...m,ref:w,style:{outline:"none",...e.style},onMouseDown:et(e.onMouseDown,()=>{D.current=!0}),onFocus:et(e.onFocus,P=>{const U=!D.current;if(P.target===P.currentTarget&&U&&!N){const J=new CustomEvent(Lb,nse);if(P.currentTarget.dispatchEvent(J),!J.defaultPrevented){const $=R().filter(I=>I.focusable),W=$.find(I=>I.active),fe=$.find(I=>I.id===S),Ce=[W,fe,...$].filter(Boolean).map(I=>I.ref.current);VL(Ce,v)}}D.current=!1}),onBlur:et(e.onBlur,()=>_(!1))})})}),HL="RovingFocusGroupItem",UL=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:a=!0,active:i=!1,tabStopId:l,children:u,...d}=e,h=ma(),p=l||h,v=ise(HL,n),m=v.currentTabStopId===p,b=IL(n),{onFocusableItemAdd:w,onFocusableItemRemove:j,currentTabStopId:S}=v;return g.useEffect(()=>{if(a)return w(),()=>j()},[a,w,j]),o.jsx($0.ItemSlot,{scope:n,id:p,focusable:a,active:i,children:o.jsx(dt.span,{tabIndex:m?0:-1,"data-orientation":v.orientation,...d,ref:t,onMouseDown:et(e.onMouseDown,C=>{a?v.onItemFocus(p):C.preventDefault()}),onFocus:et(e.onFocus,()=>v.onItemFocus(p)),onKeyDown:et(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){v.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const N=use(C,v.orientation,v.dir);if(N!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let T=b().filter(R=>R.focusable).map(R=>R.ref.current);if(N==="last")T.reverse();else if(N==="prev"||N==="next"){N==="prev"&&T.reverse();const R=T.indexOf(C.currentTarget);T=v.loop?dse(T,R+1):T.slice(R+1)}setTimeout(()=>VL(T))}}),children:typeof u=="function"?u({isCurrentTabStop:m,hasTabStop:S!=null}):u})})});UL.displayName=HL;var lse={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function cse(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function use(e,t,n){const a=cse(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(a))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(a)))return lse[a]}function VL(e,t=!1){const n=document.activeElement;for(const a of e)if(a===n||(a.focus({preventScroll:t}),document.activeElement!==n))return}function dse(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var fse=FL,hse=UL,c1="Radio",[pse,qL]=Lr(c1),[mse,gse]=pse(c1),$L=g.forwardRef((e,t)=>{const{__scopeRadio:n,name:a,checked:i=!1,required:l,disabled:u,value:d="on",onCheck:h,form:p,...v}=e,[m,b]=g.useState(null),w=Ot(t,C=>b(C)),j=g.useRef(!1),S=m?p||!!m.closest("form"):!0;return o.jsxs(mse,{scope:n,checked:i,disabled:u,children:[o.jsx(dt.button,{type:"button",role:"radio","aria-checked":i,"data-state":WL(i),"data-disabled":u?"":void 0,disabled:u,value:d,...v,ref:w,onClick:et(e.onClick,C=>{i||h?.(),S&&(j.current=C.isPropagationStopped(),j.current||C.stopPropagation())})}),S&&o.jsx(YL,{control:m,bubbles:!j.current,name:a,value:d,checked:i,required:l,disabled:u,form:p,style:{transform:"translateX(-100%)"}})]})});$L.displayName=c1;var GL="RadioIndicator",KL=g.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:a,...i}=e,l=gse(GL,n);return o.jsx(Ts,{present:a||l.checked,children:o.jsx(dt.span,{"data-state":WL(l.checked),"data-disabled":l.disabled?"":void 0,...i,ref:t})})});KL.displayName=GL;var vse="RadioBubbleInput",YL=g.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:a=!0,...i},l)=>{const u=g.useRef(null),d=Ot(u,l),h=gp(n),p=lp(t);return g.useEffect(()=>{const v=u.current;if(!v)return;const m=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(m,"checked").set;if(h!==n&&w){const j=new Event("click",{bubbles:a});w.call(v,n),v.dispatchEvent(j)}},[h,n,a]),o.jsx(dt.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:d,style:{...i.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});YL.displayName=vse;function WL(e){return e?"checked":"unchecked"}var xse=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],qp="RadioGroup",[yse]=Lr(qp,[zL,qL]),XL=zL(),QL=qL(),[bse,wse]=yse(qp),ZL=g.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:a,defaultValue:i,value:l,required:u=!1,disabled:d=!1,orientation:h,dir:p,loop:v=!0,onValueChange:m,...b}=e,w=XL(n),j=od(p),[S,C]=Zr({prop:l,defaultProp:i??null,onChange:m,caller:qp});return o.jsx(bse,{scope:n,name:a,required:u,disabled:d,value:S,onValueChange:C,children:o.jsx(fse,{asChild:!0,...w,orientation:h,dir:j,loop:v,children:o.jsx(dt.div,{role:"radiogroup","aria-required":u,"aria-orientation":h,"data-disabled":d?"":void 0,dir:j,...b,ref:t})})})});ZL.displayName=qp;var JL="RadioGroupItem",e4=g.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:a,...i}=e,l=wse(JL,n),u=l.disabled||a,d=XL(n),h=QL(n),p=g.useRef(null),v=Ot(t,p),m=l.value===i.value,b=g.useRef(!1);return g.useEffect(()=>{const w=S=>{xse.includes(S.key)&&(b.current=!0)},j=()=>b.current=!1;return document.addEventListener("keydown",w),document.addEventListener("keyup",j),()=>{document.removeEventListener("keydown",w),document.removeEventListener("keyup",j)}},[]),o.jsx(hse,{asChild:!0,...d,focusable:!u,active:m,children:o.jsx($L,{disabled:u,required:l.required,checked:m,...h,...i,name:l.name,ref:v,onCheck:()=>l.onValueChange(i.value),onKeyDown:et(w=>{w.key==="Enter"&&w.preventDefault()}),onFocus:et(i.onFocus,()=>{b.current&&p.current?.click()})})})});e4.displayName=JL;var Sse="RadioGroupIndicator",t4=g.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...a}=e,i=QL(n);return o.jsx(KL,{...i,...a,ref:t})});t4.displayName=Sse;var n4=ZL,r4=e4,jse=t4;const ch=g.forwardRef(({className:e,...t},n)=>o.jsx(n4,{className:ct("grid gap-2",e),...t,ref:n}));ch.displayName=n4.displayName;const ys=g.forwardRef(({className:e,...t},n)=>o.jsx(r4,{ref:n,className:ct("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:o.jsx(jse,{className:"flex items-center justify-center",children:o.jsx(QH,{className:"h-2.5 w-2.5 fill-current text-current"})})}));ys.displayName=r4.displayName;function Bb({value:e,onValueChange:t,options:n,placeholder:a="Select...",searchPlaceholder:i="Search...",emptyMessage:l="No results found",className:u,disabled:d}){const[h,p]=g.useState(!1),[v,m]=g.useState(""),b=n.find(S=>S.value===e),w=g.useMemo(()=>v?n.filter(S=>Au(S.label,v)||Au(S.value,v)):n,[n,v]),j=S=>{t(S),p(!1),m("")};return o.jsxs(Bu,{open:h,onOpenChange:p,children:[o.jsx(Iu,{asChild:!0,children:o.jsxs(se,{variant:"secondary",role:"combobox","aria-expanded":h,disabled:d,className:ct("w-full justify-between font-normal",!e&&"text-muted-foreground",u),children:[o.jsx("span",{className:"truncate",children:b?.label||a}),o.jsx("span",{className:"material-icons text-base ml-2 shrink-0 opacity-50",children:"unfold_more"})]})}),o.jsx(Rl,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:o.jsxs("div",{className:"flex flex-col",children:[o.jsx("div",{className:"p-2 border-b",children:o.jsx(wt,{placeholder:i,value:v,onChange:S=>m(S.target.value),className:"h-8",autoFocus:!0})}),o.jsx("div",{className:"max-h-[200px] overflow-y-auto",children:w.length===0?o.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:l}):w.map(S=>o.jsxs("button",{type:"button",className:ct("w-full px-3 py-2 text-left text-sm hover:bg-accent hover:text-accent-foreground flex items-center gap-2",e===S.value&&"bg-accent"),onClick:()=>j(S.value),children:[o.jsx("span",{className:ct("material-icons text-base",e===S.value?"opacity-100":"opacity-0"),children:"check"}),o.jsx("span",{className:"truncate",children:S.label})]},S.value))})]})})]})}const CO=["Shifting the sands...","Aligning the stars...","Polishing the steel ball...","Recalculating the spirals...","Tuning the motors...","Almost there..."];function Cse({open:e,onOpenChange:t,currentVersion:n,latestVersion:a}){const[i,l]=g.useState("confirming"),[u,d]=g.useState(""),[h,p]=g.useState(0),v=g.useRef(null),m=g.useRef(!1),b=un(S=>S.isBackendConnected);g.useEffect(()=>{e||(v.current&&clearInterval(v.current),l("confirming"),d(""),p(0),m.current=!1)},[e]),g.useEffect(()=>{i==="updating"&&(b?m.current&&l("complete"):m.current=!0)},[i,b]),g.useEffect(()=>{if(i!=="complete")return;const S=setTimeout(()=>window.location.reload(),2e3);return()=>clearTimeout(S)},[i]),g.useEffect(()=>{if(i==="updating")return v.current=setInterval(()=>{p(S=>(S+1)%CO.length)},4e3),()=>{v.current&&clearInterval(v.current)}},[i]);const w=async()=>{l("updating"),p(0),m.current=!1;try{const S=await de.request("/api/update",{method:"POST"});S.success||(l("error"),d(S.message||"Update failed"))}catch(S){l("error"),d(S instanceof Error?S.message:"Failed to start update")}},j=i==="updating"||i==="complete";return o.jsx(ga,{open:e,onOpenChange:j?void 0:t,children:o.jsxs(Wr,{onPointerDownOutside:j?S=>S.preventDefault():void 0,onEscapeKeyDown:j?S=>S.preventDefault():void 0,className:j?"[&>button:last-child]:hidden":"",children:[i==="confirming"&&o.jsxs(o.Fragment,{children:[o.jsxs(Mr,{children:[o.jsx(Dr,{children:"Update Software"}),o.jsxs(vi,{children:["Update from v",n," to v",a]})]}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"The system will download the latest version and restart automatically. This usually takes 1-2 minutes."}),o.jsxs(va,{children:[o.jsx(se,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(se,{onClick:w,children:"Update Now"})]})]}),i==="updating"&&o.jsxs("div",{className:"flex flex-col items-center py-8 gap-6",children:[o.jsxs("div",{className:"relative w-16 h-16",children:[o.jsx("div",{className:"absolute inset-0 rounded-full border-4 border-muted"}),o.jsx("div",{className:"absolute inset-0 rounded-full border-4 border-t-primary animate-spin"}),o.jsx("div",{className:"absolute inset-[6px] rounded-full border-4 border-muted"}),o.jsx("div",{className:"absolute inset-[6px] rounded-full border-4 border-t-primary/60",style:{animation:"spin 1.5s linear infinite reverse"}})]}),o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx("p",{className:"text-lg font-medium animate-pulse",children:CO[h]}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["This usually takes 1-2 minutes.",o.jsx("br",{}),"The page will reload automatically."]})]})]}),i==="complete"&&o.jsxs("div",{className:"flex flex-col items-center py-8 gap-4",children:[o.jsx("div",{className:"w-16 h-16 flex items-center justify-center rounded-full bg-green-100 dark:bg-green-900/30",children:o.jsx("span",{className:"material-icons text-green-600 dark:text-green-400 text-4xl",children:"check_circle"})}),o.jsxs("div",{className:"text-center space-y-1",children:[o.jsx("p",{className:"text-lg font-medium",children:"Update complete!"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Reloading..."})]})]}),i==="error"&&o.jsxs(o.Fragment,{children:[o.jsxs(Mr,{children:[o.jsx(Dr,{children:"Update Failed"}),o.jsx(vi,{children:"Something went wrong while starting the update."})]}),o.jsx("div",{className:"rounded-lg bg-destructive/10 p-3",children:o.jsx("p",{className:"text-sm text-destructive",children:u})}),o.jsxs(va,{children:[o.jsx(se,{variant:"outline",onClick:()=>t(!1),children:"Close"}),o.jsx(se,{onClick:w,children:"Retry"})]})]})]})})}function Nse(){const[e,t]=$6(),n=kl(),a=e.get("section"),[i,l]=g.useState([]),[u,d]=g.useState(""),[h,p]=g.useState(!1),[v,m]=g.useState("Disconnected"),[b,w]=g.useState({}),[j,S]=g.useState({provider:"none",gpio_pin:18}),[C,N]=g.useState("60"),[_,T]=g.useState({enabled:!1}),[R,D]=g.useState(null),[L,k]=g.useState(()=>a?[a]:["connection"]),[P,U]=g.useState(new Set),[J,$]=g.useState({enabled:!1,playlist:"",run_mode:"loop",pause_time:5,clear_pattern:"adaptive",shuffle:!1}),[W,fe]=g.useState("min"),[we,Ce]=g.useState(5),[I,V]=g.useState("5"),[H,be]=g.useState([]),_e=M=>M>=3600&&M%3600===0?{value:M/3600,unit:"hr"}:M>=60&&M%60===0?{value:M/60,unit:"min"}:{value:M,unit:"sec"},B=(M,ge)=>{switch(ge){case"hr":return M*3600;case"min":return M*60;default:return M}},[G,X]=g.useState({enabled:!1,finish_pattern:!1,control_wled:!1,timezone:"",time_slots:[]}),[oe,me]=g.useState({enabled:!1,time:"03:00"}),[Z,ne]=g.useState([]),[he,Ee]=g.useState("off"),[je,ke]=g.useState(""),[le,Fe]=g.useState(""),[Ge,He]=g.useState(!1),[at,Ke]=g.useState(null),[Mt,St]=g.useState(!1),_t=M=>{const ge=document.getElementById(`section-${M}`);if(ge){const mt=ge.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:mt-80,behavior:"smooth"})}};g.useEffect(()=>{a&&setTimeout(()=>{_t(a),t({},{replace:!0})},100)},[a,t]);const jt=async M=>{if(!P.has(M))switch(U(ge=>new Set(ge).add(M)),M){case"connection":await Vt(),P.has("_settings")||(U(ge=>new Set(ge).add("_settings")),await Kt());break;case"application":case"mqtt":case"autoplay":case"stillsands":case"machine":case"homing":case"clearing":case"security":P.has("_settings")||(U(ge=>new Set(ge).add("_settings")),await Kt()),(M==="autoplay"||M==="clearing")&&!P.has("_playlists")&&(U(ge=>new Set(ge).add("_playlists")),await te()),M==="clearing"&&!P.has("_patterns")&&(U(ge=>new Set(ge).add("_patterns")),await ot());break;case"led":await Wt();break;case"version":await lt();break}},ot=async()=>{try{const M=await de.get("/list_theta_rho_files");ne(Array.isArray(M)?M:[])}catch(M){console.error("Error fetching pattern files:",M)}},lt=async()=>{try{const M=await de.get("/api/version");Ke(M)}catch(M){console.error("Failed to fetch version info:",M)}},Ct=M=>{const ge=M.find(Ne=>!L.includes(Ne));k(M),M.forEach(Ne=>{P.has(Ne)||jt(Ne)}),ge&&setTimeout(()=>{_t(ge)},100)};g.useEffect(()=>{L.forEach(M=>{jt(M)})},[]);const Vt=async()=>{try{const ge=await de.get("/list_serial_ports")||[];l(ge);const Ne=await de.get("/serial_status");p(Ne.connected||!1),m(Ne.connected?"Connected":"Disconnected"),Ne.port&&ge.includes(Ne.port)?d(Ne.port):Ne.port&&!ge.includes(Ne.port)&&(console.warn(`Port ${Ne.port} from status not in available ports, ignoring`),d(""))}catch(M){console.error("Error fetching ports:",M)}};g.useEffect(()=>{Vt()},[]),cS(()=>{Vt()});const Kt=async()=>{try{const M=await de.get("/api/settings");if(w({app_name:M.app?.name,custom_logo:M.app?.custom_logo,preferred_port:M.connection?.preferred_port,table_type_override:M.machine?.table_type_override,detected_table_type:M.machine?.detected_table_type,effective_table_type:M.machine?.effective_table_type,gear_ratio:M.machine?.gear_ratio,gear_ratio_override:M.machine?.gear_ratio_override??null,x_steps_per_mm:M.machine?.x_steps_per_mm,y_steps_per_mm:M.machine?.y_steps_per_mm,available_table_types:M.machine?.available_table_types,homing_mode:M.homing?.mode,angular_offset:M.homing?.angular_offset_degrees,home_on_connect:M.homing?.home_on_connect,auto_home_enabled:M.homing?.auto_home_enabled,auto_home_after_patterns:M.homing?.auto_home_after_patterns,hard_reset_theta:M.homing?.hard_reset_theta,clear_pattern_speed:M.patterns?.clear_pattern_speed,custom_clear_from_in:M.patterns?.custom_clear_from_in,custom_clear_from_out:M.patterns?.custom_clear_from_out}),M.auto_play){const ge=M.auto_play.pause_time??300,{value:Ne,unit:mt}=_e(ge);Ce(Ne),V(String(Ne)),fe(mt),$({enabled:M.auto_play.enabled||!1,playlist:M.auto_play.playlist||"",run_mode:M.auto_play.run_mode||"loop",pause_time:ge,clear_pattern:M.auto_play.clear_pattern||"adaptive",shuffle:M.auto_play.shuffle||!1})}M.scheduled_pause&&X({enabled:M.scheduled_pause.enabled||!1,finish_pattern:M.scheduled_pause.finish_pattern||!1,control_wled:M.scheduled_pause.control_wled||!1,timezone:M.scheduled_pause.timezone||"",time_slots:M.scheduled_pause.time_slots||[]}),M.scheduled_reboot&&me({enabled:M.scheduled_reboot.enabled||!1,time:M.scheduled_reboot.time||"03:00"}),M.security&&(Ee(M.security.mode||"off"),He(M.security.has_password||!1)),M.mqtt&&T({enabled:M.mqtt.enabled||!1,broker:M.mqtt.broker,port:M.mqtt.port,username:M.mqtt.username,device_name:M.mqtt.device_name,device_id:M.mqtt.device_id,client_id:M.mqtt.client_id,discovery_prefix:M.mqtt.discovery_prefix})}catch(M){console.error("Error fetching settings:",M)}},Wt=async()=>{try{const M=await de.get("/get_led_config");S({provider:M.provider||"none",wled_ip:M.wled_ip,num_leds:M.dw_led_num_leds,gpio_pin:M.dw_led_gpio_pin,pixel_order:M.dw_led_pixel_order}),N(String(M.dw_led_num_leds||60))}catch(M){console.error("Error fetching LED config:",M)}},te=async()=>{try{const M=await de.get("/list_all_playlists");be(Array.isArray(M)?M:[])}catch(M){console.error("Error fetching playlists:",M)}},Me=async()=>{if(!u){K.error("Please select a port");return}D("connect");try{const M=await de.post("/connect",{port:u});if(M.success)p(!0),m(`Connected to ${u}`),K.success("Connected successfully");else throw new Error(M.message||"Connection failed")}catch{K.error("Failed to connect")}finally{D(null)}},st=async()=>{D("disconnect");try{(await de.post("/disconnect")).success&&(p(!1),m("Disconnected"),K.success("Disconnected"))}catch{K.error("Failed to disconnect")}finally{D(null)}},nt=async()=>{D("preferredPort");try{const M=b.preferred_port||"__auto__";await de.patch("/api/settings",{connection:{preferred_port:M}}),!b.preferred_port||b.preferred_port==="__auto__"?K.success("Auto-connect: Auto (first available port)"):b.preferred_port==="__none__"?K.success("Auto-connect: Disabled"):K.success(`Auto-connect: ${b.preferred_port}`)}catch{K.error("Failed to save auto-connect setting")}finally{D(null)}},yt=async()=>{D("appName");try{await de.patch("/api/settings",{app:{name:b.app_name}}),K.success("App name saved. Refresh to see changes.")}catch{K.error("Failed to save app name")}finally{D(null)}},gt=M=>{const ge=Date.now(),Ne=document.getElementById("favicon-ico"),mt=document.getElementById("apple-touch-icon");M?(Ne&&(Ne.href=de.getAssetUrl(`/static/custom/favicon.ico?v=${ge}`)),mt&&(mt.href=de.getAssetUrl(`/static/custom/${M}?v=${ge}`))):(Ne&&(Ne.href=de.getAssetUrl(`/static/favicon.ico?v=${ge}`)),mt&&(mt.href=de.getAssetUrl(`/static/apple-touch-icon.png?v=${ge}`))),window.dispatchEvent(new CustomEvent("branding-updated"))},xt=async M=>{const ge=M.target.files?.[0];if(ge){D("logo");try{const Ne=await de.uploadFile("/api/upload-logo",ge,"file");w({...b,custom_logo:Ne.filename}),gt(Ne.filename),K.success("Logo uploaded!")}catch(Ne){K.error(Ne instanceof Error?Ne.message:"Failed to upload logo")}finally{D(null),M.target.value=""}}},qt=async()=>{if(confirm("Remove custom logo and revert to default?")){D("logo");try{await de.delete("/api/custom-logo"),w({...b,custom_logo:void 0}),gt(null),K.success("Logo removed!")}catch{K.error("Failed to remove logo")}finally{D(null)}}},ue=async()=>{D("led");try{await de.post("/set_led_config",{provider:j.provider,ip_address:j.wled_ip,num_leds:j.num_leds,gpio_pin:j.gpio_pin,pixel_order:j.pixel_order}),K.success("LED configuration saved")}catch(M){K.error(M instanceof Error?M.message:"Failed to save LED config")}finally{D(null)}},Oe=async()=>{D("mqtt");try{await de.patch("/api/settings",{mqtt:{enabled:_.enabled,broker:_.broker,port:_.port,username:_.username,password:_.password,device_name:_.device_name,device_id:_.device_id,client_id:_.client_id,discovery_prefix:_.discovery_prefix}}),K.success("MQTT configuration saved. Restart required.")}catch{K.error("Failed to save MQTT config")}finally{D(null)}},Be=async()=>{if(!_.broker){K.error("Please enter a broker address");return}D("mqttTest");try{const M=await de.post("/api/mqtt-test",{broker:_.broker,port:_.port||1883,username:_.username||"",password:_.password||""});M.success?K.success("MQTT connection successful!"):K.error(M.error||"Connection failed")}catch{K.error("Failed to test MQTT connection")}finally{D(null)}},Qe=async()=>{D("machine");try{await de.patch("/api/settings",{machine:{table_type_override:b.table_type_override||"",gear_ratio_override:b.gear_ratio_override??0}}),K.success("Machine settings saved")}catch{K.error("Failed to save machine settings")}finally{D(null)}},Pe=async()=>{D("homing");try{await de.patch("/api/settings",{homing:{mode:b.homing_mode,angular_offset_degrees:b.angular_offset,home_on_connect:b.home_on_connect,auto_home_enabled:b.auto_home_enabled,auto_home_after_patterns:b.auto_home_after_patterns,hard_reset_theta:b.hard_reset_theta}}),K.success("Homing configuration saved")}catch{K.error("Failed to save homing configuration")}finally{D(null)}},Ze=async()=>{D("clearing");try{await de.patch("/api/settings",{patterns:{clear_pattern_speed:b.clear_pattern_speed??0,custom_clear_from_in:b.custom_clear_from_in||null,custom_clear_from_out:b.custom_clear_from_out||null}}),K.success("Clearing settings saved")}catch{K.error("Failed to save clearing settings")}finally{D(null)}},ft=async()=>{D("autoplay");try{const M=B(we,W);await de.patch("/api/settings",{auto_play:{...J,pause_time:M}}),K.success("Auto-play settings saved")}catch{K.error("Failed to save auto-play settings")}finally{D(null)}},pt=async()=>{D("stillsands");try{await de.patch("/api/settings",{scheduled_pause:G}),K.success("Still Sands settings saved")}catch{K.error("Failed to save Still Sands settings")}finally{D(null)}},z=async()=>{D("reboot");try{await de.patch("/api/settings",{scheduled_reboot:oe}),K.success("Scheduled reboot settings saved")}catch{K.error("Failed to save scheduled reboot settings")}finally{D(null)}},Se=()=>{X({...G,time_slots:[...G.time_slots,{start_time:"22:00",end_time:"06:00",days:"daily",custom_days:[]}]})},Ae=M=>{X({...G,time_slots:G.time_slots.filter((ge,Ne)=>Ne!==M)})},Re=(M,ge)=>{const Ne=[...G.time_slots];Ne[M]={...Ne[M],...ge},X({...G,time_slots:Ne})};return o.jsxs("div",{className:"flex flex-col w-full max-w-5xl mx-auto gap-6 py-3 sm:py-6 px-0 sm:px-4",children:[o.jsxs("div",{className:"space-y-0.5 sm:space-y-1 pl-1",children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Settings"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure your sand table"})]}),o.jsx(Xn,{}),o.jsxs(l1,{type:"multiple",value:L,onValueChange:Ct,className:"space-y-3",children:[o.jsxs(Fn,{value:"connection",id:"section-connection",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Hn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"usb"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Device Connection"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Serial port configuration"})]})]})}),o.jsxs(Un,{className:"pt-4 pb-6 space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:`w-10 h-10 flex items-center justify-center rounded-lg ${h?"bg-green-100 dark:bg-green-900":"bg-muted"}`,children:o.jsx("span",{className:`material-icons ${h?"text-green-600":"text-muted-foreground"}`,children:h?"usb":"usb_off"})}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:"Status"}),o.jsx("p",{className:`text-sm ${h?"text-green-600":"text-destructive"}`,children:v})]})]}),h&&o.jsx(se,{variant:"destructive",size:"sm",onClick:st,disabled:R==="disconnect",children:"Disconnect"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{children:"Available Serial Ports"}),o.jsxs("div",{className:"flex gap-3",children:[o.jsxs(Pn,{value:u,onValueChange:d,children:[o.jsx(An,{className:"flex-1",children:o.jsx(qn,{placeholder:"Select a port..."})}),o.jsx(On,{children:i.length===0?o.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"No serial ports found"}):i.map(M=>o.jsx(tt,{value:M,children:M},M))})]}),o.jsxs(se,{onClick:Me,disabled:R==="connect"||!u||h,className:"gap-2",children:[R==="connect"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"cable"}),"Connect"]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Select a port and click 'Connect' to establish a connection."})]}),o.jsx(Xn,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{children:"Auto-Connect"}),o.jsxs("div",{className:"flex gap-3",children:[o.jsxs(Pn,{value:b.preferred_port||"__auto__",onValueChange:M=>w({...b,preferred_port:M==="__auto__"?void 0:M}),children:[o.jsx(An,{className:"flex-1",children:o.jsx(qn,{placeholder:"Select auto-connect option..."})}),o.jsxs(On,{children:[o.jsx(tt,{value:"__auto__",children:"Auto (pick first available)"}),o.jsx(tt,{value:"__none__",children:"Disabled (no auto-connect)"}),i.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:"Available Ports"}),i.map(M=>o.jsx(tt,{value:M,children:M},M))]})]})]}),o.jsxs(se,{onClick:nt,disabled:R==="preferredPort",className:"gap-2",children:[R==="preferredPort"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save"]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose how the system connects on startup: Auto picks the first available port, Disabled requires manual connection, or select a specific port."})]}),o.jsx("div",{className:"p-4 rounded-lg border space-y-3",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsxs("p",{className:"font-medium flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"power"}),"Home on Connect"]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Automatically home when connecting on startup. Disable to connect without homing and home manually later."})]}),o.jsx(gr,{checked:b.home_on_connect!==!1,onCheckedChange:async M=>{w({...b,home_on_connect:M});try{await de.patch("/api/settings",{homing:{home_on_connect:M}}),K.success(M?"Home on connect enabled":"Home on connect disabled")}catch{K.error("Failed to save setting")}}})]})})]})]}),o.jsxs(Fn,{value:"machine",id:"section-machine",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Hn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"precision_manufacturing"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Machine Settings"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Table type and hardware configuration"})]})]})}),o.jsxs(Un,{className:"pt-4 pb-6 space-y-6",children:[o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[o.jsxs("div",{className:"p-3 rounded-lg bg-muted/50",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Detected Type"}),o.jsx("p",{className:"font-medium text-sm",children:b.detected_table_type||"Unknown"})]}),o.jsxs("div",{className:"p-3 rounded-lg bg-muted/50",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Gear Ratio"}),o.jsx("p",{className:"font-medium text-sm",children:b.gear_ratio??"—"})]}),o.jsxs("div",{className:"p-3 rounded-lg bg-muted/50",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"X Steps/mm"}),o.jsx("p",{className:"font-medium text-sm",children:b.x_steps_per_mm??"—"})]}),o.jsxs("div",{className:"p-3 rounded-lg bg-muted/50",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Y Steps/mm"}),o.jsx("p",{className:"font-medium text-sm",children:b.y_steps_per_mm??"—"})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{children:"Table Type Override"}),o.jsxs("div",{className:"flex gap-3",children:[o.jsxs(Pn,{value:b.table_type_override||"auto",onValueChange:M=>w({...b,table_type_override:M==="auto"?void 0:M}),children:[o.jsx(An,{className:"flex-1",children:o.jsx(qn,{placeholder:"Auto-detect (use detected type)"})}),o.jsxs(On,{children:[o.jsx(tt,{value:"auto",children:"Auto-detect (use detected type)"}),b.available_table_types?.map(M=>o.jsx(tt,{value:M.value,children:M.label},M.value))]})]}),o.jsxs(se,{onClick:Qe,disabled:R==="machine",className:"gap-2",children:[R==="machine"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save"]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Override the automatically detected table type. This affects gear ratio calculations and homing behavior."})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{children:"Gear Ratio Override"}),o.jsxs("div",{className:"flex gap-3",children:[o.jsx(wt,{type:"number",step:.25,min:0,placeholder:"Auto-detect",value:b.gear_ratio_override??"",onChange:M=>w({...b,gear_ratio_override:M.target.value?parseFloat(M.target.value):null}),className:"flex-1"}),o.jsxs(se,{onClick:Qe,disabled:R==="machine",className:"gap-2",children:[R==="machine"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save"]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Override the gear ratio used for angular/radial coupling compensation. Leave empty to auto-detect from table type (6.25 for mini, 10 for standard)."})]}),o.jsxs(nr,{className:"flex items-start",children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"info"}),o.jsx(rr,{children:"Table type is normally detected automatically from GRBL settings. Use override if auto-detection is incorrect for your hardware."})]}),o.jsxs(pi,{to:"/setup",className:"flex items-center justify-between w-full p-3 rounded-lg border hover:bg-muted/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"build"}),o.jsxs("div",{className:"text-left",children:[o.jsx("p",{className:"font-medium text-sm",children:"Hardware Setup & Calibration"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Calibrate motor directions and edit FluidNC settings"})]})]}),o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"arrow_forward"})]})]})]}),o.jsxs(Fn,{value:"homing",id:"section-homing",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Hn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"home"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Homing Configuration"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Homing mode and auto-home settings"})]})]})}),o.jsxs(Un,{className:"pt-4 pb-6 space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{children:"Homing Mode"}),o.jsxs(ch,{value:String(b.homing_mode||0),onValueChange:M=>w({...b,homing_mode:parseInt(M)}),className:"space-y-3",children:[o.jsxs("div",{className:"flex items-start gap-3 p-3 border rounded-lg cursor-pointer hover:bg-muted/50",children:[o.jsx(ys,{value:"0",id:"homing-crash",className:"mt-0.5"}),o.jsxs("div",{className:"flex-1",children:[o.jsx(Ye,{htmlFor:"homing-crash",className:"font-medium cursor-pointer",children:"Crash Homing"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Y axis moves until physical stop, then theta and rho set to 0"})]})]}),o.jsxs("div",{className:"flex items-start gap-3 p-3 border rounded-lg cursor-pointer hover:bg-muted/50",children:[o.jsx(ys,{value:"1",id:"homing-sensor",className:"mt-0.5"}),o.jsxs("div",{className:"flex-1",children:[o.jsx(Ye,{htmlFor:"homing-sensor",className:"font-medium cursor-pointer",children:"Sensor Homing"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Homes both X and Y axes using sensors"})]})]})]})]}),b.homing_mode===1&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{htmlFor:"angular-offset",children:"Sensor Offset (degrees)"}),o.jsx(wt,{id:"angular-offset",type:"number",min:"0",max:"360",step:"0.1",value:b.angular_offset??"",onChange:M=>w({...b,angular_offset:M.target.value===""?void 0:parseFloat(M.target.value)}),placeholder:"0.0"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Set the angle (in degrees) where your radial arm should be offset. Choose a value so the radial arm points East."})]}),o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsxs("p",{className:"font-medium flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"autorenew"}),"Auto-Home During Playlists"]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Perform homing after a set number of patterns to maintain accuracy"})]}),o.jsx(gr,{checked:b.auto_home_enabled||!1,onCheckedChange:M=>w({...b,auto_home_enabled:M})})]}),b.auto_home_enabled&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{htmlFor:"auto-home-patterns",children:"Home after every X patterns"}),o.jsx(wt,{id:"auto-home-patterns",type:"number",min:"1",max:"100",value:b.auto_home_after_patterns||5,onChange:M=>w({...b,auto_home_after_patterns:parseInt(M.target.value)||5})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Homing occurs after each main pattern completes (clear patterns don't count)."})]})]}),o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsxs("p",{className:"font-medium flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"restart_alt"}),"Reset Machine on Theta Normalization"]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Also reset the machine controller when normalizing theta"})]}),o.jsx(gr,{checked:b.hard_reset_theta||!1,onCheckedChange:M=>w({...b,hard_reset_theta:M})})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"When disabled (default), theta normalization only adjusts the angle mathematically. When enabled, also resets the machine controller to clear position counters."})]}),o.jsxs(se,{onClick:Pe,disabled:R==="homing",className:"gap-2",children:[R==="homing"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save Homing Configuration"]})]})]}),o.jsxs(Fn,{value:"application",id:"section-application",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Hn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"tune"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Application Settings"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Customize app name and branding"})]})]})}),o.jsxs(Un,{className:"pt-4 pb-6 space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{children:"Custom Logo"}),o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4 p-4 rounded-lg border",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"w-16 h-16 rounded-full overflow-hidden border bg-background flex items-center justify-center shrink-0",children:b.custom_logo?o.jsx("img",{src:de.getAssetUrl(`/static/custom/${b.custom_logo}`),alt:"Custom Logo",className:"w-full h-full object-cover"}):o.jsx("img",{src:de.getAssetUrl("/static/android-chrome-192x192.png"),alt:"Default Logo",className:"w-full h-full object-cover"})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:"font-medium",children:b.custom_logo?"Custom logo active":"Using default logo"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"PNG, JPG, GIF, WebP or SVG (max 5MB)"})]})]}),o.jsxs("div",{className:"flex gap-2 sm:ml-auto",children:[o.jsxs(se,{variant:"secondary",size:"sm",className:"gap-2",disabled:R==="logo",onClick:()=>document.getElementById("logo-upload")?.click(),children:[R==="logo"?o.jsx("span",{className:"material-icons-outlined animate-spin text-base",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-base",children:"upload"}),"Upload"]}),b.custom_logo&&o.jsx(se,{variant:"secondary",size:"sm",className:"gap-2 text-destructive hover:text-destructive",disabled:R==="logo",onClick:qt,children:o.jsx("span",{className:"material-icons-outlined text-base",children:"delete"})})]}),o.jsx("input",{id:"logo-upload",type:"file",accept:".png,.jpg,.jpeg,.gif,.webp,.svg",className:"hidden",onChange:xt})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"A favicon will be automatically generated from your logo."})]}),o.jsx(Xn,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{htmlFor:"appName",children:"Application Name"}),o.jsxs("div",{className:"flex gap-3",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(wt,{id:"appName",value:b.app_name||"",onChange:M=>w({...b,app_name:M.target.value}),placeholder:"e.g., Dune Weaver"}),o.jsx(se,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7 p-0",onClick:()=>w({...b,app_name:"Dune Weaver"}),children:o.jsx("span",{className:"material-icons text-base",children:"restart_alt"})})]}),o.jsxs(se,{onClick:yt,disabled:R==="appName",className:"gap-2",children:[R==="appName"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save"]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"This name appears in the browser tab and header."})]})]})]}),o.jsxs(Fn,{value:"clearing",id:"section-clearing",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Hn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"cleaning_services"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Pattern Clearing"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Customize clearing speed and patterns"})]})]})}),o.jsxs(Un,{className:"pt-4 pb-6 space-y-6",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Customize the clearing behavior used when transitioning between patterns."}),o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsx("h4",{className:"font-medium",children:"Clearing Speed"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Set a custom speed for clearing patterns. Leave empty to use the default pattern speed."}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{htmlFor:"clear-speed",children:"Speed (steps per minute)"}),o.jsx(wt,{id:"clear-speed",type:"number",min:"50",max:"2000",step:"50",value:b.clear_pattern_speed||"",onChange:M=>w({...b,clear_pattern_speed:M.target.value?parseInt(M.target.value):void 0}),placeholder:"Default (use pattern speed)"})]})]}),o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsx("h4",{className:"font-medium",children:"Custom Clear Patterns"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose specific patterns to use when clearing. Leave empty for default behavior."}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{htmlFor:"clear-from-in",children:"Clear From Center Pattern"}),o.jsx(Bb,{value:b.custom_clear_from_in||"__default__",onValueChange:M=>w({...b,custom_clear_from_in:M==="__default__"?void 0:M}),options:[{value:"__default__",label:"Default (built-in)"},...Z.map(M=>({value:M,label:M}))],placeholder:"Default (built-in)",searchPlaceholder:"Search patterns...",emptyMessage:"No patterns found"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Pattern used when clearing from center outward."})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{htmlFor:"clear-from-out",children:"Clear From Perimeter Pattern"}),o.jsx(Bb,{value:b.custom_clear_from_out||"__default__",onValueChange:M=>w({...b,custom_clear_from_out:M==="__default__"?void 0:M}),options:[{value:"__default__",label:"Default (built-in)"},...Z.map(M=>({value:M,label:M}))],placeholder:"Default (built-in)",searchPlaceholder:"Search patterns...",emptyMessage:"No patterns found"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Pattern used when clearing from perimeter inward."})]})]})]}),o.jsxs(se,{onClick:Ze,disabled:R==="clearing",className:"gap-2",children:[R==="clearing"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save Clearing Settings"]})]})]}),o.jsxs(Fn,{value:"led",id:"section-led",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Hn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"lightbulb"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"LED Controller"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"WLED or local GPIO LED control"})]})]})}),o.jsxs(Un,{className:"pt-4 pb-6 space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{children:"LED Provider"}),o.jsxs(ch,{value:j.provider,onValueChange:M=>S({...j,provider:M}),className:"flex gap-4",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(ys,{value:"none",id:"led-none"}),o.jsx(Ye,{htmlFor:"led-none",className:"font-normal",children:"None"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(ys,{value:"wled",id:"led-wled"}),o.jsx(Ye,{htmlFor:"led-wled",className:"font-normal",children:"WLED"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(ys,{value:"dw_leds",id:"led-dw"}),o.jsx(Ye,{htmlFor:"led-dw",className:"font-normal",children:"DW LEDs (GPIO)"})]})]})]}),j.provider==="wled"&&o.jsxs("div",{className:"space-y-3 p-4 rounded-lg border",children:[o.jsx(Ye,{htmlFor:"wledIp",children:"WLED IP Address"}),o.jsx(wt,{id:"wledIp",value:j.wled_ip||"",onChange:M=>S({...j,wled_ip:M.target.value}),placeholder:"e.g., 192.168.1.100"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter the IP address of your WLED controller"})]}),j.provider==="dw_leds"&&o.jsxs("div",{className:"space-y-3 p-4 rounded-lg border",children:[o.jsxs(nr,{className:"flex items-start",children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"info"}),o.jsx(rr,{children:"Supports WS2812, WS2812B, SK6812 and other WS281x LED strips"})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{htmlFor:"numLeds",children:"Number of LEDs"}),o.jsx(wt,{id:"numLeds",type:"text",inputMode:"numeric",value:C,onChange:M=>{const ge=M.target.value.replace(/[^0-9]/g,"");N(ge)},onBlur:()=>{const M=Math.min(1e3,Math.max(1,parseInt(C)||60));S({...j,num_leds:M}),N(String(M))},onKeyDown:M=>{if(M.key==="Enter"){const ge=Math.min(1e3,Math.max(1,parseInt(C)||60));S({...j,num_leds:ge}),N(String(ge))}}})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{htmlFor:"gpioPin",children:"GPIO Pin"}),o.jsxs(Pn,{value:String(j.gpio_pin||18),onValueChange:M=>S({...j,gpio_pin:parseInt(M)}),children:[o.jsx(An,{children:o.jsx(qn,{})}),o.jsxs(On,{children:[o.jsx(tt,{value:"12",children:"GPIO 12 (PWM0)"}),o.jsx(tt,{value:"13",children:"GPIO 13 (PWM1)"}),o.jsx(tt,{value:"18",children:"GPIO 18 (PWM0)"}),o.jsx(tt,{value:"19",children:"GPIO 19 (PWM1)"})]})]})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{htmlFor:"pixelOrder",children:"Pixel Color Order"}),o.jsxs(Pn,{value:j.pixel_order||"RGB",onValueChange:M=>S({...j,pixel_order:M}),children:[o.jsx(An,{children:o.jsx(qn,{})}),o.jsxs(On,{children:[o.jsxs(TT,{children:[o.jsx(D0,{children:"RGB Strips (3-channel)"}),o.jsx(tt,{value:"RGB",children:"RGB - WS2815/WS2811"}),o.jsx(tt,{value:"GRB",children:"GRB - WS2812/WS2812B"}),o.jsx(tt,{value:"BGR",children:"BGR - Some WS2811 variants"}),o.jsx(tt,{value:"RBG",children:"RBG - Rare variant"}),o.jsx(tt,{value:"GBR",children:"GBR - Rare variant"}),o.jsx(tt,{value:"BRG",children:"BRG - Rare variant"})]}),o.jsxs(TT,{children:[o.jsx(D0,{children:"RGBW Strips (4-channel)"}),o.jsx(tt,{value:"GRBW",children:"GRBW - SK6812 RGBW"}),o.jsx(tt,{value:"RGBW",children:"RGBW - SK6812 variant"})]})]})]})]})]}),o.jsxs(se,{onClick:ue,disabled:R==="led",className:"gap-2",children:[R==="led"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save LED Configuration"]})]})]}),o.jsxs(Fn,{value:"mqtt",id:"section-mqtt",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Hn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"home"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Home Assistant Integration"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"MQTT configuration for smart home control"})]})]})}),o.jsxs(Un,{className:"pt-4 pb-6 space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:"Enable MQTT"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect to Home Assistant via MQTT"})]}),o.jsx(gr,{checked:_.enabled,onCheckedChange:M=>T({..._,enabled:M})})]}),_.enabled&&o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsxs(Ye,{htmlFor:"mqttBroker",children:["Broker Address ",o.jsx("span",{className:"text-destructive",children:"*"})]}),o.jsx(wt,{id:"mqttBroker",value:_.broker||"",onChange:M=>T({..._,broker:M.target.value}),placeholder:"e.g., 192.168.1.100"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{htmlFor:"mqttPort",children:"Port"}),o.jsx(wt,{id:"mqttPort",type:"number",value:_.port||1883,onChange:M=>T({..._,port:parseInt(M.target.value)}),placeholder:"1883"})]})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{htmlFor:"mqttUser",children:"Username"}),o.jsx(wt,{id:"mqttUser",value:_.username||"",onChange:M=>T({..._,username:M.target.value}),placeholder:"Optional"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{htmlFor:"mqttPass",children:"Password"}),o.jsx(wt,{id:"mqttPass",type:"password",value:_.password||"",onChange:M=>T({..._,password:M.target.value}),placeholder:"Optional"})]})]}),o.jsx(Xn,{}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{htmlFor:"mqttDeviceName",children:"Device Name"}),o.jsx(wt,{id:"mqttDeviceName",value:_.device_name||"Dune Weaver",onChange:M=>T({..._,device_name:M.target.value})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{htmlFor:"mqttDeviceId",children:"Device ID"}),o.jsx(wt,{id:"mqttDeviceId",value:_.device_id||"dune_weaver",onChange:M=>T({..._,device_id:M.target.value})})]})]}),o.jsxs(nr,{className:"flex items-start",children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"info"}),o.jsx(rr,{children:"MQTT configuration changes require a restart to take effect."})]})]}),o.jsxs("div",{className:"flex flex-wrap gap-3",children:[o.jsxs(se,{onClick:Oe,disabled:R==="mqtt",className:"gap-2",children:[R==="mqtt"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save MQTT Configuration"]}),_.enabled&&_.broker&&o.jsxs(se,{variant:"secondary",onClick:Be,disabled:R==="mqttTest",className:"gap-2",children:[R==="mqttTest"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"wifi_tethering"}),"Test Connection"]})]})]})]}),o.jsxs(Fn,{value:"autoplay",id:"section-autoplay",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Hn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"play_circle"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Auto-play on Boot"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Start a playlist automatically on startup"})]})]})}),o.jsxs(Un,{className:"pt-4 pb-6 space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:"Enable Auto-play"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Automatically start playing when the system boots"})]}),o.jsx(gr,{checked:J.enabled,onCheckedChange:M=>$({...J,enabled:M})})]}),J.enabled&&o.jsxs("div",{className:"space-y-3 p-4 rounded-lg border",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{children:"Startup Playlist"}),o.jsxs(Pn,{value:J.playlist||void 0,onValueChange:M=>$({...J,playlist:M}),children:[o.jsx(An,{children:o.jsx(qn,{placeholder:"Select a playlist..."})}),o.jsx(On,{children:H.length===0?o.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"No playlists found"}):H.map(M=>o.jsx(tt,{value:M,children:M},M))})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose which playlist to play when the system starts."})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{children:"Run Mode"}),o.jsxs(Pn,{value:J.run_mode,onValueChange:M=>$({...J,run_mode:M}),children:[o.jsx(An,{children:o.jsx(qn,{})}),o.jsxs(On,{children:[o.jsx(tt,{value:"single",children:"Single (play once)"}),o.jsx(tt,{value:"loop",children:"Loop (repeat forever)"})]})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{children:"Pause Between Patterns"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(wt,{type:"text",inputMode:"numeric",value:I,onChange:M=>{const ge=M.target.value.replace(/[^0-9]/g,"");V(ge)},onBlur:()=>{const M=Math.max(0,parseInt(I)||0);Ce(M),V(String(M))},onKeyDown:M=>{if(M.key==="Enter"){const ge=Math.max(0,parseInt(I)||0);Ce(ge),V(String(ge))}},className:"w-20"}),o.jsxs(Pn,{value:W,onValueChange:M=>fe(M),children:[o.jsx(An,{className:"w-20",children:o.jsx(qn,{})}),o.jsxs(On,{children:[o.jsx(tt,{value:"sec",children:"sec"}),o.jsx(tt,{value:"min",children:"min"}),o.jsx(tt,{value:"hr",children:"hr"})]})]})]})]})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{children:"Clear Pattern"}),o.jsxs(Pn,{value:J.clear_pattern,onValueChange:M=>$({...J,clear_pattern:M}),children:[o.jsx(An,{children:o.jsx(qn,{})}),o.jsxs(On,{children:[o.jsx(tt,{value:"none",children:"None"}),o.jsx(tt,{value:"adaptive",children:"Adaptive"}),o.jsx(tt,{value:"clear_from_in",children:"Clear From Center"}),o.jsx(tt,{value:"clear_from_out",children:"Clear From Perimeter"}),o.jsx(tt,{value:"clear_sideway",children:"Clear Sideways"}),o.jsx(tt,{value:"random",children:"Random"})]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Pattern to run before each main pattern."})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"Shuffle Playlist"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Randomize pattern order"})]}),o.jsx(gr,{checked:J.shuffle,onCheckedChange:M=>$({...J,shuffle:M})})]})]})]}),o.jsxs(se,{onClick:ft,disabled:R==="autoplay",className:"gap-2",children:[R==="autoplay"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save Auto-play Settings"]})]})]}),o.jsxs(Fn,{value:"stillsands",id:"section-stillsands",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Hn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"bedtime"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Still Sands"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Schedule quiet periods for your table"})]})]})}),o.jsxs(Un,{className:"pt-4 pb-6 space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:"Enable Still Sands"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Pause the table during specified time periods"})]}),o.jsx(gr,{checked:G.enabled,onCheckedChange:M=>X({...G,enabled:M})})]}),G.enabled&&o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base text-muted-foreground",children:"hourglass_bottom"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"Finish Current Pattern"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Let the current pattern complete before entering still mode"})]})]}),o.jsx(gr,{checked:G.finish_pattern,onCheckedChange:M=>X({...G,finish_pattern:M})})]}),o.jsx(Xn,{}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base text-muted-foreground",children:"lightbulb"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"Control LED Lights"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Turn off LED lights during still periods"})]})]}),o.jsx(gr,{checked:G.control_wled,onCheckedChange:M=>X({...G,control_wled:M})})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 pt-3 border-t",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"schedule"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"Timezone"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Select a timezone for scheduling"})]})]}),o.jsx(Bb,{value:G.timezone||"",onValueChange:M=>X({...G,timezone:M}),placeholder:"System Default",searchPlaceholder:"Search timezones...",className:"w-full sm:w-[200px]",options:[{value:"",label:"System Default"},{value:"Etc/GMT+12",label:"UTC-12"},{value:"Etc/GMT+11",label:"UTC-11"},{value:"Etc/GMT+10",label:"UTC-10"},{value:"Etc/GMT+9",label:"UTC-9"},{value:"Etc/GMT+8",label:"UTC-8"},{value:"Etc/GMT+7",label:"UTC-7"},{value:"Etc/GMT+6",label:"UTC-6"},{value:"Etc/GMT+5",label:"UTC-5"},{value:"Etc/GMT+4",label:"UTC-4"},{value:"Etc/GMT+3",label:"UTC-3"},{value:"Etc/GMT+2",label:"UTC-2"},{value:"Etc/GMT+1",label:"UTC-1"},{value:"UTC",label:"UTC"},{value:"Etc/GMT-1",label:"UTC+1"},{value:"Etc/GMT-2",label:"UTC+2"},{value:"Etc/GMT-3",label:"UTC+3"},{value:"Etc/GMT-4",label:"UTC+4"},{value:"Etc/GMT-5",label:"UTC+5"},{value:"Etc/GMT-6",label:"UTC+6"},{value:"Etc/GMT-7",label:"UTC+7"},{value:"Etc/GMT-8",label:"UTC+8"},{value:"Etc/GMT-9",label:"UTC+9"},{value:"Etc/GMT-10",label:"UTC+10"},{value:"Etc/GMT-11",label:"UTC+11"},{value:"Etc/GMT-12",label:"UTC+12"},{value:"America/New_York",label:"America/New_York (Eastern)"},{value:"America/Chicago",label:"America/Chicago (Central)"},{value:"America/Denver",label:"America/Denver (Mountain)"},{value:"America/Los_Angeles",label:"America/Los_Angeles (Pacific)"},{value:"Europe/London",label:"Europe/London"},{value:"Europe/Paris",label:"Europe/Paris"},{value:"Europe/Berlin",label:"Europe/Berlin"},{value:"Asia/Tokyo",label:"Asia/Tokyo"},{value:"Asia/Shanghai",label:"Asia/Shanghai"},{value:"Asia/Singapore",label:"Asia/Singapore"},{value:"Australia/Sydney",label:"Australia/Sydney"}]})]})]}),o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h4",{className:"font-medium",children:"Still Periods"}),o.jsxs(se,{onClick:Se,size:"sm",variant:"secondary",className:"gap-1",children:[o.jsx("span",{className:"material-icons text-base",children:"add"}),"Add Period"]})]}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Define time periods when the sands should rest."}),G.time_slots.length===0?o.jsxs("div",{className:"text-center py-6 text-muted-foreground",children:[o.jsx("span",{className:"material-icons text-3xl mb-2",children:"schedule"}),o.jsx("p",{className:"text-sm",children:"No still periods configured"}),o.jsx("p",{className:"text-xs",children:'Click "Add Period" to create one'})]}):o.jsx("div",{className:"space-y-3",children:G.time_slots.map((M,ge)=>o.jsxs("div",{className:"p-3 border rounded-lg bg-muted/50 space-y-3 overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between -mr-1",children:[o.jsxs("span",{className:"text-sm font-medium",children:["Period ",ge+1]}),o.jsx(se,{variant:"ghost",size:"icon",onClick:()=>Ae(ge),className:"h-7 w-7 text-destructive hover:text-destructive",children:o.jsx("span",{className:"material-icons text-lg",children:"delete"})})]}),o.jsxs("div",{className:"grid grid-cols-[1fr_1fr] gap-2",children:[o.jsxs("div",{className:"space-y-1.5 min-w-0 overflow-hidden",children:[o.jsx(Ye,{className:"text-xs",children:"Start Time"}),o.jsx(wt,{type:"time",value:M.start_time,onChange:Ne=>Re(ge,{start_time:Ne.target.value}),className:"text-xs w-full"})]}),o.jsxs("div",{className:"space-y-1.5 min-w-0 overflow-hidden",children:[o.jsx(Ye,{className:"text-xs",children:"End Time"}),o.jsx(wt,{type:"time",value:M.end_time,onChange:Ne=>Re(ge,{end_time:Ne.target.value}),className:"text-xs w-full"})]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Ye,{className:"text-xs",children:"Days"}),o.jsxs(Pn,{value:M.days,onValueChange:Ne=>Re(ge,{days:Ne,...Ne!=="custom"?{custom_days:[]}:{}}),children:[o.jsx(An,{children:o.jsx(qn,{})}),o.jsxs(On,{children:[o.jsx(tt,{value:"daily",children:"Daily"}),o.jsx(tt,{value:"weekdays",children:"Weekdays"}),o.jsx(tt,{value:"weekends",children:"Weekends"}),o.jsx(tt,{value:"custom",children:"Custom"})]})]})]}),M.days==="custom"&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Ye,{className:"text-xs",children:"Select Days"}),o.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{key:"monday",label:"Mon"},{key:"tuesday",label:"Tue"},{key:"wednesday",label:"Wed"},{key:"thursday",label:"Thu"},{key:"friday",label:"Fri"},{key:"saturday",label:"Sat"},{key:"sunday",label:"Sun"}].map(Ne=>{const mt=M.custom_days?.includes(Ne.key);return o.jsx("button",{type:"button",onClick:()=>{const Y=M.custom_days||[],xe=mt?Y.filter(Le=>Le!==Ne.key):[...Y,Ne.key];Re(ge,{custom_days:xe})},className:`px-2.5 py-1 text-xs rounded-full border transition-colors ${mt?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-input hover:bg-accent"}`,children:Ne.label},Ne.key)})})]})]},ge))})]}),o.jsxs(nr,{className:"flex items-start",children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"info"}),o.jsx(rr,{children:"Times are based on the timezone selected above (or system default). Still periods that span midnight (e.g., 22:00 to 06:00) are supported. Patterns resume automatically when still periods end."})]})]}),o.jsxs(se,{onClick:pt,disabled:R==="stillsands",className:"gap-2",children:[R==="stillsands"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save Still Sands Settings"]})]})]}),o.jsxs(Fn,{value:"reboot",id:"section-reboot",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Hn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"restart_alt"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Scheduled Reboot"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Reboot the controller board daily at a set time"})]})]})}),o.jsxs(Un,{className:"pt-4 pb-6 space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:"Enable Scheduled Reboot"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Reboot the board (e.g. Raspberry Pi) once a day"})]}),o.jsx(gr,{checked:oe.enabled,onCheckedChange:M=>me({...oe,enabled:M})})]}),oe.enabled&&o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"p-4 rounded-lg border",children:o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"schedule"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"Reboot Time"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Uses the timezone selected in Still Sands (or system default)"})]})]}),o.jsx(wt,{type:"time",value:oe.time,onChange:M=>me({...oe,time:M.target.value}),className:"w-full sm:w-[140px]"})]})}),o.jsxs(nr,{className:"flex items-start",children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"info"}),o.jsx(rr,{children:"If a pattern is drawing at the scheduled time, the reboot waits until the table is idle. The table reconnects and homes automatically after rebooting."})]})]}),o.jsxs(se,{onClick:z,disabled:R==="reboot",className:"gap-2",children:[R==="reboot"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save Reboot Settings"]})]})]}),o.jsxs(Fn,{value:"security",id:"section-security",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Hn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"lock"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Security"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"App lock and access control"})]})]})}),o.jsxs(Un,{className:"pt-4 pb-6 space-y-4",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Restrict access to the app to prevent unauthorized changes. Useful for shared spaces or when the table is accessible to children."}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{className:"text-sm font-medium",children:"Security Mode"}),o.jsxs(ch,{value:he,onValueChange:M=>{const ge=M;ge==="off"&&he!=="off"&&!confirm("Turn off security? This will remove the password and unlock the app.")||(Ee(ge),ke(""),Fe(""))},className:"space-y-2",children:[o.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border",children:[o.jsx(ys,{value:"off",id:"security-off",className:"mt-0.5"}),o.jsxs("div",{children:[o.jsx(Ye,{htmlFor:"security-off",className:"font-medium cursor-pointer",children:"Off"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"No restrictions. Anyone can use the app."})]})]}),o.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border",children:[o.jsx(ys,{value:"play_only",id:"security-play-only",className:"mt-0.5"}),o.jsxs("div",{children:[o.jsx(Ye,{htmlFor:"security-play-only",className:"font-medium cursor-pointer",children:"Play Only"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Anyone can browse and play patterns. Settings require a password."})]})]}),o.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border",children:[o.jsx(ys,{value:"lockdown",id:"security-lockdown",className:"mt-0.5"}),o.jsxs("div",{children:[o.jsx(Ye,{htmlFor:"security-lockdown",className:"font-medium cursor-pointer",children:"Full Lockdown"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Password required to access the entire app."})]})]})]})]}),he!=="off"&&o.jsxs("div",{className:"space-y-3 pt-2",children:[o.jsx(Xn,{}),Ge&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"A password is currently set. Enter a new password below to change it, or leave blank to keep the existing one."}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{htmlFor:"security-password",children:Ge?"New Password":"Password"}),o.jsx(wt,{id:"security-password",type:"password",placeholder:Ge?"Leave blank to keep current":"Enter password",value:je,onChange:M=>ke(M.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{htmlFor:"security-password-confirm",children:"Confirm Password"}),o.jsx(wt,{id:"security-password-confirm",type:"password",placeholder:"Confirm password",value:le,onChange:M=>Fe(M.target.value)})]}),je&&le&&je!==le&&o.jsx("p",{className:"text-sm text-destructive",children:"Passwords do not match"})]}),o.jsxs(se,{onClick:async()=>{if(he!=="off"){if(je&&je!==le){K.error("Passwords do not match");return}if(!Ge&&!je){K.error("Please set a password");return}}D("security");try{const M={security:{mode:he}};je&&(M.security.password=je),await de.patch("/api/settings",M),K.success("Security settings saved"),ke(""),Fe(""),He(he!=="off"),window.dispatchEvent(new CustomEvent("security-updated"))}catch{K.error("Failed to save security settings")}finally{D(null)}},disabled:R==="security"||he!=="off"&&je!==""&&je!==le||he!=="off"&&!Ge&&!je,className:"w-full gap-2",children:[R==="security"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save Security Settings"]})]})]}),o.jsxs(Fn,{value:"wifi",id:"section-wifi",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Hn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"wifi"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"WiFi"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Network connection settings"})]})]})}),o.jsxs(Un,{className:"pt-4 pb-6 space-y-3",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage WiFi connections, scan for networks, and configure hotspot mode."}),o.jsxs(se,{variant:"outline",className:"w-full gap-2",onClick:()=>n("/wifi-setup"),children:[o.jsx("span",{className:"material-icons-outlined",children:"settings"}),"Open WiFi Setup"]})]})]}),o.jsxs(Fn,{value:"version",id:"section-version",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Hn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"info"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Software Version"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Updates and system information"})]})]})}),o.jsxs(Un,{className:"pt-4 pb-6 space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg bg-muted/50",children:[o.jsx("div",{className:"w-10 h-10 flex items-center justify-center bg-background rounded-lg",children:o.jsx("span",{className:"material-icons text-muted-foreground",children:"terminal"})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:"font-medium",children:"Current Version"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:at?.current?`v${at.current}`:"Loading..."})]})]}),o.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg bg-muted/50",children:[o.jsx("div",{className:"w-10 h-10 flex items-center justify-center bg-background rounded-lg",children:o.jsx("span",{className:"material-icons text-muted-foreground",children:"system_update"})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:"font-medium",children:"Latest Version"}),o.jsxs("p",{className:`text-sm ${at?.update_available?"text-green-600 dark:text-green-400 font-medium":"text-muted-foreground"}`,children:[at?.latest?o.jsxs("a",{href:`https://github.com/tuanchris/dune-weaver/releases/tag/v${at.latest}`,target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:opacity-80 transition-opacity",children:["v",at.latest]}):"Checking...",at?.update_available&&" (Update available!)"]})]})]}),at?.update_available&&o.jsxs(se,{onClick:()=>St(!0),className:"w-full",children:[o.jsx("span",{className:"material-icons text-base mr-2",children:"system_update"}),"Update Now"]}),o.jsx(Cse,{open:Mt,onOpenChange:St,currentVersion:at?.current||"",latestVersion:at?.latest||""})]})]})]})]})}function NO({signal:e}){const t=e>=75?"signal_wifi_4_bar":e>=50?"network_wifi_3_bar":e>=25?"network_wifi_2_bar":"network_wifi_1_bar",n=e>=50?"text-green-500":e>=25?"text-yellow-500":"text-red-500";return o.jsx("span",{className:`material-icons text-lg ${n}`,children:t})}function _se(){const[e,t]=g.useState(null),[n,a]=g.useState([]),[i,l]=g.useState([]),[u,d]=g.useState(null),[h,p]=g.useState(""),[v,m]=g.useState(!1),[b,w]=g.useState(!1),[j,S]=g.useState(!1),[C,N]=g.useState(!1),[_,T]=g.useState(!1),[R,D]=g.useState(""),[L,k]=g.useState(null),[P,U]=g.useState(""),[J,$]=g.useState(""),[W,fe]=g.useState(!1),[we,Ce]=g.useState(!1),I=g.useCallback(async()=>{try{const le=await de.get("/api/wifi/status");t(le)}catch{}},[]),V=g.useCallback(async()=>{try{const le=await de.get("/api/wifi/saved");l(le)}catch{}},[]),H=g.useCallback(async()=>{try{const le=await de.get("/api/wifi/hotspot/password");U(le.password),$(le.password)}catch{}},[]),be=g.useCallback(async()=>{w(!0);try{const le=await de.get("/api/wifi/networks");a(le)}catch{K.error("Failed to scan networks")}finally{w(!1)}},[]);g.useEffect(()=>{I(),be(),V(),H()},[I,be,V,H]);const _e=_||u&&u.security!=="Open"&&!u.saved,B=async()=>{const le=_?R.trim():u?.ssid;if(le){S(!0);try{const Fe=await de.post("/api/wifi/connect",{ssid:le,password:_e?h:""});Fe.success&&(K.success(Fe.message),Ee(),I(),V(),be())}catch(Fe){const Ge=Fe instanceof Error?Fe.message:"Connection failed";K.error(Ge)}finally{S(!1)}}},G=async()=>{const le=R.trim();if(le){N(!0);try{const Fe=await de.post("/api/wifi/save",{ssid:le,password:h||""});Fe.success&&(K.success(Fe.message),Ee(),V())}catch(Fe){const Ge=Fe instanceof Error?Fe.message:"Failed to save network";K.error(Ge)}finally{N(!1)}}},X=async()=>{if(!L)return;const le=L;k(null);try{await de.post("/api/wifi/forget",{ssid:le}),K.success(`Forgot '${le}'`),V(),be()}catch{K.error("Failed to forget network")}},oe=L===e?.ssid,me=i.filter(le=>le.ssid!==L).length,Z=oe&&me===0,ne=async()=>{Ce(!0);try{const le=await de.post("/api/wifi/hotspot/password",{password:J});le.success&&(U(J),K.success(le.message))}catch(le){const Fe=le instanceof Error?le.message:"Failed to update password";K.error(Fe)}finally{Ce(!1)}},he=le=>{d(le),p(""),m(!1)},Ee=()=>{!j&&!C&&(d(null),p(""),m(!1),T(!1),D(""))},je=()=>{T(!0),D(""),p(""),m(!1),d({ssid:"",signal:0,security:"Manual",saved:!1,active:!1})},ke=e?.mode==="hotspot";return o.jsxs("div",{className:"container max-w-lg mx-auto px-3 py-4 space-y-3",children:[ke&&o.jsxs(nr,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/30 dark:border-blue-800",children:[o.jsx("span",{className:"material-icons text-blue-500 mr-2",children:"wifi_tethering"}),o.jsxs(rr,{children:[o.jsx("strong",{children:"Welcome to Dune Weaver!"}),o.jsx("br",{}),"Connect to your home WiFi network below to get started."]})]}),o.jsx($n,{children:o.jsxs(Gn,{className:"pt-4 pb-3 px-4",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("span",{className:"material-icons-outlined text-base text-muted-foreground",children:"info"}),o.jsx("span",{className:"font-semibold text-sm",children:"WiFi Status"})]}),e?o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-y-1 text-sm",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-1",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"Mode"}),o.jsx(Al,{variant:ke?"secondary":"default",className:"text-xs px-1.5 py-0",children:e.mode==="hotspot"?"Hotspot":e.mode==="client"?"Connected":e.mode})]}),e.ssid&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"Network"}),o.jsx("span",{className:"font-medium text-xs",children:e.ssid})]}),e.ip&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"IP"}),o.jsx("span",{className:"font-mono text-xs",children:e.ip})]})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"Host"}),o.jsxs("span",{className:"font-mono text-xs",children:[e.hostname,".local"]})]})]}):o.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading status..."}),!ke&&o.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"WiFi management requires a Raspberry Pi."})]})}),i.length>0&&o.jsx($n,{children:o.jsxs(Gn,{className:"pt-4 pb-2 px-4",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("span",{className:"material-icons-outlined text-base text-muted-foreground",children:"bookmark"}),o.jsx("span",{className:"font-semibold text-sm",children:"Saved Networks"})]}),o.jsx("div",{className:"space-y-0.5",children:i.map(le=>o.jsxs("div",{className:"flex items-center justify-between px-2.5 py-2 rounded-lg hover:bg-muted/50",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx("span",{className:"material-icons text-muted-foreground text-lg",children:"wifi"}),o.jsx("span",{className:"font-medium text-sm",children:le.ssid})]}),o.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>k(le.ssid),children:o.jsx("span",{className:"material-icons text-sm text-destructive",children:"delete"})})]},le.name))})]})}),o.jsx($n,{children:o.jsxs(Gn,{className:"pt-4 pb-3 px-4",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("span",{className:"material-icons-outlined text-base text-muted-foreground",children:"wifi_tethering"}),o.jsx("span",{className:"font-semibold text-sm",children:"Hotspot Password"}),!P&&o.jsx(Al,{variant:"secondary",className:"text-xs px-1.5 py-0",children:"Open"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Set a password for the Dune Weaver hotspot. Leave empty for an open network."}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(wt,{type:W?"text":"password",value:J,onChange:le=>$(le.target.value),placeholder:"No password (open)",className:"pr-8 h-8 text-sm",onKeyDown:le=>{le.key==="Enter"&&J!==P&&ne()}}),o.jsx("button",{type:"button",onClick:()=>fe(!W),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:o.jsx("span",{className:"material-icons text-sm",children:W?"visibility_off":"visibility"})})]}),o.jsx(se,{size:"sm",className:"h-8",onClick:ne,disabled:we||J===P||J.length>0&&J.length<8,children:we?o.jsx("span",{className:"material-icons text-sm animate-spin",children:"refresh"}):"Save"})]}),J&&J.length<8&&J.length>0&&o.jsx("p",{className:"text-xs text-destructive mt-1",children:"Password must be at least 8 characters"})]})}),ke&&o.jsxs(o.Fragment,{children:[o.jsx(Xn,{}),o.jsxs("div",{className:"text-center text-sm text-muted-foreground space-y-1",children:[o.jsx("p",{children:"After connecting, access Dune Weaver at:"}),o.jsxs("code",{className:"text-xs bg-muted px-2 py-1 rounded",children:["http://",e?.hostname||"duneweaver",".local"]})]})]}),o.jsx($n,{children:o.jsxs(Gn,{className:"pt-4 pb-3 px-4",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("span",{className:"material-icons-outlined text-base text-muted-foreground",children:"settings_power"}),o.jsx("span",{className:"font-semibold text-sm",children:"System"})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(se,{variant:"outline",size:"sm",className:"flex-1 h-8",onClick:async()=>{if(confirm("Restart Dune Weaver?"))try{await de.post("/api/system/restart"),K.success("Restarting...")}catch{K.error("Failed to restart")}},children:[o.jsx("span",{className:"material-icons-outlined text-sm mr-1.5",children:"restart_alt"}),"Restart"]}),o.jsxs(se,{variant:"outline",size:"sm",className:"flex-1 h-8 text-destructive hover:text-destructive",onClick:async()=>{if(confirm("Shutdown the system?"))try{await de.post("/api/system/shutdown"),K.success("Shutting down...")}catch{K.error("Failed to shutdown")}},children:[o.jsx("span",{className:"material-icons-outlined text-sm mr-1.5",children:"power_settings_new"}),"Shutdown"]})]})]})}),o.jsx($n,{children:o.jsxs(Gn,{className:"pt-4 pb-2 px-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base text-muted-foreground",children:"wifi_find"}),o.jsx("span",{className:"font-semibold text-sm",children:"Networks"}),o.jsx("span",{className:"text-xs text-muted-foreground",children:n.length>0?`(${n.length})`:""})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:je,title:"Add network manually",children:o.jsx("span",{className:"material-icons text-base",children:"add"})}),o.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:be,disabled:b,children:o.jsx("span",{className:`material-icons text-base ${b?"animate-spin":""}`,children:"refresh"})})]})]}),o.jsxs("div",{className:"space-y-0.5",children:[n.length===0&&b&&o.jsx("p",{className:"text-sm text-muted-foreground text-center py-3",children:"Scanning for networks..."}),n.length===0&&!b&&o.jsx("p",{className:"text-sm text-muted-foreground text-center py-3",children:"No networks found. Try scanning again."}),n.map(le=>o.jsxs("button",{onClick:()=>he(le),className:`w-full flex items-center gap-2.5 px-2.5 py-2 rounded-lg text-left transition-colors hover:bg-muted/50
  84. ${le.active?"bg-green-50 dark:bg-green-950/20":""}`,children:[o.jsx(NO,{signal:le.signal}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-medium text-sm truncate",children:le.ssid}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[le.security,le.saved&&" · Saved",le.active&&" · Connected"]})]}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[le.signal,"%"]}),le.security!=="Open"&&o.jsx("span",{className:"material-icons text-sm text-muted-foreground",children:"lock"})]},le.ssid))]})]})}),o.jsx(ga,{open:L!==null,onOpenChange:le=>{le||k(null)},children:o.jsxs(Wr,{className:"sm:max-w-md",children:[o.jsxs(Mr,{children:[o.jsxs(Dr,{children:["Forget '",L,"'?"]}),o.jsx(vi,{children:Z?o.jsxs(o.Fragment,{children:["This is your only saved network. Forgetting it will start the"," ",o.jsx("strong",{children:"Dune Weaver"})," hotspot. Connect to the Dune Weaver WiFi to access this page again."]}):oe?o.jsx(o.Fragment,{children:"You are currently connected to this network. The system will try the next saved network, or start the hotspot if none are in range."}):"The saved credentials for this network will be removed."})]}),o.jsxs(va,{className:"flex-row gap-2 sm:justify-end",children:[o.jsx(se,{variant:"outline",onClick:()=>k(null),children:"Cancel"}),o.jsx(se,{variant:"destructive",onClick:X,children:"Forget"})]})]})}),o.jsx(ga,{open:u!==null,onOpenChange:le=>{le||Ee()},children:o.jsxs(Wr,{className:"sm:max-w-md",children:[o.jsxs(Mr,{children:[o.jsx(Dr,{className:"flex items-center gap-2",children:_?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"material-icons text-lg text-muted-foreground",children:"add_circle_outline"}),"Add Network"]}):o.jsxs(o.Fragment,{children:[u&&o.jsx(NO,{signal:u.signal}),u?.ssid]})}),o.jsx(vi,{children:_?"Enter the network name and password":o.jsxs(o.Fragment,{children:[u?.security!=="Open"?"Secured network":"Open network",u?.saved&&" · Saved"]})})]}),o.jsxs("div",{className:"space-y-4",children:[_&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{htmlFor:"wifi-ssid",children:"Network Name (SSID)"}),o.jsx(wt,{id:"wifi-ssid",type:"text",value:R,onChange:le=>D(le.target.value),placeholder:"Enter network name",autoFocus:!0})]}),_e&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{htmlFor:"wifi-password",children:"Password"}),o.jsxs("div",{className:"relative",children:[o.jsx(wt,{id:"wifi-password",type:v?"text":"password",value:h,onChange:le=>p(le.target.value),placeholder:"Enter WiFi password",autoFocus:!_,onKeyDown:le=>{le.key==="Enter"&&h&&B()}}),o.jsx("button",{type:"button",onClick:()=>m(!v),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:o.jsx("span",{className:"material-icons text-sm",children:v?"visibility_off":"visibility"})})]})]}),_?o.jsxs("div",{className:"flex gap-2",children:[o.jsx(se,{variant:"outline",className:"flex-1",onClick:G,disabled:C||j||!R.trim()||!!_e&&!h,children:C?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"material-icons text-sm animate-spin mr-2",children:"refresh"}),"Saving..."]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"material-icons text-sm mr-2",children:"bookmark_add"}),"Save"]})}),o.jsx(se,{className:"flex-1",onClick:B,disabled:j||C||!R.trim()||!!_e&&!h,children:j?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"material-icons text-sm animate-spin mr-2",children:"refresh"}),"Connecting..."]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"material-icons text-sm mr-2",children:"wifi"}),"Connect"]})})]}):o.jsx(se,{className:"w-full",onClick:B,disabled:j||!!_e&&!h,children:j?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"material-icons text-sm animate-spin mr-2",children:"refresh"}),"Connecting..."]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"material-icons text-sm mr-2",children:"wifi"}),"Connect"]})})]})]})})]})}function Ese(){const e=kl(),[t,n]=g.useState(!1),a=()=>{const l=window.open("http://10.42.0.1","_blank");(!l||l.closed)&&n(!0)};return o.jsx("div",{className:"flex flex-col items-center justify-center min-h-[60vh] px-4",children:o.jsxs("div",{className:"w-full max-w-sm text-center space-y-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-semibold",children:"Welcome to Dune Weaver"}),o.jsx("p",{className:"text-muted-foreground mt-2",children:"What would you like to do?"})]}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("button",{onClick:()=>e("/wifi-setup"),className:"w-full rounded-lg bg-primary px-6 py-3 font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:"Connect to WiFi"}),o.jsx("button",{onClick:a,className:"w-full rounded-lg border border-border bg-muted px-6 py-3 font-medium hover:bg-accent transition-colors",children:"Control Table"})]}),t&&o.jsxs("div",{className:"rounded-lg bg-muted p-3 text-sm text-muted-foreground",children:["Open your browser and go to:",o.jsx("br",{}),o.jsx("code",{className:"mt-1 inline-block rounded bg-background px-2 py-0.5 text-foreground select-all",children:"http://10.42.0.1"})]})]})})}const G0=[{key:"precheck",label:"Pre-check"},{key:"home",label:"Home"},{key:"test-y",label:"Test Y"},{key:"test-x",label:"Test X"},{key:"fix",label:"Fix"},{key:"sanity-y",label:"Verify Y"},{key:"sanity-x",label:"Verify X"},{key:"complete",label:"Done"}];function Tse(e){return G0.findIndex(t=>t.key===e)}function Rse(){const e=un(m=>m.status?.connection_status??!1),t=un(m=>m.status?.is_running??!1),[n,a]=g.useState({step:"precheck",yCorrect:null,xCorrect:null,sending:!1,fixing:!1}),i=g.useCallback(async(m,b=!0)=>{b&&a(w=>({...w,sending:!0}));try{(await de.post("/api/fluidnc/command",{command:m})).success||K.error("Command failed")}catch(w){K.error(`Error: ${w instanceof Error?w.message:"Unknown error"}`)}finally{b&&a(w=>({...w,sending:!1}))}},[]),l=g.useCallback(async m=>{a(b=>({...b,fixing:!0}));try{await de.patch("/api/fluidnc/config",{axes:{[m]:{direction_inverted:!0}}}),K.success(`${m.toUpperCase()} direction toggled and saved`)}catch(b){K.error(`Fix failed: ${b instanceof Error?b.message:"Unknown"}`)}finally{a(b=>({...b,fixing:!1}))}},[]),u=g.useCallback(async()=>{a(m=>({...m,fixing:!0}));try{await de.post("/api/fluidnc/command",{command:"$Bye",timeout:2}),K.success("Restart command sent. Reconnect when ready.")}catch{K.info("Restart command sent. The controller will reboot.")}finally{a(m=>({...m,fixing:!1}))}},[]),d=g.useCallback(async(m=3e4)=>{const b=Date.now();for(;Date.now()-b<m;){await new Promise(w=>setTimeout(w,1e3));try{if((await de.post("/api/fluidnc/command",{command:"?",timeout:2})).responses?.some(j=>j.includes("Idle")))return!0}catch{}}return!1},[]),h=()=>a({step:"precheck",yCorrect:null,xCorrect:null,sending:!1,fixing:!1}),p=Tse(n.step),v=e&&!t;return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-2",children:G0.map((m,b)=>o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{type:"button",title:m.label,onClick:()=>a(w=>({...w,step:m.key})),className:`flex items-center justify-center w-7 h-7 rounded-full text-xs font-medium shrink-0 cursor-pointer transition-opacity hover:opacity-80 ${b<p?"bg-primary text-primary-foreground":b===p?"bg-primary text-primary-foreground ring-2 ring-primary/30":"bg-muted text-muted-foreground"}`,children:b<p?o.jsx("span",{className:"material-icons-outlined text-sm",children:"check"}):b+1}),b<G0.length-1&&o.jsx("div",{className:`w-4 h-0.5 ${b<p?"bg-primary":"bg-muted"}`})]},m.key))}),n.step==="precheck"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"font-semibold",children:"Pre-check"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Verify the table is connected and no pattern is running before calibrating motor directions."}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:`material-icons-outlined text-base ${e?"text-green-500":"text-red-500"}`,children:e?"check_circle":"cancel"}),o.jsx("span",{className:"text-sm",children:"Controller connected"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:`material-icons-outlined text-base ${t?"text-red-500":"text-green-500"}`,children:t?"cancel":"check_circle"}),o.jsx("span",{className:"text-sm",children:"No pattern running"})]})]}),o.jsx(se,{onClick:()=>a(m=>({...m,step:"home"})),disabled:!v,children:"Begin Calibration"})]}),n.step==="home"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"font-semibold",children:"Home Table"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Home the table to establish a known position before testing motor directions. The ball will move to the home position."}),o.jsxs("div",{className:"flex gap-3",children:[o.jsxs(se,{onClick:async()=>{a(m=>({...m,sending:!0}));try{await de.post("/send_home"),K.success("Homing complete"),a(m=>({...m,sending:!1,step:"test-y"}))}catch(m){K.error(`Homing failed: ${m instanceof Error?m.message:"Unknown error"}`),a(b=>({...b,sending:!1}))}},disabled:n.sending,children:[n.sending?o.jsx("span",{className:"material-icons-outlined animate-spin mr-2 text-base",children:"sync"}):o.jsx("span",{className:"material-icons-outlined mr-2 text-base",children:"home"}),n.sending?"Homing...":"Home Table"]}),o.jsx(se,{variant:"outline",onClick:()=>a(m=>({...m,step:"test-y"})),disabled:n.sending,children:"Skip"})]})]}),n.step==="test-y"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"font-semibold",children:"Test Y Axis (Radial)"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["This sends a small radial movement. Watch the ball and answer whether it moved ",o.jsx("strong",{children:"outward"})," (toward the perimeter)."]}),o.jsxs(se,{onClick:()=>i("$J=G91 G21 Y5 F100.0"),disabled:n.sending,children:[n.sending?o.jsx("span",{className:"material-icons-outlined animate-spin mr-2 text-base",children:"sync"}):o.jsx("span",{className:"material-icons-outlined mr-2 text-base",children:"play_arrow"}),"Send Test Command"]}),o.jsxs("div",{className:"flex gap-3 pt-2",children:[o.jsxs(se,{variant:"outline",onClick:()=>a(m=>({...m,yCorrect:!0,step:"test-x"})),disabled:n.sending,children:[o.jsx("span",{className:"material-icons-outlined mr-1 text-base text-green-500",children:"thumb_up"}),"Yes, moved outward"]}),o.jsxs(se,{variant:"outline",onClick:()=>a(m=>({...m,yCorrect:!1,step:"test-x"})),disabled:n.sending,children:[o.jsx("span",{className:"material-icons-outlined mr-1 text-base text-red-500",children:"thumb_down"}),"No, moved inward"]})]})]}),n.step==="test-x"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"font-semibold",children:"Test X Axis (Angular)"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["This sends a small angular movement. Watch the ball and answer whether it moved ",o.jsx("strong",{children:"clockwise"})," when viewed from above."]}),o.jsxs(se,{onClick:()=>i("$J=G91 G21 X5 F100.0"),disabled:n.sending,children:[n.sending?o.jsx("span",{className:"material-icons-outlined animate-spin mr-2 text-base",children:"sync"}):o.jsx("span",{className:"material-icons-outlined mr-2 text-base",children:"play_arrow"}),"Send Test Command"]}),o.jsxs("div",{className:"flex gap-3 pt-2",children:[o.jsxs(se,{variant:"outline",onClick:()=>{a(m=>({...m,xCorrect:!0,step:m.yCorrect===!1?"fix":"sanity-y"}))},disabled:n.sending,children:[o.jsx("span",{className:"material-icons-outlined mr-1 text-base text-green-500",children:"thumb_up"}),"Yes, moved clockwise"]}),o.jsxs(se,{variant:"outline",onClick:()=>a(m=>({...m,xCorrect:!1,step:"fix"})),disabled:n.sending,children:[o.jsx("span",{className:"material-icons-outlined mr-1 text-base text-red-500",children:"thumb_down"}),"No, moved counter-clockwise"]})]})]}),n.step==="fix"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"font-semibold",children:"Fix Motor Directions"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["The following axes need their direction inverted. Click to auto-fix by toggling the ",o.jsx("code",{children:":low"})," flag on the direction pin."]}),o.jsxs("div",{className:"space-y-3",children:[n.yCorrect===!1&&o.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-medium text-sm",children:"Y Axis (Radial)"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Direction is inverted"})]}),o.jsx(se,{size:"sm",onClick:()=>l("y"),disabled:n.fixing,children:n.fixing?"Fixing...":"Fix Automatically"})]}),n.xCorrect===!1&&o.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-medium text-sm",children:"X Axis (Angular)"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Direction is inverted"})]}),o.jsx(se,{size:"sm",onClick:()=>l("x"),disabled:n.fixing,children:n.fixing?"Fixing...":"Fix Automatically"})]})]}),o.jsxs(nr,{children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"warning"}),o.jsx(rr,{children:"Direction pin changes require a controller restart to take effect. After fixing, restart the controller below, then re-run the wizard to verify."})]}),o.jsxs("div",{className:"flex gap-3",children:[o.jsxs(se,{variant:"outline",onClick:u,disabled:n.fixing,children:[o.jsx("span",{className:"material-icons-outlined mr-2 text-base",children:"restart_alt"}),"Restart Controller"]}),o.jsx(se,{onClick:()=>a(m=>({...m,step:"sanity-y"})),children:"Continue to Verification"})]})]}),n.step==="sanity-y"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"font-semibold",children:"Verify Y Axis (Larger Movement)"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["This moves the ball to center first, then sends a longer radial movement. The ball should move clearly from ",o.jsx("strong",{children:"center toward the perimeter"}),"."]}),o.jsxs(se,{onClick:async()=>{a(m=>({...m,sending:!0}));try{await de.post("/move_to_center"),await d(6e4),await i("$J=G91 G21 Y20 F100.0",!1),await d()}finally{a(m=>({...m,sending:!1}))}},disabled:n.sending,children:[n.sending?o.jsx("span",{className:"material-icons-outlined animate-spin mr-2 text-base",children:"sync"}):o.jsx("span",{className:"material-icons-outlined mr-2 text-base",children:"play_arrow"}),n.sending?"Moving...":"Send Verification Command"]}),o.jsxs("div",{className:"flex flex-wrap gap-3 pt-2",children:[o.jsxs(se,{onClick:()=>a(m=>({...m,step:"sanity-x"})),disabled:n.sending,children:[o.jsx("span",{className:"material-icons-outlined mr-1 text-base text-green-500",children:"check"}),"Looks Correct"]}),o.jsxs(se,{variant:"outline",onClick:()=>a(m=>({...m,step:"dip-check"})),disabled:n.sending,children:[o.jsx("span",{className:"material-icons-outlined mr-1 text-base text-amber-500",children:"warning"}),"Only Moved Halfway"]}),o.jsx(se,{variant:"outline",onClick:h,disabled:n.sending,children:"Start Over"})]})]}),n.step==="sanity-x"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"font-semibold",children:"Verify X Axis (Larger Movement)"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["This sends a larger angular movement. The ball should make roughly a ",o.jsx("strong",{children:"full clockwise rotation"}),". It will also spiral inward slightly — this is normal due to the mechanical coupling between the angular and radial axes."]}),o.jsxs(se,{onClick:async()=>{a(m=>({...m,sending:!0}));try{await i("$J=G91 G21 X50 F100.0",!1),await d()}finally{a(m=>({...m,sending:!1}))}},disabled:n.sending,children:[n.sending?o.jsx("span",{className:"material-icons-outlined animate-spin mr-2 text-base",children:"sync"}):o.jsx("span",{className:"material-icons-outlined mr-2 text-base",children:"play_arrow"}),n.sending?"Moving...":"Send Verification Command"]}),o.jsxs("div",{className:"flex flex-wrap gap-3 pt-2",children:[o.jsxs(se,{onClick:()=>a(m=>({...m,step:"complete"})),disabled:n.sending,children:[o.jsx("span",{className:"material-icons-outlined mr-1 text-base text-green-500",children:"check"}),"Looks Correct"]}),o.jsxs(se,{variant:"outline",onClick:()=>a(m=>({...m,step:"dip-check"})),disabled:n.sending,children:[o.jsx("span",{className:"material-icons-outlined mr-1 text-base text-amber-500",children:"warning"}),"Only Half a Revolution"]}),o.jsx(se,{variant:"outline",onClick:h,disabled:n.sending,children:"Start Over"})]})]}),n.step==="dip-check"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"font-semibold",children:"Check DIP Switches"}),o.jsxs(nr,{variant:"destructive",children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"power_off"}),o.jsxs(rr,{children:[o.jsx("strong",{children:"Turn off the table completely"})," before touching any hardware. Disconnect power before checking DIP switches."]})]}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["If the ball only moved ",o.jsx("strong",{children:"half the expected distance"}),", the stepper driver microstepping DIP switches are likely misconfigured."]}),o.jsxs("div",{className:"rounded-lg border p-4 space-y-3 bg-muted/30",children:[o.jsx("p",{className:"text-sm font-medium",children:"How to fix:"}),o.jsxs("ol",{className:"text-sm text-muted-foreground list-decimal list-inside space-y-2",children:[o.jsx("li",{children:"Power off the table completely"}),o.jsx("li",{children:"Locate the DIP switches underneath each stepper driver"}),o.jsxs("li",{children:["Set ",o.jsx("strong",{children:"all DIP switches to OFF"})," (this selects full-step or the driver's default microstepping)"]}),o.jsx("li",{children:"Power the table back on and re-run the calibration wizard"})]})]}),o.jsx("div",{className:"flex gap-3",children:o.jsx(se,{variant:"outline",onClick:h,children:"Restart Wizard"})})]}),n.step==="complete"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-2 text-green-600",children:[o.jsx("span",{className:"material-icons-outlined text-2xl",children:"check_circle"}),o.jsx("h3",{className:"font-semibold text-lg",children:"Calibration Complete"})]}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Both axes are moving in the correct directions. Your table is ready to use."}),o.jsx(se,{variant:"outline",onClick:h,children:"Run Again"})]})]})}const Ase=[{key:"steps_per_mm",label:"Steps per mm",unit:"steps"},{key:"max_rate_mm_per_min",label:"Max Rate",unit:"mm/min"},{key:"acceleration_mm_per_sec2",label:"Acceleration",unit:"mm/s²"}],Ose=[{key:"homing_cycle",label:"Homing Cycle",unit:"-1 = disabled"},{key:"homing_mpos_mm",label:"Homing MPos",unit:"mm"},{key:"homing_feed_mm_per_min",label:"Homing Feed Rate",unit:"mm/min"},{key:"homing_seek_mm_per_min",label:"Homing Seek Rate",unit:"mm/min"},{key:"homing_settle_ms",label:"Homing Settle Time",unit:"ms"},{key:"homing_seek_scaler",label:"Homing Seek Scaler",unit:""},{key:"homing_feed_scaler",label:"Homing Feed Scaler",unit:""},{key:"pulloff_mm",label:"Pulloff Distance",unit:"mm"}],Mse=[{key:"homing_positive_direction",label:"Positive Direction"}];function Dse(){const e=un(w=>w.status?.connection_status??!1),[t,n]=g.useState(null),[a,i]=g.useState(null),[l,u]=g.useState(!1),[d,h]=g.useState(!1),p=g.useCallback(async()=>{u(!0);try{const w=await de.get("/api/fluidnc/config");w.success&&(n(w.settings),i(structuredClone(w.settings)),K.success("Configuration loaded from controller"))}catch(w){K.error(`Failed to read config: ${w instanceof Error?w.message:"Unknown"}`)}finally{u(!1)}},[]),v=g.useCallback(async()=>{if(!(!t||!a)){h(!0);try{const w={};for(const S of["x","y"]){const C={},N=t.axes[S],_=a.axes[S];for(const T of Object.keys(N))T!=="direction_pin"&&N[T]!==_[T]&&N[T]!==null&&(C[T]=N[T]);Object.keys(C).length>0&&(w.axes||(w.axes={}),w.axes[S]=C)}if(t.start.must_home!==a.start.must_home&&t.start.must_home!==null&&(w.start={must_home:t.start.must_home}),!w.axes&&!w.start){K.info("No changes to save"),h(!1);return}const j=await de.patch("/api/fluidnc/config",w);j.success&&(i(structuredClone(t)),j.restart_required?K.warning("Settings saved. Direction pin changes require a controller restart."):j.saved?K.success(`Saved ${j.changes_applied.length} setting(s) to controller`):K.warning("Settings applied but flash save may have failed"))}catch(w){K.error(`Save failed: ${w instanceof Error?w.message:"Unknown"}`)}finally{h(!1)}}},[t,a]),m=(w,j,S)=>{n(C=>C&&{...C,axes:{...C.axes,[w]:{...C.axes[w],[j]:S}}})},b=t&&a?JSON.stringify(t)!==JSON.stringify(a):!1;return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(se,{onClick:p,disabled:l||!e,children:[l?o.jsx("span",{className:"material-icons-outlined animate-spin mr-2 text-base",children:"sync"}):o.jsx("span",{className:"material-icons-outlined mr-2 text-base",children:"download"}),l?"Reading...":"Read from Controller"]}),t&&o.jsxs(se,{onClick:v,disabled:d||!b,children:[d?o.jsx("span",{className:"material-icons-outlined animate-spin mr-2 text-base",children:"sync"}):o.jsx("span",{className:"material-icons-outlined mr-2 text-base",children:"save"}),d?"Saving...":"Save to Controller"]}),b&&o.jsx(Al,{variant:"secondary",children:"Unsaved changes"})]}),!e&&o.jsxs(nr,{children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"link_off"}),o.jsx(rr,{children:"Connect to a controller first to read or modify FluidNC settings."})]}),t&&o.jsx(l1,{type:"multiple",defaultValue:["axis-x","axis-y"],children:["x","y"].map(w=>o.jsxs(Fn,{value:`axis-${w}`,className:"border rounded-lg px-4 mt-2 bg-card",children:[o.jsx(Hn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:w==="x"?"rotate_right":"swap_vert"}),o.jsxs("div",{className:"text-left",children:[o.jsxs("div",{className:"font-semibold",children:[w.toUpperCase()," Axis — ",w==="x"?"Angular":"Radial"]}),o.jsxs("div",{className:"text-sm text-muted-foreground font-normal",children:["Movement, direction, and homing for the ",w==="x"?"angular":"radial"," motor"]})]})]})}),o.jsxs(Un,{className:"pt-4 pb-6 space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Movement"}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:Ase.map(j=>o.jsxs("div",{className:"space-y-1",children:[o.jsx(Ye,{className:"text-xs text-muted-foreground",children:j.label}),o.jsx(wt,{type:"number",step:"any",value:t.axes[w][j.key]??"",onChange:S=>m(w,j.key,S.target.value?parseFloat(S.target.value):null),placeholder:j.unit})]},j.key))})]}),o.jsx(Xn,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Direction"}),o.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border",children:[o.jsx("div",{children:t.axes[w].direction_pin!==null?o.jsxs("p",{className:"text-xs text-muted-foreground font-mono",children:["Pin: ",t.axes[w].direction_pin]}):o.jsx("p",{className:"text-xs text-muted-foreground",children:"Not available (may not be a stepstick driver)"})}),t.axes[w].direction_inverted!==null&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ye,{className:"text-sm",children:"Inverted"}),o.jsx(gr,{checked:t.axes[w].direction_inverted??!1,onCheckedChange:j=>m(w,"direction_inverted",j)})]})]})]}),o.jsx(Xn,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Homing"}),o.jsx("div",{className:"space-y-3",children:Mse.map(j=>o.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg border",children:[o.jsx(Ye,{className:"text-sm",children:j.label}),o.jsx(gr,{checked:t.axes[w][j.key]??!1,onCheckedChange:S=>m(w,j.key,S)})]},j.key))}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:Ose.map(j=>o.jsxs("div",{className:"space-y-1",children:[o.jsx(Ye,{className:"text-xs text-muted-foreground",children:j.label}),o.jsx(wt,{type:"number",step:"any",value:t.axes[w][j.key]??"",onChange:S=>m(w,j.key,S.target.value?parseFloat(S.target.value):null),placeholder:j.unit})]},j.key))})]})]})]},w))})]})}function Pse(){const e=kl();return o.jsxs("div",{className:"max-w-4xl mx-auto space-y-6 p-4 pb-32",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(se,{variant:"ghost",size:"icon",onClick:()=>e("/settings"),children:o.jsx("span",{className:"material-icons-outlined",children:"arrow_back"})}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-bold",children:"Hardware Setup"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Calibrate motors and configure FluidNC settings"})]})]}),o.jsxs(nr,{children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"info"}),o.jsxs(rr,{children:["This page is for ",o.jsx("strong",{children:"FluidNC-based boards with bipolar stepper motors"})," (DLC32, MKS boards). Not applicable to unipolar/28BYJ-48 setups."]})]}),o.jsxs(l1,{type:"multiple",defaultValue:["calibration","config"],children:[o.jsxs(Fn,{value:"calibration",className:"border rounded-lg px-4 bg-card",children:[o.jsx(Hn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"tune"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Calibration Wizard"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Verify and fix motor directions step by step"})]})]})}),o.jsx(Un,{className:"pt-4 pb-6",children:o.jsx(Rse,{})})]}),o.jsxs(Fn,{value:"config",className:"border rounded-lg px-4 mt-2 bg-card",children:[o.jsx(Hn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"settings"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"FluidNC Configuration"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Read and edit curated controller settings"})]})]})}),o.jsxs(Un,{className:"pt-4 pb-6",forceMount:!0,children:[o.jsxs(nr,{className:"mb-4",children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"warning"}),o.jsx(rr,{children:"These are low-level FluidNC firmware settings. Only modify them if you understand what each parameter does — incorrect values can cause erratic movement or prevent the table from working."})]}),o.jsx(Dse,{})]})]})]})]})}const kse=({...e})=>{const[t,n]=g.useState("light");return g.useEffect(()=>{const a=document.documentElement.classList.contains("dark");n(a?"dark":"light");const i=new MutationObserver(l=>{l.forEach(u=>{if(u.attributeName==="class"){const d=document.documentElement.classList.contains("dark");n(d?"dark":"light")}})});return i.observe(document.documentElement,{attributes:!0}),()=>i.disconnect()},[]),o.jsx(Zz,{theme:t,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})};function Lse(){return o.jsxs(X9,{children:[o.jsx(m6,{children:o.jsxs(Ma,{path:"/",element:o.jsx(LY,{}),children:[o.jsx(Ma,{index:!0,element:o.jsx(ZW,{})}),o.jsx(Ma,{path:"playlists",element:o.jsx(eX,{})}),o.jsx(Ma,{path:"table-control",element:o.jsx(_X,{})}),o.jsx(Ma,{path:"led",element:o.jsx(Bae,{})}),o.jsx(Ma,{path:"settings",element:o.jsx(Nse,{})}),o.jsx(Ma,{path:"wifi-setup",element:o.jsx(_se,{})}),o.jsx(Ma,{path:"captive",element:o.jsx(Ese,{})}),o.jsx(Ma,{path:"setup",element:o.jsx(Pse,{})})]})}),o.jsx(kse,{position:"top-center",richColors:!0,closeButton:!0})]})}const Bse=new jz({defaultOptions:{queries:{staleTime:1e3*60,retry:1}}});gI.createRoot(document.getElementById("root")).render(o.jsx(g.StrictMode,{children:o.jsx(F6,{children:o.jsx(Nz,{client:Bse,children:o.jsx(Lse,{})})})}))});export default Ise();