index-ZKmcHv9J.js 980 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. var ML=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Mne=ML((Nr,Er)=>{function PL(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 hf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ul(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yg={exports:{}},Zc={};var WC;function DL(){if(WC)return Zc;WC=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 Zc.Fragment=t,Zc.jsx=n,Zc.jsxs=n,Zc}var XC;function kL(){return XC||(XC=1,yg.exports=DL()),yg.exports}var o=kL(),bg={exports:{}},pt={};var QC;function LL(){if(QC)return pt;QC=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"),g=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),b=Symbol.iterator;function S(L){return L===null||typeof L!="object"?null:(L=b&&L[b]||L["@@iterator"],typeof L=="function"?L:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,C={};function N(L,re,z){this.props=L,this.context=re,this.refs=C,this.updater=z||j}N.prototype.isReactComponent={},N.prototype.setState=function(L,re){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,re,"setState")},N.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function _(){}_.prototype=N.prototype;function T(L,re,z){this.props=L,this.context=re,this.refs=C,this.updater=z||j}var O=T.prototype=new _;O.constructor=T,w(O,N.prototype),O.isPureReactComponent=!0;var M=Array.isArray;function B(){}var k={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function W(L,re,z){var ee=z.ref;return{$$typeof:e,type:L,key:re,ref:ee!==void 0?ee:null,props:z}}function ce(L,re){return W(L.type,re,L.props)}function G(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function ie(L){var re={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(z){return re[z]})}var Q=/\/+/g;function Z(L,re){return typeof L=="object"&&L!==null&&L.key!=null?ie(""+L.key):re.toString(36)}function ve(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(B,B):(L.status="pending",L.then(function(re){L.status==="pending"&&(L.status="fulfilled",L.value=re)},function(re){L.status==="pending"&&(L.status="rejected",L.reason=re)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function P(L,re,z,ee,xe){var Ne=typeof L;(Ne==="undefined"||Ne==="boolean")&&(L=null);var fe=!1;if(L===null)fe=!0;else switch(Ne){case"bigint":case"string":case"number":fe=!0;break;case"object":switch(L.$$typeof){case e:case t:fe=!0;break;case g:return fe=L._init,P(fe(L._payload),re,z,ee,xe)}}if(fe)return xe=xe(L),fe=ee===""?"."+Z(L,0):ee,M(xe)?(z="",fe!=null&&(z=fe.replace(Q,"$&/")+"/"),P(xe,re,z,"",function(ke){return ke})):xe!=null&&(G(xe)&&(xe=ce(xe,z+(xe.key==null||L&&L.key===xe.key?"":(""+xe.key).replace(Q,"$&/")+"/")+fe)),re.push(xe)),1;fe=0;var Ce=ee===""?".":ee+":";if(M(L))for(var Pe=0;Pe<L.length;Pe++)ee=L[Pe],Ne=Ce+Z(ee,Pe),fe+=P(ee,re,z,Ne,xe);else if(Pe=S(L),typeof Pe=="function")for(L=Pe.call(L),Pe=0;!(ee=L.next()).done;)ee=ee.value,Ne=Ce+Z(ee,Pe++),fe+=P(ee,re,z,Ne,xe);else if(Ne==="object"){if(typeof L.then=="function")return P(ve(L),re,z,ee,xe);throw re=String(L),Error("Objects are not valid as a React child (found: "+(re==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":re)+"). If you meant to render a collection of children, use an array instead.")}return fe}function V(L,re,z){if(L==null)return L;var ee=[],xe=0;return P(L,ee,"","",function(Ne){return re.call(z,Ne,xe++)}),ee}function H(L){if(L._status===-1){var re=L._result;re=re(),re.then(function(z){(L._status===0||L._status===-1)&&(L._status=1,L._result=z)},function(z){(L._status===0||L._status===-1)&&(L._status=2,L._result=z)}),L._status===-1&&(L._status=0,L._result=re)}if(L._status===1)return L._result.default;throw L._result}var se=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var re=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(re))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},we={map:V,forEach:function(L,re,z){V(L,function(){re.apply(this,arguments)},z)},count:function(L){var re=0;return V(L,function(){re++}),re},toArray:function(L){return V(L,function(re){return re})||[]},only:function(L){if(!G(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return pt.Activity=m,pt.Children=we,pt.Component=N,pt.Fragment=n,pt.Profiler=i,pt.PureComponent=T,pt.StrictMode=a,pt.Suspense=h,pt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=k,pt.__COMPILER_RUNTIME={__proto__:null,c:function(L){return k.H.useMemoCache(L)}},pt.cache=function(L){return function(){return L.apply(null,arguments)}},pt.cacheSignal=function(){return null},pt.cloneElement=function(L,re,z){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var ee=w({},L.props),xe=L.key;if(re!=null)for(Ne in re.key!==void 0&&(xe=""+re.key),re)!F.call(re,Ne)||Ne==="key"||Ne==="__self"||Ne==="__source"||Ne==="ref"&&re.ref===void 0||(ee[Ne]=re[Ne]);var Ne=arguments.length-2;if(Ne===1)ee.children=z;else if(1<Ne){for(var fe=Array(Ne),Ce=0;Ce<Ne;Ce++)fe[Ce]=arguments[Ce+2];ee.children=fe}return W(L.type,xe,ee)},pt.createContext=function(L){return L={$$typeof:u,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:l,_context:L},L},pt.createElement=function(L,re,z){var ee,xe={},Ne=null;if(re!=null)for(ee in re.key!==void 0&&(Ne=""+re.key),re)F.call(re,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(xe[ee]=re[ee]);var fe=arguments.length-2;if(fe===1)xe.children=z;else if(1<fe){for(var Ce=Array(fe),Pe=0;Pe<fe;Pe++)Ce[Pe]=arguments[Pe+2];xe.children=Ce}if(L&&L.defaultProps)for(ee in fe=L.defaultProps,fe)xe[ee]===void 0&&(xe[ee]=fe[ee]);return W(L,Ne,xe)},pt.createRef=function(){return{current:null}},pt.forwardRef=function(L){return{$$typeof:d,render:L}},pt.isValidElement=G,pt.lazy=function(L){return{$$typeof:g,_payload:{_status:-1,_result:L},_init:H}},pt.memo=function(L,re){return{$$typeof:p,type:L,compare:re===void 0?null:re}},pt.startTransition=function(L){var re=k.T,z={};k.T=z;try{var ee=L(),xe=k.S;xe!==null&&xe(z,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(B,se)}catch(Ne){se(Ne)}finally{re!==null&&z.types!==null&&(re.types=z.types),k.T=re}},pt.unstable_useCacheRefresh=function(){return k.H.useCacheRefresh()},pt.use=function(L){return k.H.use(L)},pt.useActionState=function(L,re,z){return k.H.useActionState(L,re,z)},pt.useCallback=function(L,re){return k.H.useCallback(L,re)},pt.useContext=function(L){return k.H.useContext(L)},pt.useDebugValue=function(){},pt.useDeferredValue=function(L,re){return k.H.useDeferredValue(L,re)},pt.useEffect=function(L,re){return k.H.useEffect(L,re)},pt.useEffectEvent=function(L){return k.H.useEffectEvent(L)},pt.useId=function(){return k.H.useId()},pt.useImperativeHandle=function(L,re,z){return k.H.useImperativeHandle(L,re,z)},pt.useInsertionEffect=function(L,re){return k.H.useInsertionEffect(L,re)},pt.useLayoutEffect=function(L,re){return k.H.useLayoutEffect(L,re)},pt.useMemo=function(L,re){return k.H.useMemo(L,re)},pt.useOptimistic=function(L,re){return k.H.useOptimistic(L,re)},pt.useReducer=function(L,re,z){return k.H.useReducer(L,re,z)},pt.useRef=function(L){return k.H.useRef(L)},pt.useState=function(L){return k.H.useState(L)},pt.useSyncExternalStore=function(L,re,z){return k.H.useSyncExternalStore(L,re,z)},pt.useTransition=function(){return k.H.useTransition()},pt.version="19.2.3",pt}var ZC;function lo(){return ZC||(ZC=1,bg.exports=LL()),bg.exports}var v=lo();const A=Ul(v),h0=PL({__proto__:null,default:A},[v]);var wg={exports:{}},Jc={},Sg={exports:{}},jg={};var JC;function BL(){return JC||(JC=1,(function(e){function t(P,V){var H=P.length;P.push(V);e:for(;0<H;){var se=H-1>>>1,we=P[se];if(0<i(we,V))P[se]=V,P[H]=we,H=se;else break e}}function n(P){return P.length===0?null:P[0]}function a(P){if(P.length===0)return null;var V=P[0],H=P.pop();if(H!==V){P[0]=H;e:for(var se=0,we=P.length,L=we>>>1;se<L;){var re=2*(se+1)-1,z=P[re],ee=re+1,xe=P[ee];if(0>i(z,H))ee<we&&0>i(xe,z)?(P[se]=xe,P[ee]=H,se=ee):(P[se]=z,P[re]=H,se=re);else if(ee<we&&0>i(xe,H))P[se]=xe,P[ee]=H,se=ee;else break e}}return V}function i(P,V){var H=P.sortIndex-V.sortIndex;return H!==0?H:P.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=[],g=1,m=null,b=3,S=!1,j=!1,w=!1,C=!1,N=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function O(P){for(var V=n(p);V!==null;){if(V.callback===null)a(p);else if(V.startTime<=P)a(p),V.sortIndex=V.expirationTime,t(h,V);else break;V=n(p)}}function M(P){if(w=!1,O(P),!j)if(n(h)!==null)j=!0,B||(B=!0,ie());else{var V=n(p);V!==null&&ve(M,V.startTime-P)}}var B=!1,k=-1,F=5,W=-1;function ce(){return C?!0:!(e.unstable_now()-W<F)}function G(){if(C=!1,B){var P=e.unstable_now();W=P;var V=!0;try{e:{j=!1,w&&(w=!1,_(k),k=-1),S=!0;var H=b;try{t:{for(O(P),m=n(h);m!==null&&!(m.expirationTime>P&&ce());){var se=m.callback;if(typeof se=="function"){m.callback=null,b=m.priorityLevel;var we=se(m.expirationTime<=P);if(P=e.unstable_now(),typeof we=="function"){m.callback=we,O(P),V=!0;break t}m===n(h)&&a(h),O(P)}else a(h);m=n(h)}if(m!==null)V=!0;else{var L=n(p);L!==null&&ve(M,L.startTime-P),V=!1}}break e}finally{m=null,b=H,S=!1}V=void 0}}finally{V?ie():B=!1}}}var ie;if(typeof T=="function")ie=function(){T(G)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,Z=Q.port2;Q.port1.onmessage=G,ie=function(){Z.postMessage(null)}}else ie=function(){N(G,0)};function ve(P,V){k=N(function(){P(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(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(P){switch(b){case 1:case 2:case 3:var V=3;break;default:V=b}var H=b;b=V;try{return P()}finally{b=H}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(P,V){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var H=b;b=P;try{return V()}finally{b=H}},e.unstable_scheduleCallback=function(P,V,H){var se=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?se+H:se):H=se,P){case 1:var we=-1;break;case 2:we=250;break;case 5:we=1073741823;break;case 4:we=1e4;break;default:we=5e3}return we=H+we,P={id:g++,callback:V,priorityLevel:P,startTime:H,expirationTime:we,sortIndex:-1},H>se?(P.sortIndex=H,t(p,P),n(h)===null&&P===n(p)&&(w?(_(k),k=-1):w=!0,ve(M,H-se))):(P.sortIndex=we,t(h,P),j||S||(j=!0,B||(B=!0,ie()))),P},e.unstable_shouldYield=ce,e.unstable_wrapCallback=function(P){var V=b;return function(){var H=b;b=V;try{return P.apply(this,arguments)}finally{b=H}}}})(jg)),jg}var eN;function FL(){return eN||(eN=1,Sg.exports=BL()),Sg.exports}var Cg={exports:{}},$n={};var tN;function IL(){if(tN)return $n;tN=1;var e=lo();function t(h){var p="https://react.dev/errors/"+h;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)p+="&args[]="+encodeURIComponent(arguments[g])}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,g){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:g}}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 $n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,$n.createPortal=function(h,p){var g=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,g)},$n.flushSync=function(h){var p=u.T,g=a.p;try{if(u.T=null,a.p=2,h)return h()}finally{u.T=p,a.p=g,a.d.f()}},$n.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))},$n.prefetchDNS=function(h){typeof h=="string"&&a.d.D(h)},$n.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var g=p.as,m=d(g,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;g==="style"?a.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:m,integrity:b,fetchPriority:S}):g==="script"&&a.d.X(h,{crossOrigin:m,integrity:b,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},$n.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var g=d(p.as,p.crossOrigin);a.d.M(h,{crossOrigin:g,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)},$n.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var g=p.as,m=d(g,p.crossOrigin);a.d.L(h,g,{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})}},$n.preloadModule=function(h,p){if(typeof h=="string")if(p){var g=d(p.as,p.crossOrigin);a.d.m(h,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else a.d.m(h)},$n.requestFormReset=function(h){a.d.r(h)},$n.unstable_batchedUpdates=function(h,p){return h(p)},$n.useFormState=function(h,p,g){return u.H.useFormState(h,p,g)},$n.useFormStatus=function(){return u.H.useHostTransitionStatus()},$n.version="19.2.3",$n}var nN;function CR(){if(nN)return Cg.exports;nN=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(),Cg.exports=IL(),Cg.exports}var rN;function zL(){if(rN)return Jc;rN=1;var e=FL(),t=lo(),n=CR();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,R=x.child;R;){if(R===c){E=!0,c=x,f=y;break}if(R===f){E=!0,f=x,c=y;break}R=R.sibling}if(!E){for(R=y.child;R;){if(R===c){E=!0,c=y,f=x;break}if(R===f){E=!0,f=y,c=x;break}R=R.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 g(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r;for(r=r.child;r!==null;){if(s=g(r),s!==null)return s;r=r.sibling}return null}var m=Object.assign,b=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),T=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),ce=Symbol.for("react.memo_cache_sentinel"),G=Symbol.iterator;function ie(r){return r===null||typeof r!="object"?null:(r=G&&r[G]||r["@@iterator"],typeof r=="function"?r:null)}var Q=Symbol.for("react.client.reference");function Z(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===Q?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case w:return"Fragment";case N:return"Profiler";case C:return"StrictMode";case M:return"Suspense";case B:return"SuspenseList";case W: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 O: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:Z(r.type)||"Memo";case F:s=r._payload,r=r._init;try{return Z(r(s))}catch{}}return null}var ve=Array.isArray,P=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},se=[],we=-1;function L(r){return{current:r}}function re(r){0>we||(r.current=se[we],se[we]=null,we--)}function z(r,s){we++,se[we]=r.current,r.current=s}var ee=L(null),xe=L(null),Ne=L(null),fe=L(null);function Ce(r,s){switch(z(Ne,s),z(xe,r),z(ee,null),s.nodeType){case 9:case 11:r=(r=s.documentElement)&&(r=r.namespaceURI)?xC(r):0;break;default:if(r=s.tagName,s=s.namespaceURI)s=xC(s),r=yC(s,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}re(ee),z(ee,r)}function Pe(){re(ee),re(xe),re(Ne)}function ke(r){r.memoizedState!==null&&z(fe,r);var s=ee.current,c=yC(s,r.type);s!==c&&(z(xe,r),z(ee,c))}function Ue(r){xe.current===r&&(re(ee),re(xe)),fe.current===r&&(re(fe),Yc._currentValue=H)}var pe,it;function st(r){if(pe===void 0)try{throw Error()}catch(c){var s=c.stack.trim().match(/\n( *(at )?)/);pe=s&&s[1]||"",it=-1<c.stack.indexOf(`
  2. at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
  3. `+pe+r+it}var Me=!1;function ot(r,s){if(!r||Me)return"";Me=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(s){var ge=function(){throw Error()};if(Object.defineProperty(ge.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ge,[])}catch(oe){var ae=oe}Reflect.construct(r,[],ge)}else{try{ge.call()}catch(oe){ae=oe}r.call(ge.prototype)}}else{try{throw Error()}catch(oe){ae=oe}(ge=r())&&typeof ge.catch=="function"&&ge.catch(function(){})}}catch(oe){if(oe&&ae&&typeof oe.stack=="string")return[oe.stack,ae.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],R=y[1];if(E&&R){var U=E.split(`
  4. `),ne=R.split(`
  5. `);for(x=f=0;f<U.length&&!U[f].includes("DetermineComponentFrameRoot");)f++;for(;x<ne.length&&!ne[x].includes("DetermineComponentFrameRoot");)x++;if(f===U.length||x===ne.length)for(f=U.length-1,x=ne.length-1;1<=f&&0<=x&&U[f]!==ne[x];)x--;for(;1<=f&&0<=x;f--,x--)if(U[f]!==ne[x]){if(f!==1||x!==1)do if(f--,x--,0>x||U[f]!==ne[x]){var he=`
  6. `+U[f].replace(" at new "," at ");return r.displayName&&he.includes("<anonymous>")&&(he=he.replace("<anonymous>",r.displayName)),he}while(1<=f&&0<=x);break}}}finally{Me=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?st(c):""}function $e(r,s){switch(r.tag){case 26:case 27:case 5:return st(r.type);case 16:return st("Lazy");case 13:return r.child!==s&&s!==null?st("Suspense Fallback"):st("Suspense");case 19:return st("SuspenseList");case 0:case 15:return ot(r.type,!1);case 11:return ot(r.type.render,!1);case 1:return ot(r.type,!0);case 31:return st("Activity");default:return""}}function Vt(r){try{var s="",c=null;do s+=$e(r,c),c=r,r=r.return;while(r);return s}catch(f){return`
  7. Error generating stack: `+f.message+`
  8. `+f.stack}}var dt=Object.prototype.hasOwnProperty,Lt=e.unstable_scheduleCallback,yt=e.unstable_cancelCallback,ft=e.unstable_shouldYield,Ge=e.unstable_requestPaint,ht=e.unstable_now,Ct=e.unstable_getCurrentPriorityLevel,Jt=e.unstable_ImmediatePriority,Wt=e.unstable_UserBlockingPriority,Xt=e.unstable_NormalPriority,de=e.unstable_LowPriority,De=e.unstable_IdlePriority,Te=e.log,Be=e.unstable_setDisableYieldValue,_e=null,We=null;function Nt(r){if(typeof Te=="function"&&Be(r),We&&typeof We.setStrictMode=="function")try{We.setStrictMode(_e,r)}catch{}}var bt=Math.clz32?Math.clz32:qt,Tt=Math.log,Rn=Math.LN2;function qt(r){return r>>>=0,r===0?32:31-(Tt(r)/Rn|0)|0}var $t=256,It=262144,Pt=4194304;function jt(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 q(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 R=f&134217727;return R!==0?(f=R&~y,f!==0?x=jt(f):(E&=R,E!==0?x=jt(E):c||(c=R&~r,c!==0&&(x=jt(c))))):(R=f&~y,R!==0?x=jt(R):E!==0?x=jt(E):c||(c=f&~r,c!==0&&(x=jt(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 Oe(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 Ve(){var r=Pt;return Pt<<=1,(Pt&62914560)===0&&(Pt=4194304),r}function At(r){for(var s=[],c=0;31>c;c++)s.push(r);return s}function tt(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Ut(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 R=r.entanglements,U=r.expirationTimes,ne=r.hiddenUpdates;for(c=E&~c;0<c;){var he=31-bt(c),ge=1<<he;R[he]=0,U[he]=-1;var ae=ne[he];if(ae!==null)for(ne[he]=null,he=0;he<ae.length;he++){var oe=ae[he];oe!==null&&(oe.lane&=-536870913)}c&=~ge}f!==0&&J(r,f,0),y!==0&&x===0&&r.tag!==0&&(r.suspendedLanes|=y&~(E&~s))}function J(r,s,c){r.pendingLanes|=s,r.suspendedLanes&=~s;var f=31-bt(s);r.entangledLanes|=s,r.entanglements[f]=r.entanglements[f]|1073741824|c&261930}function ye(r,s){var c=r.entangledLanes|=s;for(r=r.entanglements;c;){var f=31-bt(c),x=1<<f;x&s|r[f]&s&&(r[f]|=s),c&=~x}}function Re(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 I(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function be(){var r=V.p;return r!==0?r:(r=window.event,r===void 0?32:UC(r.type))}function Ze(r,s){var c=V.p;try{return V.p=r,s()}finally{V.p=c}}var Je=Math.random().toString(36).slice(2),at="__reactFiber$"+Je,mt="__reactProps$"+Je,dn="__reactContainer$"+Je,D="__reactEvents$"+Je,Ee="__reactListeners$"+Je,et="__reactHandles$"+Je,zt="__reactResources$"+Je,Or="__reactMarker$"+Je;function na(r){delete r[at],delete r[mt],delete r[D],delete r[Ee],delete r[et]}function Ra(r){var s=r[at];if(s)return s;for(var c=r.parentNode;c;){if(s=c[dn]||c[at]){if(c=s.alternate,s.child!==null||c!==null&&c.child!==null)for(r=EC(r);r!==null;){if(c=r[at])return c;r=EC(r)}return s}r=c,c=r.parentNode}return null}function ra(r){if(r=r[at]||r[dn]){var s=r.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return r}return null}function Bs(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r.stateNode;throw Error(a(33))}function aa(r){var s=r[zt];return s||(s=r[zt]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function jn(r){r[Or]=!0}var _i=new Set,sc={};function Oa(r,s){Ja(r,s),Ja(r+"Capture",s)}function Ja(r,s){for(sc[r]=s,r=0;r<s.length;r++)_i.add(s[r])}var ad=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]*$"),ic={},Fs={};function oc(r){return dt.call(Fs,r)?!0:dt.call(ic,r)?!1:ad.test(r)?Fs[r]=!0:(ic[r]=!0,!1)}function Ti(r,s,c){if(oc(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 xo(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 Mr(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 Jn(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function lc(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function sd(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 yo(r){if(!r._valueTracker){var s=lc(r)?"checked":"value";r._valueTracker=sd(r,s,""+r[s])}}function cc(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var c=s.getValue(),f="";return r&&(f=lc(r)?r.checked?"true":"false":r.value),r=f,r!==c?(s.setValue(r),!0):!1}function Ai(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 bp=/[\n"\\]/g;function Cn(r){return r.replace(bp,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function bo(r,s,c,f,x,y,E,R){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=""+Jn(s)):r.value!==""+Jn(s)&&(r.value=""+Jn(s)):E!=="submit"&&E!=="reset"||r.removeAttribute("value"),s!=null?uc(r,E,Jn(s)):c!=null?uc(r,E,Jn(c)):f!=null&&r.removeAttribute("value"),x==null&&y!=null&&(r.defaultChecked=!!y),x!=null&&(r.checked=x&&typeof x!="function"&&typeof x!="symbol"),R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?r.name=""+Jn(R):r.removeAttribute("name")}function id(r,s,c,f,x,y,E,R){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)){yo(r);return}c=c!=null?""+Jn(c):"",s=s!=null?""+Jn(s):c,R||s===r.value||(r.value=s),r.defaultValue=s}f=f??x,f=typeof f!="function"&&typeof f!="symbol"&&!!f,r.checked=R?r.checked:!!f,r.defaultChecked=!!f,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(r.name=E),yo(r)}function uc(r,s,c){s==="number"&&Ai(r.ownerDocument)===r||r.defaultValue===""+c||(r.defaultValue=""+c)}function es(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=""+Jn(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 wo(r,s,c){if(s!=null&&(s=""+Jn(s),s!==r.value&&(r.value=s),c==null)){r.defaultValue!==s&&(r.defaultValue=s);return}r.defaultValue=c!=null?""+Jn(c):""}function So(r,s,c,f){if(s==null){if(f!=null){if(c!=null)throw Error(a(92));if(ve(f)){if(1<f.length)throw Error(a(93));f=f[0]}c=f}c==null&&(c=""),s=c}c=Jn(s),r.defaultValue=c,f=r.textContent,f===c&&f!==""&&f!==null&&(r.value=f),yo(r)}function sa(r,s){if(s){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=s;return}}r.textContent=s}var qn=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 od(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||qn.has(s)?s==="float"?r.cssFloat=c:r[s]=(""+c).trim():r[s]=c+"px"}function jo(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&&od(r,x,f)}else for(var y in s)s.hasOwnProperty(y)&&od(r,y,s[y])}function er(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 Is=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"]]),hr=/^[\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 Ri(r){return hr.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Pr(){}var dc=null;function fc(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var zs=null,Hs=null;function Oi(r){var s=ra(r);if(s&&(r=s.stateNode)){var c=r[mt]||null;e:switch(r=s.stateNode,s.type){case"input":if(bo(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="'+Cn(""+s)+'"][type="radio"]'),s=0;s<c.length;s++){var f=c[s];if(f!==r&&f.form===r.form){var x=f[mt]||null;if(!x)throw Error(a(90));bo(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&&cc(f)}break e;case"textarea":wo(r,c.value,c.defaultValue);break e;case"select":s=c.value,s!=null&&es(r,!!c.multiple,s,!1)}}}var Co=!1;function No(r,s,c){if(Co)return r(s,c);Co=!0;try{var f=r(s);return f}finally{if(Co=!1,(zs!==null||Hs!==null)&&(qd(),zs&&(s=zs,r=Hs,Hs=zs=null,Oi(s),r)))for(s=0;s<r.length;s++)Oi(r[s])}}function ts(r,s){var c=r.stateNode;if(c===null)return null;var f=c[mt]||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 ia=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Eo=!1;if(ia)try{var K={};Object.defineProperty(K,"passive",{get:function(){Eo=!0}}),window.addEventListener("test",K,K),window.removeEventListener("test",K,K)}catch{Eo=!1}var je=null,nt=null,gt=null;function Ht(){if(gt)return gt;var r,s=nt,c=s.length,f,x="value"in je?je.value:je.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 gt=x.slice(r,1<f?1-f:void 0)}function rn(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 fn(){return!0}function vn(){return!1}function On(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 R in r)r.hasOwnProperty(R)&&(c=r[R],this[R]=c?c(y):y[R]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?fn:vn,this.isPropagationStopped=vn,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=fn)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=fn)},persist:function(){},isPersistent:fn}),s}var Ma={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_o=On(Ma),hc=m({},Ma,{view:0,detail:0}),R3=On(hc),wp,Sp,pc,ld=m({},hc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Cp,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!==pc&&(pc&&r.type==="mousemove"?(wp=r.screenX-pc.screenX,Sp=r.screenY-pc.screenY):Sp=wp=0,pc=r),wp)},movementY:function(r){return"movementY"in r?r.movementY:Sp}}),w1=On(ld),O3=m({},ld,{dataTransfer:0}),M3=On(O3),P3=m({},hc,{relatedTarget:0}),jp=On(P3),D3=m({},Ma,{animationName:0,elapsedTime:0,pseudoElement:0}),k3=On(D3),L3=m({},Ma,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),B3=On(L3),F3=m({},Ma,{data:0}),S1=On(F3),I3={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},z3={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"},H3={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function U3(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=H3[r])?!!s[r]:!1}function Cp(){return U3}var V3=m({},hc,{key:function(r){if(r.key){var s=I3[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=rn(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?z3[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Cp,charCode:function(r){return r.type==="keypress"?rn(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?rn(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),q3=On(V3),$3=m({},ld,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),j1=On($3),G3=m({},hc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Cp}),K3=On(G3),Y3=m({},Ma,{propertyName:0,elapsedTime:0,pseudoElement:0}),W3=On(Y3),X3=m({},ld,{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}),Q3=On(X3),Z3=m({},Ma,{newState:0,oldState:0}),J3=On(Z3),e4=[9,13,27,32],Np=ia&&"CompositionEvent"in window,mc=null;ia&&"documentMode"in document&&(mc=document.documentMode);var t4=ia&&"TextEvent"in window&&!mc,C1=ia&&(!Np||mc&&8<mc&&11>=mc),N1=" ",E1=!1;function _1(r,s){switch(r){case"keyup":return e4.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function T1(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var To=!1;function n4(r,s){switch(r){case"compositionend":return T1(s);case"keypress":return s.which!==32?null:(E1=!0,N1);case"textInput":return r=s.data,r===N1&&E1?null:r;default:return null}}function r4(r,s){if(To)return r==="compositionend"||!Np&&_1(r,s)?(r=Ht(),gt=nt=je=null,To=!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 C1&&s.locale!=="ko"?null:s.data;default:return null}}var a4={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 A1(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!a4[r.type]:s==="textarea"}function R1(r,s,c,f){zs?Hs?Hs.push(f):Hs=[f]:zs=f,s=Qd(s,"onChange"),0<s.length&&(c=new _o("onChange","change",null,c,f),r.push({event:c,listeners:s}))}var gc=null,vc=null;function s4(r){fC(r,0)}function cd(r){var s=Bs(r);if(cc(s))return r}function O1(r,s){if(r==="change")return s}var M1=!1;if(ia){var Ep;if(ia){var _p="oninput"in document;if(!_p){var P1=document.createElement("div");P1.setAttribute("oninput","return;"),_p=typeof P1.oninput=="function"}Ep=_p}else Ep=!1;M1=Ep&&(!document.documentMode||9<document.documentMode)}function D1(){gc&&(gc.detachEvent("onpropertychange",k1),vc=gc=null)}function k1(r){if(r.propertyName==="value"&&cd(vc)){var s=[];R1(s,vc,r,fc(r)),No(s4,s)}}function i4(r,s,c){r==="focusin"?(D1(),gc=s,vc=c,gc.attachEvent("onpropertychange",k1)):r==="focusout"&&D1()}function o4(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return cd(vc)}function l4(r,s){if(r==="click")return cd(s)}function c4(r,s){if(r==="input"||r==="change")return cd(s)}function u4(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var pr=typeof Object.is=="function"?Object.is:u4;function xc(r,s){if(pr(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(!dt.call(s,x)||!pr(r[x],s[x]))return!1}return!0}function L1(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function B1(r,s){var c=L1(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=L1(c)}}function F1(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?F1(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function I1(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=Ai(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=Ai(r.document)}return s}function Tp(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 d4=ia&&"documentMode"in document&&11>=document.documentMode,Ao=null,Ap=null,yc=null,Rp=!1;function z1(r,s,c){var f=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Rp||Ao==null||Ao!==Ai(f)||(f=Ao,"selectionStart"in f&&Tp(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}),yc&&xc(yc,f)||(yc=f,f=Qd(Ap,"onSelect"),0<f.length&&(s=new _o("onSelect","select",null,s,c),r.push({event:s,listeners:f}),s.target=Ao)))}function Mi(r,s){var c={};return c[r.toLowerCase()]=s.toLowerCase(),c["Webkit"+r]="webkit"+s,c["Moz"+r]="moz"+s,c}var Ro={animationend:Mi("Animation","AnimationEnd"),animationiteration:Mi("Animation","AnimationIteration"),animationstart:Mi("Animation","AnimationStart"),transitionrun:Mi("Transition","TransitionRun"),transitionstart:Mi("Transition","TransitionStart"),transitioncancel:Mi("Transition","TransitionCancel"),transitionend:Mi("Transition","TransitionEnd")},Op={},H1={};ia&&(H1=document.createElement("div").style,"AnimationEvent"in window||(delete Ro.animationend.animation,delete Ro.animationiteration.animation,delete Ro.animationstart.animation),"TransitionEvent"in window||delete Ro.transitionend.transition);function Pi(r){if(Op[r])return Op[r];if(!Ro[r])return r;var s=Ro[r],c;for(c in s)if(s.hasOwnProperty(c)&&c in H1)return Op[r]=s[c];return r}var U1=Pi("animationend"),V1=Pi("animationiteration"),q1=Pi("animationstart"),f4=Pi("transitionrun"),h4=Pi("transitionstart"),p4=Pi("transitioncancel"),$1=Pi("transitionend"),G1=new Map,Mp="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(" ");Mp.push("scrollEnd");function oa(r,s){G1.set(r,s),Oa(s,[r])}var ud=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)},Dr=[],Oo=0,Pp=0;function dd(){for(var r=Oo,s=Pp=Oo=0;s<r;){var c=Dr[s];Dr[s++]=null;var f=Dr[s];Dr[s++]=null;var x=Dr[s];Dr[s++]=null;var y=Dr[s];if(Dr[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&&K1(c,x,y)}}function fd(r,s,c,f){Dr[Oo++]=r,Dr[Oo++]=s,Dr[Oo++]=c,Dr[Oo++]=f,Pp|=f,r.lanes|=f,r=r.alternate,r!==null&&(r.lanes|=f)}function Dp(r,s,c,f){return fd(r,s,c,f),hd(r)}function Di(r,s){return fd(r,null,null,s),hd(r)}function K1(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-bt(c),r=y.hiddenUpdates,f=r[x],f===null?r[x]=[s]:f.push(s),s.lane=c|536870912),y):null}function hd(r){if(50<Hc)throw Hc=0,Vm=null,Error(a(185));for(var s=r.return;s!==null;)r=s,s=r.return;return r.tag===3?r.stateNode:null}var Mo={};function m4(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 mr(r,s,c,f){return new m4(r,s,c,f)}function kp(r){return r=r.prototype,!(!r||!r.isReactComponent)}function ns(r,s){var c=r.alternate;return c===null?(c=mr(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 Y1(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 pd(r,s,c,f,x,y){var E=0;if(f=r,typeof r=="function")kp(r)&&(E=1);else if(typeof r=="string")E=bL(r,c,ee.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case W:return r=mr(31,c,s,x),r.elementType=W,r.lanes=y,r;case w:return ki(c.children,x,y,s);case C:E=8,x|=24;break;case N:return r=mr(12,c,s,x|2),r.elementType=N,r.lanes=y,r;case M:return r=mr(13,c,s,x),r.elementType=M,r.lanes=y,r;case B:return r=mr(19,c,s,x),r.elementType=B,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 O:E=11;break e;case k:E=14;break e;case F:E=16,f=null;break e}E=29,c=Error(a(130,r===null?"null":typeof r,"")),f=null}return s=mr(E,c,s,x),s.elementType=r,s.type=f,s.lanes=y,s}function ki(r,s,c,f){return r=mr(7,r,f,s),r.lanes=c,r}function Lp(r,s,c){return r=mr(6,r,null,s),r.lanes=c,r}function W1(r){var s=mr(18,null,null,0);return s.stateNode=r,s}function Bp(r,s,c){return s=mr(4,r.children!==null?r.children:[],r.key,s),s.lanes=c,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}var X1=new WeakMap;function kr(r,s){if(typeof r=="object"&&r!==null){var c=X1.get(r);return c!==void 0?c:(s={value:r,source:s,stack:Vt(s)},X1.set(r,s),s)}return{value:r,source:s,stack:Vt(s)}}var Po=[],Do=0,md=null,bc=0,Lr=[],Br=0,Us=null,Pa=1,Da="";function rs(r,s){Po[Do++]=bc,Po[Do++]=md,md=r,bc=s}function Q1(r,s,c){Lr[Br++]=Pa,Lr[Br++]=Da,Lr[Br++]=Us,Us=r;var f=Pa;r=Da;var x=32-bt(f)-1;f&=~(1<<x),c+=1;var y=32-bt(s)+x;if(30<y){var E=x-x%5;y=(f&(1<<E)-1).toString(32),f>>=E,x-=E,Pa=1<<32-bt(s)+x|c<<x|f,Da=y+r}else Pa=1<<y|c<<x|f,Da=r}function Fp(r){r.return!==null&&(rs(r,1),Q1(r,1,0))}function Ip(r){for(;r===md;)md=Po[--Do],Po[Do]=null,bc=Po[--Do],Po[Do]=null;for(;r===Us;)Us=Lr[--Br],Lr[Br]=null,Da=Lr[--Br],Lr[Br]=null,Pa=Lr[--Br],Lr[Br]=null}function Z1(r,s){Lr[Br++]=Pa,Lr[Br++]=Da,Lr[Br++]=Us,Pa=s.id,Da=s.overflow,Us=r}var Fn=null,ln=null,Bt=!1,Vs=null,Fr=!1,zp=Error(a(519));function qs(r){var s=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw wc(kr(s,r)),zp}function J1(r){var s=r.stateNode,c=r.type,f=r.memoizedProps;switch(s[at]=r,s[mt]=f,c){case"dialog":Ot("cancel",s),Ot("close",s);break;case"iframe":case"object":case"embed":Ot("load",s);break;case"video":case"audio":for(c=0;c<Vc.length;c++)Ot(Vc[c],s);break;case"source":Ot("error",s);break;case"img":case"image":case"link":Ot("error",s),Ot("load",s);break;case"details":Ot("toggle",s);break;case"input":Ot("invalid",s),id(s,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":Ot("invalid",s);break;case"textarea":Ot("invalid",s),So(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||gC(s.textContent,c)?(f.popover!=null&&(Ot("beforetoggle",s),Ot("toggle",s)),f.onScroll!=null&&Ot("scroll",s),f.onScrollEnd!=null&&Ot("scrollend",s),f.onClick!=null&&(s.onclick=Pr),s=!0):s=!1,s||qs(r,!0)}function eS(r){for(Fn=r.return;Fn;)switch(Fn.tag){case 5:case 31:case 13:Fr=!1;return;case 27:case 3:Fr=!0;return;default:Fn=Fn.return}}function ko(r){if(r!==Fn)return!1;if(!Bt)return eS(r),Bt=!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&&ln&&qs(r),eS(r),s===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));ln=NC(r)}else if(s===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));ln=NC(r)}else s===27?(s=ln,ai(r.type)?(r=cg,cg=null,ln=r):ln=s):ln=Fn?zr(r.stateNode.nextSibling):null;return!0}function Li(){ln=Fn=null,Bt=!1}function Hp(){var r=Vs;return r!==null&&(ar===null?ar=r:ar.push.apply(ar,r),Vs=null),r}function wc(r){Vs===null?Vs=[r]:Vs.push(r)}var Up=L(null),Bi=null,as=null;function $s(r,s,c){z(Up,s._currentValue),s._currentValue=c}function ss(r){r._currentValue=Up.current,re(Up)}function Vp(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 qp(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 R=y;y=x;for(var U=0;U<s.length;U++)if(R.context===s[U]){y.lanes|=c,R=y.alternate,R!==null&&(R.lanes|=c),Vp(y.return,c,r),f||(E=null);break e}y=R.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),Vp(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 Lo(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 R=x.type;pr(x.pendingProps.value,E.value)||(r!==null?r.push(R):r=[R])}}else if(x===fe.current){if(E=x.alternate,E===null)throw Error(a(387));E.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(r!==null?r.push(Yc):r=[Yc])}x=x.return}r!==null&&qp(s,r,c,f),s.flags|=262144}function gd(r){for(r=r.firstContext;r!==null;){if(!pr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Fi(r){Bi=r,as=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function In(r){return tS(Bi,r)}function vd(r,s){return Bi===null&&Fi(r),tS(r,s)}function tS(r,s){var c=s._currentValue;if(s={context:s,memoizedValue:c,next:null},as===null){if(r===null)throw Error(a(308));as=s,r.dependencies={lanes:0,firstContext:s},r.flags|=524288}else as=as.next=s;return c}var g4=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()})}},v4=e.unstable_scheduleCallback,x4=e.unstable_NormalPriority,Nn={$$typeof:T,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function $p(){return{controller:new g4,data:new Map,refCount:0}}function Sc(r){r.refCount--,r.refCount===0&&v4(x4,function(){r.controller.abort()})}var jc=null,Gp=0,Bo=0,Fo=null;function y4(r,s){if(jc===null){var c=jc=[];Gp=0,Bo=Wm(),Fo={status:"pending",value:void 0,then:function(f){c.push(f)}}}return Gp++,s.then(nS,nS),s}function nS(){if(--Gp===0&&jc!==null){Fo!==null&&(Fo.status="fulfilled");var r=jc;jc=null,Bo=0,Fo=null;for(var s=0;s<r.length;s++)(0,r[s])()}}function b4(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 rS=P.S;P.S=function(r,s){zj=ht(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&y4(r,s),rS!==null&&rS(r,s)};var Ii=L(null);function Kp(){var r=Ii.current;return r!==null?r:an.pooledCache}function xd(r,s){s===null?z(Ii,Ii.current):z(Ii,s.pool)}function aS(){var r=Kp();return r===null?null:{parent:Nn._currentValue,pool:r}}var Io=Error(a(460)),Yp=Error(a(474)),yd=Error(a(542)),bd={then:function(){}};function sS(r){return r=r.status,r==="fulfilled"||r==="rejected"}function iS(r,s,c){switch(c=r[c],c===void 0?r.push(s):c!==s&&(s.then(Pr,Pr),s=c),s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,lS(r),r;default:if(typeof s.status=="string")s.then(Pr,Pr);else{if(r=an,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,lS(r),r}throw Hi=s,Io}}function zi(r){try{var s=r._init;return s(r._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Hi=c,Io):c}}var Hi=null;function oS(){if(Hi===null)throw Error(a(459));var r=Hi;return Hi=null,r}function lS(r){if(r===Io||r===yd)throw Error(a(483))}var zo=null,Cc=0;function wd(r){var s=Cc;return Cc+=1,zo===null&&(zo=[]),iS(zo,r,s)}function Nc(r,s){s=s.props.ref,r.ref=s!==void 0?s:null}function Sd(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 cS(r){function s(X,$){if(r){var te=X.deletions;te===null?(X.deletions=[$],X.flags|=16):te.push($)}}function c(X,$){if(!r)return null;for(;$!==null;)s(X,$),$=$.sibling;return null}function f(X){for(var $=new Map;X!==null;)X.key!==null?$.set(X.key,X):$.set(X.index,X),X=X.sibling;return $}function x(X,$){return X=ns(X,$),X.index=0,X.sibling=null,X}function y(X,$,te){return X.index=te,r?(te=X.alternate,te!==null?(te=te.index,te<$?(X.flags|=67108866,$):te):(X.flags|=67108866,$)):(X.flags|=1048576,$)}function E(X){return r&&X.alternate===null&&(X.flags|=67108866),X}function R(X,$,te,me){return $===null||$.tag!==6?($=Lp(te,X.mode,me),$.return=X,$):($=x($,te),$.return=X,$)}function U(X,$,te,me){var Xe=te.type;return Xe===w?he(X,$,te.props.children,me,te.key):$!==null&&($.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===F&&zi(Xe)===$.type)?($=x($,te.props),Nc($,te),$.return=X,$):($=pd(te.type,te.key,te.props,null,X.mode,me),Nc($,te),$.return=X,$)}function ne(X,$,te,me){return $===null||$.tag!==4||$.stateNode.containerInfo!==te.containerInfo||$.stateNode.implementation!==te.implementation?($=Bp(te,X.mode,me),$.return=X,$):($=x($,te.children||[]),$.return=X,$)}function he(X,$,te,me,Xe){return $===null||$.tag!==7?($=ki(te,X.mode,me,Xe),$.return=X,$):($=x($,te),$.return=X,$)}function ge(X,$,te){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return $=Lp(""+$,X.mode,te),$.return=X,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case S:return te=pd($.type,$.key,$.props,null,X.mode,te),Nc(te,$),te.return=X,te;case j:return $=Bp($,X.mode,te),$.return=X,$;case F:return $=zi($),ge(X,$,te)}if(ve($)||ie($))return $=ki($,X.mode,te,null),$.return=X,$;if(typeof $.then=="function")return ge(X,wd($),te);if($.$$typeof===T)return ge(X,vd(X,$),te);Sd(X,$)}return null}function ae(X,$,te,me){var Xe=$!==null?$.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return Xe!==null?null:R(X,$,""+te,me);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case S:return te.key===Xe?U(X,$,te,me):null;case j:return te.key===Xe?ne(X,$,te,me):null;case F:return te=zi(te),ae(X,$,te,me)}if(ve(te)||ie(te))return Xe!==null?null:he(X,$,te,me,null);if(typeof te.then=="function")return ae(X,$,wd(te),me);if(te.$$typeof===T)return ae(X,$,vd(X,te),me);Sd(X,te)}return null}function oe(X,$,te,me,Xe){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return X=X.get(te)||null,R($,X,""+me,Xe);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case S:return X=X.get(me.key===null?te:me.key)||null,U($,X,me,Xe);case j:return X=X.get(me.key===null?te:me.key)||null,ne($,X,me,Xe);case F:return me=zi(me),oe(X,$,te,me,Xe)}if(ve(me)||ie(me))return X=X.get(te)||null,he($,X,me,Xe,null);if(typeof me.then=="function")return oe(X,$,te,wd(me),Xe);if(me.$$typeof===T)return oe(X,$,te,vd($,me),Xe);Sd($,me)}return null}function Ie(X,$,te,me){for(var Xe=null,Gt=null,qe=$,wt=$=0,kt=null;qe!==null&&wt<te.length;wt++){qe.index>wt?(kt=qe,qe=null):kt=qe.sibling;var Kt=ae(X,qe,te[wt],me);if(Kt===null){qe===null&&(qe=kt);break}r&&qe&&Kt.alternate===null&&s(X,qe),$=y(Kt,$,wt),Gt===null?Xe=Kt:Gt.sibling=Kt,Gt=Kt,qe=kt}if(wt===te.length)return c(X,qe),Bt&&rs(X,wt),Xe;if(qe===null){for(;wt<te.length;wt++)qe=ge(X,te[wt],me),qe!==null&&($=y(qe,$,wt),Gt===null?Xe=qe:Gt.sibling=qe,Gt=qe);return Bt&&rs(X,wt),Xe}for(qe=f(qe);wt<te.length;wt++)kt=oe(qe,X,wt,te[wt],me),kt!==null&&(r&&kt.alternate!==null&&qe.delete(kt.key===null?wt:kt.key),$=y(kt,$,wt),Gt===null?Xe=kt:Gt.sibling=kt,Gt=kt);return r&&qe.forEach(function(ci){return s(X,ci)}),Bt&&rs(X,wt),Xe}function rt(X,$,te,me){if(te==null)throw Error(a(151));for(var Xe=null,Gt=null,qe=$,wt=$=0,kt=null,Kt=te.next();qe!==null&&!Kt.done;wt++,Kt=te.next()){qe.index>wt?(kt=qe,qe=null):kt=qe.sibling;var ci=ae(X,qe,Kt.value,me);if(ci===null){qe===null&&(qe=kt);break}r&&qe&&ci.alternate===null&&s(X,qe),$=y(ci,$,wt),Gt===null?Xe=ci:Gt.sibling=ci,Gt=ci,qe=kt}if(Kt.done)return c(X,qe),Bt&&rs(X,wt),Xe;if(qe===null){for(;!Kt.done;wt++,Kt=te.next())Kt=ge(X,Kt.value,me),Kt!==null&&($=y(Kt,$,wt),Gt===null?Xe=Kt:Gt.sibling=Kt,Gt=Kt);return Bt&&rs(X,wt),Xe}for(qe=f(qe);!Kt.done;wt++,Kt=te.next())Kt=oe(qe,X,wt,Kt.value,me),Kt!==null&&(r&&Kt.alternate!==null&&qe.delete(Kt.key===null?wt:Kt.key),$=y(Kt,$,wt),Gt===null?Xe=Kt:Gt.sibling=Kt,Gt=Kt);return r&&qe.forEach(function(OL){return s(X,OL)}),Bt&&rs(X,wt),Xe}function nn(X,$,te,me){if(typeof te=="object"&&te!==null&&te.type===w&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case S:e:{for(var Xe=te.key;$!==null;){if($.key===Xe){if(Xe=te.type,Xe===w){if($.tag===7){c(X,$.sibling),me=x($,te.props.children),me.return=X,X=me;break e}}else if($.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===F&&zi(Xe)===$.type){c(X,$.sibling),me=x($,te.props),Nc(me,te),me.return=X,X=me;break e}c(X,$);break}else s(X,$);$=$.sibling}te.type===w?(me=ki(te.props.children,X.mode,me,te.key),me.return=X,X=me):(me=pd(te.type,te.key,te.props,null,X.mode,me),Nc(me,te),me.return=X,X=me)}return E(X);case j:e:{for(Xe=te.key;$!==null;){if($.key===Xe)if($.tag===4&&$.stateNode.containerInfo===te.containerInfo&&$.stateNode.implementation===te.implementation){c(X,$.sibling),me=x($,te.children||[]),me.return=X,X=me;break e}else{c(X,$);break}else s(X,$);$=$.sibling}me=Bp(te,X.mode,me),me.return=X,X=me}return E(X);case F:return te=zi(te),nn(X,$,te,me)}if(ve(te))return Ie(X,$,te,me);if(ie(te)){if(Xe=ie(te),typeof Xe!="function")throw Error(a(150));return te=Xe.call(te),rt(X,$,te,me)}if(typeof te.then=="function")return nn(X,$,wd(te),me);if(te.$$typeof===T)return nn(X,$,vd(X,te),me);Sd(X,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,$!==null&&$.tag===6?(c(X,$.sibling),me=x($,te),me.return=X,X=me):(c(X,$),me=Lp(te,X.mode,me),me.return=X,X=me),E(X)):c(X,$)}return function(X,$,te,me){try{Cc=0;var Xe=nn(X,$,te,me);return zo=null,Xe}catch(qe){if(qe===Io||qe===yd)throw qe;var Gt=mr(29,qe,null,X.mode);return Gt.lanes=me,Gt.return=X,Gt}}}var Ui=cS(!0),uS=cS(!1),Gs=!1;function Wp(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Xp(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 Ks(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Ys(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=hd(r),K1(r,null,c),s}return fd(r,f,s,c),hd(r)}function Ec(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,ye(r,c)}}function Qp(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 Zp=!1;function _c(){if(Zp){var r=Fo;if(r!==null)throw r}}function Tc(r,s,c,f){Zp=!1;var x=r.updateQueue;Gs=!1;var y=x.firstBaseUpdate,E=x.lastBaseUpdate,R=x.shared.pending;if(R!==null){x.shared.pending=null;var U=R,ne=U.next;U.next=null,E===null?y=ne:E.next=ne,E=U;var he=r.alternate;he!==null&&(he=he.updateQueue,R=he.lastBaseUpdate,R!==E&&(R===null?he.firstBaseUpdate=ne:R.next=ne,he.lastBaseUpdate=U))}if(y!==null){var ge=x.baseState;E=0,he=ne=U=null,R=y;do{var ae=R.lane&-536870913,oe=ae!==R.lane;if(oe?(Dt&ae)===ae:(f&ae)===ae){ae!==0&&ae===Bo&&(Zp=!0),he!==null&&(he=he.next={lane:0,tag:R.tag,payload:R.payload,callback:null,next:null});e:{var Ie=r,rt=R;ae=s;var nn=c;switch(rt.tag){case 1:if(Ie=rt.payload,typeof Ie=="function"){ge=Ie.call(nn,ge,ae);break e}ge=Ie;break e;case 3:Ie.flags=Ie.flags&-65537|128;case 0:if(Ie=rt.payload,ae=typeof Ie=="function"?Ie.call(nn,ge,ae):Ie,ae==null)break e;ge=m({},ge,ae);break e;case 2:Gs=!0}}ae=R.callback,ae!==null&&(r.flags|=64,oe&&(r.flags|=8192),oe=x.callbacks,oe===null?x.callbacks=[ae]:oe.push(ae))}else oe={lane:ae,tag:R.tag,payload:R.payload,callback:R.callback,next:null},he===null?(ne=he=oe,U=ge):he=he.next=oe,E|=ae;if(R=R.next,R===null){if(R=x.shared.pending,R===null)break;oe=R,R=oe.next,oe.next=null,x.lastBaseUpdate=oe,x.shared.pending=null}}while(!0);he===null&&(U=ge),x.baseState=U,x.firstBaseUpdate=ne,x.lastBaseUpdate=he,y===null&&(x.shared.lanes=0),Js|=E,r.lanes=E,r.memoizedState=ge}}function dS(r,s){if(typeof r!="function")throw Error(a(191,r));r.call(s)}function fS(r,s){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)dS(c[r],s)}var Ho=L(null),jd=L(0);function hS(r,s){r=ps,z(jd,r),z(Ho,s),ps=r|s.baseLanes}function Jp(){z(jd,ps),z(Ho,Ho.current)}function em(){ps=jd.current,re(Ho),re(jd)}var gr=L(null),Ir=null;function Ws(r){var s=r.alternate;z(wn,wn.current&1),z(gr,r),Ir===null&&(s===null||Ho.current!==null||s.memoizedState!==null)&&(Ir=r)}function tm(r){z(wn,wn.current),z(gr,r),Ir===null&&(Ir=r)}function pS(r){r.tag===22?(z(wn,wn.current),z(gr,r),Ir===null&&(Ir=r)):Xs()}function Xs(){z(wn,wn.current),z(gr,gr.current)}function vr(r){re(gr),Ir===r&&(Ir=null),re(wn)}var wn=L(0);function Cd(r){for(var s=r;s!==null;){if(s.tag===13){var c=s.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||og(c)||lg(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 is=0,vt=null,en=null,En=null,Nd=!1,Uo=!1,Vi=!1,Ed=0,Ac=0,Vo=null,w4=0;function xn(){throw Error(a(321))}function nm(r,s){if(s===null)return!1;for(var c=0;c<s.length&&c<r.length;c++)if(!pr(r[c],s[c]))return!1;return!0}function rm(r,s,c,f,x,y){return is=y,vt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,P.H=r===null||r.memoizedState===null?QS:xm,Vi=!1,y=c(f,x),Vi=!1,Uo&&(y=gS(s,c,f,x)),mS(r),y}function mS(r){P.H=Mc;var s=en!==null&&en.next!==null;if(is=0,En=en=vt=null,Nd=!1,Ac=0,Vo=null,s)throw Error(a(300));r===null||_n||(r=r.dependencies,r!==null&&gd(r)&&(_n=!0))}function gS(r,s,c,f){vt=r;var x=0;do{if(Uo&&(Vo=null),Ac=0,Uo=!1,25<=x)throw Error(a(301));if(x+=1,En=en=null,r.updateQueue!=null){var y=r.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}P.H=ZS,y=s(c,f)}while(Uo);return y}function S4(){var r=P.H,s=r.useState()[0];return s=typeof s.then=="function"?Rc(s):s,r=r.useState()[0],(en!==null?en.memoizedState:null)!==r&&(vt.flags|=1024),s}function am(){var r=Ed!==0;return Ed=0,r}function sm(r,s,c){s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~c}function im(r){if(Nd){for(r=r.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Nd=!1}is=0,En=en=vt=null,Uo=!1,Ac=Ed=0,Vo=null}function Kn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return En===null?vt.memoizedState=En=r:En=En.next=r,En}function Sn(){if(en===null){var r=vt.alternate;r=r!==null?r.memoizedState:null}else r=en.next;var s=En===null?vt.memoizedState:En.next;if(s!==null)En=s,en=r;else{if(r===null)throw vt.alternate===null?Error(a(467)):Error(a(310));en=r,r={memoizedState:en.memoizedState,baseState:en.baseState,baseQueue:en.baseQueue,queue:en.queue,next:null},En===null?vt.memoizedState=En=r:En=En.next=r}return En}function _d(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Rc(r){var s=Ac;return Ac+=1,Vo===null&&(Vo=[]),r=iS(Vo,r,s),s=vt,(En===null?s.memoizedState:En.next)===null&&(s=s.alternate,P.H=s===null||s.memoizedState===null?QS:xm),r}function Td(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return Rc(r);if(r.$$typeof===T)return In(r)}throw Error(a(438,String(r)))}function om(r){var s=null,c=vt.updateQueue;if(c!==null&&(s=c.memoCache),s==null){var f=vt.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=_d(),vt.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]=ce;return s.index++,c}function os(r,s){return typeof s=="function"?s(r):s}function Ad(r){var s=Sn();return lm(s,en,r)}function lm(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 R=E=null,U=null,ne=s,he=!1;do{var ge=ne.lane&-536870913;if(ge!==ne.lane?(Dt&ge)===ge:(is&ge)===ge){var ae=ne.revertLane;if(ae===0)U!==null&&(U=U.next={lane:0,revertLane:0,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),ge===Bo&&(he=!0);else if((is&ae)===ae){ne=ne.next,ae===Bo&&(he=!0);continue}else ge={lane:0,revertLane:ne.revertLane,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},U===null?(R=U=ge,E=y):U=U.next=ge,vt.lanes|=ae,Js|=ae;ge=ne.action,Vi&&c(y,ge),y=ne.hasEagerState?ne.eagerState:c(y,ge)}else ae={lane:ge,revertLane:ne.revertLane,gesture:ne.gesture,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},U===null?(R=U=ae,E=y):U=U.next=ae,vt.lanes|=ge,Js|=ge;ne=ne.next}while(ne!==null&&ne!==s);if(U===null?E=y:U.next=R,!pr(y,r.memoizedState)&&(_n=!0,he&&(c=Fo,c!==null)))throw c;r.memoizedState=y,r.baseState=E,r.baseQueue=U,f.lastRenderedState=y}return x===null&&(f.lanes=0),[r.memoizedState,f.dispatch]}function cm(r){var s=Sn(),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);pr(y,s.memoizedState)||(_n=!0),s.memoizedState=y,s.baseQueue===null&&(s.baseState=y),c.lastRenderedState=y}return[y,f]}function vS(r,s,c){var f=vt,x=Sn(),y=Bt;if(y){if(c===void 0)throw Error(a(407));c=c()}else c=s();var E=!pr((en||x).memoizedState,c);if(E&&(x.memoizedState=c,_n=!0),x=x.queue,fm(bS.bind(null,f,x,r),[r]),x.getSnapshot!==s||E||En!==null&&En.memoizedState.tag&1){if(f.flags|=2048,qo(9,{destroy:void 0},yS.bind(null,f,x,c,s),null),an===null)throw Error(a(349));y||(is&127)!==0||xS(f,s,c)}return c}function xS(r,s,c){r.flags|=16384,r={getSnapshot:s,value:c},s=vt.updateQueue,s===null?(s=_d(),vt.updateQueue=s,s.stores=[r]):(c=s.stores,c===null?s.stores=[r]:c.push(r))}function yS(r,s,c,f){s.value=c,s.getSnapshot=f,wS(s)&&SS(r)}function bS(r,s,c){return c(function(){wS(s)&&SS(r)})}function wS(r){var s=r.getSnapshot;r=r.value;try{var c=s();return!pr(r,c)}catch{return!0}}function SS(r){var s=Di(r,2);s!==null&&sr(s,r,2)}function um(r){var s=Kn();if(typeof r=="function"){var c=r;if(r=c(),Vi){Nt(!0);try{c()}finally{Nt(!1)}}}return s.memoizedState=s.baseState=r,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:r},s}function jS(r,s,c,f){return r.baseState=c,lm(r,en,typeof f=="function"?f:os)}function j4(r,s,c,f,x){if(Md(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)}};P.T!==null?c(!0):y.isTransition=!1,f(y),c=s.pending,c===null?(y.next=s.pending=y,CS(s,y)):(y.next=c.next,s.pending=c.next=y)}}function CS(r,s){var c=s.action,f=s.payload,x=r.state;if(s.isTransition){var y=P.T,E={};P.T=E;try{var R=c(x,f),U=P.S;U!==null&&U(E,R),NS(r,s,R)}catch(ne){dm(r,s,ne)}finally{y!==null&&E.types!==null&&(y.types=E.types),P.T=y}}else try{y=c(x,f),NS(r,s,y)}catch(ne){dm(r,s,ne)}}function NS(r,s,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(f){ES(r,s,f)},function(f){return dm(r,s,f)}):ES(r,s,c)}function ES(r,s,c){s.status="fulfilled",s.value=c,_S(s),r.state=c,s=r.pending,s!==null&&(c=s.next,c===s?r.pending=null:(c=c.next,s.next=c,CS(r,c)))}function dm(r,s,c){var f=r.pending;if(r.pending=null,f!==null){f=f.next;do s.status="rejected",s.reason=c,_S(s),s=s.next;while(s!==f)}r.action=null}function _S(r){r=r.listeners;for(var s=0;s<r.length;s++)(0,r[s])()}function TS(r,s){return s}function AS(r,s){if(Bt){var c=an.formState;if(c!==null){e:{var f=vt;if(Bt){if(ln){t:{for(var x=ln,y=Fr;x.nodeType!==8;){if(!y){x=null;break t}if(x=zr(x.nextSibling),x===null){x=null;break t}}y=x.data,x=y==="F!"||y==="F"?x:null}if(x){ln=zr(x.nextSibling),f=x.data==="F!";break e}}qs(f)}f=!1}f&&(s=c[0])}}return c=Kn(),c.memoizedState=c.baseState=s,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:TS,lastRenderedState:s},c.queue=f,c=YS.bind(null,vt,f),f.dispatch=c,f=um(!1),y=vm.bind(null,vt,!1,f.queue),f=Kn(),x={state:s,dispatch:null,action:r,pending:null},f.queue=x,c=j4.bind(null,vt,x,y,c),x.dispatch=c,f.memoizedState=r,[s,c,!1]}function RS(r){var s=Sn();return OS(s,en,r)}function OS(r,s,c){if(s=lm(r,s,TS)[0],r=Ad(os)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var f=Rc(s)}catch(E){throw E===Io?yd:E}else f=s;s=Sn();var x=s.queue,y=x.dispatch;return c!==s.memoizedState&&(vt.flags|=2048,qo(9,{destroy:void 0},C4.bind(null,x,c),null)),[f,y,r]}function C4(r,s){r.action=s}function MS(r){var s=Sn(),c=en;if(c!==null)return OS(s,c,r);Sn(),s=s.memoizedState,c=Sn();var f=c.queue.dispatch;return c.memoizedState=r,[s,f,!1]}function qo(r,s,c,f){return r={tag:r,create:c,deps:f,inst:s,next:null},s=vt.updateQueue,s===null&&(s=_d(),vt.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 PS(){return Sn().memoizedState}function Rd(r,s,c,f){var x=Kn();vt.flags|=r,x.memoizedState=qo(1|s,{destroy:void 0},c,f===void 0?null:f)}function Od(r,s,c,f){var x=Sn();f=f===void 0?null:f;var y=x.memoizedState.inst;en!==null&&f!==null&&nm(f,en.memoizedState.deps)?x.memoizedState=qo(s,y,c,f):(vt.flags|=r,x.memoizedState=qo(1|s,y,c,f))}function DS(r,s){Rd(8390656,8,r,s)}function fm(r,s){Od(2048,8,r,s)}function N4(r){vt.flags|=4;var s=vt.updateQueue;if(s===null)s=_d(),vt.updateQueue=s,s.events=[r];else{var c=s.events;c===null?s.events=[r]:c.push(r)}}function kS(r){var s=Sn().memoizedState;return N4({ref:s,nextImpl:r}),function(){if((Yt&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}function LS(r,s){return Od(4,2,r,s)}function BS(r,s){return Od(4,4,r,s)}function FS(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 IS(r,s,c){c=c!=null?c.concat([r]):null,Od(4,4,FS.bind(null,s,r),c)}function hm(){}function zS(r,s){var c=Sn();s=s===void 0?null:s;var f=c.memoizedState;return s!==null&&nm(s,f[1])?f[0]:(c.memoizedState=[r,s],r)}function HS(r,s){var c=Sn();s=s===void 0?null:s;var f=c.memoizedState;if(s!==null&&nm(s,f[1]))return f[0];if(f=r(),Vi){Nt(!0);try{r()}finally{Nt(!1)}}return c.memoizedState=[f,s],f}function pm(r,s,c){return c===void 0||(is&1073741824)!==0&&(Dt&261930)===0?r.memoizedState=s:(r.memoizedState=c,r=Uj(),vt.lanes|=r,Js|=r,c)}function US(r,s,c,f){return pr(c,s)?c:Ho.current!==null?(r=pm(r,c,f),pr(r,s)||(_n=!0),r):(is&42)===0||(is&1073741824)!==0&&(Dt&261930)===0?(_n=!0,r.memoizedState=c):(r=Uj(),vt.lanes|=r,Js|=r,s)}function VS(r,s,c,f,x){var y=V.p;V.p=y!==0&&8>y?y:8;var E=P.T,R={};P.T=R,vm(r,!1,s,c);try{var U=x(),ne=P.S;if(ne!==null&&ne(R,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var he=b4(U,f);Oc(r,s,he,br(r))}else Oc(r,s,f,br(r))}catch(ge){Oc(r,s,{then:function(){},status:"rejected",reason:ge},br())}finally{V.p=y,E!==null&&R.types!==null&&(E.types=R.types),P.T=E}}function E4(){}function mm(r,s,c,f){if(r.tag!==5)throw Error(a(476));var x=qS(r).queue;VS(r,x,s,H,c===null?E4:function(){return $S(r),c(f)})}function qS(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:os,lastRenderedState:H},next:null};var c={};return s.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:c},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function $S(r){var s=qS(r);s.next===null&&(s=r.alternate.memoizedState),Oc(r,s.next.queue,{},br())}function gm(){return In(Yc)}function GS(){return Sn().memoizedState}function KS(){return Sn().memoizedState}function _4(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var c=br();r=Ks(c);var f=Ys(s,r,c);f!==null&&(sr(f,s,c),Ec(f,s,c)),s={cache:$p()},r.payload=s;return}s=s.return}}function T4(r,s,c){var f=br();c={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Md(r)?WS(s,c):(c=Dp(r,s,c,f),c!==null&&(sr(c,r,f),XS(c,s,f)))}function YS(r,s,c){var f=br();Oc(r,s,c,f)}function Oc(r,s,c,f){var x={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Md(r))WS(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,R=y(E,c);if(x.hasEagerState=!0,x.eagerState=R,pr(R,E))return fd(r,s,x,0),an===null&&dd(),!1}catch{}if(c=Dp(r,s,x,f),c!==null)return sr(c,r,f),XS(c,s,f),!0}return!1}function vm(r,s,c,f){if(f={lane:2,revertLane:Wm(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Md(r)){if(s)throw Error(a(479))}else s=Dp(r,c,f,2),s!==null&&sr(s,r,2)}function Md(r){var s=r.alternate;return r===vt||s!==null&&s===vt}function WS(r,s){Uo=Nd=!0;var c=r.pending;c===null?s.next=s:(s.next=c.next,c.next=s),r.pending=s}function XS(r,s,c){if((c&4194048)!==0){var f=s.lanes;f&=r.pendingLanes,c|=f,s.lanes=c,ye(r,c)}}var Mc={readContext:In,use:Td,useCallback:xn,useContext:xn,useEffect:xn,useImperativeHandle:xn,useLayoutEffect:xn,useInsertionEffect:xn,useMemo:xn,useReducer:xn,useRef:xn,useState:xn,useDebugValue:xn,useDeferredValue:xn,useTransition:xn,useSyncExternalStore:xn,useId:xn,useHostTransitionStatus:xn,useFormState:xn,useActionState:xn,useOptimistic:xn,useMemoCache:xn,useCacheRefresh:xn};Mc.useEffectEvent=xn;var QS={readContext:In,use:Td,useCallback:function(r,s){return Kn().memoizedState=[r,s===void 0?null:s],r},useContext:In,useEffect:DS,useImperativeHandle:function(r,s,c){c=c!=null?c.concat([r]):null,Rd(4194308,4,FS.bind(null,s,r),c)},useLayoutEffect:function(r,s){return Rd(4194308,4,r,s)},useInsertionEffect:function(r,s){Rd(4,2,r,s)},useMemo:function(r,s){var c=Kn();s=s===void 0?null:s;var f=r();if(Vi){Nt(!0);try{r()}finally{Nt(!1)}}return c.memoizedState=[f,s],f},useReducer:function(r,s,c){var f=Kn();if(c!==void 0){var x=c(s);if(Vi){Nt(!0);try{c(s)}finally{Nt(!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=T4.bind(null,vt,r),[f.memoizedState,r]},useRef:function(r){var s=Kn();return r={current:r},s.memoizedState=r},useState:function(r){r=um(r);var s=r.queue,c=YS.bind(null,vt,s);return s.dispatch=c,[r.memoizedState,c]},useDebugValue:hm,useDeferredValue:function(r,s){var c=Kn();return pm(c,r,s)},useTransition:function(){var r=um(!1);return r=VS.bind(null,vt,r.queue,!0,!1),Kn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,c){var f=vt,x=Kn();if(Bt){if(c===void 0)throw Error(a(407));c=c()}else{if(c=s(),an===null)throw Error(a(349));(Dt&127)!==0||xS(f,s,c)}x.memoizedState=c;var y={value:c,getSnapshot:s};return x.queue=y,DS(bS.bind(null,f,y,r),[r]),f.flags|=2048,qo(9,{destroy:void 0},yS.bind(null,f,y,c,s),null),c},useId:function(){var r=Kn(),s=an.identifierPrefix;if(Bt){var c=Da,f=Pa;c=(f&~(1<<32-bt(f)-1)).toString(32)+c,s="_"+s+"R_"+c,c=Ed++,0<c&&(s+="H"+c.toString(32)),s+="_"}else c=w4++,s="_"+s+"r_"+c.toString(32)+"_";return r.memoizedState=s},useHostTransitionStatus:gm,useFormState:AS,useActionState:AS,useOptimistic:function(r){var s=Kn();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,vt,!0,c),c.dispatch=s,[r,s]},useMemoCache:om,useCacheRefresh:function(){return Kn().memoizedState=_4.bind(null,vt)},useEffectEvent:function(r){var s=Kn(),c={impl:r};return s.memoizedState=c,function(){if((Yt&2)!==0)throw Error(a(440));return c.impl.apply(void 0,arguments)}}},xm={readContext:In,use:Td,useCallback:zS,useContext:In,useEffect:fm,useImperativeHandle:IS,useInsertionEffect:LS,useLayoutEffect:BS,useMemo:HS,useReducer:Ad,useRef:PS,useState:function(){return Ad(os)},useDebugValue:hm,useDeferredValue:function(r,s){var c=Sn();return US(c,en.memoizedState,r,s)},useTransition:function(){var r=Ad(os)[0],s=Sn().memoizedState;return[typeof r=="boolean"?r:Rc(r),s]},useSyncExternalStore:vS,useId:GS,useHostTransitionStatus:gm,useFormState:RS,useActionState:RS,useOptimistic:function(r,s){var c=Sn();return jS(c,en,r,s)},useMemoCache:om,useCacheRefresh:KS};xm.useEffectEvent=kS;var ZS={readContext:In,use:Td,useCallback:zS,useContext:In,useEffect:fm,useImperativeHandle:IS,useInsertionEffect:LS,useLayoutEffect:BS,useMemo:HS,useReducer:cm,useRef:PS,useState:function(){return cm(os)},useDebugValue:hm,useDeferredValue:function(r,s){var c=Sn();return en===null?pm(c,r,s):US(c,en.memoizedState,r,s)},useTransition:function(){var r=cm(os)[0],s=Sn().memoizedState;return[typeof r=="boolean"?r:Rc(r),s]},useSyncExternalStore:vS,useId:GS,useHostTransitionStatus:gm,useFormState:MS,useActionState:MS,useOptimistic:function(r,s){var c=Sn();return en!==null?jS(c,en,r,s):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:om,useCacheRefresh:KS};ZS.useEffectEvent=kS;function ym(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 bm={enqueueSetState:function(r,s,c){r=r._reactInternals;var f=br(),x=Ks(f);x.payload=s,c!=null&&(x.callback=c),s=Ys(r,x,f),s!==null&&(sr(s,r,f),Ec(s,r,f))},enqueueReplaceState:function(r,s,c){r=r._reactInternals;var f=br(),x=Ks(f);x.tag=1,x.payload=s,c!=null&&(x.callback=c),s=Ys(r,x,f),s!==null&&(sr(s,r,f),Ec(s,r,f))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var c=br(),f=Ks(c);f.tag=2,s!=null&&(f.callback=s),s=Ys(r,f,c),s!==null&&(sr(s,r,c),Ec(s,r,c))}};function JS(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?!xc(c,f)||!xc(x,y):!0}function ej(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&&bm.enqueueReplaceState(s,s.state,null)}function qi(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 tj(r){ud(r)}function nj(r){console.error(r)}function rj(r){ud(r)}function Pd(r,s){try{var c=r.onUncaughtError;c(s.value,{componentStack:s.stack})}catch(f){setTimeout(function(){throw f})}}function aj(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 wm(r,s,c){return c=Ks(c),c.tag=3,c.payload={element:null},c.callback=function(){Pd(r,s)},c}function sj(r){return r=Ks(r),r.tag=3,r}function ij(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(){aj(s,c,f)}}var E=c.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(r.callback=function(){aj(s,c,f),typeof x!="function"&&(ei===null?ei=new Set([this]):ei.add(this));var R=f.stack;this.componentDidCatch(f.value,{componentStack:R!==null?R:""})})}function A4(r,s,c,f,x){if(c.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(s=c.alternate,s!==null&&Lo(s,c,x,!0),c=gr.current,c!==null){switch(c.tag){case 31:case 13:return Ir===null?$d():c.alternate===null&&yn===0&&(yn=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),Gm(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)),Gm(r,f,x)),!1}throw Error(a(435,c.tag))}return Gm(r,f,x),$d(),!1}if(Bt)return s=gr.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=x,f!==zp&&(r=Error(a(422),{cause:f}),wc(kr(r,c)))):(f!==zp&&(s=Error(a(423),{cause:f}),wc(kr(s,c))),r=r.current.alternate,r.flags|=65536,x&=-x,r.lanes|=x,f=kr(f,c),x=wm(r.stateNode,f,x),Qp(r,x),yn!==4&&(yn=2)),!1;var y=Error(a(520),{cause:f});if(y=kr(y,c),zc===null?zc=[y]:zc.push(y),yn!==4&&(yn=2),s===null)return!0;f=kr(f,c),c=s;do{switch(c.tag){case 3:return c.flags|=65536,r=x&-x,c.lanes|=r,r=wm(c.stateNode,f,r),Qp(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"&&(ei===null||!ei.has(y))))return c.flags|=65536,x&=-x,c.lanes|=x,x=sj(x),ij(x,r,c,f),Qp(c,x),!1}c=c.return}while(c!==null);return!1}var Sm=Error(a(461)),_n=!1;function zn(r,s,c,f){s.child=r===null?uS(s,null,c,f):Ui(s,r.child,c,f)}function oj(r,s,c,f,x){c=c.render;var y=s.ref;if("ref"in f){var E={};for(var R in f)R!=="ref"&&(E[R]=f[R])}else E=f;return Fi(s),f=rm(r,s,c,E,y,x),R=am(),r!==null&&!_n?(sm(r,s,x),ls(r,s,x)):(Bt&&R&&Fp(s),s.flags|=1,zn(r,s,f,x),s.child)}function lj(r,s,c,f,x){if(r===null){var y=c.type;return typeof y=="function"&&!kp(y)&&y.defaultProps===void 0&&c.compare===null?(s.tag=15,s.type=y,cj(r,s,y,f,x)):(r=pd(c.type,null,f,s,s.mode,x),r.ref=s.ref,r.return=s,s.child=r)}if(y=r.child,!Rm(r,x)){var E=y.memoizedProps;if(c=c.compare,c=c!==null?c:xc,c(E,f)&&r.ref===s.ref)return ls(r,s,x)}return s.flags|=1,r=ns(y,f),r.ref=s.ref,r.return=s,s.child=r}function cj(r,s,c,f,x){if(r!==null){var y=r.memoizedProps;if(xc(y,f)&&r.ref===s.ref)if(_n=!1,s.pendingProps=f=y,Rm(r,x))(r.flags&131072)!==0&&(_n=!0);else return s.lanes=r.lanes,ls(r,s,x)}return jm(r,s,c,f,x)}function uj(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 dj(r,s,y,c,f)}if((c&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},r!==null&&xd(s,y!==null?y.cachePool:null),y!==null?hS(s,y):Jp(),pS(s);else return f=s.lanes=536870912,dj(r,s,y!==null?y.baseLanes|c:c,c,f)}else y!==null?(xd(s,y.cachePool),hS(s,y),Xs(),s.memoizedState=null):(r!==null&&xd(s,null),Jp(),Xs());return zn(r,s,x,c),s.child}function Pc(r,s){return r!==null&&r.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function dj(r,s,c,f,x){var y=Kp();return y=y===null?null:{parent:Nn._currentValue,pool:y},s.memoizedState={baseLanes:c,cachePool:y},r!==null&&xd(s,null),Jp(),pS(s),r!==null&&Lo(r,s,f,!0),s.childLanes=x,null}function Dd(r,s){return s=Ld({mode:s.mode,children:s.children},r.mode),s.ref=r.ref,r.child=s,s.return=r,s}function fj(r,s,c){return Ui(s,r.child,null,c),r=Dd(s,s.pendingProps),r.flags|=2,vr(s),s.memoizedState=null,r}function R4(r,s,c){var f=s.pendingProps,x=(s.flags&128)!==0;if(s.flags&=-129,r===null){if(Bt){if(f.mode==="hidden")return r=Dd(s,f),s.lanes=536870912,Pc(null,r);if(tm(s),(r=ln)?(r=CC(r,Fr),r=r!==null&&r.data==="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:Us!==null?{id:Pa,overflow:Da}:null,retryLane:536870912,hydrationErrors:null},c=W1(r),c.return=s,s.child=c,Fn=s,ln=null)):r=null,r===null)throw qs(s);return s.lanes=536870912,null}return Dd(s,f)}var y=r.memoizedState;if(y!==null){var E=y.dehydrated;if(tm(s),x)if(s.flags&256)s.flags&=-257,s=fj(r,s,c);else if(s.memoizedState!==null)s.child=r.child,s.flags|=128,s=null;else throw Error(a(558));else if(_n||Lo(r,s,c,!1),x=(c&r.childLanes)!==0,_n||x){if(f=an,f!==null&&(E=Re(f,c),E!==0&&E!==y.retryLane))throw y.retryLane=E,Di(r,E),sr(f,r,E),Sm;$d(),s=fj(r,s,c)}else r=y.treeContext,ln=zr(E.nextSibling),Fn=s,Bt=!0,Vs=null,Fr=!1,r!==null&&Z1(s,r),s=Dd(s,f),s.flags|=4096;return s}return r=ns(r.child,{mode:f.mode,children:f.children}),r.ref=s.ref,s.child=r,r.return=s,r}function kd(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 jm(r,s,c,f,x){return Fi(s),c=rm(r,s,c,f,void 0,x),f=am(),r!==null&&!_n?(sm(r,s,x),ls(r,s,x)):(Bt&&f&&Fp(s),s.flags|=1,zn(r,s,c,x),s.child)}function hj(r,s,c,f,x,y){return Fi(s),s.updateQueue=null,c=gS(s,f,c,x),mS(r),f=am(),r!==null&&!_n?(sm(r,s,y),ls(r,s,y)):(Bt&&f&&Fp(s),s.flags|=1,zn(r,s,c,y),s.child)}function pj(r,s,c,f,x){if(Fi(s),s.stateNode===null){var y=Mo,E=c.contextType;typeof E=="object"&&E!==null&&(y=In(E)),y=new c(f,y),s.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=bm,s.stateNode=y,y._reactInternals=s,y=s.stateNode,y.props=f,y.state=s.memoizedState,y.refs={},Wp(s),E=c.contextType,y.context=typeof E=="object"&&E!==null?In(E):Mo,y.state=s.memoizedState,E=c.getDerivedStateFromProps,typeof E=="function"&&(ym(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&&bm.enqueueReplaceState(y,y.state,null),Tc(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 R=s.memoizedProps,U=qi(c,R);y.props=U;var ne=y.context,he=c.contextType;E=Mo,typeof he=="object"&&he!==null&&(E=In(he));var ge=c.getDerivedStateFromProps;he=typeof ge=="function"||typeof y.getSnapshotBeforeUpdate=="function",R=s.pendingProps!==R,he||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(R||ne!==E)&&ej(s,y,f,E),Gs=!1;var ae=s.memoizedState;y.state=ae,Tc(s,f,y,x),_c(),ne=s.memoizedState,R||ae!==ne||Gs?(typeof ge=="function"&&(ym(s,c,ge,f),ne=s.memoizedState),(U=Gs||JS(s,c,U,f,ae,ne,E))?(he||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=ne),y.props=f,y.state=ne,y.context=E,f=U):(typeof y.componentDidMount=="function"&&(s.flags|=4194308),f=!1)}else{y=s.stateNode,Xp(r,s),E=s.memoizedProps,he=qi(c,E),y.props=he,ge=s.pendingProps,ae=y.context,ne=c.contextType,U=Mo,typeof ne=="object"&&ne!==null&&(U=In(ne)),R=c.getDerivedStateFromProps,(ne=typeof R=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(E!==ge||ae!==U)&&ej(s,y,f,U),Gs=!1,ae=s.memoizedState,y.state=ae,Tc(s,f,y,x),_c();var oe=s.memoizedState;E!==ge||ae!==oe||Gs||r!==null&&r.dependencies!==null&&gd(r.dependencies)?(typeof R=="function"&&(ym(s,c,R,f),oe=s.memoizedState),(he=Gs||JS(s,c,he,f,ae,oe,U)||r!==null&&r.dependencies!==null&&gd(r.dependencies))?(ne||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(f,oe,U),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(f,oe,U)),typeof y.componentDidUpdate=="function"&&(s.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof y.componentDidUpdate!="function"||E===r.memoizedProps&&ae===r.memoizedState||(s.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&ae===r.memoizedState||(s.flags|=1024),s.memoizedProps=f,s.memoizedState=oe),y.props=f,y.state=oe,y.context=U,f=he):(typeof y.componentDidUpdate!="function"||E===r.memoizedProps&&ae===r.memoizedState||(s.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&ae===r.memoizedState||(s.flags|=1024),f=!1)}return y=f,kd(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=Ui(s,r.child,null,x),s.child=Ui(s,null,c,x)):zn(r,s,c,x),s.memoizedState=y.state,r=s.child):r=ls(r,s,x),r}function mj(r,s,c,f){return Li(),s.flags|=256,zn(r,s,c,f),s.child}var Cm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Nm(r){return{baseLanes:r,cachePool:aS()}}function Em(r,s,c){return r=r!==null?r.childLanes&~c:0,s&&(r|=yr),r}function gj(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:(wn.current&2)!==0),E&&(x=!0,s.flags&=-129),E=(s.flags&32)!==0,s.flags&=-33,r===null){if(Bt){if(x?Ws(s):Xs(),(r=ln)?(r=CC(r,Fr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:Us!==null?{id:Pa,overflow:Da}:null,retryLane:536870912,hydrationErrors:null},c=W1(r),c.return=s,s.child=c,Fn=s,ln=null)):r=null,r===null)throw qs(s);return lg(r)?s.lanes=32:s.lanes=536870912,null}var R=f.children;return f=f.fallback,x?(Xs(),x=s.mode,R=Ld({mode:"hidden",children:R},x),f=ki(f,x,c,null),R.return=s,f.return=s,R.sibling=f,s.child=R,f=s.child,f.memoizedState=Nm(c),f.childLanes=Em(r,E,c),s.memoizedState=Cm,Pc(null,f)):(Ws(s),_m(s,R))}var U=r.memoizedState;if(U!==null&&(R=U.dehydrated,R!==null)){if(y)s.flags&256?(Ws(s),s.flags&=-257,s=Tm(r,s,c)):s.memoizedState!==null?(Xs(),s.child=r.child,s.flags|=128,s=null):(Xs(),R=f.fallback,x=s.mode,f=Ld({mode:"visible",children:f.children},x),R=ki(R,x,c,null),R.flags|=2,f.return=s,R.return=s,f.sibling=R,s.child=f,Ui(s,r.child,null,c),f=s.child,f.memoizedState=Nm(c),f.childLanes=Em(r,E,c),s.memoizedState=Cm,s=Pc(null,f));else if(Ws(s),lg(R)){if(E=R.nextSibling&&R.nextSibling.dataset,E)var ne=E.dgst;E=ne,f=Error(a(419)),f.stack="",f.digest=E,wc({value:f,source:null,stack:null}),s=Tm(r,s,c)}else if(_n||Lo(r,s,c,!1),E=(c&r.childLanes)!==0,_n||E){if(E=an,E!==null&&(f=Re(E,c),f!==0&&f!==U.retryLane))throw U.retryLane=f,Di(r,f),sr(E,r,f),Sm;og(R)||$d(),s=Tm(r,s,c)}else og(R)?(s.flags|=192,s.child=r.child,s=null):(r=U.treeContext,ln=zr(R.nextSibling),Fn=s,Bt=!0,Vs=null,Fr=!1,r!==null&&Z1(s,r),s=_m(s,f.children),s.flags|=4096);return s}return x?(Xs(),R=f.fallback,x=s.mode,U=r.child,ne=U.sibling,f=ns(U,{mode:"hidden",children:f.children}),f.subtreeFlags=U.subtreeFlags&65011712,ne!==null?R=ns(ne,R):(R=ki(R,x,c,null),R.flags|=2),R.return=s,f.return=s,f.sibling=R,s.child=f,Pc(null,f),f=s.child,R=r.child.memoizedState,R===null?R=Nm(c):(x=R.cachePool,x!==null?(U=Nn._currentValue,x=x.parent!==U?{parent:U,pool:U}:x):x=aS(),R={baseLanes:R.baseLanes|c,cachePool:x}),f.memoizedState=R,f.childLanes=Em(r,E,c),s.memoizedState=Cm,Pc(r.child,f)):(Ws(s),c=r.child,r=c.sibling,c=ns(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 _m(r,s){return s=Ld({mode:"visible",children:s},r.mode),s.return=r,r.child=s}function Ld(r,s){return r=mr(22,r,null,s),r.lanes=0,r}function Tm(r,s,c){return Ui(s,r.child,null,c),r=_m(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function vj(r,s,c){r.lanes|=s;var f=r.alternate;f!==null&&(f.lanes|=s),Vp(r.return,s,c)}function Am(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 xj(r,s,c){var f=s.pendingProps,x=f.revealOrder,y=f.tail;f=f.children;var E=wn.current,R=(E&2)!==0;if(R?(E=E&1|2,s.flags|=128):E&=1,z(wn,E),zn(r,s,f,c),f=Bt?bc:0,!R&&r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&vj(r,c,s);else if(r.tag===19)vj(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&&Cd(r)===null&&(x=c),c=c.sibling;c=x,c===null?(x=s.child,s.child=null):(x=c.sibling,c.sibling=null),Am(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&&Cd(r)===null){s.child=x;break}r=x.sibling,x.sibling=c,c=x,x=r}Am(s,!0,c,null,y,f);break;case"together":Am(s,!1,null,null,void 0,f);break;default:s.memoizedState=null}return s.child}function ls(r,s,c){if(r!==null&&(s.dependencies=r.dependencies),Js|=s.lanes,(c&s.childLanes)===0)if(r!==null){if(Lo(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=ns(r,r.pendingProps),s.child=c,c.return=s;r.sibling!==null;)r=r.sibling,c=c.sibling=ns(r,r.pendingProps),c.return=s;c.sibling=null}return s.child}function Rm(r,s){return(r.lanes&s)!==0?!0:(r=r.dependencies,!!(r!==null&&gd(r)))}function O4(r,s,c){switch(s.tag){case 3:Ce(s,s.stateNode.containerInfo),$s(s,Nn,r.memoizedState.cache),Li();break;case 27:case 5:ke(s);break;case 4:Ce(s,s.stateNode.containerInfo);break;case 10:$s(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,tm(s),null;break;case 13:var f=s.memoizedState;if(f!==null)return f.dehydrated!==null?(Ws(s),s.flags|=128,null):(c&s.child.childLanes)!==0?gj(r,s,c):(Ws(s),r=ls(r,s,c),r!==null?r.sibling:null);Ws(s);break;case 19:var x=(r.flags&128)!==0;if(f=(c&s.childLanes)!==0,f||(Lo(r,s,c,!1),f=(c&s.childLanes)!==0),x){if(f)return xj(r,s,c);s.flags|=128}if(x=s.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),z(wn,wn.current),f)break;return null;case 22:return s.lanes=0,uj(r,s,c,s.pendingProps);case 24:$s(s,Nn,r.memoizedState.cache)}return ls(r,s,c)}function yj(r,s,c){if(r!==null)if(r.memoizedProps!==s.pendingProps)_n=!0;else{if(!Rm(r,c)&&(s.flags&128)===0)return _n=!1,O4(r,s,c);_n=(r.flags&131072)!==0}else _n=!1,Bt&&(s.flags&1048576)!==0&&Q1(s,bc,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")kp(r)?(f=qi(r,f),s.tag=1,s=pj(null,s,r,f,c)):(s.tag=0,s=jm(null,s,r,f,c));else{if(r!=null){var x=r.$$typeof;if(x===O){s.tag=11,s=oj(null,s,r,f,c);break e}else if(x===k){s.tag=14,s=lj(null,s,r,f,c);break e}}throw s=Z(r)||r,Error(a(306,s,""))}}return s;case 0:return jm(r,s,s.type,s.pendingProps,c);case 1:return f=s.type,x=qi(f,s.pendingProps),pj(r,s,f,x,c);case 3:e:{if(Ce(s,s.stateNode.containerInfo),r===null)throw Error(a(387));f=s.pendingProps;var y=s.memoizedState;x=y.element,Xp(r,s),Tc(s,f,null,c);var E=s.memoizedState;if(f=E.cache,$s(s,Nn,f),f!==y.cache&&qp(s,[Nn],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=mj(r,s,f,c);break e}else if(f!==x){x=kr(Error(a(424)),s),wc(x),s=mj(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,ln=zr(r.firstChild),Fn=s,Bt=!0,Vs=null,Fr=!0,c=uS(s,null,f,c),s.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(Li(),f===x){s=ls(r,s,c);break e}zn(r,s,f,c)}s=s.child}return s;case 26:return kd(r,s),r===null?(c=RC(s.type,null,s.pendingProps,null))?s.memoizedState=c:Bt||(c=s.type,r=s.pendingProps,f=Zd(Ne.current).createElement(c),f[at]=s,f[mt]=r,Hn(f,c,r),jn(f),s.stateNode=f):s.memoizedState=RC(s.type,r.memoizedProps,s.pendingProps,r.memoizedState),null;case 27:return ke(s),r===null&&Bt&&(f=s.stateNode=_C(s.type,s.pendingProps,Ne.current),Fn=s,Fr=!0,x=ln,ai(s.type)?(cg=x,ln=zr(f.firstChild)):ln=x),zn(r,s,s.pendingProps.children,c),kd(r,s),r===null&&(s.flags|=4194304),s.child;case 5:return r===null&&Bt&&((x=f=ln)&&(f=oL(f,s.type,s.pendingProps,Fr),f!==null?(s.stateNode=f,Fn=s,ln=zr(f.firstChild),Fr=!1,x=!0):x=!1),x||qs(s)),ke(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,S4,null,null,c),Yc._currentValue=x),kd(r,s),zn(r,s,f,c),s.child;case 6:return r===null&&Bt&&((r=c=ln)&&(c=lL(c,s.pendingProps,Fr),c!==null?(s.stateNode=c,Fn=s,ln=null,r=!0):r=!1),r||qs(s)),null;case 13:return gj(r,s,c);case 4:return Ce(s,s.stateNode.containerInfo),f=s.pendingProps,r===null?s.child=Ui(s,null,f,c):zn(r,s,f,c),s.child;case 11:return oj(r,s,s.type,s.pendingProps,c);case 7:return zn(r,s,s.pendingProps,c),s.child;case 8:return zn(r,s,s.pendingProps.children,c),s.child;case 12:return zn(r,s,s.pendingProps.children,c),s.child;case 10:return f=s.pendingProps,$s(s,s.type,f.value),zn(r,s,f.children,c),s.child;case 9:return x=s.type._context,f=s.pendingProps.children,Fi(s),x=In(x),f=f(x),s.flags|=1,zn(r,s,f,c),s.child;case 14:return lj(r,s,s.type,s.pendingProps,c);case 15:return cj(r,s,s.type,s.pendingProps,c);case 19:return xj(r,s,c);case 31:return R4(r,s,c);case 22:return uj(r,s,c,s.pendingProps);case 24:return Fi(s),f=In(Nn),r===null?(x=Kp(),x===null&&(x=an,y=$p(),x.pooledCache=y,y.refCount++,y!==null&&(x.pooledCacheLanes|=c),x=y),s.memoizedState={parent:f,cache:x},Wp(s),$s(s,Nn,x)):((r.lanes&c)!==0&&(Xp(r,s),Tc(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),$s(s,Nn,f)):(f=y.cache,$s(s,Nn,f),f!==x.cache&&qp(s,[Nn],c,!0))),zn(r,s,s.pendingProps.children,c),s.child;case 29:throw s.pendingProps}throw Error(a(156,s.tag))}function cs(r){r.flags|=4}function Om(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(Gj())r.flags|=8192;else throw Hi=bd,Yp}else r.flags&=-16777217}function bj(r,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!kC(s))if(Gj())r.flags|=8192;else throw Hi=bd,Yp}function Bd(r,s){s!==null&&(r.flags|=4),r.flags&16384&&(s=r.tag!==22?Ve():536870912,r.lanes|=s,Yo|=s)}function Dc(r,s){if(!Bt)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 cn(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 M4(r,s,c){var f=s.pendingProps;switch(Ip(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return cn(s),null;case 1:return cn(s),null;case 3:return c=s.stateNode,f=null,r!==null&&(f=r.memoizedState.cache),s.memoizedState.cache!==f&&(s.flags|=2048),ss(Nn),Pe(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(ko(s)?cs(s):r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Hp())),cn(s),null;case 26:var x=s.type,y=s.memoizedState;return r===null?(cs(s),y!==null?(cn(s),bj(s,y)):(cn(s),Om(s,x,null,f,c))):y?y!==r.memoizedState?(cs(s),cn(s),bj(s,y)):(cn(s),s.flags&=-16777217):(r=r.memoizedProps,r!==f&&cs(s),cn(s),Om(s,x,r,f,c)),null;case 27:if(Ue(s),c=Ne.current,x=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==f&&cs(s);else{if(!f){if(s.stateNode===null)throw Error(a(166));return cn(s),null}r=ee.current,ko(s)?J1(s):(r=_C(x,f,c),s.stateNode=r,cs(s))}return cn(s),null;case 5:if(Ue(s),x=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==f&&cs(s);else{if(!f){if(s.stateNode===null)throw Error(a(166));return cn(s),null}if(y=ee.current,ko(s))J1(s);else{var E=Zd(Ne.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[at]=s,y[mt]=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(Hn(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&&cs(s)}}return cn(s),Om(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,c),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==f&&cs(s);else{if(typeof f!="string"&&s.stateNode===null)throw Error(a(166));if(r=Ne.current,ko(s)){if(r=s.stateNode,c=s.memoizedProps,f=null,x=Fn,x!==null)switch(x.tag){case 27:case 5:f=x.memoizedProps}r[at]=s,r=!!(r.nodeValue===c||f!==null&&f.suppressHydrationWarning===!0||gC(r.nodeValue,c)),r||qs(s,!0)}else r=Zd(r).createTextNode(f),r[at]=s,s.stateNode=r}return cn(s),null;case 31:if(c=s.memoizedState,r===null||r.memoizedState!==null){if(f=ko(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[at]=s}else Li(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;cn(s),r=!1}else c=Hp(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return s.flags&256?(vr(s),s):(vr(s),null);if((s.flags&128)!==0)throw Error(a(558))}return cn(s),null;case 13:if(f=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(x=ko(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[at]=s}else Li(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;cn(s),x=!1}else x=Hp(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=x),x=!0;if(!x)return s.flags&256?(vr(s),s):(vr(s),null)}return vr(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),Bd(s,s.updateQueue),cn(s),null);case 4:return Pe(),r===null&&Jm(s.stateNode.containerInfo),cn(s),null;case 10:return ss(s.type),cn(s),null;case 19:if(re(wn),f=s.memoizedState,f===null)return cn(s),null;if(x=(s.flags&128)!==0,y=f.rendering,y===null)if(x)Dc(f,!1);else{if(yn!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(y=Cd(r),y!==null){for(s.flags|=128,Dc(f,!1),r=y.updateQueue,s.updateQueue=r,Bd(s,r),s.subtreeFlags=0,r=c,c=s.child;c!==null;)Y1(c,r),c=c.sibling;return z(wn,wn.current&1|2),Bt&&rs(s,f.treeForkCount),s.child}r=r.sibling}f.tail!==null&&ht()>Ud&&(s.flags|=128,x=!0,Dc(f,!1),s.lanes=4194304)}else{if(!x)if(r=Cd(y),r!==null){if(s.flags|=128,x=!0,r=r.updateQueue,s.updateQueue=r,Bd(s,r),Dc(f,!0),f.tail===null&&f.tailMode==="hidden"&&!y.alternate&&!Bt)return cn(s),null}else 2*ht()-f.renderingStartTime>Ud&&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=ht(),r.sibling=null,c=wn.current,z(wn,x?c&1|2:c&1),Bt&&rs(s,f.treeForkCount),r):(cn(s),null);case 22:case 23:return vr(s),em(),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&&(cn(s),s.subtreeFlags&6&&(s.flags|=8192)):cn(s),c=s.updateQueue,c!==null&&Bd(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&&re(Ii),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),ss(Nn),cn(s),null;case 25:return null;case 30:return null}throw Error(a(156,s.tag))}function P4(r,s){switch(Ip(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return ss(Nn),Pe(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return Ue(s),null;case 31:if(s.memoizedState!==null){if(vr(s),s.alternate===null)throw Error(a(340));Li()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 13:if(vr(s),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(a(340));Li()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return re(wn),null;case 4:return Pe(),null;case 10:return ss(s.type),null;case 22:case 23:return vr(s),em(),r!==null&&re(Ii),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return ss(Nn),null;case 25:return null;default:return null}}function wj(r,s){switch(Ip(s),s.tag){case 3:ss(Nn),Pe();break;case 26:case 27:case 5:Ue(s);break;case 4:Pe();break;case 31:s.memoizedState!==null&&vr(s);break;case 13:vr(s);break;case 19:re(wn);break;case 10:ss(s.type);break;case 22:case 23:vr(s),em(),r!==null&&re(Ii);break;case 24:ss(Nn)}}function kc(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(R){Zt(s,s.return,R)}}function Qs(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,R=E.destroy;if(R!==void 0){E.destroy=void 0,x=s;var U=c,ne=R;try{ne()}catch(he){Zt(x,U,he)}}}f=f.next}while(f!==y)}}catch(he){Zt(s,s.return,he)}}function Sj(r){var s=r.updateQueue;if(s!==null){var c=r.stateNode;try{fS(s,c)}catch(f){Zt(r,r.return,f)}}}function jj(r,s,c){c.props=qi(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(f){Zt(r,s,f)}}function Lc(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){Zt(r,s,x)}}function ka(r,s){var c=r.ref,f=r.refCleanup;if(c!==null)if(typeof f=="function")try{f()}catch(x){Zt(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){Zt(r,s,x)}else c.current=null}function Cj(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){Zt(r,r.return,x)}}function Mm(r,s,c){try{var f=r.stateNode;tL(f,r.type,c,s),f[mt]=s}catch(x){Zt(r,r.return,x)}}function Nj(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&ai(r.type)||r.tag===4}function Pm(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Nj(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&&ai(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 Dm(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=Pr));else if(f!==4&&(f===27&&ai(r.type)&&(c=r.stateNode,s=null),r=r.child,r!==null))for(Dm(r,s,c),r=r.sibling;r!==null;)Dm(r,s,c),r=r.sibling}function Fd(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&&ai(r.type)&&(c=r.stateNode),r=r.child,r!==null))for(Fd(r,s,c),r=r.sibling;r!==null;)Fd(r,s,c),r=r.sibling}function Ej(r){var s=r.stateNode,c=r.memoizedProps;try{for(var f=r.type,x=s.attributes;x.length;)s.removeAttributeNode(x[0]);Hn(s,f,c),s[at]=r,s[mt]=c}catch(y){Zt(r,r.return,y)}}var us=!1,Tn=!1,km=!1,_j=typeof WeakSet=="function"?WeakSet:Set,kn=null;function D4(r,s){if(r=r.containerInfo,ng=sf,r=I1(r),Tp(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,R=-1,U=-1,ne=0,he=0,ge=r,ae=null;t:for(;;){for(var oe;ge!==c||x!==0&&ge.nodeType!==3||(R=E+x),ge!==y||f!==0&&ge.nodeType!==3||(U=E+f),ge.nodeType===3&&(E+=ge.nodeValue.length),(oe=ge.firstChild)!==null;)ae=ge,ge=oe;for(;;){if(ge===r)break t;if(ae===c&&++ne===x&&(R=E),ae===y&&++he===f&&(U=E),(oe=ge.nextSibling)!==null)break;ge=ae,ae=ge.parentNode}ge=oe}c=R===-1||U===-1?null:{start:R,end:U}}else c=null}c=c||{start:0,end:0}}else c=null;for(rg={focusedElem:r,selectionRange:c},sf=!1,kn=s;kn!==null;)if(s=kn,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,kn=r;else for(;kn!==null;){switch(s=kn,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 Ie=qi(c.type,x);r=f.getSnapshotBeforeUpdate(Ie,y),f.__reactInternalSnapshotBeforeUpdate=r}catch(rt){Zt(c,c.return,rt)}}break;case 3:if((r&1024)!==0){if(r=s.stateNode.containerInfo,c=r.nodeType,c===9)ig(r);else if(c===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":ig(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,kn=r;break}kn=s.return}}function Tj(r,s,c){var f=c.flags;switch(c.tag){case 0:case 11:case 15:fs(r,c),f&4&&kc(5,c);break;case 1:if(fs(r,c),f&4)if(r=c.stateNode,s===null)try{r.componentDidMount()}catch(E){Zt(c,c.return,E)}else{var x=qi(c.type,s.memoizedProps);s=s.memoizedState;try{r.componentDidUpdate(x,s,r.__reactInternalSnapshotBeforeUpdate)}catch(E){Zt(c,c.return,E)}}f&64&&Sj(c),f&512&&Lc(c,c.return);break;case 3:if(fs(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{fS(r,s)}catch(E){Zt(c,c.return,E)}}break;case 27:s===null&&f&4&&Ej(c);case 26:case 5:fs(r,c),s===null&&f&4&&Cj(c),f&512&&Lc(c,c.return);break;case 12:fs(r,c);break;case 31:fs(r,c),f&4&&Oj(r,c);break;case 13:fs(r,c),f&4&&Mj(r,c),f&64&&(r=c.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(c=V4.bind(null,c),cL(r,c))));break;case 22:if(f=c.memoizedState!==null||us,!f){s=s!==null&&s.memoizedState!==null||Tn,x=us;var y=Tn;us=f,(Tn=s)&&!y?hs(r,c,(c.subtreeFlags&8772)!==0):fs(r,c),us=x,Tn=y}break;case 30:break;default:fs(r,c)}}function Aj(r){var s=r.alternate;s!==null&&(r.alternate=null,Aj(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&na(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 hn=null,tr=!1;function ds(r,s,c){for(c=c.child;c!==null;)Rj(r,s,c),c=c.sibling}function Rj(r,s,c){if(We&&typeof We.onCommitFiberUnmount=="function")try{We.onCommitFiberUnmount(_e,c)}catch{}switch(c.tag){case 26:Tn||ka(c,s),ds(r,s,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:Tn||ka(c,s);var f=hn,x=tr;ai(c.type)&&(hn=c.stateNode,tr=!1),ds(r,s,c),$c(c.stateNode),hn=f,tr=x;break;case 5:Tn||ka(c,s);case 6:if(f=hn,x=tr,hn=null,ds(r,s,c),hn=f,tr=x,hn!==null)if(tr)try{(hn.nodeType===9?hn.body:hn.nodeName==="HTML"?hn.ownerDocument.body:hn).removeChild(c.stateNode)}catch(y){Zt(c,s,y)}else try{hn.removeChild(c.stateNode)}catch(y){Zt(c,s,y)}break;case 18:hn!==null&&(tr?(r=hn,SC(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,c.stateNode),nl(r)):SC(hn,c.stateNode));break;case 4:f=hn,x=tr,hn=c.stateNode.containerInfo,tr=!0,ds(r,s,c),hn=f,tr=x;break;case 0:case 11:case 14:case 15:Qs(2,c,s),Tn||Qs(4,c,s),ds(r,s,c);break;case 1:Tn||(ka(c,s),f=c.stateNode,typeof f.componentWillUnmount=="function"&&jj(c,s,f)),ds(r,s,c);break;case 21:ds(r,s,c);break;case 22:Tn=(f=Tn)||c.memoizedState!==null,ds(r,s,c),Tn=f;break;default:ds(r,s,c)}}function Oj(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{nl(r)}catch(c){Zt(s,s.return,c)}}}function Mj(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{nl(r)}catch(c){Zt(s,s.return,c)}}function k4(r){switch(r.tag){case 31:case 13:case 19:var s=r.stateNode;return s===null&&(s=r.stateNode=new _j),s;case 22:return r=r.stateNode,s=r._retryCache,s===null&&(s=r._retryCache=new _j),s;default:throw Error(a(435,r.tag))}}function Id(r,s){var c=k4(r);s.forEach(function(f){if(!c.has(f)){c.add(f);var x=q4.bind(null,r,f);f.then(x,x)}})}function nr(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,R=E;e:for(;R!==null;){switch(R.tag){case 27:if(ai(R.type)){hn=R.stateNode,tr=!1;break e}break;case 5:hn=R.stateNode,tr=!1;break e;case 3:case 4:hn=R.stateNode.containerInfo,tr=!0;break e}R=R.return}if(hn===null)throw Error(a(160));Rj(y,E,x),hn=null,tr=!1,y=x.alternate,y!==null&&(y.return=null),x.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Pj(s,r),s=s.sibling}var la=null;function Pj(r,s){var c=r.alternate,f=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:nr(s,r),rr(r),f&4&&(Qs(3,r,r.return),kc(3,r),Qs(5,r,r.return));break;case 1:nr(s,r),rr(r),f&512&&(Tn||c===null||ka(c,c.return)),f&64&&us&&(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=la;if(nr(s,r),rr(r),f&512&&(Tn||c===null||ka(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[Or]||y[at]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=x.createElement(f),x.head.insertBefore(y,x.querySelector("head > title"))),Hn(y,f,c),y[at]=r,jn(y),f=y;break e;case"link":var E=PC("link","href",x).get(f+(c.href||""));if(E){for(var R=0;R<E.length;R++)if(y=E[R],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(R,1);break t}}y=x.createElement(f),Hn(y,f,c),x.head.appendChild(y);break;case"meta":if(E=PC("meta","content",x).get(f+(c.content||""))){for(R=0;R<E.length;R++)if(y=E[R],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(R,1);break t}}y=x.createElement(f),Hn(y,f,c),x.head.appendChild(y);break;default:throw Error(a(468,f))}y[at]=r,jn(y),f=y}r.stateNode=f}else DC(x,r.type,r.stateNode);else r.stateNode=MC(x,f,r.memoizedProps);else y!==f?(y===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):y.count--,f===null?DC(x,r.type,r.stateNode):MC(x,f,r.memoizedProps)):f===null&&r.stateNode!==null&&Mm(r,r.memoizedProps,c.memoizedProps)}break;case 27:nr(s,r),rr(r),f&512&&(Tn||c===null||ka(c,c.return)),c!==null&&f&4&&Mm(r,r.memoizedProps,c.memoizedProps);break;case 5:if(nr(s,r),rr(r),f&512&&(Tn||c===null||ka(c,c.return)),r.flags&32){x=r.stateNode;try{sa(x,"")}catch(Ie){Zt(r,r.return,Ie)}}f&4&&r.stateNode!=null&&(x=r.memoizedProps,Mm(r,x,c!==null?c.memoizedProps:x)),f&1024&&(km=!0);break;case 6:if(nr(s,r),rr(r),f&4){if(r.stateNode===null)throw Error(a(162));f=r.memoizedProps,c=r.stateNode;try{c.nodeValue=f}catch(Ie){Zt(r,r.return,Ie)}}break;case 3:if(tf=null,x=la,la=Jd(s.containerInfo),nr(s,r),la=x,rr(r),f&4&&c!==null&&c.memoizedState.isDehydrated)try{nl(s.containerInfo)}catch(Ie){Zt(r,r.return,Ie)}km&&(km=!1,Dj(r));break;case 4:f=la,la=Jd(r.stateNode.containerInfo),nr(s,r),rr(r),la=f;break;case 12:nr(s,r),rr(r);break;case 31:nr(s,r),rr(r),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,Id(r,f)));break;case 13:nr(s,r),rr(r),r.child.flags&8192&&r.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Hd=ht()),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,Id(r,f)));break;case 22:x=r.memoizedState!==null;var U=c!==null&&c.memoizedState!==null,ne=us,he=Tn;if(us=ne||x,Tn=he||U,nr(s,r),Tn=he,us=ne,rr(r),f&8192)e:for(s=r.stateNode,s._visibility=x?s._visibility&-2:s._visibility|1,x&&(c===null||U||us||Tn||$i(r)),c=null,s=r;;){if(s.tag===5||s.tag===26){if(c===null){U=c=s;try{if(y=U.stateNode,x)E=y.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{R=U.stateNode;var ge=U.memoizedProps.style,ae=ge!=null&&ge.hasOwnProperty("display")?ge.display:null;R.style.display=ae==null||typeof ae=="boolean"?"":(""+ae).trim()}}catch(Ie){Zt(U,U.return,Ie)}}}else if(s.tag===6){if(c===null){U=s;try{U.stateNode.nodeValue=x?"":U.memoizedProps}catch(Ie){Zt(U,U.return,Ie)}}}else if(s.tag===18){if(c===null){U=s;try{var oe=U.stateNode;x?jC(oe,!0):jC(U.stateNode,!1)}catch(Ie){Zt(U,U.return,Ie)}}}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,Id(r,c))));break;case 19:nr(s,r),rr(r),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,Id(r,f)));break;case 30:break;case 21:break;default:nr(s,r),rr(r)}}function rr(r){var s=r.flags;if(s&2){try{for(var c,f=r.return;f!==null;){if(Nj(f)){c=f;break}f=f.return}if(c==null)throw Error(a(160));switch(c.tag){case 27:var x=c.stateNode,y=Pm(r);Fd(r,y,x);break;case 5:var E=c.stateNode;c.flags&32&&(sa(E,""),c.flags&=-33);var R=Pm(r);Fd(r,R,E);break;case 3:case 4:var U=c.stateNode.containerInfo,ne=Pm(r);Dm(r,ne,U);break;default:throw Error(a(161))}}catch(he){Zt(r,r.return,he)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function Dj(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var s=r;Dj(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),r=r.sibling}}function fs(r,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Tj(r,s.alternate,s),s=s.sibling}function $i(r){for(r=r.child;r!==null;){var s=r;switch(s.tag){case 0:case 11:case 14:case 15:Qs(4,s,s.return),$i(s);break;case 1:ka(s,s.return);var c=s.stateNode;typeof c.componentWillUnmount=="function"&&jj(s,s.return,c),$i(s);break;case 27:$c(s.stateNode);case 26:case 5:ka(s,s.return),$i(s);break;case 22:s.memoizedState===null&&$i(s);break;case 30:$i(s);break;default:$i(s)}r=r.sibling}}function hs(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:hs(x,y,c),kc(4,y);break;case 1:if(hs(x,y,c),f=y,x=f.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(ne){Zt(f,f.return,ne)}if(f=y,x=f.updateQueue,x!==null){var R=f.stateNode;try{var U=x.shared.hiddenCallbacks;if(U!==null)for(x.shared.hiddenCallbacks=null,x=0;x<U.length;x++)dS(U[x],R)}catch(ne){Zt(f,f.return,ne)}}c&&E&64&&Sj(y),Lc(y,y.return);break;case 27:Ej(y);case 26:case 5:hs(x,y,c),c&&f===null&&E&4&&Cj(y),Lc(y,y.return);break;case 12:hs(x,y,c);break;case 31:hs(x,y,c),c&&E&4&&Oj(x,y);break;case 13:hs(x,y,c),c&&E&4&&Mj(x,y);break;case 22:y.memoizedState===null&&hs(x,y,c),Lc(y,y.return);break;case 30:break;default:hs(x,y,c)}s=s.sibling}}function Lm(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&&Sc(c))}function Bm(r,s){r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&Sc(r))}function ca(r,s,c,f){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)kj(r,s,c,f),s=s.sibling}function kj(r,s,c,f){var x=s.flags;switch(s.tag){case 0:case 11:case 15:ca(r,s,c,f),x&2048&&kc(9,s);break;case 1:ca(r,s,c,f);break;case 3:ca(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&&Sc(r)));break;case 12:if(x&2048){ca(r,s,c,f),r=s.stateNode;try{var y=s.memoizedProps,E=y.id,R=y.onPostCommit;typeof R=="function"&&R(E,s.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(U){Zt(s,s.return,U)}}else ca(r,s,c,f);break;case 31:ca(r,s,c,f);break;case 13:ca(r,s,c,f);break;case 23:break;case 22:y=s.stateNode,E=s.alternate,s.memoizedState!==null?y._visibility&2?ca(r,s,c,f):Bc(r,s):y._visibility&2?ca(r,s,c,f):(y._visibility|=2,$o(r,s,c,f,(s.subtreeFlags&10256)!==0||!1)),x&2048&&Lm(E,s);break;case 24:ca(r,s,c,f),x&2048&&Bm(s.alternate,s);break;default:ca(r,s,c,f)}}function $o(r,s,c,f,x){for(x=x&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var y=r,E=s,R=c,U=f,ne=E.flags;switch(E.tag){case 0:case 11:case 15:$o(y,E,R,U,x),kc(8,E);break;case 23:break;case 22:var he=E.stateNode;E.memoizedState!==null?he._visibility&2?$o(y,E,R,U,x):Bc(y,E):(he._visibility|=2,$o(y,E,R,U,x)),x&&ne&2048&&Lm(E.alternate,E);break;case 24:$o(y,E,R,U,x),x&&ne&2048&&Bm(E.alternate,E);break;default:$o(y,E,R,U,x)}s=s.sibling}}function Bc(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:Bc(c,f),x&2048&&Lm(f.alternate,f);break;case 24:Bc(c,f),x&2048&&Bm(f.alternate,f);break;default:Bc(c,f)}s=s.sibling}}var Fc=8192;function Go(r,s,c){if(r.subtreeFlags&Fc)for(r=r.child;r!==null;)Lj(r,s,c),r=r.sibling}function Lj(r,s,c){switch(r.tag){case 26:Go(r,s,c),r.flags&Fc&&r.memoizedState!==null&&wL(c,la,r.memoizedState,r.memoizedProps);break;case 5:Go(r,s,c);break;case 3:case 4:var f=la;la=Jd(r.stateNode.containerInfo),Go(r,s,c),la=f;break;case 22:r.memoizedState===null&&(f=r.alternate,f!==null&&f.memoizedState!==null?(f=Fc,Fc=16777216,Go(r,s,c),Fc=f):Go(r,s,c));break;default:Go(r,s,c)}}function Bj(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];kn=f,Ij(f,r)}Bj(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Fj(r),r=r.sibling}function Fj(r){switch(r.tag){case 0:case 11:case 15:Ic(r),r.flags&2048&&Qs(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,zd(r)):Ic(r);break;default:Ic(r)}}function zd(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];kn=f,Ij(f,r)}Bj(r)}for(r=r.child;r!==null;){switch(s=r,s.tag){case 0:case 11:case 15:Qs(8,s,s.return),zd(s);break;case 22:c=s.stateNode,c._visibility&2&&(c._visibility&=-3,zd(s));break;default:zd(s)}r=r.sibling}}function Ij(r,s){for(;kn!==null;){var c=kn;switch(c.tag){case 0:case 11:case 15:Qs(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:Sc(c.memoizedState.cache)}if(f=c.child,f!==null)f.return=c,kn=f;else e:for(c=r;kn!==null;){f=kn;var x=f.sibling,y=f.return;if(Aj(f),f===c){kn=null;break e}if(x!==null){x.return=y,kn=x;break e}kn=y}}}var L4={getCacheForType:function(r){var s=In(Nn),c=s.data.get(r);return c===void 0&&(c=r(),s.data.set(r,c)),c},cacheSignal:function(){return In(Nn).controller.signal}},B4=typeof WeakMap=="function"?WeakMap:Map,Yt=0,an=null,Rt=null,Dt=0,Qt=0,xr=null,Zs=!1,Ko=!1,Fm=!1,ps=0,yn=0,Js=0,Gi=0,Im=0,yr=0,Yo=0,zc=null,ar=null,zm=!1,Hd=0,zj=0,Ud=1/0,Vd=null,ei=null,Mn=0,ti=null,Wo=null,ms=0,Hm=0,Um=null,Hj=null,Hc=0,Vm=null;function br(){return(Yt&2)!==0&&Dt!==0?Dt&-Dt:P.T!==null?Wm():be()}function Uj(){if(yr===0)if((Dt&536870912)===0||Bt){var r=It;It<<=1,(It&3932160)===0&&(It=262144),yr=r}else yr=536870912;return r=gr.current,r!==null&&(r.flags|=32),yr}function sr(r,s,c){(r===an&&(Qt===2||Qt===9)||r.cancelPendingCommit!==null)&&(Xo(r,0),ni(r,Dt,yr,!1)),tt(r,c),((Yt&2)===0||r!==an)&&(r===an&&((Yt&2)===0&&(Gi|=c),yn===4&&ni(r,Dt,yr,!1)),La(r))}function Vj(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?z4(r,s):$m(r,s,!0),y=f;do{if(x===0){Ko&&!f&&ni(r,s,0,!1);break}else{if(c=r.current.alternate,y&&!F4(c)){x=$m(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 R=r;x=zc;var U=R.current.memoizedState.isDehydrated;if(U&&(Xo(R,E).flags|=256),E=$m(R,E,!1),E!==2){if(Fm&&!U){R.errorRecoveryDisabledLanes|=y,Gi|=y,x=4;break e}y=ar,ar=x,y!==null&&(ar===null?ar=y:ar.push.apply(ar,y))}x=E}if(y=!1,x!==2)continue}}if(x===1){Xo(r,0),ni(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:ni(f,s,yr,!Zs);break e;case 2:ar=null;break;case 3:case 5:break;default:throw Error(a(329))}if((s&62914560)===s&&(x=Hd+300-ht(),10<x)){if(ni(f,s,yr,!Zs),q(f,0,!0)!==0)break e;ms=s,f.timeoutHandle=bC(qj.bind(null,f,c,ar,Vd,zm,s,yr,Gi,Yo,Zs,y,"Throttled",-0,0),x);break e}qj(f,c,ar,Vd,zm,s,yr,Gi,Yo,Zs,y,null,-0,0)}}break}while(!0);La(r)}function qj(r,s,c,f,x,y,E,R,U,ne,he,ge,ae,oe){if(r.timeoutHandle=-1,ge=s.subtreeFlags,ge&8192||(ge&16785408)===16785408){ge={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Pr},Lj(s,y,ge);var Ie=(y&62914560)===y?Hd-ht():(y&4194048)===y?zj-ht():0;if(Ie=SL(ge,Ie),Ie!==null){ms=y,r.cancelPendingCommit=Ie(Zj.bind(null,r,s,y,c,f,x,E,R,U,he,ge,null,ae,oe)),ni(r,y,E,!ne);return}}Zj(r,s,y,c,f,x,E,R,U)}function F4(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(!pr(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 ni(r,s,c,f){s&=~Im,s&=~Gi,r.suspendedLanes|=s,r.pingedLanes&=~s,f&&(r.warmLanes|=s),f=r.expirationTimes;for(var x=s;0<x;){var y=31-bt(x),E=1<<y;f[y]=-1,x&=~E}c!==0&&J(r,c,s)}function qd(){return(Yt&6)===0?(Uc(0),!1):!0}function qm(){if(Rt!==null){if(Qt===0)var r=Rt.return;else r=Rt,as=Bi=null,im(r),zo=null,Cc=0,r=Rt;for(;r!==null;)wj(r.alternate,r),r=r.return;Rt=null}}function Xo(r,s){var c=r.timeoutHandle;c!==-1&&(r.timeoutHandle=-1,aL(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),ms=0,qm(),an=r,Rt=c=ns(r.current,null),Dt=s,Qt=0,xr=null,Zs=!1,Ko=Se(r,s),Fm=!1,Yo=yr=Im=Gi=Js=yn=0,ar=zc=null,zm=!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-bt(f),y=1<<x;s|=r[x],f&=~y}return ps=s,dd(),c}function $j(r,s){vt=null,P.H=Mc,s===Io||s===yd?(s=oS(),Qt=3):s===Yp?(s=oS(),Qt=4):Qt=s===Sm?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,xr=s,Rt===null&&(yn=1,Pd(r,kr(s,r.current)))}function Gj(){var r=gr.current;return r===null?!0:(Dt&4194048)===Dt?Ir===null:(Dt&62914560)===Dt||(Dt&536870912)!==0?r===Ir:!1}function Kj(){var r=P.H;return P.H=Mc,r===null?Mc:r}function Yj(){var r=P.A;return P.A=L4,r}function $d(){yn=4,Zs||(Dt&4194048)!==Dt&&gr.current!==null||(Ko=!0),(Js&134217727)===0&&(Gi&134217727)===0||an===null||ni(an,Dt,yr,!1)}function $m(r,s,c){var f=Yt;Yt|=2;var x=Kj(),y=Yj();(an!==r||Dt!==s)&&(Vd=null,Xo(r,s)),s=!1;var E=yn;e:do try{if(Qt!==0&&Rt!==null){var R=Rt,U=xr;switch(Qt){case 8:qm(),E=6;break e;case 3:case 2:case 9:case 6:gr.current===null&&(s=!0);var ne=Qt;if(Qt=0,xr=null,Qo(r,R,U,ne),c&&Ko){E=0;break e}break;default:ne=Qt,Qt=0,xr=null,Qo(r,R,U,ne)}}I4(),E=yn;break}catch(he){$j(r,he)}while(!0);return s&&r.shellSuspendCounter++,as=Bi=null,Yt=f,P.H=x,P.A=y,Rt===null&&(an=null,Dt=0,dd()),E}function I4(){for(;Rt!==null;)Wj(Rt)}function z4(r,s){var c=Yt;Yt|=2;var f=Kj(),x=Yj();an!==r||Dt!==s?(Vd=null,Ud=ht()+500,Xo(r,s)):Ko=Se(r,s);e:do try{if(Qt!==0&&Rt!==null){s=Rt;var y=xr;t:switch(Qt){case 1:Qt=0,xr=null,Qo(r,s,y,1);break;case 2:case 9:if(sS(y)){Qt=0,xr=null,Xj(s);break}s=function(){Qt!==2&&Qt!==9||an!==r||(Qt=7),La(r)},y.then(s,s);break e;case 3:Qt=7;break e;case 4:Qt=5;break e;case 7:sS(y)?(Qt=0,xr=null,Xj(s)):(Qt=0,xr=null,Qo(r,s,y,7));break;case 5:var E=null;switch(Rt.tag){case 26:E=Rt.memoizedState;case 5:case 27:var R=Rt;if(E?kC(E):R.stateNode.complete){Qt=0,xr=null;var U=R.sibling;if(U!==null)Rt=U;else{var ne=R.return;ne!==null?(Rt=ne,Gd(ne)):Rt=null}break t}}Qt=0,xr=null,Qo(r,s,y,5);break;case 6:Qt=0,xr=null,Qo(r,s,y,6);break;case 8:qm(),yn=6;break e;default:throw Error(a(462))}}H4();break}catch(he){$j(r,he)}while(!0);return as=Bi=null,P.H=f,P.A=x,Yt=c,Rt!==null?0:(an=null,Dt=0,dd(),yn)}function H4(){for(;Rt!==null&&!ft();)Wj(Rt)}function Wj(r){var s=yj(r.alternate,r,ps);r.memoizedProps=r.pendingProps,s===null?Gd(r):Rt=s}function Xj(r){var s=r,c=s.alternate;switch(s.tag){case 15:case 0:s=hj(c,s,s.pendingProps,s.type,void 0,Dt);break;case 11:s=hj(c,s,s.pendingProps,s.type.render,s.ref,Dt);break;case 5:im(s);default:wj(c,s),s=Rt=Y1(s,ps),s=yj(c,s,ps)}r.memoizedProps=r.pendingProps,s===null?Gd(r):Rt=s}function Qo(r,s,c,f){as=Bi=null,im(s),zo=null,Cc=0;var x=s.return;try{if(A4(r,x,s,c,Dt)){yn=1,Pd(r,kr(c,r.current)),Rt=null;return}}catch(y){if(x!==null)throw Rt=x,y;yn=1,Pd(r,kr(c,r.current)),Rt=null;return}s.flags&32768?(Bt||f===1?r=!0:Ko||(Dt&536870912)!==0?r=!1:(Zs=r=!0,(f===2||f===9||f===3||f===6)&&(f=gr.current,f!==null&&f.tag===13&&(f.flags|=16384))),Qj(s,r)):Gd(s)}function Gd(r){var s=r;do{if((s.flags&32768)!==0){Qj(s,Zs);return}r=s.return;var c=M4(s.alternate,s,ps);if(c!==null){Rt=c;return}if(s=s.sibling,s!==null){Rt=s;return}Rt=s=r}while(s!==null);yn===0&&(yn=5)}function Qj(r,s){do{var c=P4(r.alternate,r);if(c!==null){c.flags&=32767,Rt=c;return}if(c=r.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!s&&(r=r.sibling,r!==null)){Rt=r;return}Rt=r=c}while(r!==null);yn=6,Rt=null}function Zj(r,s,c,f,x,y,E,R,U){r.cancelPendingCommit=null;do Kd();while(Mn!==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|=Pp,Ut(r,c,y,E,R,U),r===an&&(Rt=an=null,Dt=0),Wo=s,ti=r,ms=c,Hm=y,Um=x,Hj=f,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,$4(Xt,function(){return rC(),null})):(r.callbackNode=null,r.callbackPriority=0),f=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||f){f=P.T,P.T=null,x=V.p,V.p=2,E=Yt,Yt|=4;try{D4(r,s,c)}finally{Yt=E,V.p=x,P.T=f}}Mn=1,Jj(),eC(),tC()}}function Jj(){if(Mn===1){Mn=0;var r=ti,s=Wo,c=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||c){c=P.T,P.T=null;var f=V.p;V.p=2;var x=Yt;Yt|=4;try{Pj(s,r);var y=rg,E=I1(r.containerInfo),R=y.focusedElem,U=y.selectionRange;if(E!==R&&R&&R.ownerDocument&&F1(R.ownerDocument.documentElement,R)){if(U!==null&&Tp(R)){var ne=U.start,he=U.end;if(he===void 0&&(he=ne),"selectionStart"in R)R.selectionStart=ne,R.selectionEnd=Math.min(he,R.value.length);else{var ge=R.ownerDocument||document,ae=ge&&ge.defaultView||window;if(ae.getSelection){var oe=ae.getSelection(),Ie=R.textContent.length,rt=Math.min(U.start,Ie),nn=U.end===void 0?rt:Math.min(U.end,Ie);!oe.extend&&rt>nn&&(E=nn,nn=rt,rt=E);var X=B1(R,rt),$=B1(R,nn);if(X&&$&&(oe.rangeCount!==1||oe.anchorNode!==X.node||oe.anchorOffset!==X.offset||oe.focusNode!==$.node||oe.focusOffset!==$.offset)){var te=ge.createRange();te.setStart(X.node,X.offset),oe.removeAllRanges(),rt>nn?(oe.addRange(te),oe.extend($.node,$.offset)):(te.setEnd($.node,$.offset),oe.addRange(te))}}}}for(ge=[],oe=R;oe=oe.parentNode;)oe.nodeType===1&&ge.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof R.focus=="function"&&R.focus(),R=0;R<ge.length;R++){var me=ge[R];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}sf=!!ng,rg=ng=null}finally{Yt=x,V.p=f,P.T=c}}r.current=s,Mn=2}}function eC(){if(Mn===2){Mn=0;var r=ti,s=Wo,c=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||c){c=P.T,P.T=null;var f=V.p;V.p=2;var x=Yt;Yt|=4;try{Tj(r,s.alternate,s)}finally{Yt=x,V.p=f,P.T=c}}Mn=3}}function tC(){if(Mn===4||Mn===3){Mn=0,Ge();var r=ti,s=Wo,c=ms,f=Hj;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?Mn=5:(Mn=0,Wo=ti=null,nC(r,r.pendingLanes));var x=r.pendingLanes;if(x===0&&(ei=null),I(c),s=s.stateNode,We&&typeof We.onCommitFiberRoot=="function")try{We.onCommitFiberRoot(_e,s,void 0,(s.current.flags&128)===128)}catch{}if(f!==null){s=P.T,x=V.p,V.p=2,P.T=null;try{for(var y=r.onRecoverableError,E=0;E<f.length;E++){var R=f[E];y(R.value,{componentStack:R.stack})}}finally{P.T=s,V.p=x}}(ms&3)!==0&&Kd(),La(r),x=r.pendingLanes,(c&261930)!==0&&(x&42)!==0?r===Vm?Hc++:(Hc=0,Vm=r):Hc=0,Uc(0)}}function nC(r,s){(r.pooledCacheLanes&=s)===0&&(s=r.pooledCache,s!=null&&(r.pooledCache=null,Sc(s)))}function Kd(){return Jj(),eC(),tC(),rC()}function rC(){if(Mn!==5)return!1;var r=ti,s=Hm;Hm=0;var c=I(ms),f=P.T,x=V.p;try{V.p=32>c?32:c,P.T=null,c=Um,Um=null;var y=ti,E=ms;if(Mn=0,Wo=ti=null,ms=0,(Yt&6)!==0)throw Error(a(331));var R=Yt;if(Yt|=4,Fj(y.current),kj(y,y.current,E,c),Yt=R,Uc(0,!1),We&&typeof We.onPostCommitFiberRoot=="function")try{We.onPostCommitFiberRoot(_e,y)}catch{}return!0}finally{V.p=x,P.T=f,nC(r,s)}}function aC(r,s,c){s=kr(c,s),s=wm(r.stateNode,s,2),r=Ys(r,s,2),r!==null&&(tt(r,2),La(r))}function Zt(r,s,c){if(r.tag===3)aC(r,r,c);else for(;s!==null;){if(s.tag===3){aC(s,r,c);break}else if(s.tag===1){var f=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(ei===null||!ei.has(f))){r=kr(c,r),c=sj(2),f=Ys(s,c,2),f!==null&&(ij(c,f,s,r),tt(f,2),La(f));break}}s=s.return}}function Gm(r,s,c){var f=r.pingCache;if(f===null){f=r.pingCache=new B4;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)||(Fm=!0,x.add(c),r=U4.bind(null,r,s,c),s.then(r,r))}function U4(r,s,c){var f=r.pingCache;f!==null&&f.delete(s),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,an===r&&(Dt&c)===c&&(yn===4||yn===3&&(Dt&62914560)===Dt&&300>ht()-Hd?(Yt&2)===0&&Xo(r,0):Im|=c,Yo===Dt&&(Yo=0)),La(r)}function sC(r,s){s===0&&(s=Ve()),r=Di(r,s),r!==null&&(tt(r,s),La(r))}function V4(r){var s=r.memoizedState,c=0;s!==null&&(c=s.retryLane),sC(r,c)}function q4(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),sC(r,c)}function $4(r,s){return Lt(r,s)}var Yd=null,Zo=null,Km=!1,Wd=!1,Ym=!1,ri=0;function La(r){r!==Zo&&r.next===null&&(Zo===null?Yd=Zo=r:Zo=Zo.next=r),Wd=!0,Km||(Km=!0,K4())}function Uc(r,s){if(!Ym&&Wd){Ym=!0;do for(var c=!1,f=Yd;f!==null;){if(r!==0){var x=f.pendingLanes;if(x===0)var y=0;else{var E=f.suspendedLanes,R=f.pingedLanes;y=(1<<31-bt(42|r)+1)-1,y&=x&~(E&~R),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(c=!0,cC(f,y))}else y=Dt,y=q(f,f===an?y:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(y&3)===0||Se(f,y)||(c=!0,cC(f,y));f=f.next}while(c);Ym=!1}}function G4(){iC()}function iC(){Wd=Km=!1;var r=0;ri!==0&&rL()&&(r=ri);for(var s=ht(),c=null,f=Yd;f!==null;){var x=f.next,y=oC(f,s);y===0?(f.next=null,c===null?Yd=x:c.next=x,x===null&&(Zo=c)):(c=f,(r!==0||(y&3)!==0)&&(Wd=!0)),f=x}Mn!==0&&Mn!==5||Uc(r),ri!==0&&(ri=0)}function oC(r,s){for(var c=r.suspendedLanes,f=r.pingedLanes,x=r.expirationTimes,y=r.pendingLanes&-62914561;0<y;){var E=31-bt(y),R=1<<E,U=x[E];U===-1?((R&c)===0||(R&f)!==0)&&(x[E]=Oe(R,s)):U<=s&&(r.expiredLanes|=R),y&=~R}if(s=an,c=Dt,c=q(r,r===s?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),f=r.callbackNode,c===0||r===s&&(Qt===2||Qt===9)||r.cancelPendingCommit!==null)return f!==null&&f!==null&&yt(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&&yt(f),I(c)){case 2:case 8:c=Wt;break;case 32:c=Xt;break;case 268435456:c=De;break;default:c=Xt}return f=lC.bind(null,r),c=Lt(c,f),r.callbackPriority=s,r.callbackNode=c,s}return f!==null&&f!==null&&yt(f),r.callbackPriority=2,r.callbackNode=null,2}function lC(r,s){if(Mn!==0&&Mn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var c=r.callbackNode;if(Kd()&&r.callbackNode!==c)return null;var f=Dt;return f=q(r,r===an?f:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),f===0?null:(Vj(r,f,s),oC(r,ht()),r.callbackNode!=null&&r.callbackNode===c?lC.bind(null,r):null)}function cC(r,s){if(Kd())return null;Vj(r,s,!0)}function K4(){sL(function(){(Yt&6)!==0?Lt(Jt,G4):iC()})}function Wm(){if(ri===0){var r=Bo;r===0&&(r=$t,$t<<=1,($t&261888)===0&&($t=256)),ri=r}return ri}function uC(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Ri(""+r)}function dC(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 Y4(r,s,c,f,x){if(s==="submit"&&c&&c.stateNode===x){var y=uC((x[mt]||null).action),E=f.submitter;E&&(s=(s=E[mt]||null)?uC(s.formAction):E.getAttribute("formAction"),s!==null&&(y=s,E=null));var R=new _o("action","action",null,f,x);r.push({event:R,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(ri!==0){var U=E?dC(x,E):new FormData(x);mm(c,{pending:!0,data:U,method:x.method,action:y},null,U)}}else typeof y=="function"&&(R.preventDefault(),U=E?dC(x,E):new FormData(x),mm(c,{pending:!0,data:U,method:x.method,action:y},y,U))},currentTarget:x}]})}}for(var Xm=0;Xm<Mp.length;Xm++){var Qm=Mp[Xm],W4=Qm.toLowerCase(),X4=Qm[0].toUpperCase()+Qm.slice(1);oa(W4,"on"+X4)}oa(U1,"onAnimationEnd"),oa(V1,"onAnimationIteration"),oa(q1,"onAnimationStart"),oa("dblclick","onDoubleClick"),oa("focusin","onFocus"),oa("focusout","onBlur"),oa(f4,"onTransitionRun"),oa(h4,"onTransitionStart"),oa(p4,"onTransitionCancel"),oa($1,"onTransitionEnd"),Ja("onMouseEnter",["mouseout","mouseover"]),Ja("onMouseLeave",["mouseout","mouseover"]),Ja("onPointerEnter",["pointerout","pointerover"]),Ja("onPointerLeave",["pointerout","pointerover"]),Oa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Oa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Oa("onBeforeInput",["compositionend","keypress","textInput","paste"]),Oa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Oa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Oa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Vc="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(" "),Q4=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Vc));function fC(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 R=f[E],U=R.instance,ne=R.currentTarget;if(R=R.listener,U!==y&&x.isPropagationStopped())break e;y=R,x.currentTarget=ne;try{y(x)}catch(he){ud(he)}x.currentTarget=null,y=U}else for(E=0;E<f.length;E++){if(R=f[E],U=R.instance,ne=R.currentTarget,R=R.listener,U!==y&&x.isPropagationStopped())break e;y=R,x.currentTarget=ne;try{y(x)}catch(he){ud(he)}x.currentTarget=null,y=U}}}}function Ot(r,s){var c=s[D];c===void 0&&(c=s[D]=new Set);var f=r+"__bubble";c.has(f)||(hC(s,r,2,!1),c.add(f))}function Zm(r,s,c){var f=0;s&&(f|=4),hC(c,r,f,s)}var Xd="_reactListening"+Math.random().toString(36).slice(2);function Jm(r){if(!r[Xd]){r[Xd]=!0,_i.forEach(function(c){c!=="selectionchange"&&(Q4.has(c)||Zm(c,!1,r),Zm(c,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[Xd]||(s[Xd]=!0,Zm("selectionchange",!1,s))}}function hC(r,s,c,f){switch(UC(s)){case 2:var x=NL;break;case 8:x=EL;break;default:x=pg}c=x.bind(null,s,c,r),x=void 0,!Eo||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 eg(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 R=f.stateNode.containerInfo;if(R===x)break;if(E===4)for(E=f.return;E!==null;){var U=E.tag;if((U===3||U===4)&&E.stateNode.containerInfo===x)return;E=E.return}for(;R!==null;){if(E=Ra(R),E===null)return;if(U=E.tag,U===5||U===6||U===26||U===27){f=y=E;continue e}R=R.parentNode}}f=f.return}No(function(){var ne=y,he=fc(c),ge=[];e:{var ae=G1.get(r);if(ae!==void 0){var oe=_o,Ie=r;switch(r){case"keypress":if(rn(c)===0)break e;case"keydown":case"keyup":oe=q3;break;case"focusin":Ie="focus",oe=jp;break;case"focusout":Ie="blur",oe=jp;break;case"beforeblur":case"afterblur":oe=jp;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":oe=w1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":oe=M3;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":oe=K3;break;case U1:case V1:case q1:oe=k3;break;case $1:oe=W3;break;case"scroll":case"scrollend":oe=R3;break;case"wheel":oe=Q3;break;case"copy":case"cut":case"paste":oe=B3;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":oe=j1;break;case"toggle":case"beforetoggle":oe=J3}var rt=(s&4)!==0,nn=!rt&&(r==="scroll"||r==="scrollend"),X=rt?ae!==null?ae+"Capture":null:ae;rt=[];for(var $=ne,te;$!==null;){var me=$;if(te=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||te===null||X===null||(me=ts($,X),me!=null&&rt.push(qc($,me,te))),nn)break;$=$.return}0<rt.length&&(ae=new oe(ae,Ie,null,c,he),ge.push({event:ae,listeners:rt}))}}if((s&7)===0){e:{if(ae=r==="mouseover"||r==="pointerover",oe=r==="mouseout"||r==="pointerout",ae&&c!==dc&&(Ie=c.relatedTarget||c.fromElement)&&(Ra(Ie)||Ie[dn]))break e;if((oe||ae)&&(ae=he.window===he?he:(ae=he.ownerDocument)?ae.defaultView||ae.parentWindow:window,oe?(Ie=c.relatedTarget||c.toElement,oe=ne,Ie=Ie?Ra(Ie):null,Ie!==null&&(nn=l(Ie),rt=Ie.tag,Ie!==nn||rt!==5&&rt!==27&&rt!==6)&&(Ie=null)):(oe=null,Ie=ne),oe!==Ie)){if(rt=w1,me="onMouseLeave",X="onMouseEnter",$="mouse",(r==="pointerout"||r==="pointerover")&&(rt=j1,me="onPointerLeave",X="onPointerEnter",$="pointer"),nn=oe==null?ae:Bs(oe),te=Ie==null?ae:Bs(Ie),ae=new rt(me,$+"leave",oe,c,he),ae.target=nn,ae.relatedTarget=te,me=null,Ra(he)===ne&&(rt=new rt(X,$+"enter",Ie,c,he),rt.target=te,rt.relatedTarget=nn,me=rt),nn=me,oe&&Ie)t:{for(rt=Z4,X=oe,$=Ie,te=0,me=X;me;me=rt(me))te++;me=0;for(var Xe=$;Xe;Xe=rt(Xe))me++;for(;0<te-me;)X=rt(X),te--;for(;0<me-te;)$=rt($),me--;for(;te--;){if(X===$||$!==null&&X===$.alternate){rt=X;break t}X=rt(X),$=rt($)}rt=null}else rt=null;oe!==null&&pC(ge,ae,oe,rt,!1),Ie!==null&&nn!==null&&pC(ge,nn,Ie,rt,!0)}}e:{if(ae=ne?Bs(ne):window,oe=ae.nodeName&&ae.nodeName.toLowerCase(),oe==="select"||oe==="input"&&ae.type==="file")var Gt=O1;else if(A1(ae))if(M1)Gt=c4;else{Gt=o4;var qe=i4}else oe=ae.nodeName,!oe||oe.toLowerCase()!=="input"||ae.type!=="checkbox"&&ae.type!=="radio"?ne&&er(ne.elementType)&&(Gt=O1):Gt=l4;if(Gt&&(Gt=Gt(r,ne))){R1(ge,Gt,c,he);break e}qe&&qe(r,ae,ne),r==="focusout"&&ne&&ae.type==="number"&&ne.memoizedProps.value!=null&&uc(ae,"number",ae.value)}switch(qe=ne?Bs(ne):window,r){case"focusin":(A1(qe)||qe.contentEditable==="true")&&(Ao=qe,Ap=ne,yc=null);break;case"focusout":yc=Ap=Ao=null;break;case"mousedown":Rp=!0;break;case"contextmenu":case"mouseup":case"dragend":Rp=!1,z1(ge,c,he);break;case"selectionchange":if(d4)break;case"keydown":case"keyup":z1(ge,c,he)}var wt;if(Np)e:{switch(r){case"compositionstart":var kt="onCompositionStart";break e;case"compositionend":kt="onCompositionEnd";break e;case"compositionupdate":kt="onCompositionUpdate";break e}kt=void 0}else To?_1(r,c)&&(kt="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(kt="onCompositionStart");kt&&(C1&&c.locale!=="ko"&&(To||kt!=="onCompositionStart"?kt==="onCompositionEnd"&&To&&(wt=Ht()):(je=he,nt="value"in je?je.value:je.textContent,To=!0)),qe=Qd(ne,kt),0<qe.length&&(kt=new S1(kt,r,null,c,he),ge.push({event:kt,listeners:qe}),wt?kt.data=wt:(wt=T1(c),wt!==null&&(kt.data=wt)))),(wt=t4?n4(r,c):r4(r,c))&&(kt=Qd(ne,"onBeforeInput"),0<kt.length&&(qe=new S1("onBeforeInput","beforeinput",null,c,he),ge.push({event:qe,listeners:kt}),qe.data=wt)),Y4(ge,r,ne,c,he)}fC(ge,s)})}function qc(r,s,c){return{instance:r,listener:s,currentTarget:c}}function Qd(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=ts(r,c),x!=null&&f.unshift(qc(r,x,y)),x=ts(r,s),x!=null&&f.push(qc(r,x,y))),r.tag===3)return f;r=r.return}return[]}function Z4(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function pC(r,s,c,f,x){for(var y=s._reactName,E=[];c!==null&&c!==f;){var R=c,U=R.alternate,ne=R.stateNode;if(R=R.tag,U!==null&&U===f)break;R!==5&&R!==26&&R!==27||ne===null||(U=ne,x?(ne=ts(c,y),ne!=null&&E.unshift(qc(c,ne,U))):x||(ne=ts(c,y),ne!=null&&E.push(qc(c,ne,U)))),c=c.return}E.length!==0&&r.push({event:s,listeners:E})}var J4=/\r\n?/g,eL=/\u0000|\uFFFD/g;function mC(r){return(typeof r=="string"?r:""+r).replace(J4,`
  9. `).replace(eL,"")}function gC(r,s){return s=mC(s),mC(r)===s}function tn(r,s,c,f,x,y){switch(c){case"children":typeof f=="string"?s==="body"||s==="textarea"&&f===""||sa(r,f):(typeof f=="number"||typeof f=="bigint")&&s!=="body"&&sa(r,""+f);break;case"className":xo(r,"class",f);break;case"tabIndex":xo(r,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":xo(r,c,f);break;case"style":jo(r,f,y);break;case"data":if(s!=="object"){xo(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=Ri(""+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"&&tn(r,s,"name",x.name,x,null),tn(r,s,"formEncType",x.formEncType,x,null),tn(r,s,"formMethod",x.formMethod,x,null),tn(r,s,"formTarget",x.formTarget,x,null)):(tn(r,s,"encType",x.encType,x,null),tn(r,s,"method",x.method,x,null),tn(r,s,"target",x.target,x,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){r.removeAttribute(c);break}f=Ri(""+f),r.setAttribute(c,f);break;case"onClick":f!=null&&(r.onclick=Pr);break;case"onScroll":f!=null&&Ot("scroll",r);break;case"onScrollEnd":f!=null&&Ot("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=Ri(""+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":Ot("beforetoggle",r),Ot("toggle",r),Ti(r,"popover",f);break;case"xlinkActuate":Mr(r,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":Mr(r,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":Mr(r,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":Mr(r,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":Mr(r,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":Mr(r,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":Mr(r,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":Mr(r,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":Mr(r,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":Ti(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=Is.get(c)||c,Ti(r,c,f))}}function tg(r,s,c,f,x,y){switch(c){case"style":jo(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"?sa(r,f):(typeof f=="number"||typeof f=="bigint")&&sa(r,""+f);break;case"onScroll":f!=null&&Ot("scroll",r);break;case"onScrollEnd":f!=null&&Ot("scrollend",r);break;case"onClick":f!=null&&(r.onclick=Pr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!sc.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[mt]||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,""):Ti(r,c,f)}}}function Hn(r,s,c){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ot("error",r),Ot("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:tn(r,s,y,E,c,null)}}x&&tn(r,s,"srcSet",c.srcSet,c,null),f&&tn(r,s,"src",c.src,c,null);return;case"input":Ot("invalid",r);var R=y=E=x=null,U=null,ne=null;for(f in c)if(c.hasOwnProperty(f)){var he=c[f];if(he!=null)switch(f){case"name":x=he;break;case"type":E=he;break;case"checked":U=he;break;case"defaultChecked":ne=he;break;case"value":y=he;break;case"defaultValue":R=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(a(137,s));break;default:tn(r,s,f,he,c,null)}}id(r,y,R,U,ne,E,x,!1);return;case"select":Ot("invalid",r),f=E=y=null;for(x in c)if(c.hasOwnProperty(x)&&(R=c[x],R!=null))switch(x){case"value":y=R;break;case"defaultValue":E=R;break;case"multiple":f=R;default:tn(r,s,x,R,c,null)}s=y,c=E,r.multiple=!!f,s!=null?es(r,!!f,s,!1):c!=null&&es(r,!!f,c,!0);return;case"textarea":Ot("invalid",r),y=x=f=null;for(E in c)if(c.hasOwnProperty(E)&&(R=c[E],R!=null))switch(E){case"value":f=R;break;case"defaultValue":x=R;break;case"children":y=R;break;case"dangerouslySetInnerHTML":if(R!=null)throw Error(a(91));break;default:tn(r,s,E,R,c,null)}So(r,f,x,y);return;case"option":for(U in c)c.hasOwnProperty(U)&&(f=c[U],f!=null)&&(U==="selected"?r.selected=f&&typeof f!="function"&&typeof f!="symbol":tn(r,s,U,f,c,null));return;case"dialog":Ot("beforetoggle",r),Ot("toggle",r),Ot("cancel",r),Ot("close",r);break;case"iframe":case"object":Ot("load",r);break;case"video":case"audio":for(f=0;f<Vc.length;f++)Ot(Vc[f],r);break;case"image":Ot("error",r),Ot("load",r);break;case"details":Ot("toggle",r);break;case"embed":case"source":case"link":Ot("error",r),Ot("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(ne in c)if(c.hasOwnProperty(ne)&&(f=c[ne],f!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:tn(r,s,ne,f,c,null)}return;default:if(er(s)){for(he in c)c.hasOwnProperty(he)&&(f=c[he],f!==void 0&&tg(r,s,he,f,c,void 0));return}}for(R in c)c.hasOwnProperty(R)&&(f=c[R],f!=null&&tn(r,s,R,f,c,null))}function tL(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,R=null,U=null,ne=null,he=null;for(oe in c){var ge=c[oe];if(c.hasOwnProperty(oe)&&ge!=null)switch(oe){case"checked":break;case"value":break;case"defaultValue":U=ge;default:f.hasOwnProperty(oe)||tn(r,s,oe,null,f,ge)}}for(var ae in f){var oe=f[ae];if(ge=c[ae],f.hasOwnProperty(ae)&&(oe!=null||ge!=null))switch(ae){case"type":y=oe;break;case"name":x=oe;break;case"checked":ne=oe;break;case"defaultChecked":he=oe;break;case"value":E=oe;break;case"defaultValue":R=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(a(137,s));break;default:oe!==ge&&tn(r,s,ae,oe,f,ge)}}bo(r,E,R,U,ne,he,y,x);return;case"select":oe=E=R=ae=null;for(y in c)if(U=c[y],c.hasOwnProperty(y)&&U!=null)switch(y){case"value":break;case"multiple":oe=U;default:f.hasOwnProperty(y)||tn(r,s,y,null,f,U)}for(x in f)if(y=f[x],U=c[x],f.hasOwnProperty(x)&&(y!=null||U!=null))switch(x){case"value":ae=y;break;case"defaultValue":R=y;break;case"multiple":E=y;default:y!==U&&tn(r,s,x,y,f,U)}s=R,c=E,f=oe,ae!=null?es(r,!!c,ae,!1):!!f!=!!c&&(s!=null?es(r,!!c,s,!0):es(r,!!c,c?[]:"",!1));return;case"textarea":oe=ae=null;for(R in c)if(x=c[R],c.hasOwnProperty(R)&&x!=null&&!f.hasOwnProperty(R))switch(R){case"value":break;case"children":break;default:tn(r,s,R,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":ae=x;break;case"defaultValue":oe=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(a(91));break;default:x!==y&&tn(r,s,E,x,f,y)}wo(r,ae,oe);return;case"option":for(var Ie in c)ae=c[Ie],c.hasOwnProperty(Ie)&&ae!=null&&!f.hasOwnProperty(Ie)&&(Ie==="selected"?r.selected=!1:tn(r,s,Ie,null,f,ae));for(U in f)ae=f[U],oe=c[U],f.hasOwnProperty(U)&&ae!==oe&&(ae!=null||oe!=null)&&(U==="selected"?r.selected=ae&&typeof ae!="function"&&typeof ae!="symbol":tn(r,s,U,ae,f,oe));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)ae=c[rt],c.hasOwnProperty(rt)&&ae!=null&&!f.hasOwnProperty(rt)&&tn(r,s,rt,null,f,ae);for(ne in f)if(ae=f[ne],oe=c[ne],f.hasOwnProperty(ne)&&ae!==oe&&(ae!=null||oe!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(a(137,s));break;default:tn(r,s,ne,ae,f,oe)}return;default:if(er(s)){for(var nn in c)ae=c[nn],c.hasOwnProperty(nn)&&ae!==void 0&&!f.hasOwnProperty(nn)&&tg(r,s,nn,void 0,f,ae);for(he in f)ae=f[he],oe=c[he],!f.hasOwnProperty(he)||ae===oe||ae===void 0&&oe===void 0||tg(r,s,he,ae,f,oe);return}}for(var X in c)ae=c[X],c.hasOwnProperty(X)&&ae!=null&&!f.hasOwnProperty(X)&&tn(r,s,X,null,f,ae);for(ge in f)ae=f[ge],oe=c[ge],!f.hasOwnProperty(ge)||ae===oe||ae==null&&oe==null||tn(r,s,ge,ae,f,oe)}function vC(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function nL(){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,R=x.duration;if(y&&R&&vC(E)){for(E=0,R=x.responseEnd,f+=1;f<c.length;f++){var U=c[f],ne=U.startTime;if(ne>R)break;var he=U.transferSize,ge=U.initiatorType;he&&vC(ge)&&(U=U.responseEnd,E+=he*(U<R?1:(R-ne)/(U-ne)))}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 ng=null,rg=null;function Zd(r){return r.nodeType===9?r:r.ownerDocument}function xC(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 yC(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 sg=null;function rL(){var r=window.event;return r&&r.type==="popstate"?r===sg?!1:(sg=r,!0):(sg=null,!1)}var bC=typeof setTimeout=="function"?setTimeout:void 0,aL=typeof clearTimeout=="function"?clearTimeout:void 0,wC=typeof Promise=="function"?Promise:void 0,sL=typeof queueMicrotask=="function"?queueMicrotask:typeof wC<"u"?function(r){return wC.resolve(null).then(r).catch(iL)}:bC;function iL(r){setTimeout(function(){throw r})}function ai(r){return r==="head"}function SC(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),nl(s);return}f--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")f++;else if(c==="html")$c(r.ownerDocument.documentElement);else if(c==="head"){c=r.ownerDocument.head,$c(c);for(var y=c.firstChild;y;){var E=y.nextSibling,R=y.nodeName;y[Or]||R==="SCRIPT"||R==="STYLE"||R==="LINK"&&y.rel.toLowerCase()==="stylesheet"||c.removeChild(y),y=E}}else c==="body"&&$c(r.ownerDocument.body);c=x}while(c);nl(s)}function jC(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 ig(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":ig(c),na(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}r.removeChild(c)}}function oL(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[Or])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=zr(r.nextSibling),r===null)break}return null}function lL(r,s,c){if(s==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!c||(r=zr(r.nextSibling),r===null))return null;return r}function CC(r,s){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!s||(r=zr(r.nextSibling),r===null))return null;return r}function og(r){return r.data==="$?"||r.data==="$~"}function lg(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function cL(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 zr(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 cg=null;function NC(r){r=r.nextSibling;for(var s=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"||c==="/&"){if(s===0)return zr(r.nextSibling);s--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||s++}r=r.nextSibling}return null}function EC(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 _C(r,s,c){switch(s=Zd(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 $c(r){for(var s=r.attributes;s.length;)r.removeAttributeNode(s[0]);na(r)}var Hr=new Map,TC=new Set;function Jd(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var gs=V.d;V.d={f:uL,r:dL,D:fL,C:hL,L:pL,m:mL,X:vL,S:gL,M:xL};function uL(){var r=gs.f(),s=qd();return r||s}function dL(r){var s=ra(r);s!==null&&s.tag===5&&s.type==="form"?$S(s):gs.r(r)}var Jo=typeof document>"u"?null:document;function AC(r,s,c){var f=Jo;if(f&&typeof s=="string"&&s){var x=Cn(s);x='link[rel="'+r+'"][href="'+x+'"]',typeof c=="string"&&(x+='[crossorigin="'+c+'"]'),TC.has(x)||(TC.add(x),r={rel:r,crossOrigin:c,href:s},f.querySelector(x)===null&&(s=f.createElement("link"),Hn(s,"link",r),jn(s),f.head.appendChild(s)))}}function fL(r){gs.D(r),AC("dns-prefetch",r,null)}function hL(r,s){gs.C(r,s),AC("preconnect",r,s)}function pL(r,s,c){gs.L(r,s,c);var f=Jo;if(f&&r&&s){var x='link[rel="preload"][as="'+Cn(s)+'"]';s==="image"&&c&&c.imageSrcSet?(x+='[imagesrcset="'+Cn(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(x+='[imagesizes="'+Cn(c.imageSizes)+'"]')):x+='[href="'+Cn(r)+'"]';var y=x;switch(s){case"style":y=el(r);break;case"script":y=tl(r)}Hr.has(y)||(r=m({rel:"preload",href:s==="image"&&c&&c.imageSrcSet?void 0:r,as:s},c),Hr.set(y,r),f.querySelector(x)!==null||s==="style"&&f.querySelector(Gc(y))||s==="script"&&f.querySelector(Kc(y))||(s=f.createElement("link"),Hn(s,"link",r),jn(s),f.head.appendChild(s)))}}function mL(r,s){gs.m(r,s);var c=Jo;if(c&&r){var f=s&&typeof s.as=="string"?s.as:"script",x='link[rel="modulepreload"][as="'+Cn(f)+'"][href="'+Cn(r)+'"]',y=x;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=tl(r)}if(!Hr.has(y)&&(r=m({rel:"modulepreload",href:r},s),Hr.set(y,r),c.querySelector(x)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Kc(y)))return}f=c.createElement("link"),Hn(f,"link",r),jn(f),c.head.appendChild(f)}}}function gL(r,s,c){gs.S(r,s,c);var f=Jo;if(f&&r){var x=aa(f).hoistableStyles,y=el(r);s=s||"default";var E=x.get(y);if(!E){var R={loading:0,preload:null};if(E=f.querySelector(Gc(y)))R.loading=5;else{r=m({rel:"stylesheet",href:r,"data-precedence":s},c),(c=Hr.get(y))&&ug(r,c);var U=E=f.createElement("link");jn(U),Hn(U,"link",r),U._p=new Promise(function(ne,he){U.onload=ne,U.onerror=he}),U.addEventListener("load",function(){R.loading|=1}),U.addEventListener("error",function(){R.loading|=2}),R.loading|=4,ef(E,s,f)}E={type:"stylesheet",instance:E,count:1,state:R},x.set(y,E)}}}function vL(r,s){gs.X(r,s);var c=Jo;if(c&&r){var f=aa(c).hoistableScripts,x=tl(r),y=f.get(x);y||(y=c.querySelector(Kc(x)),y||(r=m({src:r,async:!0},s),(s=Hr.get(x))&&dg(r,s),y=c.createElement("script"),jn(y),Hn(y,"link",r),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},f.set(x,y))}}function xL(r,s){gs.M(r,s);var c=Jo;if(c&&r){var f=aa(c).hoistableScripts,x=tl(r),y=f.get(x);y||(y=c.querySelector(Kc(x)),y||(r=m({src:r,async:!0,type:"module"},s),(s=Hr.get(x))&&dg(r,s),y=c.createElement("script"),jn(y),Hn(y,"link",r),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},f.set(x,y))}}function RC(r,s,c,f){var x=(x=Ne.current)?Jd(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=el(c.href),c=aa(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=el(c.href);var y=aa(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(Gc(r)))&&!y._p&&(E.instance=y,E.state.loading=5),Hr.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},Hr.set(r,c),y||yL(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=tl(c),c=aa(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 el(r){return'href="'+Cn(r)+'"'}function Gc(r){return'link[rel="stylesheet"]['+r+"]"}function OC(r){return m({},r,{"data-precedence":r.precedence,precedence:null})}function yL(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}),Hn(s,"link",c),jn(s),r.head.appendChild(s))}function tl(r){return'[src="'+Cn(r)+'"]'}function Kc(r){return"script[async]"+r}function MC(r,s,c){if(s.count++,s.instance===null)switch(s.type){case"style":var f=r.querySelector('style[data-href~="'+Cn(c.href)+'"]');if(f)return s.instance=f,jn(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"),jn(f),Hn(f,"style",x),ef(f,c.precedence,r),s.instance=f;case"stylesheet":x=el(c.href);var y=r.querySelector(Gc(x));if(y)return s.state.loading|=4,s.instance=y,jn(y),y;f=OC(c),(x=Hr.get(x))&&ug(f,x),y=(r.ownerDocument||r).createElement("link"),jn(y);var E=y;return E._p=new Promise(function(R,U){E.onload=R,E.onerror=U}),Hn(y,"link",f),s.state.loading|=4,ef(y,c.precedence,r),s.instance=y;case"script":return y=tl(c.src),(x=r.querySelector(Kc(y)))?(s.instance=x,jn(x),x):(f=c,(x=Hr.get(y))&&(f=m({},c),dg(f,x)),r=r.ownerDocument||r,x=r.createElement("script"),jn(x),Hn(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,ef(f,c.precedence,r));return s.instance}function ef(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 R=f[E];if(R.dataset.precedence===s)y=R;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 ug(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.title==null&&(r.title=s.title)}function dg(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.integrity==null&&(r.integrity=s.integrity)}var tf=null;function PC(r,s,c){if(tf===null){var f=new Map,x=tf=new Map;x.set(c,f)}else x=tf,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[Or]||y[at]||r==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var E=y.getAttribute(s)||"";E=r+E;var R=f.get(E);R?R.push(y):f.set(E,[y])}}return f}function DC(r,s,c){r=r.ownerDocument||r,r.head.insertBefore(c,s==="title"?r.querySelector("head > title"):null)}function bL(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 kC(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function wL(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=el(f.href),y=s.querySelector(Gc(x));if(y){s=y._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=nf.bind(r),s.then(r,r)),c.state.loading|=4,c.instance=y,jn(y);return}y=s.ownerDocument||s,f=OC(f),(x=Hr.get(x))&&ug(f,x),y=y.createElement("link"),jn(y);var E=y;E._p=new Promise(function(R,U){E.onload=R,E.onerror=U}),Hn(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=nf.bind(r),s.addEventListener("load",c),s.addEventListener("error",c))}}var fg=0;function SL(r,s){return r.stylesheets&&r.count===0&&af(r,r.stylesheets),0<r.count||0<r.imgCount?function(c){var f=setTimeout(function(){if(r.stylesheets&&af(r,r.stylesheets),r.unsuspend){var y=r.unsuspend;r.unsuspend=null,y()}},6e4+s);0<r.imgBytes&&fg===0&&(fg=62500*nL());var x=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&af(r,r.stylesheets),r.unsuspend)){var y=r.unsuspend;r.unsuspend=null,y()}},(r.imgBytes>fg?50:800)+s);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(f),clearTimeout(x)}}:null}function nf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)af(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var rf=null;function af(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,rf=new Map,s.forEach(jL,r),rf=null,nf.call(r))}function jL(r,s){if(!(s.state.loading&4)){var c=rf.get(r);if(c)var f=c.get(null);else{c=new Map,rf.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=nf.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 Yc={$$typeof:T,Provider:null,Consumer:null,_currentValue:H,_currentValue2:H,_threadCount:0};function CL(r,s,c,f,x,y,E,R,U){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=At(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=At(0),this.hiddenUpdates=At(null),this.identifierPrefix=f,this.onUncaughtError=x,this.onCaughtError=y,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=U,this.incompleteTransitions=new Map}function LC(r,s,c,f,x,y,E,R,U,ne,he,ge){return r=new CL(r,s,c,E,U,ne,he,ge,R),s=1,y===!0&&(s|=24),y=mr(3,null,null,s),r.current=y,y.stateNode=r,s=$p(),s.refCount++,r.pooledCache=s,s.refCount++,y.memoizedState={element:f,isDehydrated:c,cache:s},Wp(y),r}function BC(r){return r?(r=Mo,r):Mo}function FC(r,s,c,f,x,y){x=BC(x),f.context===null?f.context=x:f.pendingContext=x,f=Ks(s),f.payload={element:c},y=y===void 0?null:y,y!==null&&(f.callback=y),c=Ys(r,f,s),c!==null&&(sr(c,r,s),Ec(c,r,s))}function IC(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<s?c:s}}function hg(r,s){IC(r,s),(r=r.alternate)&&IC(r,s)}function zC(r){if(r.tag===13||r.tag===31){var s=Di(r,67108864);s!==null&&sr(s,r,67108864),hg(r,67108864)}}function HC(r){if(r.tag===13||r.tag===31){var s=br();s=Le(s);var c=Di(r,s);c!==null&&sr(c,r,s),hg(r,s)}}var sf=!0;function NL(r,s,c,f){var x=P.T;P.T=null;var y=V.p;try{V.p=2,pg(r,s,c,f)}finally{V.p=y,P.T=x}}function EL(r,s,c,f){var x=P.T;P.T=null;var y=V.p;try{V.p=8,pg(r,s,c,f)}finally{V.p=y,P.T=x}}function pg(r,s,c,f){if(sf){var x=mg(f);if(x===null)eg(r,s,f,of,c),VC(r,f);else if(TL(x,r,s,c,f))f.stopPropagation();else if(VC(r,f),s&4&&-1<_L.indexOf(r)){for(;x!==null;){var y=ra(x);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var E=jt(y.pendingLanes);if(E!==0){var R=y;for(R.pendingLanes|=2,R.entangledLanes|=2;E;){var U=1<<31-bt(E);R.entanglements[1]|=U,E&=~U}La(y),(Yt&6)===0&&(Ud=ht()+500,Uc(0))}}break;case 31:case 13:R=Di(y,2),R!==null&&sr(R,y,2),qd(),hg(y,2)}if(y=mg(f),y===null&&eg(r,s,f,of,c),y===x)break;x=y}x!==null&&f.stopPropagation()}else eg(r,s,f,null,c)}}function mg(r){return r=fc(r),gg(r)}var of=null;function gg(r){if(of=null,r=Ra(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 of=r,null}function UC(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(Ct()){case Jt:return 2;case Wt:return 8;case Xt:case de:return 32;case De:return 268435456;default:return 32}default:return 32}}var vg=!1,si=null,ii=null,oi=null,Wc=new Map,Xc=new Map,li=[],_L="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 VC(r,s){switch(r){case"focusin":case"focusout":si=null;break;case"dragenter":case"dragleave":ii=null;break;case"mouseover":case"mouseout":oi=null;break;case"pointerover":case"pointerout":Wc.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Xc.delete(s.pointerId)}}function Qc(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=ra(s),s!==null&&zC(s)),r):(r.eventSystemFlags|=f,s=r.targetContainers,x!==null&&s.indexOf(x)===-1&&s.push(x),r)}function TL(r,s,c,f,x){switch(s){case"focusin":return si=Qc(si,r,s,c,f,x),!0;case"dragenter":return ii=Qc(ii,r,s,c,f,x),!0;case"mouseover":return oi=Qc(oi,r,s,c,f,x),!0;case"pointerover":var y=x.pointerId;return Wc.set(y,Qc(Wc.get(y)||null,r,s,c,f,x)),!0;case"gotpointercapture":return y=x.pointerId,Xc.set(y,Qc(Xc.get(y)||null,r,s,c,f,x)),!0}return!1}function qC(r){var s=Ra(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,Ze(r.priority,function(){HC(c)});return}}else if(s===31){if(s=d(c),s!==null){r.blockedOn=s,Ze(r.priority,function(){HC(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 lf(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var c=mg(r.nativeEvent);if(c===null){c=r.nativeEvent;var f=new c.constructor(c.type,c);dc=f,c.target.dispatchEvent(f),dc=null}else return s=ra(c),s!==null&&zC(s),r.blockedOn=c,!1;s.shift()}return!0}function $C(r,s,c){lf(r)&&c.delete(s)}function AL(){vg=!1,si!==null&&lf(si)&&(si=null),ii!==null&&lf(ii)&&(ii=null),oi!==null&&lf(oi)&&(oi=null),Wc.forEach($C),Xc.forEach($C)}function cf(r,s){r.blockedOn===s&&(r.blockedOn=null,vg||(vg=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,AL)))}var uf=null;function GC(r){uf!==r&&(uf=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){uf===r&&(uf=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(gg(f||c)===null)continue;break}var y=ra(c);y!==null&&(r.splice(s,3),s-=3,mm(y,{pending:!0,data:x,method:c.method,action:f},f,x))}}))}function nl(r){function s(U){return cf(U,r)}si!==null&&cf(si,r),ii!==null&&cf(ii,r),oi!==null&&cf(oi,r),Wc.forEach(s),Xc.forEach(s);for(var c=0;c<li.length;c++){var f=li[c];f.blockedOn===r&&(f.blockedOn=null)}for(;0<li.length&&(c=li[0],c.blockedOn===null);)qC(c),c.blockedOn===null&&li.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[mt]||null;if(typeof y=="function")E||GC(c);else if(E){var R=null;if(y&&y.hasAttribute("formAction")){if(x=y,E=y[mt]||null)R=E.formAction;else if(gg(x)!==null)continue}else R=E.action;typeof R=="function"?c[f+1]=R:(c.splice(f,3),f-=3),GC(c)}}}function KC(){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 xg(r){this._internalRoot=r}df.prototype.render=xg.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(a(409));var c=s.current,f=br();FC(c,f,r,s,null,null)},df.prototype.unmount=xg.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;FC(r.current,2,null,r,null,null),qd(),s[dn]=null}};function df(r){this._internalRoot=r}df.prototype.unstable_scheduleHydration=function(r){if(r){var s=be();r={blockedOn:null,target:r,priority:s};for(var c=0;c<li.length&&s!==0&&s<li[c].priority;c++);li.splice(c,0,r),c===0&&qC(r)}};var YC=t.version;if(YC!=="19.2.3")throw Error(a(527,YC,"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?g(r):null,r=r===null?null:r.stateNode,r};var RL={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ff=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ff.isDisabled&&ff.supportsFiber)try{_e=ff.inject(RL),We=ff}catch{}}return Jc.createRoot=function(r,s){if(!i(r))throw Error(a(299));var c=!1,f="",x=tj,y=nj,E=rj;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=LC(r,1,!1,null,null,c,f,null,x,y,E,KC),r[dn]=s.current,Jm(r),new xg(s)},Jc.hydrateRoot=function(r,s,c){if(!i(r))throw Error(a(299));var f=!1,x="",y=tj,E=nj,R=rj,U=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&&(R=c.onRecoverableError),c.formState!==void 0&&(U=c.formState)),s=LC(r,1,!0,s,c??null,f,x,U,y,E,R,KC),s.context=BC(null),c=s.current,f=br(),f=Le(f),x=Ks(f),x.callback=null,Ys(c,x,f),c=f,s.current.lanes=c,tt(s,c),La(s),r[dn]=s.current,Jm(r),new df(s)},Jc.version="19.2.3",Jc}var aN;function HL(){if(aN)return wg.exports;aN=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(),wg.exports=zL(),wg.exports}var UL=HL();var sN="popstate";function VL(e={}){function t(a,i){let{pathname:l,search:u,hash:d}=a.location;return lb("",{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:Cu(i)}return $L(t,n,null,e)}function gn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Zr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function qL(){return Math.random().toString(36).substring(2,10)}function iN(e,t){return{usr:e.state,key:e.key,idx:t}}function lb(e,t,n=null,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Vl(t):t,state:n,key:t&&t.key||a||qL()}}function Cu({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 Vl(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 $L(e,t,n,a={}){let{window:i=document.defaultView,v5Compat:l=!1}=a,u=i.history,d="POP",h=null,p=g();p==null&&(p=0,u.replaceState({...u.state,idx:p},""));function g(){return(u.state||{idx:null}).idx}function m(){d="POP";let C=g(),N=C==null?null:C-p;p=C,h&&h({action:d,location:w.location,delta:N})}function b(C,N){d="PUSH";let _=lb(w.location,C,N);p=g()+1;let T=iN(_,p),O=w.createHref(_);try{u.pushState(T,"",O)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;i.location.assign(O)}l&&h&&h({action:d,location:w.location,delta:1})}function S(C,N){d="REPLACE";let _=lb(w.location,C,N);p=g();let T=iN(_,p),O=w.createHref(_);u.replaceState(T,"",O),l&&h&&h({action:d,location:w.location,delta:0})}function j(C){return GL(C)}let w={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(sN,m),h=C,()=>{i.removeEventListener(sN,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:S,go(C){return u.go(C)}};return w}function GL(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),gn(n,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:Cu(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=n+a),new URL(a,n)}function NR(e,t,n="/"){return KL(e,t,n,!1)}function KL(e,t,n,a){let i=typeof t=="string"?Vl(t):t,l=Es(i.pathname||"/",n);if(l==null)return null;let u=ER(e);YL(u);let d=null;for(let h=0;d==null&&h<u.length;++h){let p=s8(l);d=r8(u[h],p,a)}return d}function ER(e,t=[],n=[],a="",i=!1){let l=(u,d,h=i,p)=>{let g={relativePath:p===void 0?u.path||"":p,caseSensitive:u.caseSensitive===!0,childrenIndex:d,route:u};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(a)&&h)return;gn(g.relativePath.startsWith(a),`Absolute route path "${g.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(a.length)}let m=Cs([a,g.relativePath]),b=n.concat(g);u.children&&u.children.length>0&&(gn(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),ER(u.children,t,b,m,h)),!(u.path==null&&!u.index)&&t.push({path:m,score:t8(m,u.index),routesMeta:b})};return e.forEach((u,d)=>{if(u.path===""||!u.path?.includes("?"))l(u,d);else for(let h of _R(u.path))l(u,d,!0,h)}),t}function _R(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=_R(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 YL(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:n8(t.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var WL=/^:[\w-]+$/,XL=3,QL=2,ZL=1,JL=10,e8=-2,oN=e=>e==="*";function t8(e,t){let n=e.split("/"),a=n.length;return n.some(oN)&&(a+=e8),t&&(a+=QL),n.filter(i=>!oN(i)).reduce((i,l)=>i+(WL.test(l)?XL:l===""?ZL:JL),a)}function n8(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 r8(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,g=l==="/"?t:t.slice(l.length)||"/",m=Gf({path:h.relativePath,caseSensitive:h.caseSensitive,end:p},g),b=h.route;if(!m&&p&&n&&!a[a.length-1].route.index&&(m=Gf({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},g)),!m)return null;Object.assign(i,m.params),u.push({params:i,pathname:Cs([l,m.pathname]),pathnameBase:c8(Cs([l,m.pathnameBase])),route:b}),m.pathnameBase!=="/"&&(l=Cs([l,m.pathnameBase]))}return u}function Gf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=a8(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:g,isOptional:m},b)=>{if(g==="*"){let j=d[b]||"";u=l.slice(0,l.length-j.length).replace(/(.)\/+$/,"$1")}const S=d[b];return m&&!S?p[g]=void 0:p[g]=(S||"").replace(/%2F/g,"/"),p},{}),pathname:l,pathnameBase:u,pattern:e}}function a8(e,t=!1,n=!0){Zr(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 s8(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Zr(!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 Es(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 TR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,i8=e=>TR.test(e);function o8(e,t="/"){let{pathname:n,search:a="",hash:i=""}=typeof e=="string"?Vl(e):e,l;if(n)if(i8(n))l=n;else{if(n.includes("//")){let u=n;n=n.replace(/\/\/+/g,"/"),Zr(!1,`Pathnames cannot have embedded double slashes - normalizing ${u} -> ${n}`)}n.startsWith("/")?l=lN(n.substring(1),"/"):l=lN(n,t)}else l=t;return{pathname:l,search:u8(a),hash:d8(i)}}function lN(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 Ng(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 l8(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function AR(e){let t=l8(e);return t.map((n,a)=>a===t.length-1?n.pathname:n.pathnameBase)}function RR(e,t,n,a=!1){let i;typeof e=="string"?i=Vl(e):(i={...e},gn(!i.pathname||!i.pathname.includes("?"),Ng("?","pathname","search",i)),gn(!i.pathname||!i.pathname.includes("#"),Ng("#","pathname","hash",i)),gn(!i.search||!i.search.includes("#"),Ng("#","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=o8(i,d),p=u&&u!=="/"&&u.endsWith("/"),g=(l||u===".")&&n.endsWith("/");return!h.pathname.endsWith("/")&&(p||g)&&(h.pathname+="/"),h}var Cs=e=>e.join("/").replace(/\/\/+/g,"/"),c8=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),u8=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,d8=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,f8=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 h8(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function p8(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var OR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function MR(e,t){let n=e;if(typeof n!="string"||!TR.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=n,i=!1;if(OR)try{let l=new URL(window.location.href),u=n.startsWith("//")?new URL(l.protocol+n):new URL(n),d=Es(u.pathname,t);u.origin===l.origin&&d!=null?n=d+u.search+u.hash:i=!0}catch{Zr(!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 PR=["POST","PUT","PATCH","DELETE"];new Set(PR);var m8=["GET",...PR];new Set(m8);var ql=v.createContext(null);ql.displayName="DataRouter";var xh=v.createContext(null);xh.displayName="DataRouterState";var g8=v.createContext(!1),DR=v.createContext({isTransitioning:!1});DR.displayName="ViewTransition";var v8=v.createContext(new Map);v8.displayName="Fetchers";var x8=v.createContext(null);x8.displayName="Await";var ta=v.createContext(null);ta.displayName="Navigation";var zu=v.createContext(null);zu.displayName="Location";var Xa=v.createContext({outlet:null,matches:[],isDataRoute:!1});Xa.displayName="Route";var p0=v.createContext(null);p0.displayName="RouteError";var kR="REACT_ROUTER_ERROR",y8="REDIRECT",b8="ROUTE_ERROR_RESPONSE";function w8(e){if(e.startsWith(`${kR}:${y8}:{`))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 S8(e){if(e.startsWith(`${kR}:${b8}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new f8(t.status,t.statusText,t.data)}catch{}}function j8(e,{relative:t}={}){gn(Hu(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=v.useContext(ta),{hash:i,pathname:l,search:u}=Uu(e,{relative:t}),d=l;return n!=="/"&&(d=l==="/"?n:Cs([n,l])),a.createHref({pathname:d,search:u,hash:i})}function Hu(){return v.useContext(zu)!=null}function Ms(){return gn(Hu(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(zu).location}var LR="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function BR(e){v.useContext(ta).static||v.useLayoutEffect(e)}function yh(){let{isDataRoute:e}=v.useContext(Xa);return e?B8():C8()}function C8(){gn(Hu(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(ql),{basename:t,navigator:n}=v.useContext(ta),{matches:a}=v.useContext(Xa),{pathname:i}=Ms(),l=JSON.stringify(AR(a)),u=v.useRef(!1);return BR(()=>{u.current=!0}),v.useCallback((h,p={})=>{if(Zr(u.current,LR),!u.current)return;if(typeof h=="number"){n.go(h);return}let g=RR(h,JSON.parse(l),i,p.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Cs([t,g.pathname])),(p.replace?n.replace:n.push)(g,p.state,p)},[t,n,l,i,e])}var FR=v.createContext(null);function IR(){return v.useContext(FR)}function N8(e){let t=v.useContext(Xa).outlet;return v.useMemo(()=>t&&v.createElement(FR.Provider,{value:e},t),[t,e])}function Uu(e,{relative:t}={}){let{matches:n}=v.useContext(Xa),{pathname:a}=Ms(),i=JSON.stringify(AR(n));return v.useMemo(()=>RR(e,JSON.parse(i),a,t==="path"),[e,i,a,t])}function E8(e,t){return zR(e,t)}function zR(e,t,n,a,i){gn(Hu(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:l}=v.useContext(ta),{matches:u}=v.useContext(Xa),d=u[u.length-1],h=d?d.params:{},p=d?d.pathname:"/",g=d?d.pathnameBase:"/",m=d&&d.route;{let _=m&&m.path||"";UR(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=Ms(),S;if(t){let _=typeof t=="string"?Vl(t):t;gn(g==="/"||_.pathname?.startsWith(g),`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 "${g}" but pathname "${_.pathname}" was given in the \`location\` prop.`),S=_}else S=b;let j=S.pathname||"/",w=j;if(g!=="/"){let _=g.replace(/^\//,"").split("/");w="/"+j.replace(/^\//,"").split("/").slice(_.length).join("/")}let C=NR(e,{pathname:w});Zr(m||C!=null,`No routes matched location "${S.pathname}${S.search}${S.hash}" `),Zr(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 "${S.pathname}${S.search}${S.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=O8(C&&C.map(_=>Object.assign({},_,{params:Object.assign({},h,_.params),pathname:Cs([g,l.encodeLocation?l.encodeLocation(_.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?g:Cs([g,l.encodeLocation?l.encodeLocation(_.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathnameBase])})),u,n,a,i);return t&&N?v.createElement(zu.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...S},navigationType:"POP"}},N):N}function _8(){let e=L8(),t=h8(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=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:l},"ErrorBoundary")," or"," ",v.createElement("code",{style:l},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),n?v.createElement("pre",{style:i},n):null,u)}var T8=v.createElement(_8,null),HR=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=S8(e.digest);n&&(e=n)}let t=e!==void 0?v.createElement(Xa.Provider,{value:this.props.routeContext},v.createElement(p0.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?v.createElement(A8,{error:e},t):t}};HR.contextType=g8;var Eg=new WeakMap;function A8({children:e,error:t}){let{basename:n}=v.useContext(ta);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=w8(t.digest);if(a){let i=Eg.get(t);if(i)throw i;let l=MR(a.location,n);if(OR&&!Eg.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 Eg.set(t,u),u}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function R8({routeContext:e,match:t,children:n}){let a=v.useContext(ql);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(Xa.Provider,{value:e},n)}function O8(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 g=l.findIndex(m=>m.route.id&&u?.[m.route.id]!==void 0);gn(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),l=l.slice(0,Math.min(l.length,g+1))}let d=!1,h=-1;if(n)for(let g=0;g<l.length;g++){let m=l[g];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(h=g),m.route.id){let{loaderData:b,errors:S}=n,j=m.route.loader&&!b.hasOwnProperty(m.route.id)&&(!S||S[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?(g,m)=>{a(g,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:p8(n.matches),errorInfo:m})}:void 0;return l.reduceRight((g,m,b)=>{let S,j=!1,w=null,C=null;n&&(S=u&&m.route.id?u[m.route.id]:void 0,w=m.route.errorElement||T8,d&&(h<0&&b===0?(UR("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 S?T=w:j?T=C:m.route.Component?T=v.createElement(m.route.Component,null):m.route.element?T=m.route.element:T=g,v.createElement(R8,{match:m,routeContext:{outlet:g,matches:N,isDataRoute:n!=null},children:T})};return n&&(m.route.ErrorBoundary||m.route.errorElement||b===0)?v.createElement(HR,{location:n.location,revalidation:n.revalidation,component:w,error:S,children:_(),routeContext:{outlet:null,matches:N,isDataRoute:!0},onError:p}):_()},null)}function m0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function M8(e){let t=v.useContext(ql);return gn(t,m0(e)),t}function P8(e){let t=v.useContext(xh);return gn(t,m0(e)),t}function D8(e){let t=v.useContext(Xa);return gn(t,m0(e)),t}function g0(e){let t=D8(e),n=t.matches[t.matches.length-1];return gn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function k8(){return g0("useRouteId")}function L8(){let e=v.useContext(p0),t=P8("useRouteError"),n=g0("useRouteError");return e!==void 0?e:t.errors?.[n]}function B8(){let{router:e}=M8("useNavigate"),t=g0("useNavigate"),n=v.useRef(!1);return BR(()=>{n.current=!0}),v.useCallback(async(i,l={})=>{Zr(n.current,LR),n.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:t,...l}))},[e,t])}var cN={};function UR(e,t,n){!t&&!cN[e]&&(cN[e]=!0,Zr(!1,n))}v.memo(F8);function F8({routes:e,future:t,state:n,onError:a}){return zR(e,void 0,n,a,t)}function I8(e){return N8(e.context)}function Ss(e){gn(!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 z8({basename:e="/",children:t=null,location:n,navigationType:a="POP",navigator:i,static:l=!1,unstable_useTransitions:u}){gn(!Hu(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),h=v.useMemo(()=>({basename:d,navigator:i,static:l,unstable_useTransitions:u,future:{}}),[d,i,l,u]);typeof n=="string"&&(n=Vl(n));let{pathname:p="/",search:g="",hash:m="",state:b=null,key:S="default"}=n,j=v.useMemo(()=>{let w=Es(p,d);return w==null?null:{location:{pathname:w,search:g,hash:m,state:b,key:S},navigationType:a}},[d,p,g,m,b,S,a]);return Zr(j!=null,`<Router basename="${d}"> is not able to match the URL "${p}${g}${m}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:v.createElement(ta.Provider,{value:h},v.createElement(zu.Provider,{children:t,value:j}))}function H8({children:e,location:t}){return E8(cb(e),t)}function cb(e,t=[]){let n=[];return v.Children.forEach(e,(a,i)=>{if(!v.isValidElement(a))return;let l=[...t,i];if(a.type===v.Fragment){n.push.apply(n,cb(a.props.children,l));return}gn(a.type===Ss,`[${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>`),gn(!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=cb(a.props.children,l)),n.push(u)}),n}var Pf="get",Df="application/x-www-form-urlencoded";function bh(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function U8(e){return bh(e)&&e.tagName.toLowerCase()==="button"}function V8(e){return bh(e)&&e.tagName.toLowerCase()==="form"}function q8(e){return bh(e)&&e.tagName.toLowerCase()==="input"}function $8(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function G8(e,t){return e.button===0&&(!t||t==="_self")&&!$8(e)}function ub(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 K8(e,t){let n=ub(e);return t&&t.forEach((a,i)=>{n.has(i)||t.getAll(i).forEach(l=>{n.append(i,l)})}),n}var pf=null;function Y8(){if(pf===null)try{new FormData(document.createElement("form"),0),pf=!1}catch{pf=!0}return pf}var W8=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function _g(e){return e!=null&&!W8.has(e)?(Zr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Df}"`),null):e}function X8(e,t){let n,a,i,l,u;if(V8(e)){let d=e.getAttribute("action");a=d?Es(d,t):null,n=e.getAttribute("method")||Pf,i=_g(e.getAttribute("enctype"))||Df,l=new FormData(e)}else if(U8(e)||q8(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?Es(h,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||Pf,i=_g(e.getAttribute("formenctype"))||_g(d.getAttribute("enctype"))||Df,l=new FormData(d,e),!Y8()){let{name:p,type:g,value:m}=e;if(g==="image"){let b=p?`${p}.`:"";l.append(`${b}x`,"0"),l.append(`${b}y`,"0")}else p&&l.append(p,m)}}else{if(bh(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Pf,a=null,i=Df,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 v0(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Q8(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&&Es(i.pathname,t)==="/"?i.pathname=`${t.replace(/\/$/,"")}/_root.${a}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${a}`,i}async function Z8(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 J8(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 e6(e,t,n){let a=await Promise.all(e.map(async i=>{let l=t.routes[i.route.id];if(l){let u=await Z8(l,n);return u.links?u.links():[]}return[]}));return a6(a.flat(1).filter(J8).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function uN(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 g=a.routes[h.route.id];if(!g||!g.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 t6(e,t,{includeHydrateFallback:n}={}){return n6(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 n6(e){return[...new Set(e)]}function r6(e){let t={},n=Object.keys(e).sort();for(let a of n)t[a]=e[a];return t}function a6(e,t){let n=new Set;return new Set(t),e.reduce((a,i)=>{let l=JSON.stringify(r6(i));return n.has(l)||(n.add(l),a.push({key:l,link:i})),a},[])}function VR(){let e=v.useContext(ql);return v0(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function s6(){let e=v.useContext(xh);return v0(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var x0=v.createContext(void 0);x0.displayName="FrameworkContext";function qR(){let e=v.useContext(x0);return v0(e,"You must render this element inside a <HydratedRouter> element"),e}function i6(e,t){let n=v.useContext(x0),[a,i]=v.useState(!1),[l,u]=v.useState(!1),{onFocus:d,onBlur:h,onMouseEnter:p,onMouseLeave:g,onTouchStart:m}=t,b=v.useRef(null);v.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let w=N=>{N.forEach(_=>{u(_.isIntersecting)})},C=new IntersectionObserver(w,{threshold:.5});return b.current&&C.observe(b.current),()=>{C.disconnect()}}},[e]),v.useEffect(()=>{if(a){let w=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(w)}}},[a]);let S=()=>{i(!0)},j=()=>{i(!1),u(!1)};return n?e!=="intent"?[l,b,{}]:[l,b,{onFocus:eu(d,S),onBlur:eu(h,j),onMouseEnter:eu(p,S),onMouseLeave:eu(g,j),onTouchStart:eu(m,S)}]:[!1,b,{}]}function eu(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function o6({page:e,...t}){let{router:n}=VR(),a=v.useMemo(()=>NR(n.routes,e,n.basename),[n.routes,e,n.basename]);return a?v.createElement(c6,{page:e,matches:a,...t}):null}function l6(e){let{manifest:t,routeModules:n}=qR(),[a,i]=v.useState([]);return v.useEffect(()=>{let l=!1;return e6(e,t,n).then(u=>{l||i(u)}),()=>{l=!0}},[e,t,n]),a}function c6({page:e,matches:t,...n}){let a=Ms(),{future:i,manifest:l,routeModules:u}=qR(),{basename:d}=VR(),{loaderData:h,matches:p}=s6(),g=v.useMemo(()=>uN(e,t,p,l,a,"data"),[e,t,p,l,a]),m=v.useMemo(()=>uN(e,t,p,l,a,"assets"),[e,t,p,l,a]),b=v.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let w=new Set,C=!1;if(t.forEach(_=>{let T=l.routes[_.route.id];!T||!T.hasLoader||(!g.some(O=>O.route.id===_.route.id)&&_.route.id in h&&u[_.route.id]?.shouldRevalidate||T.hasClientLoader?C=!0:w.add(_.route.id))}),w.size===0)return[];let N=Q8(e,d,i.unstable_trailingSlashAwareDataRequests,"data");return C&&w.size>0&&N.searchParams.set("_routes",t.filter(_=>w.has(_.route.id)).map(_=>_.route.id).join(",")),[N.pathname+N.search]},[d,i.unstable_trailingSlashAwareDataRequests,h,a,l,g,t,e,u]),S=v.useMemo(()=>t6(m,l),[m,l]),j=l6(m);return v.createElement(v.Fragment,null,b.map(w=>v.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...n})),S.map(w=>v.createElement("link",{key:w,rel:"modulepreload",href:w,...n})),j.map(({key:w,link:C})=>v.createElement("link",{key:w,nonce:n.nonce,...C})))}function u6(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var d6=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{d6&&(window.__reactRouterVersion="7.12.0")}catch{}function f6({basename:e,children:t,unstable_useTransitions:n,window:a}){let i=v.useRef();i.current==null&&(i.current=VL({window:a,v5Compat:!0}));let l=i.current,[u,d]=v.useState({action:l.action,location:l.location}),h=v.useCallback(p=>{n===!1?d(p):v.startTransition(()=>d(p))},[n]);return v.useLayoutEffect(()=>l.listen(h),[l,h]),v.createElement(z8,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:l,unstable_useTransitions:n})}var $R=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Qi=v.forwardRef(function({onClick:t,discover:n="render",prefetch:a="none",relative:i,reloadDocument:l,replace:u,state:d,target:h,to:p,preventScrollReset:g,viewTransition:m,unstable_defaultShouldRevalidate:b,...S},j){let{basename:w,unstable_useTransitions:C}=v.useContext(ta),N=typeof p=="string"&&$R.test(p),_=MR(p,w);p=_.to;let T=j8(p,{relative:i}),[O,M,B]=i6(a,S),k=g6(p,{replace:u,state:d,target:h,preventScrollReset:g,relative:i,viewTransition:m,unstable_defaultShouldRevalidate:b,unstable_useTransitions:C});function F(ce){t&&t(ce),ce.defaultPrevented||k(ce)}let W=v.createElement("a",{...S,...B,href:_.absoluteURL||T,onClick:_.isExternal||l?t:F,ref:u6(j,M),target:h,"data-discover":!N&&n==="render"?"true":void 0});return O&&!N?v.createElement(v.Fragment,null,W,v.createElement(o6,{page:T})):W});Qi.displayName="Link";var h6=v.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:a="",end:i=!1,style:l,to:u,viewTransition:d,children:h,...p},g){let m=Uu(u,{relative:p.relative}),b=Ms(),S=v.useContext(xh),{navigator:j,basename:w}=v.useContext(ta),C=S!=null&&S6(m)&&d===!0,N=j.encodeLocation?j.encodeLocation(m).pathname:m.pathname,_=b.pathname,T=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;n||(_=_.toLowerCase(),T=T?T.toLowerCase():null,N=N.toLowerCase()),T&&w&&(T=Es(T,w)||T);const O=N!=="/"&&N.endsWith("/")?N.length-1:N.length;let M=_===N||!i&&_.startsWith(N)&&_.charAt(O)==="/",B=T!=null&&(T===N||!i&&T.startsWith(N)&&T.charAt(N.length)==="/"),k={isActive:M,isPending:B,isTransitioning:C},F=M?t:void 0,W;typeof a=="function"?W=a(k):W=[a,M?"active":null,B?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let ce=typeof l=="function"?l(k):l;return v.createElement(Qi,{...p,"aria-current":F,className:W,ref:g,style:ce,to:u,viewTransition:d},typeof h=="function"?h(k):h)});h6.displayName="NavLink";var p6=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:i,state:l,method:u=Pf,action:d,onSubmit:h,relative:p,preventScrollReset:g,viewTransition:m,unstable_defaultShouldRevalidate:b,...S},j)=>{let{unstable_useTransitions:w}=v.useContext(ta),C=b6(),N=w6(d,{relative:p}),_=u.toLowerCase()==="get"?"get":"post",T=typeof d=="string"&&$R.test(d),O=M=>{if(h&&h(M),M.defaultPrevented)return;M.preventDefault();let B=M.nativeEvent.submitter,k=B?.getAttribute("formmethod")||u,F=()=>C(B||M.currentTarget,{fetcherKey:t,method:k,navigate:n,replace:i,state:l,relative:p,preventScrollReset:g,viewTransition:m,unstable_defaultShouldRevalidate:b});w&&n!==!1?v.startTransition(()=>F()):F()};return v.createElement("form",{ref:j,method:_,action:N,onSubmit:a?h:O,...S,"data-discover":!T&&e==="render"?"true":void 0})});p6.displayName="Form";function m6(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function GR(e){let t=v.useContext(ql);return gn(t,m6(e)),t}function g6(e,{target:t,replace:n,state:a,preventScrollReset:i,relative:l,viewTransition:u,unstable_defaultShouldRevalidate:d,unstable_useTransitions:h}={}){let p=yh(),g=Ms(),m=Uu(e,{relative:l});return v.useCallback(b=>{if(G8(b,t)){b.preventDefault();let S=n!==void 0?n:Cu(g)===Cu(m),j=()=>p(e,{replace:S,state:a,preventScrollReset:i,relative:l,viewTransition:u,unstable_defaultShouldRevalidate:d});h?v.startTransition(()=>j()):j()}},[g,p,m,n,a,t,e,i,l,u,d,h])}function v6(e){Zr(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=v.useRef(ub(e)),n=v.useRef(!1),a=Ms(),i=v.useMemo(()=>K8(a.search,n.current?null:t.current),[a.search]),l=yh(),u=v.useCallback((d,h)=>{const p=ub(typeof d=="function"?d(new URLSearchParams(i)):d);n.current=!0,l("?"+p,h)},[l,i]);return[i,u]}var x6=0,y6=()=>`__${String(++x6)}__`;function b6(){let{router:e}=GR("useSubmit"),{basename:t}=v.useContext(ta),n=k8(),a=e.fetch,i=e.navigate;return v.useCallback(async(l,u={})=>{let{action:d,method:h,encType:p,formData:g,body:m}=X8(l,t);if(u.navigate===!1){let b=u.fetcherKey||y6();await a(b,n,u.action||d,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:g,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:g,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}=v.useContext(ta),a=v.useContext(Xa);gn(a,"useFormAction must be used inside a RouteContext");let[i]=a.matches.slice(-1),l={...Uu(e||".",{relative:t})},u=Ms();if(e==null){l.search=u.search;let d=new URLSearchParams(l.search),h=d.getAll("index");if(h.some(g=>g==="")){d.delete("index"),h.filter(m=>m).forEach(m=>d.append("index",m));let g=d.toString();l.search=g?`?${g}`:""}}return(!e||e===".")&&i.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(l.pathname=l.pathname==="/"?n:Cs([n,l.pathname])),Cu(l)}function S6(e,{relative:t}={}){let n=v.useContext(DR);gn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=GR("useViewTransitionState"),i=Uu(e,{relative:t});if(!n.isTransitioning)return!1;let l=Es(n.currentLocation.pathname,a)||n.currentLocation.pathname,u=Es(n.nextLocation.pathname,a)||n.nextLocation.pathname;return Gf(i.pathname,u)!=null||Gf(i.pathname,l)!=null}var Vu=CR();const KR=Ul(Vu);var wh=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(){}},j6={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},C6=class{#e=j6;#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)}},db=new C6;function N6(e){setTimeout(e,0)}var Sh=typeof window>"u"||"Deno"in globalThis;function va(){}function E6(e,t){return typeof e=="function"?e(t):e}function _6(e){return typeof e=="number"&&e>=0&&e!==1/0}function T6(e,t){return Math.max(e+(t||0)-Date.now(),0)}function fb(e,t){return typeof e=="function"?e(t):e}function A6(e,t){return typeof e=="function"?e(t):e}function dN(e,t){const{type:n="all",exact:a,fetchStatus:i,predicate:l,queryKey:u,stale:d}=e;if(u){if(a){if(t.queryHash!==y0(u,t.options))return!1}else if(!Eu(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 fN(e,t){const{exact:n,status:a,predicate:i,mutationKey:l}=e;if(l){if(!t.options.mutationKey)return!1;if(n){if(Nu(t.options.mutationKey)!==Nu(l))return!1}else if(!Eu(t.options.mutationKey,l))return!1}return!(a&&t.state.status!==a||i&&!i(t))}function y0(e,t){return(t?.queryKeyHashFn||Nu)(e)}function Nu(e){return JSON.stringify(e,(t,n)=>hb(n)?Object.keys(n).sort().reduce((a,i)=>(a[i]=n[i],a),{}):n)}function Eu(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Eu(e[n],t[n])):!1}var R6=Object.prototype.hasOwnProperty;function YR(e,t){if(e===t)return e;const n=hN(e)&&hN(t);if(!n&&!(hb(e)&&hb(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 g=n?p:l[p],m=e[g],b=t[g];if(m===b){d[g]=m,(n?p<i:R6.call(e,g))&&h++;continue}if(m===null||b===null||typeof m!="object"||typeof b!="object"){d[g]=b;continue}const S=YR(m,b);d[g]=S,S===m&&h++}return i===u&&h===i?e:d}function hN(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function hb(e){if(!pN(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!pN(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function pN(e){return Object.prototype.toString.call(e)==="[object Object]"}function O6(e){return new Promise(t=>{db.setTimeout(t,e)})}function M6(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?YR(e,t):t}function P6(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function D6(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var b0=Symbol();function WR(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===b0?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function k6(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 L6=class extends wh{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!Sh&&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"}},XR=new L6;function B6(){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 F6=N6;function I6(){let e=[],t=0,n=d=>{d()},a=d=>{d()},i=F6;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 Yn=I6(),z6=class extends wh{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!Sh&&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}},Kf=new z6;function H6(e){return Math.min(1e3*2**e,3e4)}function QR(e){return(e??"online")==="online"?Kf.isOnline():!0}var pb=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function ZR(e){let t=!1,n=0,a;const i=B6(),l=()=>i.status!=="pending",u=w=>{if(!l()){const C=new pb(w);b(C),e.onCancel?.(C)}},d=()=>{t=!0},h=()=>{t=!1},p=()=>XR.isFocused()&&(e.networkMode==="always"||Kf.isOnline())&&e.canRun(),g=()=>QR(e.networkMode)&&e.canRun(),m=w=>{l()||(a?.(),i.resolve(w))},b=w=>{l()||(a?.(),i.reject(w))},S=()=>new Promise(w=>{a=C=>{(l()||p())&&w(C)},e.onPause?.()}).then(()=>{a=void 0,l()||e.onContinue?.()}),j=()=>{if(l())return;let w;const C=n===0?e.initialPromise:void 0;try{w=C??e.fn()}catch(N){w=Promise.reject(N)}Promise.resolve(w).then(m).catch(N=>{if(l())return;const _=e.retry??(Sh?0:3),T=e.retryDelay??H6,O=typeof T=="function"?T(n,N):T,M=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,N);if(t||!M){b(N);return}n++,e.onFail?.(n,N),O6(O).then(()=>p()?void 0:S()).then(()=>{t?b(N):j()})})};return{promise:i,status:()=>i.status,cancel:u,continue:()=>(a?.(),i),cancelRetry:d,continueRetry:h,canStart:g,start:()=>(g()?j():S().then(j),i)}}var JR=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),_6(this.gcTime)&&(this.#e=db.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Sh?1/0:300*1e3))}clearGcTimeout(){this.#e&&(db.clearTimeout(this.#e),this.#e=void 0)}},U6=class extends JR{#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=gN(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=gN(this.options);t.data!==void 0&&(this.setState(mN(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=M6(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(va).catch(va):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>A6(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===b0||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>fb(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:!T6(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=WR(this.options,t),p=(()=>{const g={client:this.#a,queryKey:this.queryKey,meta:this.meta};return a(g),g})();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=ZR({initialPromise:t?.initialPromise,fn:u.fetchFn,onCancel:d=>{d instanceof pb&&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 pb){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,...V6(n.data,this.options),fetchMeta:e.meta??null};case"success":const a={...n,...mN(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),Yn.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function V6(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:QR(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function mN(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function gN(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 vN(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 g=!1;const m=j=>{k6(j,()=>t.signal,()=>g=!0)},b=WR(t.options,t.fetchOptions),S=async(j,w,C)=>{if(g)return Promise.reject();if(w==null&&j.pages.length)return Promise.resolve(j);const _=(()=>{const B={client:t.client,queryKey:t.queryKey,pageParam:w,direction:C?"backward":"forward",meta:t.options.meta};return m(B),B})(),T=await b(_),{maxPages:O}=t.options,M=C?D6:P6;return{pages:M(j.pages,T,O),pageParams:M(j.pageParams,w,O)}};if(i&&l.length){const j=i==="backward",w=j?q6:xN,C={pages:l,pageParams:u},N=w(a,C);d=await S(C,N,j)}else{const j=e??l.length;do{const w=h===0?u[0]??a.initialPageParam:xN(a,d);if(h>0&&w==null)break;d=await S(d,w),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 xN(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 q6(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var $6=class extends JR{#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||G6(),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=ZR({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),Yn.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function G6(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var K6=class extends wh{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 $6({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(){Yn.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=>fN(t,n))}findAll(e={}){return this.getAll().filter(t=>fN(e,t))}notify(e){Yn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return Yn.batch(()=>Promise.all(e.map(t=>t.continue().catch(va))))}};function mf(e){return e.options.scope?.id}var Y6=class extends wh{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const a=t.queryKey,i=t.queryHash??y0(a,t);let l=this.get(i);return l||(l=new U6({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(){Yn.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=>dN(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>dN(e,n)):t}notify(e){Yn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Yn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Yn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},W6=class{#e;#t;#n;#a;#r;#i;#o;#s;constructor(e={}){this.#e=e.queryCache||new Y6,this.#t=e.mutationCache||new K6,this.#n=e.defaultOptions||{},this.#a=new Map,this.#r=new Map,this.#i=0}mount(){this.#i++,this.#i===1&&(this.#o=XR.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Kf.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(fb(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=E6(t,l);if(u!==void 0)return this.#e.build(this,a).setData(u,{...n,manual:!0})}setQueriesData(e,t,n){return Yn.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;Yn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return Yn.batch(()=>(n.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},a=Yn.batch(()=>this.#e.findAll(e).map(i=>i.cancel(n)));return Promise.all(a).then(va).catch(va)}invalidateQueries(e,t={}){return Yn.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=Yn.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(va)),i.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(a).then(va)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(fb(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(va).catch(va)}fetchInfiniteQuery(e){return e.behavior=vN(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(va).catch(va)}ensureInfiniteQueryData(e){return e.behavior=vN(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Kf.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(Nu(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#a.values()],n={};return t.forEach(a=>{Eu(e,a.queryKey)&&Object.assign(n,a.defaultOptions)}),n}setMutationDefaults(e,t){this.#r.set(Nu(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(a=>{Eu(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=y0(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===b0&&(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()}},X6=v.createContext(void 0),Q6=({client:e,children:t})=>(v.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),o.jsx(X6.Provider,{value:e,children:t}));function Z6(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 J6=e=>{switch(e){case"success":return nB;case"info":return aB;case"warning":return rB;case"error":return sB;default:return null}},eB=Array(12).fill(0),tB=({visible:e,className:t})=>A.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},A.createElement("div",{className:"sonner-spinner"},eB.map((n,a)=>A.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),nB=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"})),rB=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"})),aB=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"})),sB=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"})),iB=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"})),oB=()=>{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 mb=1;class lB{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:mb++,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(uB(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 g=typeof n.error=="function"?await n.error(p):n.error,m=typeof n.description=="function"?await n.description(p):n.description,S=typeof g=="object"&&!A.isValidElement(g)?g:{message:g};this.create({id:a,type:"error",description:m,...S})}}).finally(()=>{l&&(this.dismiss(a),a=void 0),n.finally==null||n.finally.call(n)}),h=()=>new Promise((p,g)=>d.then(()=>u[0]==="reject"?g(u[1]):p(u[1])).catch(g));return typeof a!="string"&&typeof a!="number"?{unwrap:h}:Object.assign(a,{unwrap:h})},this.custom=(t,n)=>{const a=n?.id||mb++;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 or=new lB,cB=(e,t)=>{const n=t?.id||mb++;return or.addToast({title:e,...t,id:n}),n},uB=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",dB=cB,fB=()=>or.toasts,hB=()=>or.getActiveToasts(),Y=Object.assign(dB,{success:or.success,info:or.info,warning:or.warning,error:or.error,custom:or.custom,message:or.message,promise:or.promise,dismiss:or.dismiss,loading:or.loading},{getHistory:fB,getToasts:hB});Z6("[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 gf(e){return e.label!==void 0}const pB=3,mB="24px",gB="16px",yN=4e3,vB=356,xB=14,yB=45,bB=200;function Ba(...e){return e.filter(Boolean).join(" ")}function wB(e){const[t,n]=e.split("-"),a=[];return t&&a.push(t),n&&a.push(n),a}const SB=e=>{var t,n,a,i,l,u,d,h,p;const{invert:g,toast:m,unstyled:b,interacting:S,setHeights:j,visibleToasts:w,heights:C,index:N,toasts:_,expanded:T,removeToast:O,defaultRichColors:M,closeButton:B,style:k,cancelButtonStyle:F,actionButtonStyle:W,className:ce="",descriptionClassName:G="",duration:ie,position:Q,gap:Z,expandByDefault:ve,classNames:P,icons:V,closeButtonAriaLabel:H="Close toast"}=e,[se,we]=A.useState(null),[L,re]=A.useState(null),[z,ee]=A.useState(!1),[xe,Ne]=A.useState(!1),[fe,Ce]=A.useState(!1),[Pe,ke]=A.useState(!1),[Ue,pe]=A.useState(!1),[it,st]=A.useState(0),[Me,ot]=A.useState(0),$e=A.useRef(m.duration||ie||yN),Vt=A.useRef(null),dt=A.useRef(null),Lt=N===0,yt=N+1<=w,ft=m.type,Ge=m.dismissible!==!1,ht=m.className||"",Ct=m.descriptionClassName||"",Jt=A.useMemo(()=>C.findIndex(q=>q.toastId===m.id)||0,[C,m.id]),Wt=A.useMemo(()=>{var q;return(q=m.closeButton)!=null?q:B},[m.closeButton,B]),Xt=A.useMemo(()=>m.duration||ie||yN,[m.duration,ie]),de=A.useRef(0),De=A.useRef(0),Te=A.useRef(0),Be=A.useRef(null),[_e,We]=Q.split("-"),Nt=A.useMemo(()=>C.reduce((q,Se,Oe)=>Oe>=Jt?q:q+Se.height,0),[C,Jt]),bt=oB(),Tt=m.invert||g,Rn=ft==="loading";De.current=A.useMemo(()=>Jt*Z+Nt,[Jt,Nt]),A.useEffect(()=>{$e.current=Xt},[Xt]),A.useEffect(()=>{ee(!0)},[]),A.useEffect(()=>{const q=dt.current;if(q){const Se=q.getBoundingClientRect().height;return ot(Se),j(Oe=>[{toastId:m.id,height:Se,position:m.position},...Oe]),()=>j(Oe=>Oe.filter(Ve=>Ve.toastId!==m.id))}},[j,m.id]),A.useLayoutEffect(()=>{if(!z)return;const q=dt.current,Se=q.style.height;q.style.height="auto";const Oe=q.getBoundingClientRect().height;q.style.height=Se,ot(Oe),j(Ve=>Ve.find(tt=>tt.toastId===m.id)?Ve.map(tt=>tt.toastId===m.id?{...tt,height:Oe}:tt):[{toastId:m.id,height:Oe,position:m.position},...Ve])},[z,m.title,m.description,j,m.id,m.jsx,m.action,m.cancel]);const qt=A.useCallback(()=>{Ne(!0),st(De.current),j(q=>q.filter(Se=>Se.toastId!==m.id)),setTimeout(()=>{O(m)},bB)},[m,O,j,De]);A.useEffect(()=>{if(m.promise&&ft==="loading"||m.duration===1/0||m.type==="loading")return;let q;return T||S||bt?(()=>{if(Te.current<de.current){const Ve=new Date().getTime()-de.current;$e.current=$e.current-Ve}Te.current=new Date().getTime()})():$e.current!==1/0&&(de.current=new Date().getTime(),q=setTimeout(()=>{m.onAutoClose==null||m.onAutoClose.call(m,m),qt()},$e.current)),()=>clearTimeout(q)},[T,S,m,ft,bt,qt]),A.useEffect(()=>{m.delete&&(qt(),m.onDismiss==null||m.onDismiss.call(m,m))},[qt,m.delete]);function $t(){var q;if(V?.loading){var Se;return A.createElement("div",{className:Ba(P?.loader,m==null||(Se=m.classNames)==null?void 0:Se.loader,"sonner-loader"),"data-visible":ft==="loading"},V.loading)}return A.createElement(tB,{className:Ba(P?.loader,m==null||(q=m.classNames)==null?void 0:q.loader),visible:ft==="loading"})}const It=m.icon||V?.[ft]||J6(ft);var Pt,jt;return A.createElement("li",{tabIndex:0,ref:dt,className:Ba(ce,ht,P?.toast,m==null||(t=m.classNames)==null?void 0:t.toast,P?.default,P?.[ft],m==null||(n=m.classNames)==null?void 0:n[ft]),"data-sonner-toast":"","data-rich-colors":(Pt=m.richColors)!=null?Pt:M,"data-styled":!(m.jsx||m.unstyled||b),"data-mounted":z,"data-promise":!!m.promise,"data-swiped":Ue,"data-removed":xe,"data-visible":yt,"data-y-position":_e,"data-x-position":We,"data-index":N,"data-front":Lt,"data-swiping":fe,"data-dismissible":Ge,"data-type":ft,"data-invert":Tt,"data-swipe-out":Pe,"data-swipe-direction":L,"data-expanded":!!(T||ve&&z),"data-testid":m.testId,style:{"--index":N,"--toasts-before":N,"--z-index":_.length-N,"--offset":`${xe?it:De.current}px`,"--initial-height":ve?"auto":`${Me}px`,...k,...m.style},onDragEnd:()=>{Ce(!1),we(null),Be.current=null},onPointerDown:q=>{q.button!==2&&(Rn||!Ge||(Vt.current=new Date,st(De.current),q.target.setPointerCapture(q.pointerId),q.target.tagName!=="BUTTON"&&(Ce(!0),Be.current={x:q.clientX,y:q.clientY})))},onPointerUp:()=>{var q,Se,Oe;if(Pe||!Ge)return;Be.current=null;const Ve=Number(((q=dt.current)==null?void 0:q.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),At=Number(((Se=dt.current)==null?void 0:Se.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),tt=new Date().getTime()-((Oe=Vt.current)==null?void 0:Oe.getTime()),Ut=se==="x"?Ve:At,J=Math.abs(Ut)/tt;if(Math.abs(Ut)>=yB||J>.11){st(De.current),m.onDismiss==null||m.onDismiss.call(m,m),re(se==="x"?Ve>0?"right":"left":At>0?"down":"up"),qt(),ke(!0);return}else{var ye,Re;(ye=dt.current)==null||ye.style.setProperty("--swipe-amount-x","0px"),(Re=dt.current)==null||Re.style.setProperty("--swipe-amount-y","0px")}pe(!1),Ce(!1),we(null)},onPointerMove:q=>{var Se,Oe,Ve;if(!Be.current||!Ge||((Se=window.getSelection())==null?void 0:Se.toString().length)>0)return;const tt=q.clientY-Be.current.y,Ut=q.clientX-Be.current.x;var J;const ye=(J=e.swipeDirections)!=null?J:wB(Q);!se&&(Math.abs(Ut)>1||Math.abs(tt)>1)&&we(Math.abs(Ut)>Math.abs(tt)?"x":"y");let Re={x:0,y:0};const Le=I=>1/(1.5+Math.abs(I)/20);if(se==="y"){if(ye.includes("top")||ye.includes("bottom"))if(ye.includes("top")&&tt<0||ye.includes("bottom")&&tt>0)Re.y=tt;else{const I=tt*Le(tt);Re.y=Math.abs(I)<Math.abs(tt)?I:tt}}else if(se==="x"&&(ye.includes("left")||ye.includes("right")))if(ye.includes("left")&&Ut<0||ye.includes("right")&&Ut>0)Re.x=Ut;else{const I=Ut*Le(Ut);Re.x=Math.abs(I)<Math.abs(Ut)?I:Ut}(Math.abs(Re.x)>0||Math.abs(Re.y)>0)&&pe(!0),(Oe=dt.current)==null||Oe.style.setProperty("--swipe-amount-x",`${Re.x}px`),(Ve=dt.current)==null||Ve.style.setProperty("--swipe-amount-y",`${Re.y}px`)}},Wt&&!m.jsx&&ft!=="loading"?A.createElement("button",{"aria-label":H,"data-disabled":Rn,"data-close-button":!0,onClick:Rn||!Ge?()=>{}:()=>{qt(),m.onDismiss==null||m.onDismiss.call(m,m)},className:Ba(P?.closeButton,m==null||(a=m.classNames)==null?void 0:a.closeButton)},(jt=V?.close)!=null?jt:iB):null,(ft||m.icon||m.promise)&&m.icon!==null&&(V?.[ft]!==null||m.icon)?A.createElement("div",{"data-icon":"",className:Ba(P?.icon,m==null||(i=m.classNames)==null?void 0:i.icon)},m.promise||m.type==="loading"&&!m.icon?m.icon||$t():null,m.type!=="loading"?It:null):null,A.createElement("div",{"data-content":"",className:Ba(P?.content,m==null||(l=m.classNames)==null?void 0:l.content)},A.createElement("div",{"data-title":"",className:Ba(P?.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:Ba(G,Ct,P?.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&&gf(m.cancel)?A.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||F,onClick:q=>{gf(m.cancel)&&Ge&&(m.cancel.onClick==null||m.cancel.onClick.call(m.cancel,q),qt())},className:Ba(P?.cancelButton,m==null||(h=m.classNames)==null?void 0:h.cancelButton)},m.cancel.label):null,A.isValidElement(m.action)?m.action:m.action&&gf(m.action)?A.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||W,onClick:q=>{gf(m.action)&&(m.action.onClick==null||m.action.onClick.call(m.action,q),!q.defaultPrevented&&qt())},className:Ba(P?.actionButton,m==null||(p=m.classNames)==null?void 0:p.actionButton)},m.action.label):null)};function bN(){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 jB(e,t){const n={};return[e,t].forEach((a,i)=>{const l=i===1,u=l?"--mobile-offset":"--offset",d=l?gB:mB;function h(p){["top","right","bottom","left"].forEach(g=>{n[`${u}-${g}`]=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 CB=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:g,mobileOffset:m,theme:b="light",richColors:S,duration:j,style:w,visibleToasts:C=pB,toastOptions:N,dir:_=bN(),gap:T=xB,icons:O,containerAriaLabel:M="Notifications"}=t,[B,k]=A.useState([]),F=A.useMemo(()=>a?B.filter(z=>z.toasterId===a):B.filter(z=>!z.toasterId),[B,a]),W=A.useMemo(()=>Array.from(new Set([l].concat(F.filter(z=>z.position).map(z=>z.position)))),[F,l]),[ce,G]=A.useState([]),[ie,Q]=A.useState(!1),[Z,ve]=A.useState(!1),[P,V]=A.useState(b!=="system"?b:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=A.useRef(null),se=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),we=A.useRef(null),L=A.useRef(!1),re=A.useCallback(z=>{k(ee=>{var xe;return(xe=ee.find(Ne=>Ne.id===z.id))!=null&&xe.delete||or.dismiss(z.id),ee.filter(({id:Ne})=>Ne!==z.id)})},[]);return A.useEffect(()=>or.subscribe(z=>{if(z.dismiss){requestAnimationFrame(()=>{k(ee=>ee.map(xe=>xe.id===z.id?{...xe,delete:!0}:xe))});return}setTimeout(()=>{KR.flushSync(()=>{k(ee=>{const xe=ee.findIndex(Ne=>Ne.id===z.id);return xe!==-1?[...ee.slice(0,xe),{...ee[xe],...z},...ee.slice(xe+1)]:[z,...ee]})})})}),[B]),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 z=window.matchMedia("(prefers-color-scheme: dark)");try{z.addEventListener("change",({matches:ee})=>{V(ee?"dark":"light")})}catch{z.addListener(({matches:xe})=>{try{V(xe?"dark":"light")}catch(Ne){console.error(Ne)}})}},[b]),A.useEffect(()=>{B.length<=1&&Q(!1)},[B]),A.useEffect(()=>{const z=ee=>{var xe;if(u.every(Ce=>ee[Ce]||ee.code===Ce)){var fe;Q(!0),(fe=H.current)==null||fe.focus()}ee.code==="Escape"&&(document.activeElement===H.current||(xe=H.current)!=null&&xe.contains(document.activeElement))&&Q(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[u]),A.useEffect(()=>{if(H.current)return()=>{we.current&&(we.current.focus({preventScroll:!0}),we.current=null,L.current=!1)}},[H.current]),A.createElement("section",{ref:n,"aria-label":`${M} ${se}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},W.map((z,ee)=>{var xe;const[Ne,fe]=z.split("-");return F.length?A.createElement("ol",{key:z,dir:_==="auto"?bN():_,tabIndex:-1,ref:H,className:p,"data-sonner-toaster":!0,"data-sonner-theme":P,"data-y-position":Ne,"data-x-position":fe,style:{"--front-toast-height":`${((xe=ce[0])==null?void 0:xe.height)||0}px`,"--width":`${vB}px`,"--gap":`${T}px`,...w,...jB(g,m)},onBlur:Ce=>{L.current&&!Ce.currentTarget.contains(Ce.relatedTarget)&&(L.current=!1,we.current&&(we.current.focus({preventScroll:!0}),we.current=null))},onFocus:Ce=>{Ce.target instanceof HTMLElement&&Ce.target.dataset.dismissible==="false"||L.current||(L.current=!0,we.current=Ce.relatedTarget)},onMouseEnter:()=>Q(!0),onMouseMove:()=>Q(!0),onMouseLeave:()=>{Z||Q(!1)},onDragEnd:()=>Q(!1),onPointerDown:Ce=>{Ce.target instanceof HTMLElement&&Ce.target.dataset.dismissible==="false"||ve(!0)},onPointerUp:()=>ve(!1)},F.filter(Ce=>!Ce.position&&ee===0||Ce.position===z).map((Ce,Pe)=>{var ke,Ue;return A.createElement(SB,{key:Ce.id,icons:O,index:Pe,toast:Ce,defaultRichColors:S,duration:(ke=N?.duration)!=null?ke:j,className:N?.className,descriptionClassName:N?.descriptionClassName,invert:i,visibleToasts:C,closeButton:(Ue=N?.closeButton)!=null?Ue:h,interacting:Z,position:z,style:N?.style,unstyled:N?.unstyled,classNames:N?.classNames,cancelButtonStyle:N?.cancelButtonStyle,actionButtonStyle:N?.actionButtonStyle,closeButtonAriaLabel:N?.closeButtonAriaLabel,removeToast:re,toasts:F.filter(pe=>pe.position==Ce.position),heights:ce.filter(pe=>pe.position==Ce.position),setHeights:G,expandByDefault:d,gap:T,expanded:ie,swipeDirections:t.swipeDirections})})):null}))});function wN(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function co(...e){return t=>{let n=!1;const a=e.map(i=>{const l=wN(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():wN(e[i],null)}}}}function _t(...e){return v.useCallback(co(...e),e)}var NB=Symbol.for("react.lazy"),Yf=h0[" use ".trim().toString()];function EB(e){return typeof e=="object"&&e!==null&&"then"in e}function eO(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===NB&&"_payload"in e&&EB(e._payload)}function jh(e){const t=TB(e),n=v.forwardRef((a,i)=>{let{children:l,...u}=a;eO(l)&&typeof Yf=="function"&&(l=Yf(l._payload));const d=v.Children.toArray(l),h=d.find(RB);if(h){const p=h.props.children,g=d.map(m=>m===h?v.Children.count(p)>1?v.Children.only(null):v.isValidElement(p)?p.props.children:null:m);return o.jsx(t,{...u,ref:i,children:v.isValidElement(p)?v.cloneElement(p,void 0,g):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}var _B=jh("Slot");function TB(e){const t=v.forwardRef((n,a)=>{let{children:i,...l}=n;if(eO(i)&&typeof Yf=="function"&&(i=Yf(i._payload)),v.isValidElement(i)){const u=MB(i),d=OB(l,i.props);return i.type!==v.Fragment&&(d.ref=a?co(a,u):u),v.cloneElement(i,d)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var AB=Symbol("radix.slottable");function RB(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===AB}function OB(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 MB(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 tO(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=tO(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function nO(){for(var e,t,n=0,a="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=tO(e))&&(a&&(a+=" "),a+=t);return a}const SN=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,jN=nO,qu=(e,t)=>n=>{var a;if(t?.variants==null)return jN(e,n?.class,n?.className);const{variants:i,defaultVariants:l}=t,u=Object.keys(i).map(p=>{const g=n?.[p],m=l?.[p];if(g===null)return null;const b=SN(g)||SN(m);return i[p][b]}),d=n&&Object.entries(n).reduce((p,g)=>{let[m,b]=g;return b===void 0||(p[m]=b),p},{}),h=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((p,g)=>{let{class:m,className:b,...S}=g;return Object.entries(S).every(j=>{let[w,C]=j;return Array.isArray(C)?C.includes({...l,...d}[w]):{...l,...d}[w]===C})?[...p,m,b]:p},[]);return jN(e,u,h,n?.class,n?.className)},PB=(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},DB=(e,t)=>({classGroupId:e,validator:t}),rO=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Wf="-",CN=[],kB="arbitrary..",LB=e=>{const t=FB(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return BB(u);const d=u.split(Wf),h=d[0]===""&&d.length>1?1:0;return aO(d,h,t)},getConflictingClassGroupIds:(u,d)=>{if(d){const h=a[u],p=n[u];return h?p?PB(p,h):h:p||CN}return n[u]||CN}}},aO=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],l=n.nextPart.get(i);if(l){const p=aO(e,t+1,l);if(p)return p}const u=n.validators;if(u===null)return;const d=t===0?e.join(Wf):e.slice(t).join(Wf),h=u.length;for(let p=0;p<h;p++){const g=u[p];if(g.validator(d))return g.classGroupId}},BB=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?kB+a:void 0})(),FB=e=>{const{theme:t,classGroups:n}=e;return IB(n,t)},IB=(e,t)=>{const n=rO();for(const a in e){const i=e[a];w0(i,n,a,t)}return n},w0=(e,t,n,a)=>{const i=e.length;for(let l=0;l<i;l++){const u=e[l];zB(u,t,n,a)}},zB=(e,t,n,a)=>{if(typeof e=="string"){HB(e,t,n);return}if(typeof e=="function"){UB(e,t,n,a);return}VB(e,t,n,a)},HB=(e,t,n)=>{const a=e===""?t:sO(t,e);a.classGroupId=n},UB=(e,t,n,a)=>{if(qB(e)){w0(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(DB(n,e))},VB=(e,t,n,a)=>{const i=Object.entries(e),l=i.length;for(let u=0;u<l;u++){const[d,h]=i[u];w0(h,sO(t,d),n,a)}},sO=(e,t)=>{let n=e;const a=t.split(Wf),i=a.length;for(let l=0;l<i;l++){const u=a[l];let d=n.nextPart.get(u);d||(d=rO(),n.nextPart.set(u,d)),n=d}return n},qB=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,$B=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="!",NN=":",GB=[],EN=(e,t,n,a,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:i}),KB=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=i=>{const l=[];let u=0,d=0,h=0,p;const g=i.length;for(let w=0;w<g;w++){const C=i[w];if(u===0&&d===0){if(C===NN){l.push(i.slice(h,w)),h=w+1;continue}if(C==="/"){p=w;continue}}C==="["?u++:C==="]"?u--:C==="("?d++:C===")"&&d--}const m=l.length===0?i:i.slice(h);let b=m,S=!1;m.endsWith(gb)?(b=m.slice(0,-1),S=!0):m.startsWith(gb)&&(b=m.slice(1),S=!0);const j=p&&p>h?p-h:void 0;return EN(l,S,b,j)};if(t){const i=t+NN,l=a;a=u=>u.startsWith(i)?l(u.slice(i.length)):EN(GB,!1,u,void 0,!0)}if(n){const i=a;a=l=>n({className:l,parseClassName:i})}return a},YB=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}},WB=e=>({cache:$B(e.cacheSize),parseClassName:KB(e),sortModifiers:YB(e),...LB(e)}),XB=/\s+/,QB=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:i,sortModifiers:l}=t,u=[],d=e.trim().split(XB);let h="";for(let p=d.length-1;p>=0;p-=1){const g=d[p],{isExternal:m,modifiers:b,hasImportantModifier:S,baseClassName:j,maybePostfixModifierPosition:w}=n(g);if(m){h=g+(h.length>0?" "+h:h);continue}let C=!!w,N=a(C?j.substring(0,w):j);if(!N){if(!C){h=g+(h.length>0?" "+h:h);continue}if(N=a(j),!N){h=g+(h.length>0?" "+h:h);continue}C=!1}const _=b.length===0?"":b.length===1?b[0]:l(b).join(":"),T=S?_+gb:_,O=T+N;if(u.indexOf(O)>-1)continue;u.push(O);const M=i(N,C);for(let B=0;B<M.length;++B){const k=M[B];u.push(T+k)}h=g+(h.length>0?" "+h:h)}return h},ZB=(...e)=>{let t=0,n,a,i="";for(;t<e.length;)(n=e[t++])&&(a=iO(n))&&(i&&(i+=" "),i+=a);return i},iO=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=iO(e[a]))&&(n&&(n+=" "),n+=t);return n},JB=(e,...t)=>{let n,a,i,l;const u=h=>{const p=t.reduce((g,m)=>m(g),e());return n=WB(p),a=n.cache.get,i=n.cache.set,l=d,d(h)},d=h=>{const p=a(h);if(p)return p;const g=QB(h,n);return i(h,g),g};return l=u,(...h)=>l(ZB(...h))},eF=[],Pn=e=>{const t=n=>n[e]||eF;return t.isThemeGetter=!0,t},oO=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,lO=/^\((?:(\w[\w-]*):)?(.+)\)$/i,tF=/^\d+\/\d+$/,nF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,rF=/\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$/,aF=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,sF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,iF=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,rl=e=>tF.test(e),Et=e=>!!e&&!Number.isNaN(Number(e)),ui=e=>!!e&&Number.isInteger(Number(e)),Tg=e=>e.endsWith("%")&&Et(e.slice(0,-1)),vs=e=>nF.test(e),oF=()=>!0,lF=e=>rF.test(e)&&!aF.test(e),cO=()=>!1,cF=e=>sF.test(e),uF=e=>iF.test(e),dF=e=>!ze(e)&&!He(e),fF=e=>$l(e,fO,cO),ze=e=>oO.test(e),Ki=e=>$l(e,hO,lF),Ag=e=>$l(e,vF,Et),_N=e=>$l(e,uO,cO),hF=e=>$l(e,dO,uF),vf=e=>$l(e,pO,cF),He=e=>lO.test(e),tu=e=>Gl(e,hO),pF=e=>Gl(e,xF),TN=e=>Gl(e,uO),mF=e=>Gl(e,fO),gF=e=>Gl(e,dO),xf=e=>Gl(e,pO,!0),$l=(e,t,n)=>{const a=oO.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},Gl=(e,t,n=!1)=>{const a=lO.exec(e);return a?a[1]?t(a[1]):n:!1},uO=e=>e==="position"||e==="percentage",dO=e=>e==="image"||e==="url",fO=e=>e==="length"||e==="size"||e==="bg-size",hO=e=>e==="length",vF=e=>e==="number",xF=e=>e==="family-name",pO=e=>e==="shadow",yF=()=>{const e=Pn("color"),t=Pn("font"),n=Pn("text"),a=Pn("font-weight"),i=Pn("tracking"),l=Pn("leading"),u=Pn("breakpoint"),d=Pn("container"),h=Pn("spacing"),p=Pn("radius"),g=Pn("shadow"),m=Pn("inset-shadow"),b=Pn("text-shadow"),S=Pn("drop-shadow"),j=Pn("blur"),w=Pn("perspective"),C=Pn("aspect"),N=Pn("ease"),_=Pn("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],O=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],M=()=>[...O(),He,ze],B=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],F=()=>[He,ze,h],W=()=>[rl,"full","auto",...F()],ce=()=>[ui,"none","subgrid",He,ze],G=()=>["auto",{span:["full",ui,He,ze]},ui,He,ze],ie=()=>[ui,"auto",He,ze],Q=()=>["auto","min","max","fr",He,ze],Z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ve=()=>["start","end","center","stretch","center-safe","end-safe"],P=()=>["auto",...F()],V=()=>[rl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...F()],H=()=>[e,He,ze],se=()=>[...O(),TN,_N,{position:[He,ze]}],we=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",mF,fF,{size:[He,ze]}],re=()=>[Tg,tu,Ki],z=()=>["","none","full",p,He,ze],ee=()=>["",Et,tu,Ki],xe=()=>["solid","dashed","dotted","double"],Ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],fe=()=>[Et,Tg,TN,_N],Ce=()=>["","none",j,He,ze],Pe=()=>["none",Et,He,ze],ke=()=>["none",Et,He,ze],Ue=()=>[Et,He,ze],pe=()=>[rl,"full",...F()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[vs],breakpoint:[vs],color:[oF],container:[vs],"drop-shadow":[vs],ease:["in","out","in-out"],font:[dF],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[vs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[vs],shadow:[vs],spacing:["px",Et],text:[vs],"text-shadow":[vs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",rl,ze,He,C]}],container:["container"],columns:[{columns:[Et,ze,He,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:M()}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:W()}],"inset-x":[{"inset-x":W()}],"inset-y":[{"inset-y":W()}],start:[{start:W()}],end:[{end:W()}],top:[{top:W()}],right:[{right:W()}],bottom:[{bottom:W()}],left:[{left:W()}],visibility:["visible","invisible","collapse"],z:[{z:[ui,"auto",He,ze]}],basis:[{basis:[rl,"full","auto",d,...F()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Et,rl,"auto","initial","none",ze]}],grow:[{grow:["",Et,He,ze]}],shrink:[{shrink:["",Et,He,ze]}],order:[{order:[ui,"first","last","none",He,ze]}],"grid-cols":[{"grid-cols":ce()}],"col-start-end":[{col:G()}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":ce()}],"row-start-end":[{row:G()}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Q()}],"auto-rows":[{"auto-rows":Q()}],gap:[{gap:F()}],"gap-x":[{"gap-x":F()}],"gap-y":[{"gap-y":F()}],"justify-content":[{justify:[...Z(),"normal"]}],"justify-items":[{"justify-items":[...ve(),"normal"]}],"justify-self":[{"justify-self":["auto",...ve()]}],"align-content":[{content:["normal",...Z()]}],"align-items":[{items:[...ve(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ve(),{baseline:["","last"]}]}],"place-content":[{"place-content":Z()}],"place-items":[{"place-items":[...ve(),"baseline"]}],"place-self":[{"place-self":["auto",...ve()]}],p:[{p:F()}],px:[{px:F()}],py:[{py:F()}],ps:[{ps:F()}],pe:[{pe:F()}],pt:[{pt:F()}],pr:[{pr:F()}],pb:[{pb:F()}],pl:[{pl:F()}],m:[{m:P()}],mx:[{mx:P()}],my:[{my:P()}],ms:[{ms:P()}],me:[{me:P()}],mt:[{mt:P()}],mr:[{mr:P()}],mb:[{mb:P()}],ml:[{ml:P()}],"space-x":[{"space-x":F()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":F()}],"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,tu,Ki]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,He,Ag]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Tg,ze]}],"font-family":[{font:[pF,ze,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,He,ze]}],"line-clamp":[{"line-clamp":[Et,"none",He,Ag]}],leading:[{leading:[l,...F()]}],"list-image":[{"list-image":["none",He,ze]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",He,ze]}],"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:[...xe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Et,"from-font","auto",He,Ki]}],"text-decoration-color":[{decoration:H()}],"underline-offset":[{"underline-offset":[Et,"auto",He,ze]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",He,ze]}],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",He,ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:se()}],"bg-repeat":[{bg:we()}],"bg-size":[{bg:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ui,He,ze],radial:["",He,ze],conic:[ui,He,ze]},gF,hF]}],"bg-color":[{bg:H()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:H()}],"gradient-via":[{via:H()}],"gradient-to":[{to:H()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...xe(),"hidden","none"]}],"divide-style":[{divide:[...xe(),"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:[...xe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Et,He,ze]}],"outline-w":[{outline:["",Et,tu,Ki]}],"outline-color":[{outline:H()}],shadow:[{shadow:["","none",g,xf,vf]}],"shadow-color":[{shadow:H()}],"inset-shadow":[{"inset-shadow":["none",m,xf,vf]}],"inset-shadow-color":[{"inset-shadow":H()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:H()}],"ring-offset-w":[{"ring-offset":[Et,Ki]}],"ring-offset-color":[{"ring-offset":H()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":H()}],"text-shadow":[{"text-shadow":["none",b,xf,vf]}],"text-shadow-color":[{"text-shadow":H()}],opacity:[{opacity:[Et,He,ze]}],"mix-blend":[{"mix-blend":[...Ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ne()}],"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":[Et]}],"mask-image-linear-from-pos":[{"mask-linear-from":fe()}],"mask-image-linear-to-pos":[{"mask-linear-to":fe()}],"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":fe()}],"mask-image-t-to-pos":[{"mask-t-to":fe()}],"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":fe()}],"mask-image-r-to-pos":[{"mask-r-to":fe()}],"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":fe()}],"mask-image-b-to-pos":[{"mask-b-to":fe()}],"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":fe()}],"mask-image-l-to-pos":[{"mask-l-to":fe()}],"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":fe()}],"mask-image-x-to-pos":[{"mask-x-to":fe()}],"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":fe()}],"mask-image-y-to-pos":[{"mask-y-to":fe()}],"mask-image-y-from-color":[{"mask-y-from":H()}],"mask-image-y-to-color":[{"mask-y-to":H()}],"mask-image-radial":[{"mask-radial":[He,ze]}],"mask-image-radial-from-pos":[{"mask-radial-from":fe()}],"mask-image-radial-to-pos":[{"mask-radial-to":fe()}],"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":O()}],"mask-image-conic-pos":[{"mask-conic":[Et]}],"mask-image-conic-from-pos":[{"mask-conic-from":fe()}],"mask-image-conic-to-pos":[{"mask-conic-to":fe()}],"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:se()}],"mask-repeat":[{mask:we()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",He,ze]}],filter:[{filter:["","none",He,ze]}],blur:[{blur:Ce()}],brightness:[{brightness:[Et,He,ze]}],contrast:[{contrast:[Et,He,ze]}],"drop-shadow":[{"drop-shadow":["","none",S,xf,vf]}],"drop-shadow-color":[{"drop-shadow":H()}],grayscale:[{grayscale:["",Et,He,ze]}],"hue-rotate":[{"hue-rotate":[Et,He,ze]}],invert:[{invert:["",Et,He,ze]}],saturate:[{saturate:[Et,He,ze]}],sepia:[{sepia:["",Et,He,ze]}],"backdrop-filter":[{"backdrop-filter":["","none",He,ze]}],"backdrop-blur":[{"backdrop-blur":Ce()}],"backdrop-brightness":[{"backdrop-brightness":[Et,He,ze]}],"backdrop-contrast":[{"backdrop-contrast":[Et,He,ze]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Et,He,ze]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Et,He,ze]}],"backdrop-invert":[{"backdrop-invert":["",Et,He,ze]}],"backdrop-opacity":[{"backdrop-opacity":[Et,He,ze]}],"backdrop-saturate":[{"backdrop-saturate":[Et,He,ze]}],"backdrop-sepia":[{"backdrop-sepia":["",Et,He,ze]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":F()}],"border-spacing-x":[{"border-spacing-x":F()}],"border-spacing-y":[{"border-spacing-y":F()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",He,ze]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Et,"initial",He,ze]}],ease:[{ease:["linear","initial",N,He,ze]}],delay:[{delay:[Et,He,ze]}],animate:[{animate:["none",_,He,ze]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,He,ze]}],"perspective-origin":[{"perspective-origin":M()}],rotate:[{rotate:Pe()}],"rotate-x":[{"rotate-x":Pe()}],"rotate-y":[{"rotate-y":Pe()}],"rotate-z":[{"rotate-z":Pe()}],scale:[{scale:ke()}],"scale-x":[{"scale-x":ke()}],"scale-y":[{"scale-y":ke()}],"scale-z":[{"scale-z":ke()}],"scale-3d":["scale-3d"],skew:[{skew:Ue()}],"skew-x":[{"skew-x":Ue()}],"skew-y":[{"skew-y":Ue()}],transform:[{transform:[He,ze,"","none","gpu","cpu"]}],"transform-origin":[{origin:M()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:pe()}],"translate-x":[{"translate-x":pe()}],"translate-y":[{"translate-y":pe()}],"translate-z":[{"translate-z":pe()}],"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",He,ze]}],"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":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"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",He,ze]}],fill:[{fill:["none",...H()]}],"stroke-w":[{stroke:[Et,tu,Ki,Ag]}],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"]}},bF=JB(yF);function lt(...e){return bF(nO(e))}function AN(e){return e.toLowerCase().replace(/[\s_-]+/g," ")}function _u(e,t){return AN(e).includes(AN(t))}const wF=qu("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:"border-[1.5px] border-destructive text-destructive bg-transparent hover:bg-destructive/10",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"}}),le=v.forwardRef(({className:e,variant:t,size:n,asChild:a=!1,...i},l)=>{const u=a?_B:"button";return o.jsx(u,{className:lt(wF({variant:t,size:n,className:e})),ref:l,...i})});le.displayName="Button";function SF(e,t=[]){let n=[];function a(l,u){const d=v.createContext(u);d.displayName=l+"Context";const h=n.length;n=[...n,u];const p=m=>{const{scope:b,children:S,...j}=m,w=b?.[e]?.[h]||d,C=v.useMemo(()=>j,Object.values(j));return o.jsx(w.Provider,{value:C,children:S})};p.displayName=l+"Provider";function g(m,b){const S=b?.[e]?.[h]||d,j=v.useContext(S);if(j)return j;if(u!==void 0)return u;throw new Error(`\`${m}\` must be used within \`${l}\``)}return[p,g]}const i=()=>{const l=n.map(u=>v.createContext(u));return function(d){const h=d?.[e]||l;return v.useMemo(()=>({[`__scope${e}`]:{...d,[e]:h}}),[d,h])}};return i.scopeName=e,[a,jF(i,...t)]}function jF(...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 v.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var CF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],mO=CF.reduce((e,t)=>{const n=jh(`Primitive.${t}`),a=v.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}},{}),S0="Progress",j0=100,[NF]=SF(S0),[EF,_F]=NF(S0),gO=v.forwardRef((e,t)=>{const{__scopeProgress:n,value:a=null,max:i,getValueLabel:l=TF,...u}=e;(i||i===0)&&!RN(i)&&console.error(AF(`${i}`,"Progress"));const d=RN(i)?i:j0;a!==null&&!ON(a,d)&&console.error(RF(`${a}`,"Progress"));const h=ON(a,d)?a:null,p=Xf(h)?l(h,d):void 0;return o.jsx(EF,{scope:n,value:h,max:d,children:o.jsx(mO.div,{"aria-valuemax":d,"aria-valuemin":0,"aria-valuenow":Xf(h)?h:void 0,"aria-valuetext":p,role:"progressbar","data-state":yO(h,d),"data-value":h??void 0,"data-max":d,...u,ref:t})})});gO.displayName=S0;var vO="ProgressIndicator",xO=v.forwardRef((e,t)=>{const{__scopeProgress:n,...a}=e,i=_F(vO,n);return o.jsx(mO.div,{"data-state":yO(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...a,ref:t})});xO.displayName=vO;function TF(e,t){return`${Math.round(e/t*100)}%`}function yO(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Xf(e){return typeof e=="number"}function RN(e){return Xf(e)&&!isNaN(e)&&e>0}function ON(e,t){return Xf(e)&&!isNaN(e)&&e<=t&&e>=0}function AF(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${j0}\`.`}function RF(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 ${j0} if no \`max\` prop is set)
  13. - \`null\` or \`undefined\` if the progress is indeterminate.
  14. Defaulting to \`null\`.`}var bO=gO,OF=xO;const Wi=v.forwardRef(({className:e,value:t,...n},a)=>o.jsx(bO,{ref:a,className:lt("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...n,children:o.jsx(OF,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Wi.displayName=bO.displayName;const St=v.forwardRef(({className:e,type:t,...n},a)=>o.jsx("input",{type:t,className:lt("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}));St.displayName="Input";function Qe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}function MF(e,t){const n=v.createContext(t),a=l=>{const{children:u,...d}=l,h=v.useMemo(()=>d,Object.values(d));return o.jsx(n.Provider,{value:h,children:u})};a.displayName=e+"Provider";function i(l){const u=v.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 Rr(e,t=[]){let n=[];function a(l,u){const d=v.createContext(u),h=n.length;n=[...n,u];const p=m=>{const{scope:b,children:S,...j}=m,w=b?.[e]?.[h]||d,C=v.useMemo(()=>j,Object.values(j));return o.jsx(w.Provider,{value:C,children:S})};p.displayName=l+"Provider";function g(m,b){const S=b?.[e]?.[h]||d,j=v.useContext(S);if(j)return j;if(u!==void 0)return u;throw new Error(`\`${m}\` must be used within \`${l}\``)}return[p,g]}const i=()=>{const l=n.map(u=>v.createContext(u));return function(d){const h=d?.[e]||l;return v.useMemo(()=>({[`__scope${e}`]:{...d,[e]:h}}),[d,h])}};return i.scopeName=e,[a,PF(i,...t)]}function PF(...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 v.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var Vn=globalThis?.document?v.useLayoutEffect:()=>{},DF=h0[" useId ".trim().toString()]||(()=>{}),kF=0;function wa(e){const[t,n]=v.useState(DF());return Vn(()=>{n(a=>a??String(kF++))},[e]),t?`radix-${t}`:""}var LF=h0[" useInsertionEffect ".trim().toString()]||Vn;function Jr({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[i,l,u]=BF({defaultProp:t,onChange:n}),d=e!==void 0,h=d?e:i;{const g=v.useRef(e!==void 0);v.useEffect(()=>{const m=g.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.`),g.current=d},[d,a])}const p=v.useCallback(g=>{if(d){const m=FF(g)?g(e):g;m!==e&&u.current?.(m)}else l(g)},[d,e,l,u]);return[h,p]}function BF({defaultProp:e,onChange:t}){const[n,a]=v.useState(e),i=v.useRef(n),l=v.useRef(t);return LF(()=>{l.current=t},[t]),v.useEffect(()=>{i.current!==n&&(l.current?.(n),i.current=n)},[n,i]),[n,a,l]}function FF(e){return typeof e=="function"}function IF(e){const t=zF(e),n=v.forwardRef((a,i)=>{const{children:l,...u}=a,d=v.Children.toArray(l),h=d.find(UF);if(h){const p=h.props.children,g=d.map(m=>m===h?v.Children.count(p)>1?v.Children.only(null):v.isValidElement(p)?p.props.children:null:m);return o.jsx(t,{...u,ref:i,children:v.isValidElement(p)?v.cloneElement(p,void 0,g):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function zF(e){const t=v.forwardRef((n,a)=>{const{children:i,...l}=n;if(v.isValidElement(i)){const u=qF(i),d=VF(l,i.props);return i.type!==v.Fragment&&(d.ref=a?co(a,u):u),v.cloneElement(i,d)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var HF=Symbol("radix.slottable");function UF(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===HF}function VF(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 qF(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 $F=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ct=$F.reduce((e,t)=>{const n=IF(`Primitive.${t}`),a=v.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 GF(e,t){e&&Vu.flushSync(()=>e.dispatchEvent(t))}function gi(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>t.current?.(...n),[])}function KF(e,t=globalThis?.document){const n=gi(e);v.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 YF="DismissableLayer",vb="dismissableLayer.update",WF="dismissableLayer.pointerDownOutside",XF="dismissableLayer.focusOutside",MN,wO=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),$u=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:l,onInteractOutside:u,onDismiss:d,...h}=e,p=v.useContext(wO),[g,m]=v.useState(null),b=g?.ownerDocument??globalThis?.document,[,S]=v.useState({}),j=_t(t,k=>m(k)),w=Array.from(p.layers),[C]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),N=w.indexOf(C),_=g?w.indexOf(g):-1,T=p.layersWithOutsidePointerEventsDisabled.size>0,O=_>=N,M=JF(k=>{const F=k.target,W=[...p.branches].some(ce=>ce.contains(F));!O||W||(i?.(k),u?.(k),k.defaultPrevented||d?.())},b),B=eI(k=>{const F=k.target;[...p.branches].some(ce=>ce.contains(F))||(l?.(k),u?.(k),k.defaultPrevented||d?.())},b);return KF(k=>{_===p.layers.size-1&&(a?.(k),!k.defaultPrevented&&d&&(k.preventDefault(),d()))},b),v.useEffect(()=>{if(g)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(MN=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(g)),p.layers.add(g),PN(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(b.body.style.pointerEvents=MN)}},[g,b,n,p]),v.useEffect(()=>()=>{g&&(p.layers.delete(g),p.layersWithOutsidePointerEventsDisabled.delete(g),PN())},[g,p]),v.useEffect(()=>{const k=()=>S({});return document.addEventListener(vb,k),()=>document.removeEventListener(vb,k)},[]),o.jsx(ct.div,{...h,ref:j,style:{pointerEvents:T?O?"auto":"none":void 0,...e.style},onFocusCapture:Qe(e.onFocusCapture,B.onFocusCapture),onBlurCapture:Qe(e.onBlurCapture,B.onBlurCapture),onPointerDownCapture:Qe(e.onPointerDownCapture,M.onPointerDownCapture)})});$u.displayName=YF;var QF="DismissableLayerBranch",ZF=v.forwardRef((e,t)=>{const n=v.useContext(wO),a=v.useRef(null),i=_t(t,a);return v.useEffect(()=>{const l=a.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),o.jsx(ct.div,{...e,ref:i})});ZF.displayName=QF;function JF(e,t=globalThis?.document){const n=gi(e),a=v.useRef(!1),i=v.useRef(()=>{});return v.useEffect(()=>{const l=d=>{if(d.target&&!a.current){let h=function(){SO(WF,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 eI(e,t=globalThis?.document){const n=gi(e),a=v.useRef(!1);return v.useEffect(()=>{const i=l=>{l.target&&!a.current&&SO(XF,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 PN(){const e=new CustomEvent(vb);document.dispatchEvent(e)}function SO(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?GF(i,l):i.dispatchEvent(l)}var Rg="focusScope.autoFocusOnMount",Og="focusScope.autoFocusOnUnmount",DN={bubbles:!1,cancelable:!0},tI="FocusScope",Ch=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:i,onUnmountAutoFocus:l,...u}=e,[d,h]=v.useState(null),p=gi(i),g=gi(l),m=v.useRef(null),b=_t(t,w=>h(w)),S=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(a){let w=function(T){if(S.paused||!d)return;const O=T.target;d.contains(O)?m.current=O:di(m.current,{select:!0})},C=function(T){if(S.paused||!d)return;const O=T.relatedTarget;O!==null&&(d.contains(O)||di(m.current,{select:!0}))},N=function(T){if(document.activeElement===document.body)for(const M of T)M.removedNodes.length>0&&di(d)};document.addEventListener("focusin",w),document.addEventListener("focusout",C);const _=new MutationObserver(N);return d&&_.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",C),_.disconnect()}}},[a,d,S.paused]),v.useEffect(()=>{if(d){LN.add(S);const w=document.activeElement;if(!d.contains(w)){const N=new CustomEvent(Rg,DN);d.addEventListener(Rg,p),d.dispatchEvent(N),N.defaultPrevented||(nI(oI(jO(d)),{select:!0}),document.activeElement===w&&di(d))}return()=>{d.removeEventListener(Rg,p),setTimeout(()=>{const N=new CustomEvent(Og,DN);d.addEventListener(Og,g),d.dispatchEvent(N),N.defaultPrevented||di(w??document.body,{select:!0}),d.removeEventListener(Og,g),LN.remove(S)},0)}}},[d,p,g,S]);const j=v.useCallback(w=>{if(!n&&!a||S.paused)return;const C=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,N=document.activeElement;if(C&&N){const _=w.currentTarget,[T,O]=rI(_);T&&O?!w.shiftKey&&N===O?(w.preventDefault(),n&&di(T,{select:!0})):w.shiftKey&&N===T&&(w.preventDefault(),n&&di(O,{select:!0})):N===_&&w.preventDefault()}},[n,a,S.paused]);return o.jsx(ct.div,{tabIndex:-1,...u,ref:b,onKeyDown:j})});Ch.displayName=tI;function nI(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(di(a,{select:t}),document.activeElement!==n)return}function rI(e){const t=jO(e),n=kN(t,e),a=kN(t.reverse(),e);return[n,a]}function jO(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 kN(e,t){for(const n of e)if(!aI(n,{upTo:t}))return n}function aI(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 sI(e){return e instanceof HTMLInputElement&&"select"in e}function di(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&sI(e)&&t&&e.select()}}var LN=iI();function iI(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=BN(e,t),e.unshift(t)},remove(t){e=BN(e,t),e[0]?.resume()}}}function BN(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function oI(e){return e.filter(t=>t.tagName!=="A")}var lI="Portal",Nh=v.forwardRef((e,t)=>{const{container:n,...a}=e,[i,l]=v.useState(!1);Vn(()=>l(!0),[]);const u=n||i&&globalThis?.document?.body;return u?KR.createPortal(o.jsx(ct.div,{...a,ref:t}),u):null});Nh.displayName=lI;function cI(e,t){return v.useReducer((n,a)=>t[n][a]??n,e)}var Ps=e=>{const{present:t,children:n}=e,a=uI(t),i=typeof n=="function"?n({present:a.isPresent}):v.Children.only(n),l=_t(a.ref,dI(i));return typeof n=="function"||a.isPresent?v.cloneElement(i,{ref:l}):null};Ps.displayName="Presence";function uI(e){const[t,n]=v.useState(),a=v.useRef(null),i=v.useRef(e),l=v.useRef("none"),u=e?"mounted":"unmounted",[d,h]=cI(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const p=yf(a.current);l.current=d==="mounted"?p:"none"},[d]),Vn(()=>{const p=a.current,g=i.current;if(g!==e){const b=l.current,S=yf(p);e?h("MOUNT"):S==="none"||p?.display==="none"?h("UNMOUNT"):h(g&&b!==S?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,h]),Vn(()=>{if(t){let p;const g=t.ownerDocument.defaultView??window,m=S=>{const w=yf(a.current).includes(CSS.escape(S.animationName));if(S.target===t&&w&&(h("ANIMATION_END"),!i.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",p=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},b=S=>{S.target===t&&(l.current=yf(a.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{g.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:v.useCallback(p=>{a.current=p?getComputedStyle(p):null,n(p)},[])}}function yf(e){return e?.animationName||"none"}function dI(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 Mg=0;function C0(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??FN()),document.body.insertAdjacentElement("beforeend",e[1]??FN()),Mg++,()=>{Mg===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Mg--}},[])}function FN(){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 Ha=function(){return Ha=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},Ha.apply(this,arguments)};function CO(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 fI(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 kf="right-scroll-bar-position",Lf="width-before-scroll-bar",hI="with-scroll-bars-hidden",pI="--removed-body-scroll-bar-size";function Pg(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function mI(e,t){var n=v.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 gI=typeof window<"u"?v.useLayoutEffect:v.useEffect,IN=new WeakMap;function vI(e,t){var n=mI(null,function(a){return e.forEach(function(i){return Pg(i,a)})});return gI(function(){var a=IN.get(n);if(a){var i=new Set(a),l=new Set(e),u=n.current;i.forEach(function(d){l.has(d)||Pg(d,null)}),l.forEach(function(d){i.has(d)||Pg(d,u)})}IN.set(n,e)},[e]),n}function xI(e){return e}function yI(e,t){t===void 0&&(t=xI);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 g=u;u=[],g.forEach(l)},p=function(){return Promise.resolve().then(h)};p(),n={push:function(g){u.push(g),p()},filter:function(g){return u=u.filter(g),n}}}};return i}function bI(e){e===void 0&&(e={});var t=yI(null);return t.options=Ha({async:!0,ssr:!1},e),t}var NO=function(e){var t=e.sideCar,n=CO(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 v.createElement(a,Ha({},n))};NO.isSideCarExport=!0;function wI(e,t){return e.useMedium(t),NO}var EO=bI(),Dg=function(){},Eh=v.forwardRef(function(e,t){var n=v.useRef(null),a=v.useState({onScrollCapture:Dg,onWheelCapture:Dg,onTouchMoveCapture:Dg}),i=a[0],l=a[1],u=e.forwardProps,d=e.children,h=e.className,p=e.removeScrollBar,g=e.enabled,m=e.shards,b=e.sideCar,S=e.noRelative,j=e.noIsolation,w=e.inert,C=e.allowPinchZoom,N=e.as,_=N===void 0?"div":N,T=e.gapMode,O=CO(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),M=b,B=vI([n,t]),k=Ha(Ha({},O),i);return v.createElement(v.Fragment,null,g&&v.createElement(M,{sideCar:EO,removeScrollBar:p,shards:m,noRelative:S,noIsolation:j,inert:w,setCallbacks:l,allowPinchZoom:!!C,lockRef:n,gapMode:T}),u?v.cloneElement(v.Children.only(d),Ha(Ha({},k),{ref:B})):v.createElement(_,Ha({},k,{className:h,ref:B}),d))});Eh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Eh.classNames={fullWidth:Lf,zeroRight:kf};var SI=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function jI(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=SI();return t&&e.setAttribute("nonce",t),e}function CI(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function NI(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var EI=function(){var e=0,t=null;return{add:function(n){e==0&&(t=jI())&&(CI(t,n),NI(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},_I=function(){var e=EI();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},_O=function(){var e=_I(),t=function(n){var a=n.styles,i=n.dynamic;return e(a,i),null};return t},TI={left:0,top:0,right:0,gap:0},kg=function(e){return parseInt(e||"",10)||0},AI=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[kg(n),kg(a),kg(i)]},RI=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return TI;var t=AI(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])}},OI=_O(),kl="data-scroll-locked",MI=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(hI,` {
  16. overflow: hidden `).concat(a,`;
  17. padding-right: `).concat(d,"px ").concat(a,`;
  18. }
  19. body[`).concat(kl,`] {
  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(kf,` {
  32. right: `).concat(d,"px ").concat(a,`;
  33. }
  34. .`).concat(Lf,` {
  35. margin-right: `).concat(d,"px ").concat(a,`;
  36. }
  37. .`).concat(kf," .").concat(kf,` {
  38. right: 0 `).concat(a,`;
  39. }
  40. .`).concat(Lf," .").concat(Lf,` {
  41. margin-right: 0 `).concat(a,`;
  42. }
  43. body[`).concat(kl,`] {
  44. `).concat(pI,": ").concat(d,`px;
  45. }
  46. `)},zN=function(){var e=parseInt(document.body.getAttribute(kl)||"0",10);return isFinite(e)?e:0},PI=function(){v.useEffect(function(){return document.body.setAttribute(kl,(zN()+1).toString()),function(){var e=zN()-1;e<=0?document.body.removeAttribute(kl):document.body.setAttribute(kl,e.toString())}},[])},DI=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,i=a===void 0?"margin":a;PI();var l=v.useMemo(function(){return RI(i)},[i]);return v.createElement(OI,{styles:MI(l,!t,i,n?"":"!important")})},xb=!1;if(typeof window<"u")try{var bf=Object.defineProperty({},"passive",{get:function(){return xb=!0,!0}});window.addEventListener("test",bf,bf),window.removeEventListener("test",bf,bf)}catch{xb=!1}var al=xb?{passive:!1}:!1,kI=function(e){return e.tagName==="TEXTAREA"},TO=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!kI(e)&&n[t]==="visible")},LI=function(e){return TO(e,"overflowY")},BI=function(e){return TO(e,"overflowX")},HN=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var i=AO(e,a);if(i){var l=RO(e,a),u=l[1],d=l[2];if(u>d)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},FI=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},II=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},AO=function(e,t){return e==="v"?LI(t):BI(t)},RO=function(e,t){return e==="v"?FI(t):II(t)},zI=function(e,t){return e==="h"&&t==="rtl"?-1:1},HI=function(e,t,n,a,i){var l=zI(e,window.getComputedStyle(t).direction),u=l*a,d=n.target,h=t.contains(d),p=!1,g=u>0,m=0,b=0;do{if(!d)break;var S=RO(e,d),j=S[0],w=S[1],C=S[2],N=w-C-l*j;(j||N)&&AO(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(g&&Math.abs(m)<1||!g&&Math.abs(b)<1)&&(p=!0),p},wf=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},UN=function(e){return[e.deltaX,e.deltaY]},VN=function(e){return e&&"current"in e?e.current:e},UI=function(e,t){return e[0]===t[0]&&e[1]===t[1]},VI=function(e){return`
  47. .block-interactivity-`.concat(e,` {pointer-events: none;}
  48. .allow-interactivity-`).concat(e,` {pointer-events: all;}
  49. `)},qI=0,sl=[];function $I(e){var t=v.useRef([]),n=v.useRef([0,0]),a=v.useRef(),i=v.useState(qI++)[0],l=v.useState(_O)[0],u=v.useRef(e);v.useEffect(function(){u.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var w=fI([e.lockRef.current],(e.shards||[]).map(VN),!0).filter(Boolean);return w.forEach(function(C){return C.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),w.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var d=v.useCallback(function(w,C){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!u.current.allowPinchZoom;var N=wf(w),_=n.current,T="deltaX"in w?w.deltaX:_[0]-N[0],O="deltaY"in w?w.deltaY:_[1]-N[1],M,B=w.target,k=Math.abs(T)>Math.abs(O)?"h":"v";if("touches"in w&&k==="h"&&B.type==="range")return!1;var F=window.getSelection(),W=F&&F.anchorNode,ce=W?W===B||W.contains(B):!1;if(ce)return!1;var G=HN(k,B);if(!G)return!0;if(G?M=k:(M=k==="v"?"h":"v",G=HN(k,B)),!G)return!1;if(!a.current&&"changedTouches"in w&&(T||O)&&(a.current=M),!M)return!0;var ie=a.current||M;return HI(ie,C,w,ie==="h"?T:O)},[]),h=v.useCallback(function(w){var C=w;if(!(!sl.length||sl[sl.length-1]!==l)){var N="deltaY"in C?UN(C):wf(C),_=t.current.filter(function(M){return M.name===C.type&&(M.target===C.target||C.target===M.shadowParent)&&UI(M.delta,N)})[0];if(_&&_.should){C.cancelable&&C.preventDefault();return}if(!_){var T=(u.current.shards||[]).map(VN).filter(Boolean).filter(function(M){return M.contains(C.target)}),O=T.length>0?d(C,T[0]):!u.current.noIsolation;O&&C.cancelable&&C.preventDefault()}}},[]),p=v.useCallback(function(w,C,N,_){var T={name:w,delta:C,target:N,should:_,shadowParent:GI(N)};t.current.push(T),setTimeout(function(){t.current=t.current.filter(function(O){return O!==T})},1)},[]),g=v.useCallback(function(w){n.current=wf(w),a.current=void 0},[]),m=v.useCallback(function(w){p(w.type,UN(w),w.target,d(w,e.lockRef.current))},[]),b=v.useCallback(function(w){p(w.type,wf(w),w.target,d(w,e.lockRef.current))},[]);v.useEffect(function(){return sl.push(l),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:b}),document.addEventListener("wheel",h,al),document.addEventListener("touchmove",h,al),document.addEventListener("touchstart",g,al),function(){sl=sl.filter(function(w){return w!==l}),document.removeEventListener("wheel",h,al),document.removeEventListener("touchmove",h,al),document.removeEventListener("touchstart",g,al)}},[]);var S=e.removeScrollBar,j=e.inert;return v.createElement(v.Fragment,null,j?v.createElement(l,{styles:VI(i)}):null,S?v.createElement(DI,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function GI(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const KI=wI(EO,$I);var _h=v.forwardRef(function(e,t){return v.createElement(Eh,Ha({},e,{ref:t,sideCar:KI}))});_h.classNames=Eh.classNames;var YI=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},il=new WeakMap,Sf=new WeakMap,jf={},Lg=0,OO=function(e){return e&&(e.host||OO(e.parentNode))},WI=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=OO(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})},XI=function(e,t,n,a){var i=WI(t,Array.isArray(e)?e:[e]);jf[n]||(jf[n]=new WeakMap);var l=jf[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 g=function(m){!m||h.has(m)||Array.prototype.forEach.call(m.children,function(b){if(d.has(b))g(b);else try{var S=b.getAttribute(a),j=S!==null&&S!=="false",w=(il.get(b)||0)+1,C=(l.get(b)||0)+1;il.set(b,w),l.set(b,C),u.push(b),w===1&&j&&Sf.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 g(t),d.clear(),Lg++,function(){u.forEach(function(m){var b=il.get(m)-1,S=l.get(m)-1;il.set(m,b),l.set(m,S),b||(Sf.has(m)||m.removeAttribute(a),Sf.delete(m)),S||m.removeAttribute(n)}),Lg--,Lg||(il=new WeakMap,il=new WeakMap,Sf=new WeakMap,jf={})}},N0=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),i=YI(e);return i?(a.push.apply(a,Array.from(i.querySelectorAll("[aria-live], script"))),XI(a,i,n,"aria-hidden")):function(){return null}};function QI(e){const t=ZI(e),n=v.forwardRef((a,i)=>{const{children:l,...u}=a,d=v.Children.toArray(l),h=d.find(ez);if(h){const p=h.props.children,g=d.map(m=>m===h?v.Children.count(p)>1?v.Children.only(null):v.isValidElement(p)?p.props.children:null:m);return o.jsx(t,{...u,ref:i,children:v.isValidElement(p)?v.cloneElement(p,void 0,g):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function ZI(e){const t=v.forwardRef((n,a)=>{const{children:i,...l}=n;if(v.isValidElement(i)){const u=nz(i),d=tz(l,i.props);return i.type!==v.Fragment&&(d.ref=a?co(a,u):u),v.cloneElement(i,d)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var JI=Symbol("radix.slottable");function ez(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===JI}function tz(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 nz(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 Th="Dialog",[MO]=Rr(Th),[rz,Na]=MO(Th),PO=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:i,onOpenChange:l,modal:u=!0}=e,d=v.useRef(null),h=v.useRef(null),[p,g]=Jr({prop:a,defaultProp:i??!1,onChange:l,caller:Th});return o.jsx(rz,{scope:t,triggerRef:d,contentRef:h,contentId:wa(),titleId:wa(),descriptionId:wa(),open:p,onOpenChange:g,onOpenToggle:v.useCallback(()=>g(m=>!m),[g]),modal:u,children:n})};PO.displayName=Th;var DO="DialogTrigger",kO=v.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,i=Na(DO,n),l=_t(t,i.triggerRef);return o.jsx(ct.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":T0(i.open),...a,ref:l,onClick:Qe(e.onClick,i.onOpenToggle)})});kO.displayName=DO;var E0="DialogPortal",[az,LO]=MO(E0,{forceMount:void 0}),BO=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:i}=e,l=Na(E0,t);return o.jsx(az,{scope:t,forceMount:n,children:v.Children.map(a,u=>o.jsx(Ps,{present:n||l.open,children:o.jsx(Nh,{asChild:!0,container:i,children:u})}))})};BO.displayName=E0;var Qf="DialogOverlay",FO=v.forwardRef((e,t)=>{const n=LO(Qf,e.__scopeDialog),{forceMount:a=n.forceMount,...i}=e,l=Na(Qf,e.__scopeDialog);return l.modal?o.jsx(Ps,{present:a||l.open,children:o.jsx(iz,{...i,ref:t})}):null});FO.displayName=Qf;var sz=QI("DialogOverlay.RemoveScroll"),iz=v.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,i=Na(Qf,n);return o.jsx(_h,{as:sz,allowPinchZoom:!0,shards:[i.contentRef],children:o.jsx(ct.div,{"data-state":T0(i.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),no="DialogContent",IO=v.forwardRef((e,t)=>{const n=LO(no,e.__scopeDialog),{forceMount:a=n.forceMount,...i}=e,l=Na(no,e.__scopeDialog);return o.jsx(Ps,{present:a||l.open,children:l.modal?o.jsx(oz,{...i,ref:t}):o.jsx(lz,{...i,ref:t})})});IO.displayName=no;var oz=v.forwardRef((e,t)=>{const n=Na(no,e.__scopeDialog),a=v.useRef(null),i=_t(t,n.contentRef,a);return v.useEffect(()=>{const l=a.current;if(l)return N0(l)},[]),o.jsx(zO,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Qe(e.onCloseAutoFocus,l=>{l.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Qe(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&l.preventDefault()}),onFocusOutside:Qe(e.onFocusOutside,l=>l.preventDefault())})}),lz=v.forwardRef((e,t)=>{const n=Na(no,e.__scopeDialog),a=v.useRef(!1),i=v.useRef(!1);return o.jsx(zO,{...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()}})}),zO=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:l,...u}=e,d=Na(no,n),h=v.useRef(null),p=_t(t,h);return C0(),o.jsxs(o.Fragment,{children:[o.jsx(Ch,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:i,onUnmountAutoFocus:l,children:o.jsx($u,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":T0(d.open),...u,ref:p,onDismiss:()=>d.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(cz,{titleId:d.titleId}),o.jsx(dz,{contentRef:h,descriptionId:d.descriptionId})]})]})}),_0="DialogTitle",HO=v.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,i=Na(_0,n);return o.jsx(ct.h2,{id:i.titleId,...a,ref:t})});HO.displayName=_0;var UO="DialogDescription",VO=v.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,i=Na(UO,n);return o.jsx(ct.p,{id:i.descriptionId,...a,ref:t})});VO.displayName=UO;var qO="DialogClose",$O=v.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,i=Na(qO,n);return o.jsx(ct.button,{type:"button",...a,ref:t,onClick:Qe(e.onClick,()=>i.onOpenChange(!1))})});$O.displayName=qO;function T0(e){return e?"open":"closed"}var GO="DialogTitleWarning",[Dne,KO]=MF(GO,{contentName:no,titleName:_0,docsSlug:"dialog"}),cz=({titleId:e})=>{const t=KO(GO),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 v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},uz="DialogDescriptionWarning",dz=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${KO(uz).contentName}}.`;return v.useEffect(()=>{const i=e.current?.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},YO=PO,fz=kO,WO=BO,Ah=FO,Rh=IO,Oh=HO,Mh=VO,XO=$O;const hz=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),pz=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase()),qN=e=>{const t=pz(e);return t.charAt(0).toUpperCase()+t.slice(1)},QO=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim(),mz=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var gz={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 vz=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:i="",children:l,iconNode:u,...d},h)=>v.createElement("svg",{ref:h,...gz,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:QO("lucide",i),...!l&&!mz(d)&&{"aria-hidden":"true"},...d},[...u.map(([p,g])=>v.createElement(p,g)),...Array.isArray(l)?l:[l]]));const Ea=(e,t)=>{const n=v.forwardRef(({className:a,...i},l)=>v.createElement(vz,{ref:l,iconNode:t,className:QO(`lucide-${hz(qN(e))}`,`lucide-${e}`,a),...i}));return n.displayName=qN(e),n};const xz=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],yb=Ea("check",xz);const yz=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],A0=Ea("chevron-down",yz);const bz=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],wz=Ea("chevron-up",bz);const Sz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],jz=Ea("circle",Sz);const Cz=[["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"}]],Nz=Ea("layers",Cz);const Ez=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],$N=Ea("loader-circle",Ez);const _z=[["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"}]],Tz=Ea("pencil",_z);const Az=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Rz=Ea("plus",Az);const Oz=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Mz=Ea("refresh-cw",Oz);const Pz=[["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"}]],ZO=Ea("trash-2",Pz);const Dz=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],JO=Ea("x",Dz),Xr=YO,fl=fz,kz=WO,eM=v.forwardRef(({className:e,...t},n)=>o.jsx(Ah,{ref:n,className:lt("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}));eM.displayName=Ah.displayName;const _r=v.forwardRef(({className:e,children:t,...n},a)=>o.jsxs(kz,{children:[o.jsx(eM,{}),o.jsxs(Rh,{ref:a,className:lt("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(XO,{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(JO,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_r.displayName=Rh.displayName;const cr=({className:e,...t})=>o.jsx("div",{className:lt("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});cr.displayName="DialogHeader";const Sa=({className:e,...t})=>o.jsx("div",{className:lt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Sa.displayName="DialogFooter";const ur=v.forwardRef(({className:e,...t},n)=>o.jsx(Oh,{ref:n,className:lt("font-display text-lg font-semibold leading-none tracking-tight",e),...t}));ur.displayName=Oh.displayName;const _s=v.forwardRef(({className:e,...t},n)=>o.jsx(Mh,{ref:n,className:lt("text-sm text-muted-foreground",e),...t}));_s.displayName=Mh.displayName;class Lz{_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 g=await p.text();return g?JSON.parse(g):{}}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,g])=>{u.append(p,g)});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 ue=new Lz;function Bz(){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(g=>g.id===a);if(!u?.url)return;const h=(g=>{try{return new URL(g).origin}catch{return g}})(u.url),p=window.location.origin;h!==p&&ue.setBaseUrl(u.url)}catch{}}Bz();const GN=e=>{let t;const n=new Set,a=(p,g)=>{const m=typeof p=="function"?p(t):p;if(!Object.is(m,t)){const b=t;t=g??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(S=>S(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},Fz=(e=>e?GN(e):GN),Iz=e=>e;function zz(e,t=Iz){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 Hz=e=>{const t=Fz(e),n=a=>zz(t,a);return Object.assign(n,t),n},tM=(e=>Hz),sn=tM()(()=>({isBackendConnected:!1,connectionAttempts:0,status:null}));let xa=null,Bf=null;function R0(){if(xa){if(xa.readyState===WebSocket.CONNECTING)return;xa.readyState===WebSocket.OPEN&&xa.close(),xa=null}const e=new WebSocket(ue.getWebSocketUrl("/ws/status"));xa=e,e.onopen=()=>{sn.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&&sn.setState({status:n.data})}catch{}},e.onclose=()=>{xa=null,sn.setState(t=>({isBackendConnected:!1,connectionAttempts:t.connectionAttempts+1})),Bf=setTimeout(R0,3e3)},e.onerror=()=>{sn.setState({isBackendConnected:!1})}}ue.onBaseUrlChange(()=>{sn.setState({status:null,isBackendConnected:!1}),Bf&&(clearTimeout(Bf),Bf=null),xa&&(xa.readyState===WebSocket.OPEN&&xa.close(),xa=null),R0()});R0();let Ff=null;sn.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;Ff!==null&&n&&!Ff&&window.dispatchEvent(new CustomEvent("playback-started")),Ff=n});ue.onBaseUrlChange(()=>{Ff=null});function xs(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 hl(e){return e?e.split("/").pop()?.replace(".thr","")||e:"Unknown"}function Uz({file:e,index:t,previewUrl:n,requestPreview:a}){const i=v.useRef(null),l=v.useRef(!1);return v.useEffect(()=>{if(!i.current||n||l.current)return;const u=new IntersectionObserver(d=>{d.forEach(h=>{h.isIntersecting&&!l.current&&(l.current=!0,a(e),u.disconnect())})},{rootMargin:"50px"});return u.observe(i.current),()=>u.disconnect()},[e,n,a]),o.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg transition-colors hover:bg-muted/50",children:[o.jsx("div",{ref:i,className:"w-28 h-28 rounded-full overflow-hidden bg-muted border shrink-0",children:n?o.jsx("img",{src:n,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 font-display font-medium truncate",children:hl(e)}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["#",t+1]})]})]})}function Vz({isLogsOpen:e=!1,logsDrawerHeight:t=256,isVisible:n,openExpanded:a=!1,onClose:i}){const l=sn(de=>de.status),[u,d]=v.useState(null),[h,p]=v.useState(!1),g=v.useRef(null),m=v.useRef(null),b=de=>{g.current=de.touches[0].clientY},S=de=>{if(g.current===null)return;const Te=de.changedTouches[0].clientY-g.current;Te>50?h?p(!1):i():Te<-50&&j&&p(!0),g.current=null};v.useEffect(()=>{if(n&&h)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[n,h]),v.useEffect(()=>{const de=m.current;if(!de)return;const De=Te=>{Te.target.closest("[data-scrollable]")||Te.preventDefault()};return de.addEventListener("touchmove",De,{passive:!1}),()=>{de.removeEventListener("touchmove",De)}},[]),v.useEffect(()=>{a&&n&&p(!0)},[a,n]),v.useEffect(()=>{const de=()=>{p(!0)};return window.addEventListener("playback-started",de),()=>window.removeEventListener("playback-started",de)},[]);const j=l?.is_running||l?.is_paused||(l?.pause_time_remaining??0)>0,w=v.useRef(null);v.useEffect(()=>(w.current&&(clearTimeout(w.current),w.current=null),!j&&h&&(w.current=setTimeout(()=>{p(!1)},500)),()=>{w.current&&clearTimeout(w.current)}),[j,h]);const[C,N]=v.useState([]),_=v.useRef(null),T=v.useRef(null),O=v.useRef(-1),M=v.useRef(null),B=v.useRef(null),k=v.useRef(null),F=v.useRef(0),W=v.useRef(0),ce=v.useRef(0),[G,ie]=v.useState(null),Q=v.useRef("");v.useEffect(()=>{if(!n)return;const de=l?.current_file,De=l?.playlist?.next_file,Te=[de,De].filter(Boolean),Be=Te.join("|");Be!==Q.current&&(Q.current=Be,Te.length>0?ue.post("/preview_thr_batch",{file_names:Te}).then(_e=>{de&&_e[de]?.image_data?d(_e[de].image_data):d(null),De&&_e[De]?.image_data?ie(_e[De].image_data):ie(null)}).catch(()=>{d(null),ie(null)}):(d(null),ie(null)))},[n,l?.current_file,l?.playlist?.next_file]);const Z=v.useCallback((de,De,Te)=>{const Be=Te/2,_e=Te/2,We=Te/2*.9*De,Nt=Be+We*Math.cos(de),bt=_e+We*Math.sin(de);return{x:Nt,y:bt}},[]),ve=v.useCallback(()=>{const de=document.documentElement.classList.contains("dark"),De=getComputedStyle(document.documentElement),Te=(Be,_e)=>De.getPropertyValue(Be).trim()||_e;return{isDark:de,bgOuter:Te("--color-background",de?"#171310":"#F5EFE6"),bgInner:Te("--color-card",de?"#211C17":"#FDFAF4"),borderColor:Te("--color-border",de?"#352D23":"#E2D6C2"),lineColor:Te("--color-foreground",de?"#F2EAD9":"#292219"),markerColor:Te("--color-live",de?"#7BC4B0":"#35836F"),markerBorder:Te("--color-card",de?"#211C17":"#FDFAF4")}},[]),P=v.useCallback((de,De)=>{const Te=ve();T.current||(T.current=document.createElement("canvas"));const Be=T.current;Be.width=de,Be.height=de;const _e=Be.getContext("2d");if(_e){if(_e.fillStyle=Te.bgOuter,_e.fillRect(0,0,de,de),_e.beginPath(),_e.arc(de/2,de/2,de/2*.95,0,Math.PI*2),_e.fillStyle=Te.bgInner,_e.fill(),_e.strokeStyle=Te.borderColor,_e.lineWidth=1,_e.stroke(),_e.strokeStyle=Te.lineColor,_e.lineWidth=1.5,_e.lineCap="round",_e.lineJoin="round",De.length>0){const We=Z(De[0][0],De[0][1],de);_e.beginPath(),_e.moveTo(We.x,We.y),_e.stroke()}O.current=0,B.current=Te.isDark}},[ve,Z]),V=v.useCallback((de,De,Te,Be=!1)=>{const We=de.canvas.width,Nt=ve(),bt=Math.max(0,Te-16),Tt=Math.floor(bt);(Be||!T.current||B.current!==Nt.isDark||Tt<O.current)&&P(We,De);const qt=T.current;if(!qt)return;const $t=qt.getContext("2d");if($t){if(De.length>0&&Tt>O.current){$t.strokeStyle=Nt.lineColor,$t.lineWidth=1.5,$t.lineCap="round",$t.lineJoin="round",$t.beginPath();const It=Z(De[O.current][0],De[O.current][1],We);$t.moveTo(It.x,It.y);for(let Pt=O.current+1;Pt<=Tt&&Pt<De.length;Pt++){const jt=Z(De[Pt][0],De[Pt][1],We);$t.lineTo(jt.x,jt.y)}$t.stroke(),O.current=Tt}if(de.drawImage(qt,0,0),De.length>0&&Tt<De.length-1){const It=bt-Tt,Pt=De[Tt],jt=De[Math.min(Tt+1,De.length-1)],q=Pt[0]+(jt[0]-Pt[0])*It,Se=Pt[1]+(jt[1]-Pt[1])*It,Oe=Z(q,Se,We);de.save(),de.beginPath(),de.arc(Oe.x,Oe.y,8,0,Math.PI*2),de.shadowColor=Nt.markerColor,de.shadowBlur=8,de.fillStyle=Nt.markerColor,de.fill(),de.restore(),de.strokeStyle=Nt.markerBorder,de.lineWidth=2,de.stroke()}else if(De.length>0&&Tt<De.length){const It=Z(De[Tt][0],De[Tt][1],We);de.save(),de.beginPath(),de.arc(It.x,It.y,8,0,Math.PI*2),de.shadowColor=Nt.markerColor,de.shadowBlur=8,de.fillStyle=Nt.markerColor,de.fill(),de.restore(),de.strokeStyle=Nt.markerBorder,de.lineWidth=2,de.stroke()}}},[ve,P,Z]);v.useEffect(()=>{const de=l?.current_file;!de||!(de!==M.current||C.length===0)||(M.current=de,O.current=-1,ue.post("/get_theta_rho_coordinates",{file_name:de}).then(Te=>{Te.coordinates&&Array.isArray(Te.coordinates)&&N(Te.coordinates)}).catch(Te=>{console.error("Failed to fetch coordinates:",Te),N([])}))},[l?.current_file,C.length]);const H=v.useCallback(de=>de.length===0?0:(l?.progress?.percentage||0)/100*de.length,[l?.progress?.percentage]);v.useEffect(()=>{const de=l?.progress?.percentage||0;de!==F.current&&(F.current=de,W.current=performance.now())},[l?.progress?.percentage]),v.useEffect(()=>{if(!h||C.length===0)return;const de=l?.is_paused||!1,De=4.2,Te=()=>{if(!_.current)return;const _e=_.current.getContext("2d");if(!_e)return;const We=H(C),bt=(performance.now()-W.current)/1e3;let Tt;de?Tt=We:(Tt=F.current/100*C.length+bt*De,Tt=Math.min(Tt,We+2)),ce.current=Tt,V(_e,C,Tt),k.current=requestAnimationFrame(Te)},Be=setTimeout(()=>{if(!_.current)return;const _e=_.current.getContext("2d");_e&&(O.current=-1,T.current=null,ce.current=H(C),W.current=performance.now(),V(_e,C,ce.current,!0),k.current=requestAnimationFrame(Te))},50);return()=>{clearTimeout(Be),k.current&&cancelAnimationFrame(k.current)}},[h,C,l?.is_paused,V,H]);const se=async()=>{try{const de=l?.is_paused?"/resume_execution":"/pause_execution";await ue.post(de),Y.success(l?.is_paused?"Resumed":"Paused")}catch(de){let De="Failed to toggle pause";if(de instanceof Error)try{const Te=de.message.match(/\{.*\}/);if(Te){const Be=JSON.parse(Te[0]);Be.detail&&(De=Be.detail)}}catch{}Y.error(De)}},we=async()=>{try{await ue.post("/stop_execution"),Y.success("Stopped")}catch{try{await ue.post("/force_stop"),Y.success("Force stopped")}catch{Y.error("Failed to stop")}}},L=async()=>{try{await ue.post("/skip_pattern"),Y.success("Skipping to next pattern")}catch{Y.error("Failed to skip")}},[re,z]=v.useState(""),[ee,xe]=v.useState(!1),[Ne,fe]=v.useState({}),Ce=v.useRef(null),Pe=v.useRef(null),ke=de=>{Ce.current=de.touches[0].clientY},Ue=de=>{if(Ce.current===null)return;if(de.changedTouches[0].clientY-Ce.current>80){const Be=Pe.current?.querySelector("[data-scrollable]");(!Be||Be.scrollTop<=0)&&xe(!1)}Ce.current=null},pe=l?.playlist?.files||[],it=async()=>{const de=parseInt(re);if(isNaN(de)||de<10||de>6e3){Y.error("Speed must be between 10 and 6000 mm/s");return}try{await ue.post("/set_speed",{speed:de}),z(""),Y.success(`Speed set to ${de} mm/s`)}catch{Y.error("Failed to set speed")}},st=v.useRef(new Set),Me=v.useRef(new Set),ot=v.useRef(null),$e=v.useCallback(de=>{Ne[de]||st.current.has(de)||Me.current.has(de)||(Me.current.add(de),ot.current&&clearTimeout(ot.current),ot.current=setTimeout(async()=>{const De=Array.from(Me.current);if(Me.current.clear(),De.length!==0){De.forEach(Te=>st.current.add(Te));try{const Te=await ue.post("/preview_thr_batch",{file_names:De}),Be={};for(const[_e,We]of Object.entries(Te))We.image_data&&(Be[_e]=We.image_data);Object.keys(Be).length>0&&fe(_e=>({..._e,...Be}))}catch(Te){console.error("Failed to fetch queue previews:",Te)}}},100))},[Ne]);if(!n)return null;const Vt=hl(l?.current_file??null),dt=l?.progress?.percentage||0,Lt=l?.progress?.remaining_time||0,yt=l?.progress?.elapsed_time||0,ft=l?.progress?.last_completed_time?.actual_time_seconds,Ge=ft?Math.max(0,ft-yt):Lt,ht=!!ft,Ct=(l?.pause_time_remaining??0)>0,Jt=l?.pause_time_remaining??0,Wt=l?.original_pause_time??0,Xt=Wt>0?(Wt-Jt)/Wt*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:S,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(le,{variant:"ghost",size:"icon",className:"md:hidden h-8 w-8",onClick:()=>xe(!0),title:"View queue",children:o.jsx("span",{className:"material-icons-outlined text-lg",children:"queue_music"})}),j&&o.jsx(le,{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(le,{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:Ct?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: ",hl(l.playlist.next_file)]})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-sm md:text-base font-display 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]})]})})}),Ct?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(Wi,{value:Xt,className:"h-2 flex-1"}),o.jsx("span",{className:"text-sm text-muted-foreground font-mono",children:xs(Jt)})]}):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:xs(yt)}),o.jsx(Wi,{value:dt,className:"h-2 flex-1 bg-live/20 [&>div]:bg-live"}),o.jsxs("span",{className:`text-sm text-muted-foreground text-right font-mono flex items-center justify-end gap-1.5 shrink-0 ${ht?"w-24":"w-14"}`,title:ht?"ETA based on last completed run":"Estimated time remaining",children:[ht&&o.jsx("span",{className:"material-icons-outlined text-sm",children:"history"}),"-",xs(Ge)]})]}),o.jsxs("div",{className:"flex items-center justify-center gap-3",children:[o.jsx(le,{variant:"secondary",size:"icon",className:"h-10 w-10 rounded-full",onClick:we,title:"Stop",children:o.jsx("span",{className:"material-icons",children:"stop"})}),o.jsx(le,{variant:"default",size:"icon",className:"h-12 w-12 rounded-full",onClick:se,children:o.jsx("span",{className:"material-icons text-xl",children:l.is_paused?"play_arrow":"pause"})}),l.playlist&&o.jsx(le,{variant:"secondary",size:"icon",className:"h-10 w-10 rounded-full",onClick:L,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(St,{type:"number",placeholder:String(l.speed),value:re,onChange:de=>z(de.target.value),onKeyDown:de=>de.key==="Enter"&&it(),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:()=>xe(!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:G?o.jsx("img",{src:G,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:hl(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&&(Ct?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(Wi,{value:Xt,className:"h-2 flex-1"}),o.jsx("span",{className:"text-sm text-muted-foreground font-mono",children:xs(Jt)})]}):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:xs(yt)}),o.jsx(Wi,{value:dt,className:"h-2 flex-1 bg-live/20 [&>div]:bg-live"}),o.jsxs("span",{className:`text-sm text-muted-foreground text-right font-mono flex items-center justify-end gap-1.5 shrink-0 ${ht?"w-24":"w-14"}`,children:[ht&&o.jsx("span",{className:"material-icons-outlined text-sm",children:"history"}),"-",xs(Ge)]})]}))]}),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:Ct?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: ",hl(l.playlist.next_file)]})]}):o.jsxs(o.Fragment,{children:[o.jsx("h2",{className:"text-lg md:text-xl font-display 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]})]})})]}),Ct?o.jsxs("div",{className:"space-y-1 md:space-y-2",children:[o.jsx(Wi,{value:Xt,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:[xs(Jt)," remaining"]})]})]}):o.jsxs("div",{className:"space-y-1 md:space-y-2",children:[o.jsx(Wi,{value:dt,className:"h-1.5 md:h-2 bg-live/20 [&>div]:bg-live"}),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:xs(yt)}),o.jsxs("span",{children:[dt.toFixed(0),"%"]}),o.jsxs("span",{className:"w-16 flex items-center justify-end gap-1",children:[ht&&o.jsx("span",{className:"material-icons-outlined text-xs",children:"history"}),"-",xs(Ge)]})]})]}),o.jsxs("div",{className:"flex items-center justify-center gap-2 md:gap-3",children:[o.jsx(le,{variant:"secondary",size:"icon",className:"h-10 w-10 md:h-12 md:w-12 rounded-full",onClick:we,title:"Stop",children:o.jsx("span",{className:"material-icons text-lg md:text-2xl",children:"stop"})}),o.jsx(le,{variant:"default",size:"icon",className:"h-12 w-12 md:h-14 md:w-14 rounded-full",onClick:se,children:o.jsx("span",{className:"material-icons text-xl md:text-2xl",children:l?.is_paused?"play_arrow":"pause"})}),l?.playlist&&o.jsx(le,{variant:"secondary",size:"icon",className:"h-10 w-10 md:h-12 md:w-12 rounded-full",onClick:L,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(St,{type:"number",placeholder:String(l?.speed||1e3),value:re,onChange:de=>z(de.target.value),onKeyDown:de=>de.key==="Enter"&&it(),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:()=>xe(!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:G?o.jsx("img",{src:G,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-display font-medium truncate",children:hl(l.playlist.next_file)})]}),o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-lg",children:"queue_music"})]})]})]})})]})]})}),o.jsx(Xr,{open:ee,onOpenChange:xe,children:o.jsxs(_r,{ref:Pe,className:"max-w-md max-h-[80vh] flex flex-col",onTouchStart:ke,onTouchEnd:Ue,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(cr,{children:[o.jsxs(ur,{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(_s,{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&&pe.length>0?(()=>{const de=!!l.playlist.shuffled,De=l.playlist.current_index,Te=de?pe.map((Be,_e)=>({file:Be,index:_e})):pe.map((Be,_e)=>({file:Be,index:_e})).filter(({index:Be})=>Be>De);return Te.length===0?o.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No upcoming patterns"}):o.jsxs("div",{className:"space-y-1",children:[de&&o.jsx("p",{className:"text-xs text-muted-foreground px-2 pb-1",children:"Shuffle is on — the table picks the order, so this lists the playlist's patterns, not the play order."}),Te.map(({file:Be,index:_e})=>o.jsx(Uz,{file:Be,index:_e,previewUrl:Ne[Be]||null,requestPreview:$e},`queue-item-${_e}`))]})})():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 qz=["top","right","bottom","left"],vi=Math.min,Sr=Math.max,Zf=Math.round,Cf=Math.floor,qa=e=>({x:e,y:e}),$z={left:"right",right:"left",bottom:"top",top:"bottom"},Gz={start:"end",end:"start"};function bb(e,t,n){return Sr(e,vi(t,n))}function Ts(e,t){return typeof e=="function"?e(t):e}function As(e){return e.split("-")[0]}function Kl(e){return e.split("-")[1]}function O0(e){return e==="x"?"y":"x"}function M0(e){return e==="y"?"height":"width"}const Kz=new Set(["top","bottom"]);function Ua(e){return Kz.has(As(e))?"y":"x"}function P0(e){return O0(Ua(e))}function Yz(e,t,n){n===void 0&&(n=!1);const a=Kl(e),i=P0(e),l=M0(i);let u=i==="x"?a===(n?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(u=Jf(u)),[u,Jf(u)]}function Wz(e){const t=Jf(e);return[wb(e),t,wb(t)]}function wb(e){return e.replace(/start|end/g,t=>Gz[t])}const KN=["left","right"],YN=["right","left"],Xz=["top","bottom"],Qz=["bottom","top"];function Zz(e,t,n){switch(e){case"top":case"bottom":return n?t?YN:KN:t?KN:YN;case"left":case"right":return t?Xz:Qz;default:return[]}}function Jz(e,t,n,a){const i=Kl(e);let l=Zz(As(e),n==="start",a);return i&&(l=l.map(u=>u+"-"+i),t&&(l=l.concat(l.map(wb)))),l}function Jf(e){return e.replace(/left|right|bottom|top/g,t=>$z[t])}function e9(e){return{top:0,right:0,bottom:0,left:0,...e}}function nM(e){return typeof e!="number"?e9(e):{top:e,right:e,bottom:e,left:e}}function eh(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 WN(e,t,n){let{reference:a,floating:i}=e;const l=Ua(t),u=P0(t),d=M0(u),h=As(t),p=l==="y",g=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 S;switch(h){case"top":S={x:g,y:a.y-i.height};break;case"bottom":S={x:g,y:a.y+a.height};break;case"right":S={x:a.x+a.width,y:m};break;case"left":S={x:a.x-i.width,y:m};break;default:S={x:a.x,y:a.y}}switch(Kl(t)){case"start":S[u]-=b*(n&&p?-1:1);break;case"end":S[u]+=b*(n&&p?-1:1);break}return S}const t9=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:g,y:m}=WN(p,a,h),b=a,S={},j=0;for(let w=0;w<d.length;w++){const{name:C,fn:N}=d[w],{x:_,y:T,data:O,reset:M}=await N({x:g,y:m,initialPlacement:a,placement:b,strategy:i,middlewareData:S,rects:p,platform:u,elements:{reference:e,floating:t}});g=_??g,m=T??m,S={...S,[C]:{...S[C],...O}},M&&j<=50&&(j++,typeof M=="object"&&(M.placement&&(b=M.placement),M.rects&&(p=M.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:i}):M.rects),{x:g,y:m}=WN(p,b,h)),w=-1)}return{x:g,y:m,placement:b,strategy:i,middlewareData:S}};async function Tu(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:g="viewport",elementContext:m="floating",altBoundary:b=!1,padding:S=0}=Ts(t,e),j=nM(S),C=d[b?m==="floating"?"reference":"floating":m],N=eh(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:g,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)),O=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},M=eh(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:_,offsetParent:T,strategy:h}):_);return{top:(N.top-M.top+j.top)/O.y,bottom:(M.bottom-N.bottom+j.bottom)/O.y,left:(N.left-M.left+j.left)/O.x,right:(M.right-N.right+j.right)/O.x}}const n9=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:g=0}=Ts(e,t)||{};if(p==null)return{};const m=nM(g),b={x:n,y:a},S=P0(i),j=M0(S),w=await u.getDimensions(p),C=S==="y",N=C?"top":"left",_=C?"bottom":"right",T=C?"clientHeight":"clientWidth",O=l.reference[j]+l.reference[S]-b[S]-l.floating[j],M=b[S]-l.reference[S],B=await(u.getOffsetParent==null?void 0:u.getOffsetParent(p));let k=B?B[T]:0;(!k||!await(u.isElement==null?void 0:u.isElement(B)))&&(k=d.floating[T]||l.floating[j]);const F=O/2-M/2,W=k/2-w[j]/2-1,ce=vi(m[N],W),G=vi(m[_],W),ie=ce,Q=k-w[j]-G,Z=k/2-w[j]/2+F,ve=bb(ie,Z,Q),P=!h.arrow&&Kl(i)!=null&&Z!==ve&&l.reference[j]/2-(Z<ie?ce:G)-w[j]/2<0,V=P?Z<ie?Z-ie:Z-Q:0;return{[S]:b[S]+V,data:{[S]:ve,centerOffset:Z-ve-V,...P&&{alignmentOffset:V}},reset:P}}}),r9=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:g=!0,crossAxis:m=!0,fallbackPlacements:b,fallbackStrategy:S="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:w=!0,...C}=Ts(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const N=As(i),_=Ua(d),T=As(d)===d,O=await(h.isRTL==null?void 0:h.isRTL(p.floating)),M=b||(T||!w?[Jf(d)]:Wz(d)),B=j!=="none";!b&&B&&M.push(...Jz(d,w,j,O));const k=[d,...M],F=await Tu(t,C),W=[];let ce=((a=l.flip)==null?void 0:a.overflows)||[];if(g&&W.push(F[N]),m){const Z=Yz(i,u,O);W.push(F[Z[0]],F[Z[1]])}if(ce=[...ce,{placement:i,overflows:W}],!W.every(Z=>Z<=0)){var G,ie;const Z=(((G=l.flip)==null?void 0:G.index)||0)+1,ve=k[Z];if(ve&&(!(m==="alignment"?_!==Ua(ve):!1)||ce.every(H=>Ua(H.placement)===_?H.overflows[0]>0:!0)))return{data:{index:Z,overflows:ce},reset:{placement:ve}};let P=(ie=ce.filter(V=>V.overflows[0]<=0).sort((V,H)=>V.overflows[1]-H.overflows[1])[0])==null?void 0:ie.placement;if(!P)switch(S){case"bestFit":{var Q;const V=(Q=ce.filter(H=>{if(B){const se=Ua(H.placement);return se===_||se==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(se=>se>0).reduce((se,we)=>se+we,0)]).sort((H,se)=>H[1]-se[1])[0])==null?void 0:Q[0];V&&(P=V);break}case"initialPlacement":P=d;break}if(i!==P)return{reset:{placement:P}}}return{}}}};function XN(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function QN(e){return qz.some(t=>e[t]>=0)}const a9=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:a="referenceHidden",...i}=Ts(e,t);switch(a){case"referenceHidden":{const l=await Tu(t,{...i,elementContext:"reference"}),u=XN(l,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:QN(u)}}}case"escaped":{const l=await Tu(t,{...i,altBoundary:!0}),u=XN(l,n.floating);return{data:{escapedOffsets:u,escaped:QN(u)}}}default:return{}}}}},rM=new Set(["left","top"]);async function s9(e,t){const{placement:n,platform:a,elements:i}=e,l=await(a.isRTL==null?void 0:a.isRTL(i.floating)),u=As(n),d=Kl(n),h=Ua(n)==="y",p=rM.has(u)?-1:1,g=l&&h?-1:1,m=Ts(t,e);let{mainAxis:b,crossAxis:S,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"&&(S=d==="end"?j*-1:j),h?{x:S*g,y:b*p}:{x:b*p,y:S*g}}const i9=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 s9(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}}}}},o9=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}=Ts(e,t),p={x:n,y:a},g=await Tu(t,h),m=Ua(As(i)),b=O0(m);let S=p[b],j=p[m];if(l){const C=b==="y"?"top":"left",N=b==="y"?"bottom":"right",_=S+g[C],T=S-g[N];S=bb(_,S,T)}if(u){const C=m==="y"?"top":"left",N=m==="y"?"bottom":"right",_=j+g[C],T=j-g[N];j=bb(_,j,T)}const w=d.fn({...t,[b]:S,[m]:j});return{...w,data:{x:w.x-n,y:w.y-a,enabled:{[b]:l,[m]:u}}}}}},l9=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}=Ts(e,t),g={x:n,y:a},m=Ua(i),b=O0(m);let S=g[b],j=g[m];const w=Ts(d,t),C=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(h){const T=b==="y"?"height":"width",O=l.reference[b]-l.floating[T]+C.mainAxis,M=l.reference[b]+l.reference[T]-C.mainAxis;S<O?S=O:S>M&&(S=M)}if(p){var N,_;const T=b==="y"?"width":"height",O=rM.has(As(i)),M=l.reference[m]-l.floating[T]+(O&&((N=u.offset)==null?void 0:N[m])||0)+(O?0:C.crossAxis),B=l.reference[m]+l.reference[T]+(O?0:((_=u.offset)==null?void 0:_[m])||0)-(O?C.crossAxis:0);j<M?j=M:j>B&&(j=B)}return{[b]:S,[m]:j}}}},c9=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}=Ts(e,t),g=await Tu(t,p),m=As(i),b=Kl(i),S=Ua(i)==="y",{width:j,height:w}=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 _=w-g.top-g.bottom,T=j-g.left-g.right,O=vi(w-g[C],_),M=vi(j-g[N],T),B=!t.middlewareData.shift;let k=O,F=M;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(F=T),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(k=_),B&&!b){const ce=Sr(g.left,0),G=Sr(g.right,0),ie=Sr(g.top,0),Q=Sr(g.bottom,0);S?F=j-2*(ce!==0||G!==0?ce+G:Sr(g.left,g.right)):k=w-2*(ie!==0||Q!==0?ie+Q:Sr(g.top,g.bottom))}await h({...t,availableWidth:F,availableHeight:k});const W=await u.getDimensions(d.floating);return j!==W.width||w!==W.height?{reset:{rects:!0}}:{}}}};function Ph(){return typeof window<"u"}function Yl(e){return aM(e)?(e.nodeName||"").toLowerCase():"#document"}function Tr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Qa(e){var t;return(t=(aM(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function aM(e){return Ph()?e instanceof Node||e instanceof Tr(e).Node:!1}function ja(e){return Ph()?e instanceof Element||e instanceof Tr(e).Element:!1}function Ka(e){return Ph()?e instanceof HTMLElement||e instanceof Tr(e).HTMLElement:!1}function ZN(e){return!Ph()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Tr(e).ShadowRoot}const u9=new Set(["inline","contents"]);function Gu(e){const{overflow:t,overflowX:n,overflowY:a,display:i}=Ca(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+n)&&!u9.has(i)}const d9=new Set(["table","td","th"]);function f9(e){return d9.has(Yl(e))}const h9=[":popover-open",":modal"];function Dh(e){return h9.some(t=>{try{return e.matches(t)}catch{return!1}})}const p9=["transform","translate","scale","rotate","perspective"],m9=["transform","translate","scale","rotate","perspective","filter"],g9=["paint","layout","strict","content"];function D0(e){const t=k0(),n=ja(e)?Ca(e):e;return p9.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)||m9.some(a=>(n.willChange||"").includes(a))||g9.some(a=>(n.contain||"").includes(a))}function v9(e){let t=xi(e);for(;Ka(t)&&!Fl(t);){if(D0(t))return t;if(Dh(t))return null;t=xi(t)}return null}function k0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const x9=new Set(["html","body","#document"]);function Fl(e){return x9.has(Yl(e))}function Ca(e){return Tr(e).getComputedStyle(e)}function kh(e){return ja(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xi(e){if(Yl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ZN(e)&&e.host||Qa(e);return ZN(t)?t.host:t}function sM(e){const t=xi(e);return Fl(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ka(t)&&Gu(t)?t:sM(t)}function Au(e,t,n){var a;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=sM(e),l=i===((a=e.ownerDocument)==null?void 0:a.body),u=Tr(i);if(l){const d=Sb(u);return t.concat(u,u.visualViewport||[],Gu(i)?i:[],d&&n?Au(d):[])}return t.concat(i,Au(i,[],n))}function Sb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function iM(e){const t=Ca(e);let n=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const i=Ka(e),l=i?e.offsetWidth:n,u=i?e.offsetHeight:a,d=Zf(n)!==l||Zf(a)!==u;return d&&(n=l,a=u),{width:n,height:a,$:d}}function L0(e){return ja(e)?e:e.contextElement}function Ll(e){const t=L0(e);if(!Ka(t))return qa(1);const n=t.getBoundingClientRect(),{width:a,height:i,$:l}=iM(t);let u=(l?Zf(n.width):n.width)/a,d=(l?Zf(n.height):n.height)/i;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const y9=qa(0);function oM(e){const t=Tr(e);return!k0()||!t.visualViewport?y9:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function b9(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Tr(e)?!1:t}function ro(e,t,n,a){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),l=L0(e);let u=qa(1);t&&(a?ja(a)&&(u=Ll(a)):u=Ll(e));const d=b9(l,n,a)?oM(l):qa(0);let h=(i.left+d.x)/u.x,p=(i.top+d.y)/u.y,g=i.width/u.x,m=i.height/u.y;if(l){const b=Tr(l),S=a&&ja(a)?Tr(a):a;let j=b,w=Sb(j);for(;w&&a&&S!==j;){const C=Ll(w),N=w.getBoundingClientRect(),_=Ca(w),T=N.left+(w.clientLeft+parseFloat(_.paddingLeft))*C.x,O=N.top+(w.clientTop+parseFloat(_.paddingTop))*C.y;h*=C.x,p*=C.y,g*=C.x,m*=C.y,h+=T,p+=O,j=Tr(w),w=Sb(j)}}return eh({width:g,height:m,x:h,y:p})}function Lh(e,t){const n=kh(e).scrollLeft;return t?t.left+n:ro(Qa(e)).left+n}function lM(e,t){const n=e.getBoundingClientRect(),a=n.left+t.scrollLeft-Lh(e,n),i=n.top+t.scrollTop;return{x:a,y:i}}function w9(e){let{elements:t,rect:n,offsetParent:a,strategy:i}=e;const l=i==="fixed",u=Qa(a),d=t?Dh(t.floating):!1;if(a===u||d&&l)return n;let h={scrollLeft:0,scrollTop:0},p=qa(1);const g=qa(0),m=Ka(a);if((m||!m&&!l)&&((Yl(a)!=="body"||Gu(u))&&(h=kh(a)),Ka(a))){const S=ro(a);p=Ll(a),g.x=S.x+a.clientLeft,g.y=S.y+a.clientTop}const b=u&&!m&&!l?lM(u,h):qa(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-h.scrollLeft*p.x+g.x+b.x,y:n.y*p.y-h.scrollTop*p.y+g.y+b.y}}function S9(e){return Array.from(e.getClientRects())}function j9(e){const t=Qa(e),n=kh(e),a=e.ownerDocument.body,i=Sr(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),l=Sr(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let u=-n.scrollLeft+Lh(e);const d=-n.scrollTop;return Ca(a).direction==="rtl"&&(u+=Sr(t.clientWidth,a.clientWidth)-i),{width:i,height:l,x:u,y:d}}const JN=25;function C9(e,t){const n=Tr(e),a=Qa(e),i=n.visualViewport;let l=a.clientWidth,u=a.clientHeight,d=0,h=0;if(i){l=i.width,u=i.height;const g=k0();(!g||g&&t==="fixed")&&(d=i.offsetLeft,h=i.offsetTop)}const p=Lh(a);if(p<=0){const g=a.ownerDocument,m=g.body,b=getComputedStyle(m),S=g.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,j=Math.abs(a.clientWidth-m.clientWidth-S);j<=JN&&(l-=j)}else p<=JN&&(l+=p);return{width:l,height:u,x:d,y:h}}const N9=new Set(["absolute","fixed"]);function E9(e,t){const n=ro(e,!0,t==="fixed"),a=n.top+e.clientTop,i=n.left+e.clientLeft,l=Ka(e)?Ll(e):qa(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 eE(e,t,n){let a;if(t==="viewport")a=C9(e,n);else if(t==="document")a=j9(Qa(e));else if(ja(t))a=E9(t,n);else{const i=oM(e);a={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return eh(a)}function cM(e,t){const n=xi(e);return n===t||!ja(n)||Fl(n)?!1:Ca(n).position==="fixed"||cM(n,t)}function _9(e,t){const n=t.get(e);if(n)return n;let a=Au(e,[],!1).filter(d=>ja(d)&&Yl(d)!=="body"),i=null;const l=Ca(e).position==="fixed";let u=l?xi(e):e;for(;ja(u)&&!Fl(u);){const d=Ca(u),h=D0(u);!h&&d.position==="fixed"&&(i=null),(l?!h&&!i:!h&&d.position==="static"&&!!i&&N9.has(i.position)||Gu(u)&&!h&&cM(e,u))?a=a.filter(g=>g!==u):i=d,u=xi(u)}return t.set(e,a),a}function T9(e){let{element:t,boundary:n,rootBoundary:a,strategy:i}=e;const u=[...n==="clippingAncestors"?Dh(t)?[]:_9(t,this._c):[].concat(n),a],d=u[0],h=u.reduce((p,g)=>{const m=eE(t,g,i);return p.top=Sr(m.top,p.top),p.right=vi(m.right,p.right),p.bottom=vi(m.bottom,p.bottom),p.left=Sr(m.left,p.left),p},eE(t,d,i));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function A9(e){const{width:t,height:n}=iM(e);return{width:t,height:n}}function R9(e,t,n){const a=Ka(t),i=Qa(t),l=n==="fixed",u=ro(e,!0,l,t);let d={scrollLeft:0,scrollTop:0};const h=qa(0);function p(){h.x=Lh(i)}if(a||!a&&!l)if((Yl(t)!=="body"||Gu(i))&&(d=kh(t)),a){const S=ro(t,!0,l,t);h.x=S.x+t.clientLeft,h.y=S.y+t.clientTop}else i&&p();l&&!a&&i&&p();const g=i&&!a&&!l?lM(i,d):qa(0),m=u.left+d.scrollLeft-h.x-g.x,b=u.top+d.scrollTop-h.y-g.y;return{x:m,y:b,width:u.width,height:u.height}}function Bg(e){return Ca(e).position==="static"}function tE(e,t){if(!Ka(e)||Ca(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Qa(e)===n&&(n=n.ownerDocument.body),n}function uM(e,t){const n=Tr(e);if(Dh(e))return n;if(!Ka(e)){let i=xi(e);for(;i&&!Fl(i);){if(ja(i)&&!Bg(i))return i;i=xi(i)}return n}let a=tE(e,t);for(;a&&f9(a)&&Bg(a);)a=tE(a,t);return a&&Fl(a)&&Bg(a)&&!D0(a)?n:a||v9(e)||n}const O9=async function(e){const t=this.getOffsetParent||uM,n=this.getDimensions,a=await n(e.floating);return{reference:R9(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function M9(e){return Ca(e).direction==="rtl"}const P9={convertOffsetParentRelativeRectToViewportRelativeRect:w9,getDocumentElement:Qa,getClippingRect:T9,getOffsetParent:uM,getElementRects:O9,getClientRects:S9,getDimensions:A9,getScale:Ll,isElement:ja,isRTL:M9};function dM(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function D9(e,t){let n=null,a;const i=Qa(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:g,top:m,width:b,height:S}=p;if(d||t(),!b||!S)return;const j=Cf(m),w=Cf(i.clientWidth-(g+b)),C=Cf(i.clientHeight-(m+S)),N=Cf(g),T={rootMargin:-j+"px "+-w+"px "+-C+"px "+-N+"px",threshold:Sr(0,vi(1,h))||1};let O=!0;function M(B){const k=B[0].intersectionRatio;if(k!==h){if(!O)return u();k?u(!1,k):a=setTimeout(()=>{u(!1,1e-7)},1e3)}k===1&&!dM(p,e.getBoundingClientRect())&&u(),O=!1}try{n=new IntersectionObserver(M,{...T,root:i.ownerDocument})}catch{n=new IntersectionObserver(M,T)}n.observe(e)}return u(!0),l}function k9(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=L0(e),g=i||l?[...p?Au(p):[],...Au(t)]:[];g.forEach(N=>{i&&N.addEventListener("scroll",n,{passive:!0}),l&&N.addEventListener("resize",n)});const m=p&&d?D9(p,n):null;let b=-1,S=null;u&&(S=new ResizeObserver(N=>{let[_]=N;_&&_.target===p&&S&&(S.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var T;(T=S)==null||T.observe(t)})),n()}),p&&!h&&S.observe(p),S.observe(t));let j,w=h?ro(e):null;h&&C();function C(){const N=ro(e);w&&!dM(w,N)&&n(),w=N,j=requestAnimationFrame(C)}return n(),()=>{var N;g.forEach(_=>{i&&_.removeEventListener("scroll",n),l&&_.removeEventListener("resize",n)}),m?.(),(N=S)==null||N.disconnect(),S=null,h&&cancelAnimationFrame(j)}}const L9=i9,B9=o9,F9=r9,I9=c9,z9=a9,nE=n9,H9=l9,U9=(e,t,n)=>{const a=new Map,i={platform:P9,...n},l={...i.platform,_c:a};return t9(e,t,{...i,platform:l})};var V9=typeof document<"u",q9=function(){},If=V9?v.useLayoutEffect:q9;function th(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(!th(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)&&!th(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function fM(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function rE(e,t){const n=fM(e);return Math.round(t*n)/n}function Fg(e){const t=v.useRef(e);return If(()=>{t.current=e}),t}function $9(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,[g,m]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[b,S]=v.useState(a);th(b,a)||S(a);const[j,w]=v.useState(null),[C,N]=v.useState(null),_=v.useCallback(H=>{H!==B.current&&(B.current=H,w(H))},[]),T=v.useCallback(H=>{H!==k.current&&(k.current=H,N(H))},[]),O=l||j,M=u||C,B=v.useRef(null),k=v.useRef(null),F=v.useRef(g),W=h!=null,ce=Fg(h),G=Fg(i),ie=Fg(p),Q=v.useCallback(()=>{if(!B.current||!k.current)return;const H={placement:t,strategy:n,middleware:b};G.current&&(H.platform=G.current),U9(B.current,k.current,H).then(se=>{const we={...se,isPositioned:ie.current!==!1};Z.current&&!th(F.current,we)&&(F.current=we,Vu.flushSync(()=>{m(we)}))})},[b,t,n,G,ie]);If(()=>{p===!1&&F.current.isPositioned&&(F.current.isPositioned=!1,m(H=>({...H,isPositioned:!1})))},[p]);const Z=v.useRef(!1);If(()=>(Z.current=!0,()=>{Z.current=!1}),[]),If(()=>{if(O&&(B.current=O),M&&(k.current=M),O&&M){if(ce.current)return ce.current(O,M,Q);Q()}},[O,M,Q,ce,W]);const ve=v.useMemo(()=>({reference:B,floating:k,setReference:_,setFloating:T}),[_,T]),P=v.useMemo(()=>({reference:O,floating:M}),[O,M]),V=v.useMemo(()=>{const H={position:n,left:0,top:0};if(!P.floating)return H;const se=rE(P.floating,g.x),we=rE(P.floating,g.y);return d?{...H,transform:"translate("+se+"px, "+we+"px)",...fM(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:se,top:we}},[n,d,P.floating,g.x,g.y]);return v.useMemo(()=>({...g,update:Q,refs:ve,elements:P,floatingStyles:V}),[g,Q,ve,P,V])}const G9=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?nE({element:a.current,padding:i}).fn(n):{}:a?nE({element:a,padding:i}).fn(n):{}}}},K9=(e,t)=>({...L9(e),options:[e,t]}),Y9=(e,t)=>({...B9(e),options:[e,t]}),W9=(e,t)=>({...H9(e),options:[e,t]}),X9=(e,t)=>({...F9(e),options:[e,t]}),Q9=(e,t)=>({...I9(e),options:[e,t]}),Z9=(e,t)=>({...z9(e),options:[e,t]}),J9=(e,t)=>({...G9(e),options:[e,t]});var eH="Arrow",hM=v.forwardRef((e,t)=>{const{children:n,width:a=10,height:i=5,...l}=e;return o.jsx(ct.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"})})});hM.displayName=eH;var tH=hM;function Bh(e){const[t,n]=v.useState(void 0);return Vn(()=>{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 B0="Popper",[pM,Wl]=Rr(B0),[nH,mM]=pM(B0),gM=e=>{const{__scopePopper:t,children:n}=e,[a,i]=v.useState(null);return o.jsx(nH,{scope:t,anchor:a,onAnchorChange:i,children:n})};gM.displayName=B0;var vM="PopperAnchor",xM=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:a,...i}=e,l=mM(vM,n),u=v.useRef(null),d=_t(t,u),h=v.useRef(null);return v.useEffect(()=>{const p=h.current;h.current=a?.current||u.current,p!==h.current&&l.onAnchorChange(h.current)}),a?null:o.jsx(ct.div,{...i,ref:d})});xM.displayName=vM;var F0="PopperContent",[rH,aH]=pM(F0),yM=v.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:g=0,sticky:m="partial",hideWhenDetached:b=!1,updatePositionStrategy:S="optimized",onPlaced:j,...w}=e,C=mM(F0,n),[N,_]=v.useState(null),T=_t(t,fe=>_(fe)),[O,M]=v.useState(null),B=Bh(O),k=B?.width??0,F=B?.height??0,W=a+(l!=="center"?"-"+l:""),ce=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},G=Array.isArray(p)?p:[p],ie=G.length>0,Q={padding:ce,boundary:G.filter(iH),altBoundary:ie},{refs:Z,floatingStyles:ve,placement:P,isPositioned:V,middlewareData:H}=$9({strategy:"fixed",placement:W,whileElementsMounted:(...fe)=>k9(...fe,{animationFrame:S==="always"}),elements:{reference:C.anchor},middleware:[K9({mainAxis:i+F,alignmentAxis:u}),h&&Y9({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?W9():void 0,...Q}),h&&X9({...Q}),Q9({...Q,apply:({elements:fe,rects:Ce,availableWidth:Pe,availableHeight:ke})=>{const{width:Ue,height:pe}=Ce.reference,it=fe.floating.style;it.setProperty("--radix-popper-available-width",`${Pe}px`),it.setProperty("--radix-popper-available-height",`${ke}px`),it.setProperty("--radix-popper-anchor-width",`${Ue}px`),it.setProperty("--radix-popper-anchor-height",`${pe}px`)}}),O&&J9({element:O,padding:d}),oH({arrowWidth:k,arrowHeight:F}),b&&Z9({strategy:"referenceHidden",...Q})]}),[se,we]=SM(P),L=gi(j);Vn(()=>{V&&L?.()},[V,L]);const re=H.arrow?.x,z=H.arrow?.y,ee=H.arrow?.centerOffset!==0,[xe,Ne]=v.useState();return Vn(()=>{N&&Ne(window.getComputedStyle(N).zIndex)},[N]),o.jsx("div",{ref:Z.setFloating,"data-radix-popper-content-wrapper":"",style:{...ve,transform:V?ve.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:xe,"--radix-popper-transform-origin":[H.transformOrigin?.x,H.transformOrigin?.y].join(" "),...H.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(rH,{scope:n,placedSide:se,onArrowChange:M,arrowX:re,arrowY:z,shouldHideArrow:ee,children:o.jsx(ct.div,{"data-side":se,"data-align":we,...w,ref:T,style:{...w.style,animation:V?void 0:"none"}})})})});yM.displayName=F0;var bM="PopperArrow",sH={top:"bottom",right:"left",bottom:"top",left:"right"},wM=v.forwardRef(function(t,n){const{__scopePopper:a,...i}=t,l=aH(bM,a),u=sH[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(tH,{...i,ref:n,style:{...i.style,display:"block"}})})});wM.displayName=bM;function iH(e){return e!==null}var oH=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,g]=SM(n),m={start:"0%",center:"50%",end:"100%"}[g],b=(i.arrow?.x??0)+d/2,S=(i.arrow?.y??0)+h/2;let j="",w="";return p==="bottom"?(j=u?m:`${b}px`,w=`${-h}px`):p==="top"?(j=u?m:`${b}px`,w=`${a.floating.height+h}px`):p==="right"?(j=`${-h}px`,w=u?m:`${S}px`):p==="left"&&(j=`${a.floating.width+h}px`,w=u?m:`${S}px`),{data:{x:j,y:w}}}});function SM(e){const[t,n="center"]=e.split("-");return[t,n]}var I0=gM,Fh=xM,z0=yM,H0=wM;function lH(e){const t=cH(e),n=v.forwardRef((a,i)=>{const{children:l,...u}=a,d=v.Children.toArray(l),h=d.find(dH);if(h){const p=h.props.children,g=d.map(m=>m===h?v.Children.count(p)>1?v.Children.only(null):v.isValidElement(p)?p.props.children:null:m);return o.jsx(t,{...u,ref:i,children:v.isValidElement(p)?v.cloneElement(p,void 0,g):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function cH(e){const t=v.forwardRef((n,a)=>{const{children:i,...l}=n;if(v.isValidElement(i)){const u=hH(i),d=fH(l,i.props);return i.type!==v.Fragment&&(d.ref=a?co(a,u):u),v.cloneElement(i,d)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var uH=Symbol("radix.slottable");function dH(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===uH}function fH(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 hH(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 Ih="Popover",[jM]=Rr(Ih,[Wl]),Ku=Wl(),[pH,Si]=jM(Ih),CM=e=>{const{__scopePopover:t,children:n,open:a,defaultOpen:i,onOpenChange:l,modal:u=!1}=e,d=Ku(t),h=v.useRef(null),[p,g]=v.useState(!1),[m,b]=Jr({prop:a,defaultProp:i??!1,onChange:l,caller:Ih});return o.jsx(I0,{...d,children:o.jsx(pH,{scope:t,contentId:wa(),triggerRef:h,open:m,onOpenChange:b,onOpenToggle:v.useCallback(()=>b(S=>!S),[b]),hasCustomAnchor:p,onCustomAnchorAdd:v.useCallback(()=>g(!0),[]),onCustomAnchorRemove:v.useCallback(()=>g(!1),[]),modal:u,children:n})})};CM.displayName=Ih;var NM="PopoverAnchor",mH=v.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,i=Si(NM,n),l=Ku(n),{onCustomAnchorAdd:u,onCustomAnchorRemove:d}=i;return v.useEffect(()=>(u(),()=>d()),[u,d]),o.jsx(Fh,{...l,...a,ref:t})});mH.displayName=NM;var EM="PopoverTrigger",_M=v.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,i=Si(EM,n),l=Ku(n),u=_t(t,i.triggerRef),d=o.jsx(ct.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":MM(i.open),...a,ref:u,onClick:Qe(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?d:o.jsx(Fh,{asChild:!0,...l,children:d})});_M.displayName=EM;var U0="PopoverPortal",[gH,vH]=jM(U0,{forceMount:void 0}),TM=e=>{const{__scopePopover:t,forceMount:n,children:a,container:i}=e,l=Si(U0,t);return o.jsx(gH,{scope:t,forceMount:n,children:o.jsx(Ps,{present:n||l.open,children:o.jsx(Nh,{asChild:!0,container:i,children:a})})})};TM.displayName=U0;var Il="PopoverContent",AM=v.forwardRef((e,t)=>{const n=vH(Il,e.__scopePopover),{forceMount:a=n.forceMount,...i}=e,l=Si(Il,e.__scopePopover);return o.jsx(Ps,{present:a||l.open,children:l.modal?o.jsx(yH,{...i,ref:t}):o.jsx(bH,{...i,ref:t})})});AM.displayName=Il;var xH=lH("PopoverContent.RemoveScroll"),yH=v.forwardRef((e,t)=>{const n=Si(Il,e.__scopePopover),a=v.useRef(null),i=_t(t,a),l=v.useRef(!1);return v.useEffect(()=>{const u=a.current;if(u)return N0(u)},[]),o.jsx(_h,{as:xH,allowPinchZoom:!0,children:o.jsx(RM,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Qe(e.onCloseAutoFocus,u=>{u.preventDefault(),l.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Qe(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:Qe(e.onFocusOutside,u=>u.preventDefault(),{checkForDefaultPrevented:!1})})})}),bH=v.forwardRef((e,t)=>{const n=Si(Il,e.__scopePopover),a=v.useRef(!1),i=v.useRef(!1);return o.jsx(RM,{...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()}})}),RM=v.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:p,onInteractOutside:g,...m}=e,b=Si(Il,n),S=Ku(n);return C0(),o.jsx(Ch,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:i,onUnmountAutoFocus:l,children:o.jsx($u,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:g,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:p,onDismiss:()=>b.onOpenChange(!1),children:o.jsx(z0,{"data-state":MM(b.open),role:"dialog",id:b.contentId,...S,...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)"}})})})}),OM="PopoverClose",wH=v.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,i=Si(OM,n);return o.jsx(ct.button,{type:"button",...a,ref:t,onClick:Qe(e.onClick,()=>i.onOpenChange(!1))})});wH.displayName=OM;var SH="PopoverArrow",jH=v.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,i=Ku(n);return o.jsx(H0,{...i,...a,ref:t})});jH.displayName=SH;function MM(e){return e?"open":"closed"}var CH=CM,NH=_M,EH=TM,PM=AM;const Ru=CH,Ou=NH,zl=v.forwardRef(({className:e,align:t="center",sideOffset:n=4,...a},i)=>o.jsx(EH,{children:o.jsx(PM,{ref:i,align:t,sideOffset:n,className:lt("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})}));zl.displayName=PM.displayName;var _H=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],TH=_H.reduce((e,t)=>{const n=jh(`Primitive.${t}`),a=v.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}},{}),AH="Separator",aE="horizontal",RH=["horizontal","vertical"],DM=v.forwardRef((e,t)=>{const{decorative:n,orientation:a=aE,...i}=e,l=OH(a)?a:aE,d=n?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return o.jsx(TH.div,{"data-orientation":l,...d,...i,ref:t})});DM.displayName=AH;function OH(e){return RH.includes(e)}var kM=DM;const jr=v.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...a},i)=>o.jsx(kM,{ref:i,decorative:n,orientation:t,className:lt("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...a}));jr.displayName=kM.displayName;const MH="dune_weaver_previews",PH=1,Rs="previews",DH=200,sE=DH*1024*1024;let ya=null;const Zi=new Map,kH=100;async function zh(){return ya||new Promise((e,t)=>{const n=indexedDB.open(MH,PH);n.onerror=()=>{console.error("Failed to open preview cache database"),t(n.error)},n.onsuccess=()=>{ya=n.result,console.debug("Preview cache database opened successfully"),e(ya)},n.onupgradeneeded=a=>{const l=a.target.result.createObjectStore(Rs,{keyPath:"pattern"});l.createIndex("lastAccessed","lastAccessed",{unique:!1}),l.createIndex("size","size",{unique:!1}),console.debug("Preview cache database schema created")}})}function LM(e,t){if(Zi.size>=kH){const n=Zi.keys().next().value;n&&Zi.delete(n)}Zi.set(e,t)}async function V0(e,t){try{if(!t||!t.image_data){console.warn(`Invalid preview data for ${e}, skipping cache save`);return}ya||await zh(),LM(e,t);const n=Math.ceil(t.image_data.length*3/4);await BH(n);const a={pattern:e,data:t,size:n,lastAccessed:Date.now(),created:Date.now()},l=ya.transaction([Rs],"readwrite").objectStore(Rs);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 LH(){try{if(!ya)return 0;const t=ya.transaction([Rs],"readonly").objectStore(Rs);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 BH(e){try{const t=await LH();if(t+e<=sE)return;console.debug(`Cache size would exceed limit (${((t+e)/1024/1024).toFixed(1)}MB), cleaning up...`);const a=ya.transaction([Rs],"readwrite").objectStore(Rs),i=a.index("lastAccessed"),l=await new Promise((h,p)=>{const g=i.getAll();g.onsuccess=()=>h(g.result),g.onerror=()=>p(g.error)});l.sort((h,p)=>h.lastAccessed-p.lastAccessed);let u=0;const d=e+sE*.1;for(const h of l){if(u>=d)break;await new Promise((p,g)=>{const m=a.delete(h.pattern);m.onsuccess=()=>{u+=h.size,Zi.delete(h.pattern),console.debug(`Evicted cached preview for ${h.pattern} (${(h.size/1024).toFixed(1)}KB)`),p()},m.onerror=()=>g(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 vu(e){const t=new Map,n=[];for(const a of e)Zi.has(a)?t.set(a,Zi.get(a)):n.push(a);if(n.length>0&&ya)try{const i=ya.transaction([Rs],"readwrite").objectStore(Rs);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),LM(l,h.data)),u()},d.onerror=()=>u()})))}catch(a){console.warn(`Error batch getting from cache: ${a}`)}return t}async function BM(e){try{await zh();const n=await ue.get("/list_theta_rho_files_with_metadata"),a=n.map(d=>d.path),i=await vu(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),g=l.slice(h,p);try{const m=await ue.post("/preview_thr_batch",{file_names:g});for(const[b,S]of Object.entries(m))S&&!S.error&&await V0(b,S)}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 FM=v.createContext(null),nu="duneweaver_tables",ru="duneweaver_active_table";function iE(e){try{return new URL(e).origin}catch{return e}}function FH({children:e}){const[t,n]=v.useState([]),[a,i]=v.useState(null),[l,u]=v.useState(!1),[d,h]=v.useState(null),p=v.useRef(!1),g=v.useRef(null);v.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 O=T.tables.find(M=>M.id===_);O&&(g.current=_,i(O),iE(O.url)!==window.location.origin&&ue.setBaseUrl(O.url))}}b()}catch(N){console.error("Failed to load saved tables:",N),b()}}},[]),v.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=v.useCallback(async N=>{if(N.isDiscovered)try{await fetch("/api/known-tables",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:N.id,name:N.name,url:N.url,host:N.host,port:N.port,version:N.version})})}catch(_){console.error("Failed to persist discovered table:",_)}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:",_)}iE(N.url)===window.location.origin?ue.setBaseUrl(""):ue.setBaseUrl(N.url),window.location.reload()},[t]),b=v.useCallback(async()=>{u(!0);try{const[N,_,T,O]=await Promise.all([fetch("/api/table-info"),fetch("/api/settings").catch(()=>null),fetch("/api/known-tables").catch(()=>null),fetch("/api/discovered-tables").catch(()=>null)]);if(!N.ok)throw new Error("Failed to fetch table info");const M=await N.json(),B=_?.ok?await _.json():null,F=(T?.ok?await T.json():null)?.tables||[],ce=(O?.ok?await O.json():null)?.tables||[],G={id:M.id,name:M.name,url:window.location.origin,version:M.version,isOnline:!0,isCurrent:!0,customLogo:B?.app?.custom_logo||void 0};if(n(()=>{const ie=[G];return F.forEach(Q=>{Q.id!==G.id&&ie.push({id:Q.id,name:Q.name,url:Q.url,host:Q.host,port:Q.port,version:Q.version,isOnline:!1,isCurrent:!1})}),ce.forEach(Q=>{if(Q.id===G.id)return;const Z=ie.find(ve=>ve.id===Q.id);Z?(Z.isOnline=!0,Z.url=Q.url,Z.host=Q.host,Z.port=Q.port,Q.version&&(Z.version=Q.version)):ie.push({id:Q.id,name:Q.name,url:Q.url,host:Q.host,port:Q.port,version:Q.version,isOnline:!0,isCurrent:!1,isDiscovered:!0})}),ie}),!a&&!g.current){i(G);try{const ie={tables:[G],activeTableId:G.id};localStorage.setItem(nu,JSON.stringify(ie)),localStorage.setItem(ru,G.id)}catch(ie){console.error("Failed to save initial table selection:",ie)}}else a?.isCurrent&&i(ie=>ie?{...ie,name:G.name}:null);g.current=null,h(new Date),setTimeout(()=>{n(ie=>(ie.filter(Z=>!Z.isCurrent).forEach(async Z=>{try{const[ve,P]=await Promise.all([fetch(`${Z.url}/api/table-info`,{signal:AbortSignal.timeout(3e3)}),fetch(`${Z.url}/api/settings`,{signal:AbortSignal.timeout(3e3)}).catch(()=>null)]),V=ve.ok,se=(P?.ok?await P.json():null)?.app?.custom_logo||void 0;n(we=>we.map(L=>L.id===Z.id?{...L,isOnline:V,customLogo:se}:L))}catch{n(ve=>ve.map(P=>P.id===Z.id?{...P,isOnline:!1}:P))}}),ie))},100)}catch(N){console.error("Table refresh failed:",N)}finally{u(!1)}},[a]),S=v.useCallback(async(N,_)=>{try{const T=N.replace(/\/$/,"");if(t.find(W=>W.url===T))return null;const[O,M]=await Promise.all([fetch(`${T}/api/table-info`),fetch(`${T}/api/settings`).catch(()=>null)]);if(!O.ok)throw new Error("Failed to fetch table info");const B=await O.json(),k=M?.ok?await M.json():null,F={id:B.id,name:_||B.name,url:T,version:B.version,isOnline:!0,isCurrent:!1,customLogo:k?.app?.custom_logo||void 0};try{const W=new URL(T).hostname;await fetch("/api/known-tables",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:F.id,name:F.name,url:F.url,host:W,version:F.version})})}catch(W){console.error("Failed to persist table to backend:",W)}return n(W=>[...W,F]),F}catch(T){return console.error("Failed to add table:",T),null}},[t]),j=v.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),ue.setBaseUrl(""))}},[a,t,m]),w=v.useCallback(async(N,_)=>{const T=t.find(O=>O.id===N);if(T)try{const O=T.isCurrent?"":T.url;if((await fetch(`${O}/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(B){console.error("Failed to update known table name:",B)}n(B=>B.map(k=>k.id===N?{...k,name:_}:k)),a?.id===N&&i(B=>B?{...B,name:_}:null)}}catch(O){console.error("Failed to update table name:",O)}},[t,a]),C=v.useCallback(async N=>{try{const _=N.isCurrent?"":N.url,[T,O]=await Promise.all([fetch(`${_}/api/table-info`,{signal:AbortSignal.timeout(3e3)}),fetch(`${_}/api/settings`,{signal:AbortSignal.timeout(3e3)}).catch(()=>null)]),M=T.ok,k=(O?.ok?await O.json():null)?.app?.custom_logo||void 0;return n(F=>F.map(W=>W.id===N.id?{...W,isOnline:M,customLogo:k}:W)),M}catch{return n(_=>_.map(T=>T.id===N.id?{...T,isOnline:!1}:T)),!1}},[]);return o.jsx(FM.Provider,{value:{tables:t,activeTable:a,isDiscovering:l,lastDiscovery:d,setActiveTable:m,discoverTables:b,addTable:S,removeTable:j,updateTableName:w,refreshTableStatus:C},children:e})}function IM(){const e=v.useContext(FM);if(!e)throw new Error("useTable must be used within a TableProvider");return e}const IH=qu("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 Va({className:e,variant:t,...n}){return o.jsx("div",{className:lt(IH({variant:t}),e),...n})}const oE=e=>{try{return new URL(e).hostname}catch{return e.replace(/^https?:\/\//,"").split(":")[0]}};function zH(e,t){const n=t?.port||null,a=l=>!!n&&(n.includes(l.host)||!!l.hostname&&n.toLowerCase().includes(l.hostname.toLowerCase())),i=e.map(l=>({...l,status:a(l)&&t?.connected?"connected":"available"}));return n&&!e.some(a)&&i.unshift({name:t?.hostname||oE(n),hostname:t?.hostname||null,host:oE(n),port:80,url:n,mac:null,status:t?.connected?"connected":"added-offline"}),i.sort((l,u)=>l.name.localeCompare(u.name,void 0,{sensitivity:"base"})||l.host.localeCompare(u.host))}function HH({children:e}){const{tables:t,activeTable:n,setActiveTable:a,addTable:i,removeTable:l,updateTableName:u}=IM(),[d,h]=v.useState(!1),[p,g]=v.useState(!1),[m,b]=v.useState(!1),[S,j]=v.useState(""),[w,C]=v.useState(""),[N,_]=v.useState(null),[T,O]=v.useState(""),[M,B]=v.useState(!1),[k,F]=v.useState([]),[W,ce]=v.useState(null),[G,ie]=v.useState(!1),[Q,Z]=v.useState(null),ve=v.useCallback(async()=>{ie(!0);try{const[z,ee]=await Promise.all([ue.get("/api/discovered-boards").catch(()=>null),ue.get("/serial_status").catch(()=>null)]);F(z?.boards||[]),ce(ee)}finally{ie(!1)}},[]);v.useEffect(()=>{d&&ve()},[d,ve]),v.useEffect(()=>{const z=()=>ve();return window.addEventListener("board-connected",z),()=>window.removeEventListener("board-connected",z)},[ve]);const P=sn(z=>z.status?.connection_status??!1);v.useEffect(()=>{ve()},[P,ve]);const V=async z=>{Z(z.url);try{(await ue.post("/connect",{port:z.url})).success?(Y.success(`Connected to ${z.name}`),window.dispatchEvent(new CustomEvent("board-connected")),await ve()):Y.error(`Couldn't connect to ${z.name}`)}catch(ee){ee instanceof Error&&ee.message.startsWith("HTTP 401")?Y.error(`${z.name} is password-protected — connect it from Settings`):Y.error(`Couldn't reach ${z.name}`)}finally{Z(null)}},H=z=>{z.id!==n?.id&&(a(z),Y.success(`Switched to ${z.name}`)),h(!1)},se=async()=>{if(!S.trim()){Y.error("Please enter a URL");return}B(!0);try{let z=S.trim();!z.startsWith("http://")&&!z.startsWith("https://")&&(z=`http://${z}`);const ee=await i(z,w.trim()||void 0);ee?(Y.success(`Added ${ee.name}`),g(!1),j(""),C("")):Y.error("Couldn't reach a Dune Weaver server at that address. Use the address of the table's server (Raspberry Pi), not the controller board — tables on your network appear here automatically.")}finally{B(!1)}},we=async()=>{!N||!T.trim()||(await u(N.id,T.trim()),Y.success("Table renamed"),b(!1),_(null),O(""))},L=z=>{if(z.isCurrent){Y.error("Can't remove the current table");return}l(z.id),Y.success(`Removed ${z.name}`)},re=z=>{_(z),O(z.name),b(!0)};return o.jsxs(o.Fragment,{children:[o.jsxs(Ru,{open:d,onOpenChange:h,children:[o.jsx(Ou,{asChild:!0,children:e||o.jsxs(le,{variant:"ghost",size:"sm",className:"gap-2 h-9 px-2",children:[o.jsx(Nz,{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(zl,{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.filter(z=>!z.isCurrent).map(z=>o.jsxs("div",{className:`flex items-center gap-2 px-2 py-2 rounded-md cursor-pointer hover:bg-accent group ${n?.id===z.id?"bg-accent":""}`,onClick:()=>H(z),children:[o.jsxs("div",{className:"relative flex-shrink-0",children:[o.jsx("img",{src:z.customLogo?`${z.isCurrent?"":z.url}/static/custom/${z.customLogo}`:`${z.isCurrent?"":z.url}/static/android-chrome-192x192.png`,alt:z.name,className:"w-8 h-8 rounded-full object-cover",onError:ee=>{ee.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 ${z.isOnline?"bg-success":"bg-destructive"}`})]}),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:z.name}),z.isCurrent&&o.jsx(Va,{variant:"secondary",className:"text-[10px] px-1 py-0",children:"This"}),z.isDiscovered&&o.jsx(Va,{variant:"outline",className:"text-[10px] px-1 py-0",children:"Discovered"})]}),o.jsx("span",{className:"text-xs text-muted-foreground truncate block",children:z.host||new URL(z.url).hostname})]}),o.jsxs("div",{className:"flex md:opacity-0 md:group-hover:opacity-100 items-center gap-1 transition-opacity",children:[o.jsx(le,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:ee=>{ee.stopPropagation(),re(z)},title:"Rename",children:o.jsx(Tz,{className:"h-3.5 w-3.5"})}),!z.isCurrent&&o.jsx(le,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-destructive hover:text-destructive",onClick:ee=>{ee.stopPropagation(),L(z)},title:"Remove",children:o.jsx(ZO,{className:"h-3.5 w-3.5"})})]}),n?.id===z.id&&o.jsx(yb,{className:"h-4 w-4 text-primary flex-shrink-0"})]},z.id))}),o.jsxs("div",{className:"pt-1",children:[o.jsxs("div",{className:"flex items-center justify-between px-2 py-1",children:[o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Boards on your network"}),o.jsx(le,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-muted-foreground",onClick:ve,disabled:G,title:"Rescan",children:o.jsx(Mz,{className:`h-3.5 w-3.5 ${G?"animate-spin":""}`})})]}),(()=>{const z=zH(k,W);return z.length===0?o.jsx("p",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:G?"Scanning…":"No boards found on the network yet."}):o.jsx("div",{className:"space-y-1",children:z.map(ee=>o.jsxs("div",{className:`flex items-center gap-2 px-2 py-2 rounded-md ${ee.status==="connected"?"bg-accent":""}`,children:[o.jsxs("div",{className:"relative flex-shrink-0",children:[o.jsx("img",{src:"/static/android-chrome-192x192.png",alt:ee.name,className:"w-8 h-8 rounded-full object-cover"}),o.jsx("span",{className:`absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full border-2 border-popover ${ee.status==="added-offline"?"bg-destructive":"bg-success"}`,title:ee.status==="added-offline"?"Unreachable":"Reachable"})]}),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:ee.name}),ee.status==="connected"&&o.jsx(Va,{variant:"secondary",className:"text-[10px] px-1 py-0",children:"Added"}),ee.status==="added-offline"&&o.jsx(Va,{variant:"outline",className:"text-[10px] px-1 py-0",children:"Added · offline"})]}),o.jsx("span",{className:"text-xs text-muted-foreground truncate block",children:ee.host})]}),ee.status==="connected"?o.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[o.jsx("span",{className:"text-xs font-medium text-success",children:"Connected"}),o.jsx(yb,{className:"h-4 w-4 text-primary"})]}):ee.status==="available"?o.jsx(le,{variant:"outline",size:"sm",className:"h-7 shrink-0",disabled:Q===ee.url,onClick:()=>V(ee),children:Q===ee.url?o.jsx($N,{className:"h-3.5 w-3.5 animate-spin"}):"Connect"}):o.jsx(le,{variant:"ghost",size:"sm",className:"h-7 shrink-0 text-muted-foreground",disabled:Q===ee.url,onClick:()=>V(ee),title:"Retry connection",children:Q===ee.url?o.jsx($N,{className:"h-3.5 w-3.5 animate-spin"}):"Reconnect"})]},ee.mac||ee.url))})})()]}),o.jsxs(le,{variant:"secondary",size:"sm",className:"w-full gap-2",onClick:()=>g(!0),children:[o.jsx(Rz,{className:"h-3.5 w-3.5"}),"Add Table Manually"]})]})})]}),o.jsx(Xr,{open:p,onOpenChange:g,children:o.jsxs(_r,{children:[o.jsx(cr,{children:o.jsx(ur,{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(St,{placeholder:"192.168.1.100:8080 or http://...",value:S,onChange:z=>j(z.target.value),onKeyDown:z=>z.key==="Enter"&&se()}),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(St,{placeholder:"Living Room Table",value:w,onChange:z=>C(z.target.value),onKeyDown:z=>z.key==="Enter"&&se()})]})]}),o.jsxs(Sa,{className:"gap-2 sm:gap-0",children:[o.jsx(le,{variant:"secondary",onClick:()=>g(!1),children:"Cancel"}),o.jsx(le,{onClick:se,disabled:M,children:M?"Adding...":"Add Table"})]})]})}),o.jsx(Xr,{open:m,onOpenChange:b,children:o.jsxs(_r,{children:[o.jsx(cr,{children:o.jsx(ur,{children:"Rename Table"})}),o.jsx("div",{className:"py-4",children:o.jsx(St,{placeholder:"Table name",value:T,onChange:z=>O(z.target.value),onKeyDown:z=>z.key==="Enter"&&we(),autoFocus:!0})}),o.jsxs(Sa,{className:"gap-2 sm:gap-0",children:[o.jsx(le,{variant:"secondary",onClick:()=>b(!1),children:"Cancel"}),o.jsx(le,{onClick:we,children:"Save"})]})]})})]})}const zM=v.createContext({});function q0(e){const t=v.useRef(null);return t.current===null&&(t.current=e()),t.current}const HM=typeof window<"u",UM=HM?v.useLayoutEffect:v.useEffect,$0=v.createContext(null);function G0(e,t){e.indexOf(t)===-1&&e.push(t)}function K0(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const Ya=(e,t,n)=>n>t?t:n<e?e:n;let Y0=()=>{};const Os={},VM=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function qM(e){return typeof e=="object"&&e!==null}const $M=e=>/^0[^.\s]+$/u.test(e);function W0(e){let t;return()=>(t===void 0&&(t=e()),t)}const Qr=e=>e,UH=(e,t)=>n=>t(e(n)),Yu=(...e)=>e.reduce(UH),Mu=(e,t,n)=>{const a=t-e;return a===0?1:(n-e)/a};class X0{constructor(){this.subscriptions=[]}add(t){return G0(this.subscriptions,t),()=>K0(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 Ns=e=>e*1e3,Wr=e=>e/1e3;function GM(e,t){return t?e*(1e3/t):0}const KM=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,VH=1e-7,qH=12;function $H(e,t,n,a,i){let l,u,d=0;do u=t+(n-t)/2,l=KM(u,a,i)-e,l>0?n=u:t=u;while(Math.abs(l)>VH&&++d<qH);return u}function Wu(e,t,n,a){if(e===t&&n===a)return Qr;const i=l=>$H(l,0,1,e,n);return l=>l===0||l===1?l:KM(i(l),t,a)}const YM=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,WM=e=>t=>1-e(1-t),XM=Wu(.33,1.53,.69,.99),Q0=WM(XM),QM=YM(Q0),ZM=e=>(e*=2)<1?.5*Q0(e):.5*(2-Math.pow(2,-10*(e-1))),Z0=e=>1-Math.sin(Math.acos(e)),JM=WM(Z0),eP=YM(Z0),GH=Wu(.42,0,1,1),KH=Wu(0,0,.58,1),tP=Wu(.42,0,.58,1),YH=e=>Array.isArray(e)&&typeof e[0]!="number",nP=e=>Array.isArray(e)&&typeof e[0]=="number",WH={linear:Qr,easeIn:GH,easeInOut:tP,easeOut:KH,circIn:Z0,circInOut:eP,circOut:JM,backIn:Q0,backInOut:QM,backOut:XM,anticipate:ZM},XH=e=>typeof e=="string",lE=e=>{if(nP(e)){Y0(e.length===4);const[t,n,a,i]=e;return Wu(t,n,a,i)}else if(XH(e))return WH[e];return e},Nf=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function QH(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(g){u.has(g)&&(p.schedule(g),e()),g(d)}const p={schedule:(g,m=!1,b=!1)=>{const j=b&&i?n:a;return m&&u.add(g),j.has(g)||j.add(g),g},cancel:g=>{a.delete(g),u.delete(g)},process:g=>{if(d=g,i){l=!0;return}i=!0,[n,a]=[a,n],n.forEach(h),n.clear(),i=!1,l&&(l=!1,p.process(g))}};return p}const ZH=40;function rP(e,t){let n=!1,a=!0;const i={delta:0,timestamp:0,isProcessing:!1},l=()=>n=!0,u=Nf.reduce((T,O)=>(T[O]=QH(l),T),{}),{setup:d,read:h,resolveKeyframes:p,preUpdate:g,update:m,preRender:b,render:S,postRender:j}=u,w=()=>{const T=Os.useManualTiming?i.timestamp:performance.now();n=!1,Os.useManualTiming||(i.delta=a?1e3/60:Math.max(Math.min(T-i.timestamp,ZH),1)),i.timestamp=T,i.isProcessing=!0,d.process(i),h.process(i),p.process(i),g.process(i),m.process(i),b.process(i),S.process(i),j.process(i),i.isProcessing=!1,n&&t&&(a=!1,e(w))},C=()=>{n=!0,a=!0,i.isProcessing||e(w)};return{schedule:Nf.reduce((T,O)=>{const M=u[O];return T[O]=(B,k=!1,F=!1)=>(n||C(),M.schedule(B,k,F)),T},{}),cancel:T=>{for(let O=0;O<Nf.length;O++)u[Nf[O]].cancel(T)},state:i,steps:u}}const{schedule:on,cancel:Wa,state:Un,steps:Ig}=rP(typeof requestAnimationFrame<"u"?requestAnimationFrame:Qr,!0);let zf;function JH(){zf=void 0}const Qn={now:()=>(zf===void 0&&Qn.set(Un.isProcessing||Os.useManualTiming?Un.timestamp:performance.now()),zf),set:e=>{zf=e,queueMicrotask(JH)}},aP=e=>t=>typeof t=="string"&&t.startsWith(e),sP=aP("--"),eU=aP("var(--"),J0=e=>eU(e)?tU.test(e.split("/*")[0].trim()):!1,tU=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function cE(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Xl={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Pu={...Xl,transform:e=>Ya(0,1,e)},Ef={...Xl,default:1},xu=e=>Math.round(e*1e5)/1e5,ew=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function nU(e){return e==null}const rU=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,tw=(e,t)=>n=>!!(typeof n=="string"&&rU.test(n)&&n.startsWith(e)||t&&!nU(n)&&Object.prototype.hasOwnProperty.call(n,t)),iP=(e,t,n)=>a=>{if(typeof a!="string")return a;const[i,l,u,d]=a.match(ew);return{[e]:parseFloat(i),[t]:parseFloat(l),[n]:parseFloat(u),alpha:d!==void 0?parseFloat(d):1}},aU=e=>Ya(0,255,e),zg={...Xl,transform:e=>Math.round(aU(e))},Ji={test:tw("rgb","red"),parse:iP("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:a=1})=>"rgba("+zg.transform(e)+", "+zg.transform(t)+", "+zg.transform(n)+", "+xu(Pu.transform(a))+")"};function sU(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 jb={test:tw("#"),parse:sU,transform:Ji.transform},Xu=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),fi=Xu("deg"),$a=Xu("%"),Fe=Xu("px"),iU=Xu("vh"),oU=Xu("vw"),uE={...$a,parse:e=>$a.parse(e)/100,transform:e=>$a.transform(e*100)},Ol={test:tw("hsl","hue"),parse:iP("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:a=1})=>"hsla("+Math.round(e)+", "+$a.transform(xu(t))+", "+$a.transform(xu(n))+", "+xu(Pu.transform(a))+")"},An={test:e=>Ji.test(e)||jb.test(e)||Ol.test(e),parse:e=>Ji.test(e)?Ji.parse(e):Ol.test(e)?Ol.parse(e):jb.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Ji.transform(e):Ol.transform(e),getAnimatableNone:e=>{const t=An.parse(e);return t.alpha=0,An.transform(t)}},lU=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function cU(e){return isNaN(e)&&typeof e=="string"&&(e.match(ew)?.length||0)+(e.match(lU)?.length||0)>0}const oP="number",lP="color",uU="var",dU="var(",dE="${}",fU=/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 Du(e){const t=e.toString(),n=[],a={color:[],number:[],var:[]},i=[];let l=0;const d=t.replace(fU,h=>(An.test(h)?(a.color.push(l),i.push(lP),n.push(An.parse(h))):h.startsWith(dU)?(a.var.push(l),i.push(uU),n.push(h)):(a.number.push(l),i.push(oP),n.push(parseFloat(h))),++l,dE)).split(dE);return{values:n,split:d,indexes:a,types:i}}function cP(e){return Du(e).values}function uP(e){const{split:t,types:n}=Du(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===oP?l+=xu(i[u]):d===lP?l+=An.transform(i[u]):l+=i[u]}return l}}const hU=e=>typeof e=="number"?0:An.test(e)?An.getAnimatableNone(e):e;function pU(e){const t=cP(e);return uP(e)(t.map(hU))}const yi={test:cU,parse:cP,createTransformer:uP,getAnimatableNone:pU};function Hg(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 mU({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=Hg(h,d,e+1/3),l=Hg(h,d,e),u=Hg(h,d,e-1/3)}return{red:Math.round(i*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:a}}function nh(e,t){return n=>n>0?t:e}const mn=(e,t,n)=>e+(t-e)*n,Ug=(e,t,n)=>{const a=e*e,i=n*(t*t-a)+a;return i<0?0:Math.sqrt(i)},gU=[jb,Ji,Ol],vU=e=>gU.find(t=>t.test(e));function fE(e){const t=vU(e);if(!t)return!1;let n=t.parse(e);return t===Ol&&(n=mU(n)),n}const hE=(e,t)=>{const n=fE(e),a=fE(t);if(!n||!a)return nh(e,t);const i={...n};return l=>(i.red=Ug(n.red,a.red,l),i.green=Ug(n.green,a.green,l),i.blue=Ug(n.blue,a.blue,l),i.alpha=mn(n.alpha,a.alpha,l),Ji.transform(i))},Cb=new Set(["none","hidden"]);function xU(e,t){return Cb.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function yU(e,t){return n=>mn(e,t,n)}function nw(e){return typeof e=="number"?yU:typeof e=="string"?J0(e)?nh:An.test(e)?hE:SU:Array.isArray(e)?dP:typeof e=="object"?An.test(e)?hE:bU:nh}function dP(e,t){const n=[...e],a=n.length,i=e.map((l,u)=>nw(l)(l,t[u]));return l=>{for(let u=0;u<a;u++)n[u]=i[u](l);return n}}function bU(e,t){const n={...e,...t},a={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(a[i]=nw(e[i])(e[i],t[i]));return i=>{for(const l in a)n[l]=a[l](i);return n}}function wU(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 SU=(e,t)=>{const n=yi.createTransformer(t),a=Du(e),i=Du(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?Cb.has(e)&&!i.values.length||Cb.has(t)&&!a.values.length?xU(e,t):Yu(dP(wU(a,i),i.values),n):nh(e,t)};function fP(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?mn(e,t,n):nw(e)(e,t)}const jU=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>on.update(t,n),stop:()=>Wa(t),now:()=>Un.isProcessing?Un.timestamp:Qn.now()}},hP=(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)})`},rh=2e4;function rw(e){let t=0;const n=50;let a=e.next(t);for(;!a.done&&t<rh;)t+=n,a=e.next(t);return t>=rh?1/0:t}function CU(e,t=100,n){const a=n({...e,keyframes:[0,t]}),i=Math.min(rw(a),rh);return{type:"keyframes",ease:l=>a.next(i*l).value/t,duration:Wr(i)}}const NU=5;function pP(e,t,n){const a=Math.max(t-NU,0);return GM(n-e(a),t-a)}const bn={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},Vg=.001;function EU({duration:e=bn.duration,bounce:t=bn.bounce,velocity:n=bn.velocity,mass:a=bn.mass}){let i,l,u=1-t;u=Ya(bn.minDamping,bn.maxDamping,u),e=Ya(bn.minDuration,bn.maxDuration,Wr(e)),u<1?(i=p=>{const g=p*u,m=g*e,b=g-n,S=Nb(p,u),j=Math.exp(-m);return Vg-b/S*j},l=p=>{const m=p*u*e,b=m*n+n,S=Math.pow(u,2)*Math.pow(p,2)*e,j=Math.exp(-m),w=Nb(Math.pow(p,2),u);return(-i(p)+Vg>0?-1:1)*((b-S)*j)/w}):(i=p=>{const g=Math.exp(-p*e),m=(p-n)*e+1;return-Vg+g*m},l=p=>{const g=Math.exp(-p*e),m=(n-p)*(e*e);return g*m});const d=5/e,h=TU(i,l,d);if(e=Ns(e),isNaN(h))return{stiffness:bn.stiffness,damping:bn.damping,duration:e};{const p=Math.pow(h,2)*a;return{stiffness:p,damping:u*2*Math.sqrt(a*p),duration:e}}}const _U=12;function TU(e,t,n){let a=n;for(let i=1;i<_U;i++)a=a-e(a)/t(a);return a}function Nb(e,t){return e*Math.sqrt(1-t*t)}const AU=["duration","bounce"],RU=["stiffness","damping","mass"];function pE(e,t){return t.some(n=>e[n]!==void 0)}function OU(e){let t={velocity:bn.velocity,stiffness:bn.stiffness,damping:bn.damping,mass:bn.mass,isResolvedFromDuration:!1,...e};if(!pE(e,RU)&&pE(e,AU))if(e.visualDuration){const n=e.visualDuration,a=2*Math.PI/(n*1.2),i=a*a,l=2*Ya(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:bn.mass,stiffness:i,damping:l}}else{const n=EU(e);t={...t,...n,mass:bn.mass},t.isResolvedFromDuration=!0}return t}function ah(e=bn.visualDuration,t=bn.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:g,duration:m,velocity:b,isResolvedFromDuration:S}=OU({...n,velocity:-Wr(n.velocity||0)}),j=b||0,w=p/(2*Math.sqrt(h*g)),C=u-l,N=Wr(Math.sqrt(h/g)),_=Math.abs(C)<5;a||(a=_?bn.restSpeed.granular:bn.restSpeed.default),i||(i=_?bn.restDelta.granular:bn.restDelta.default);let T;if(w<1){const M=Nb(N,w);T=B=>{const k=Math.exp(-w*N*B);return u-k*((j+w*N*C)/M*Math.sin(M*B)+C*Math.cos(M*B))}}else if(w===1)T=M=>u-Math.exp(-N*M)*(C+(j+N*C)*M);else{const M=N*Math.sqrt(w*w-1);T=B=>{const k=Math.exp(-w*N*B),F=Math.min(M*B,300);return u-k*((j+w*N*C)*Math.sinh(F)+M*C*Math.cosh(F))/M}}const O={calculatedDuration:S&&m||null,next:M=>{const B=T(M);if(S)d.done=M>=m;else{let k=M===0?j:0;w<1&&(k=M===0?Ns(j):pP(T,M,B));const F=Math.abs(k)<=a,W=Math.abs(u-B)<=i;d.done=F&&W}return d.value=d.done?u:B,d},toString:()=>{const M=Math.min(rw(O),rh),B=hP(k=>O.next(M*k).value,M,30);return M+"ms "+B},toTransition:()=>{}};return O}ah.applyToOptions=e=>{const t=CU(e,100,ah);return e.ease=t.ease,e.duration=Ns(t.duration),e.type="keyframes",e};function Eb({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:g}){const m=e[0],b={done:!1,value:m},S=F=>d!==void 0&&F<d||h!==void 0&&F>h,j=F=>d===void 0?h:h===void 0||Math.abs(d-F)<Math.abs(h-F)?d:h;let w=n*t;const C=m+w,N=u===void 0?C:u(C);N!==C&&(w=N-m);const _=F=>-w*Math.exp(-F/a),T=F=>N+_(F),O=F=>{const W=_(F),ce=T(F);b.done=Math.abs(W)<=p,b.value=b.done?N:ce};let M,B;const k=F=>{S(b.value)&&(M=F,B=ah({keyframes:[b.value,j(b.value)],velocity:pP(T,F,b.value),damping:i,stiffness:l,restDelta:p,restSpeed:g}))};return k(0),{calculatedDuration:null,next:F=>{let W=!1;return!B&&M===void 0&&(W=!0,O(F),k(F)),M!==void 0&&F>=M?B.next(F-M):(!W&&O(F),b)}}}function MU(e,t,n){const a=[],i=n||Os.mix||fP,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]||Qr:t;d=Yu(h,d)}a.push(d)}return a}function mP(e,t,{clamp:n=!0,ease:a,mixer:i}={}){const l=e.length;if(Y0(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=MU(t,a,i),h=d.length,p=g=>{if(u&&g<e[0])return t[0];let m=0;if(h>1)for(;m<e.length-2&&!(g<e[m+1]);m++);const b=Mu(e[m],e[m+1],g);return d[m](b)};return n?g=>p(Ya(e[0],e[l-1],g)):p}function PU(e,t){const n=e[e.length-1];for(let a=1;a<=t;a++){const i=Mu(0,t,a);e.push(mn(n,1,i))}}function DU(e){const t=[0];return PU(t,e.length-1),t}function kU(e,t){return e.map(n=>n*t)}function LU(e,t){return e.map(()=>t||tP).splice(0,e.length-1)}function yu({duration:e=300,keyframes:t,times:n,ease:a="easeInOut"}){const i=YH(a)?a.map(lE):lE(a),l={done:!1,value:t[0]},u=kU(n&&n.length===t.length?n:DU(t),e),d=mP(u,t,{ease:Array.isArray(i)?i:LU(t,i)});return{calculatedDuration:e,next:h=>(l.value=d(h),l.done=h>=e,l)}}const BU=e=>e!==null;function aw(e,{repeat:t,repeatType:n="loop"},a,i=1){const l=e.filter(BU),d=i<0||t&&n!=="loop"&&t%2===1?0:l.length-1;return!d||a===void 0?l[d]:a}const FU={decay:Eb,inertia:Eb,tween:yu,keyframes:yu,spring:ah};function gP(e){typeof e.type=="string"&&(e.type=FU[e.type])}class sw{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 IU=e=>e/100;class iw extends sw{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!==Qn.now()&&this.tick(Qn.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;gP(t);const{type:n=yu,repeat:a=0,repeatDelay:i=0,repeatType:l,velocity:u=0}=t;let{keyframes:d}=t;const h=n||yu;h!==yu&&typeof d[0]!="number"&&(this.mixKeyframes=Yu(IU,fP(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=rw(p));const{calculatedDuration:g}=p;this.calculatedDuration=g,this.resolvedDuration=g+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:g,repeat:m,repeatType:b,repeatDelay:S,type:j,onUpdate:w,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,O=a;if(m){const F=Math.min(this.currentTime,i)/d;let W=Math.floor(F),ce=F%1;!ce&&F>=1&&(ce=1),ce===1&&W--,W=Math.min(W,m+1),W%2&&(b==="reverse"?(ce=1-ce,S&&(ce-=S/d)):b==="mirror"&&(O=u)),T=Ya(0,1,ce)*d}const M=_?{done:!1,value:g[0]}:O.next(T);l&&(M.value=l(M.value));let{done:B}=M;!_&&h!==null&&(B=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&B);return k&&j!==Eb&&(M.value=aw(g,this.options,C,this.speed)),w&&w(M.value),k&&this.finish(),M}then(t,n){return this.finished.then(t,n)}get duration(){return Wr(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Wr(t)}get time(){return Wr(this.currentTime)}set time(t){t=Ns(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(Qn.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Wr(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=jU,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(Qn.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 zU(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const eo=e=>e*180/Math.PI,_b=e=>{const t=eo(Math.atan2(e[1],e[0]));return Tb(t)},HU={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:_b,rotateZ:_b,skewX:e=>eo(Math.atan(e[1])),skewY:e=>eo(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Tb=e=>(e=e%360,e<0&&(e+=360),e),mE=_b,gE=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),vE=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),UU={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:gE,scaleY:vE,scale:e=>(gE(e)+vE(e))/2,rotateX:e=>Tb(eo(Math.atan2(e[6],e[5]))),rotateY:e=>Tb(eo(Math.atan2(-e[2],e[0]))),rotateZ:mE,rotate:mE,skewX:e=>eo(Math.atan(e[4])),skewY:e=>eo(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Ab(e){return e.includes("scale")?1:0}function Rb(e,t){if(!e||e==="none")return Ab(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let a,i;if(n)a=UU,i=n;else{const d=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);a=HU,i=d}if(!i)return Ab(t);const l=a[t],u=i[1].split(",").map(qU);return typeof l=="function"?l(u):u[l]}const VU=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Rb(n,t)};function qU(e){return parseFloat(e.trim())}const Ql=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Zl=new Set(Ql),xE=e=>e===Xl||e===Fe,$U=new Set(["x","y","z"]),GU=Ql.filter(e=>!$U.has(e));function KU(e){const t=[];return GU.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})=>Rb(t,"x"),y:(e,{transform:t})=>Rb(t,"y")};mi.translateX=mi.x;mi.translateY=mi.y;const to=new Set;let Ob=!1,Mb=!1,Pb=!1;function vP(){if(Mb){const e=Array.from(to).filter(a=>a.needsMeasurement),t=new Set(e.map(a=>a.element)),n=new Map;t.forEach(a=>{const i=KU(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)})}Mb=!1,Ob=!1,to.forEach(e=>e.complete(Pb)),to.clear()}function xP(){to.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Mb=!0)})}function YU(){Pb=!0,xP(),vP(),Pb=!1}class ow{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?(to.add(this),Ob||(Ob=!0,on.read(xP),on.resolveKeyframes(vP))):(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])}zU(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),to.delete(this)}cancel(){this.state==="scheduled"&&(to.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const WU=e=>e.startsWith("--");function XU(e,t,n){WU(t)?e.style.setProperty(t,n):e.style[t]=n}const QU=W0(()=>window.ScrollTimeline!==void 0),ZU={};function JU(e,t){const n=W0(e);return()=>ZU[t]??n()}const yP=JU(()=>{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})`,yE={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 bP(e,t){if(e)return typeof e=="function"?yP()?hP(e,t):"ease-out":nP(e)?lu(e):Array.isArray(e)?e.map(n=>bP(n,t)||yE.easeOut):yE[e]}function eV(e,t,n,{delay:a=0,duration:i=300,repeat:l=0,repeatType:u="loop",ease:d="easeOut",times:h}={},p=void 0){const g={[t]:n};h&&(g.offset=h);const m=bP(d,i);Array.isArray(m)&&(g.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(g,b)}function wP(e){return typeof e=="function"&&"applyToOptions"in e}function tV({type:e,...t}){return wP(e)&&yP()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class nV extends sw{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,Y0(typeof t.type!="string");const p=tV(t);this.animation=eV(n,a,i,p,l),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!l){const g=aw(i,this.options,d,this.speed);this.updateMotionValue?this.updateMotionValue(g):XU(n,a,g),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 Wr(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Wr(t)}get time(){return Wr(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ns(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&&QU()?(this.animation.timeline=t,Qr):n(this)}}const SP={anticipate:ZM,backInOut:QM,circInOut:eP};function rV(e){return e in SP}function aV(e){typeof e.ease=="string"&&rV(e.ease)&&(e.ease=SP[e.ease])}const qg=10;class sV extends nV{constructor(t){aV(t),gP(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 iw({...u,autoplay:!1}),h=Math.max(qg,Qn.now()-this.startTime),p=Ya(0,qg,h-qg);n.setWithVelocity(d.sample(Math.max(0,h-p)).value,d.sample(h).value,p),d.stop()}}const bE=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(yi.test(e)||e==="0")&&!e.startsWith("url("));function iV(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 oV(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=bE(i,t),d=bE(l,t);return!u||!d?!1:iV(e)||(n==="spring"||wP(n))&&a}function Db(e){e.duration=0,e.type="keyframes"}const lV=new Set(["opacity","clipPath","filter","transform"]),cV=W0(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function uV(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 cV()&&n&&lV.has(n)&&(n!=="transform"||!p)&&!h&&!a&&i!=="mirror"&&l!==0&&u!=="inertia"}const dV=40;class fV extends sw{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:g,...m}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Qn.now();const b={autoplay:t,delay:n,type:a,repeat:i,repeatDelay:l,repeatType:u,name:h,motionValue:p,element:g,...m},S=g?.KeyframeResolver||ow;this.keyframeResolver=new S(d,(j,w,C)=>this.onKeyframesResolved(j,w,b,!C),h,p,g),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,a,i){this.keyframeResolver=void 0;const{name:l,type:u,velocity:d,delay:h,isHandoff:p,onUpdate:g}=a;this.resolvedAt=Qn.now(),oV(t,l,u,d)||((Os.instantAnimations||!h)&&g?.(aw(t,a,n)),t[0]=t[t.length-1],Db(a),a.repeat=0);const b={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>dV?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...a,keyframes:t},S=!p&&uV(b),j=b.motionValue?.owner?.current,w=S?new sV({...b,element:j}):new iw(b);w.finished.then(()=>{this.notifyFinished()}).catch(Qr),this.pendingTimeline&&(this.stopTimeline=w.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=w}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(),YU()),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 jP(e,t,n,a=0,i=1){const l=Array.from(e).sort((p,g)=>p.sortNodePosition(g)).indexOf(t),u=e.size,d=(u-1)*a;return typeof n=="function"?n(l,u):i===1?l*a:d-l*a}const hV=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function pV(e){const t=hV.exec(e);if(!t)return[,];const[,n,a,i]=t;return[`--${n??a}`,i]}function CP(e,t,n=1){const[a,i]=pV(e);if(!a)return;const l=window.getComputedStyle(t).getPropertyValue(a);if(l){const u=l.trim();return VM(u)?parseFloat(u):u}return J0(i)?CP(i,t,n+1):i}const mV={type:"spring",stiffness:500,damping:25,restSpeed:10},gV=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),vV={type:"keyframes",duration:.8},xV={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},yV=(e,{keyframes:t})=>t.length>2?vV:Zl.has(e)?e.startsWith("scale")?gV(t[1]):mV:xV,bV=e=>e!==null;function wV(e,{repeat:t,repeatType:n="loop"},a){const i=e.filter(bV),l=t&&n!=="loop"&&t%2===1?0:i.length-1;return i[l]}function lw(e,t){return e?.[t]??e?.default??e}function SV({when:e,delay:t,delayChildren:n,staggerChildren:a,staggerDirection:i,repeat:l,repeatType:u,repeatDelay:d,from:h,elapsed:p,...g}){return!!Object.keys(g).length}const cw=(e,t,n,a={},i,l)=>u=>{const d=lw(a,e)||{},h=d.delay||a.delay||0;let{elapsed:p=0}=a;p=p-Ns(h);const g={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};SV(d)||Object.assign(g,yV(e,g)),g.duration&&(g.duration=Ns(g.duration)),g.repeatDelay&&(g.repeatDelay=Ns(g.repeatDelay)),g.from!==void 0&&(g.keyframes[0]=g.from);let m=!1;if((g.type===!1||g.duration===0&&!g.repeatDelay)&&(Db(g),g.delay===0&&(m=!0)),(Os.instantAnimations||Os.skipAnimations)&&(m=!0,Db(g),g.delay=0),g.allowFlatten=!d.type&&!d.ease,m&&!l&&t.get()!==void 0){const b=wV(g.keyframes,d);if(b!==void 0){on.update(()=>{g.onUpdate(b),g.onComplete()});return}}return d.isSync?new iw(g):new fV(g)};function wE(e){const t=[{},{}];return e?.values.forEach((n,a)=>{t[0][a]=n.get(),t[1][a]=n.getVelocity()}),t}function uw(e,t,n,a){if(typeof t=="function"){const[i,l]=wE(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]=wE(a);t=t(n!==void 0?n:e.custom,i,l)}return t}function Bl(e,t,n){const a=e.getProps();return uw(a,t,n!==void 0?n:a.custom,e)}const NP=new Set(["width","height","top","left","right","bottom",...Ql]),SE=30,jV=e=>!isNaN(parseFloat(e)),bu={current:void 0};class CV{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=a=>{const i=Qn.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=Qn.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=jV(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 X0);const a=this.events[t].add(n);return t==="change"?()=>{a(),on.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 bu.current&&bu.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=Qn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>SE)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,SE);return GM(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 ao(e,t){return new CV(e,t)}const kb=e=>Array.isArray(e);function NV(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,ao(n))}function EV(e){return kb(e)?e[e.length-1]||0:e}function _V(e,t){const n=Bl(e,t);let{transitionEnd:a={},transition:i={},...l}=n||{};l={...l,...a};for(const u in l){const d=EV(l[u]);NV(e,u,d)}}const Gn=e=>!!(e&&e.getVelocity);function TV(e){return!!(Gn(e)&&e.add)}function Lb(e,t){const n=e.getValue("willChange");if(TV(n))return n.add(t);if(!n&&Os.WillChange){const a=new Os.WillChange("auto");e.addValue("willChange",a),a.add(t)}}function dw(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const AV="framerAppearId",EP="data-"+dw(AV);function _P(e){return e.props[EP]}function RV({protectedKeys:e,needsAnimating:t},n){const a=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,a}function TP(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 g in d){const m=e.getValue(g,e.latestValues[g]??null),b=d[g];if(b===void 0||p&&RV(p,g))continue;const S={delay:n,...lw(l||{},g)},j=m.get();if(j!==void 0&&!m.isAnimating&&!Array.isArray(b)&&b===j&&!S.velocity)continue;let w=!1;if(window.MotionHandoffAnimation){const N=_P(e);if(N){const _=window.MotionHandoffAnimation(N,g,on);_!==null&&(S.startTime=_,w=!0)}}Lb(e,g),m.start(cw(g,m,b,e.shouldReduceMotion&&NP.has(g)?{type:!1}:S,e,w));const C=m.animation;C&&h.push(C)}return u&&Promise.all(h).then(()=>{on.update(()=>{u&&_V(e,u)})}),h}function Bb(e,t,n={}){const a=Bl(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(TP(e,a,n)):()=>Promise.resolve(),u=e.variantChildren&&e.variantChildren.size?(h=0)=>{const{delayChildren:p=0,staggerChildren:g,staggerDirection:m}=i;return OV(e,t,h,p,g,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 OV(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(Bb(h,t,{...u,delay:n+(typeof a=="function"?0:a)+jP(e.variantChildren,h,a,i,l)}).then(()=>h.notify("AnimationComplete",t)));return Promise.all(d)}function MV(e,t,n={}){e.notify("AnimationStart",t);let a;if(Array.isArray(t)){const i=t.map(l=>Bb(e,l,n));a=Promise.all(i)}else if(typeof t=="string")a=Bb(e,t,n);else{const i=typeof t=="function"?Bl(e,t,n.custom):t;a=Promise.all(TP(e,i,n))}return a.then(()=>{e.notify("AnimationComplete",t)})}const PV={test:e=>e==="auto",parse:e=>e},AP=e=>t=>t.test(e),RP=[Xl,Fe,$a,fi,oU,iU,PV],jE=e=>RP.find(AP(e));function DV(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||$M(e):!0}const kV=new Set(["brightness","contrast","saturate","opacity"]);function LV(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[a]=n.match(ew)||[];if(!a)return e;const i=n.replace(a,"");let l=kV.has(t)?1:0;return a!==n&&(l*=100),t+"("+l+i+")"}const BV=/\b([a-z-]*)\(.*?\)/gu,Fb={...yi,getAnimatableNone:e=>{const t=e.match(BV);return t?t.map(LV).join(" "):e}},CE={...Xl,transform:Math.round},FV={rotate:fi,rotateX:fi,rotateY:fi,rotateZ:fi,scale:Ef,scaleX:Ef,scaleY:Ef,scaleZ:Ef,skew:fi,skewX:fi,skewY:fi,distance:Fe,translateX:Fe,translateY:Fe,translateZ:Fe,x:Fe,y:Fe,z:Fe,perspective:Fe,transformPerspective:Fe,opacity:Pu,originX:uE,originY:uE,originZ:Fe},fw={borderWidth:Fe,borderTopWidth:Fe,borderRightWidth:Fe,borderBottomWidth:Fe,borderLeftWidth:Fe,borderRadius:Fe,radius:Fe,borderTopLeftRadius:Fe,borderTopRightRadius:Fe,borderBottomRightRadius:Fe,borderBottomLeftRadius:Fe,width:Fe,maxWidth:Fe,height:Fe,maxHeight:Fe,top:Fe,right:Fe,bottom:Fe,left:Fe,inset:Fe,insetBlock:Fe,insetBlockStart:Fe,insetBlockEnd:Fe,insetInline:Fe,insetInlineStart:Fe,insetInlineEnd:Fe,padding:Fe,paddingTop:Fe,paddingRight:Fe,paddingBottom:Fe,paddingLeft:Fe,paddingBlock:Fe,paddingBlockStart:Fe,paddingBlockEnd:Fe,paddingInline:Fe,paddingInlineStart:Fe,paddingInlineEnd:Fe,margin:Fe,marginTop:Fe,marginRight:Fe,marginBottom:Fe,marginLeft:Fe,marginBlock:Fe,marginBlockStart:Fe,marginBlockEnd:Fe,marginInline:Fe,marginInlineStart:Fe,marginInlineEnd:Fe,backgroundPositionX:Fe,backgroundPositionY:Fe,...FV,zIndex:CE,fillOpacity:Pu,strokeOpacity:Pu,numOctaves:CE},IV={...fw,color:An,backgroundColor:An,outlineColor:An,fill:An,stroke:An,borderColor:An,borderTopColor:An,borderRightColor:An,borderBottomColor:An,borderLeftColor:An,filter:Fb,WebkitFilter:Fb},OP=e=>IV[e];function MP(e,t){let n=OP(e);return n!==Fb&&(n=yi),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const zV=new Set(["auto","none","0"]);function HV(e,t,n){let a=0,i;for(;a<e.length&&!i;){const l=e[a];typeof l=="string"&&!zV.has(l)&&Du(l).values.length&&(i=e[a]),a++}if(i&&n)for(const l of t)e[l]=MP(n,i)}class UV extends ow{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 g=0;g<t.length;g++){let m=t[g];if(typeof m=="string"&&(m=m.trim(),J0(m))){const b=CP(m,n.current);b!==void 0&&(t[g]=b),g===t.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!NP.has(a)||t.length!==2)return;const[i,l]=t,u=jE(i),d=jE(l),h=cE(i),p=cE(l);if(h!==p&&mi[a]){this.needsMeasurement=!0;return}if(u!==d)if(xE(u)&&xE(d))for(let g=0;g<t.length;g++){const m=t[g];typeof m=="string"&&(t[g]=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||DV(t[i]))&&a.push(i);a.length&&HV(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 VV(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 PP=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function qV(e){return qM(e)&&"offsetHeight"in e}const{schedule:hw}=rP(queueMicrotask,!1),ma={x:!1,y:!1};function DP(){return ma.x||ma.y}function $V(e){return e==="x"||e==="y"?ma[e]?null:(ma[e]=!0,()=>{ma[e]=!1}):ma.x||ma.y?null:(ma.x=ma.y=!0,()=>{ma.x=ma.y=!1})}function kP(e,t){const n=VV(e),a=new AbortController,i={passive:!0,...t,signal:a.signal};return[n,i,()=>a.abort()]}function NE(e){return!(e.pointerType==="touch"||DP())}function GV(e,t,n={}){const[a,i,l]=kP(e,n),u=d=>{if(!NE(d))return;const{target:h}=d,p=t(h,d);if(typeof p!="function"||!h)return;const g=m=>{NE(m)&&(p(m),h.removeEventListener("pointerleave",g))};h.addEventListener("pointerleave",g,i)};return a.forEach(d=>{d.addEventListener("pointerenter",u,i)}),l}const LP=(e,t)=>t?e===t?!0:LP(e,t.parentElement):!1,pw=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,KV=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function BP(e){return KV.has(e.tagName)||e.isContentEditable===!0}const Hf=new WeakSet;function EE(e){return t=>{t.key==="Enter"&&e(t)}}function $g(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const YV=(e,t)=>{const n=e.currentTarget;if(!n)return;const a=EE(()=>{if(Hf.has(n))return;$g(n,"down");const i=EE(()=>{$g(n,"up")}),l=()=>$g(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 _E(e){return pw(e)&&!DP()}function WV(e,t,n={}){const[a,i,l]=kP(e,n),u=d=>{const h=d.currentTarget;if(!_E(d))return;Hf.add(h);const p=t(h,d),g=(S,j)=>{window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",b),Hf.has(h)&&Hf.delete(h),_E(S)&&typeof p=="function"&&p(S,{success:j})},m=S=>{g(S,h===window||h===document||n.useGlobalTarget||LP(h,S.target))},b=S=>{g(S,!1)};window.addEventListener("pointerup",m,i),window.addEventListener("pointercancel",b,i)};return a.forEach(d=>{(n.useGlobalTarget?window:d).addEventListener("pointerdown",u,i),qV(d)&&(d.addEventListener("focus",p=>YV(p,i)),!BP(d)&&!d.hasAttribute("tabindex")&&(d.tabIndex=0))}),l}function FP(e){return qM(e)&&"ownerSVGElement"in e}function XV(e){return FP(e)&&e.tagName==="svg"}function QV(...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=mP(i,l,u);return t?d(a):d}const ZV=[...RP,An,yi],JV=e=>ZV.find(AP(e)),TE=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ml=()=>({x:TE(),y:TE()}),AE=()=>({min:0,max:0}),Dn=()=>({x:AE(),y:AE()}),Ib={current:null},IP={current:!1},eq=typeof window<"u";function tq(){if(IP.current=!0,!!eq)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Ib.current=e.matches;e.addEventListener("change",t),t()}else Ib.current=!1}const nq=new WeakMap;function Hh(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function ku(e){return typeof e=="string"||Array.isArray(e)}const mw=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],gw=["initial",...mw];function Uh(e){return Hh(e.animate)||gw.some(t=>ku(e[t]))}function zP(e){return!!(Uh(e)||e.variants)}function rq(e,t,n){for(const a in t){const i=t[a],l=n[a];if(Gn(i))e.addValue(a,i);else if(Gn(l))e.addValue(a,ao(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,ao(u!==void 0?u:i,{owner:e}))}}for(const a in n)t[a]===void 0&&e.removeValue(a);return t}const RE=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let sh={};function HP(e){sh=e}function aq(){return sh}class sq{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=ow,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=Qn.now();this.renderScheduledAt<b&&(this.renderScheduledAt=b,on.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=Uh(n),this.isVariantNode=zP(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:g,...m}=this.scrapeMotionValuesFromProps(n,{},this);for(const b in m){const S=m[b];h[b]!==void 0&&Gn(S)&&S.set(h[b])}}mount(t){this.current=t,nq.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:(IP.current||tq(),this.shouldReduceMotion=Ib.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Wa(this.notifyUpdate),Wa(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=Zl.has(t);a&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",u=>{this.latestValues[t]=u,this.props.onUpdate&&on.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 sh){const n=sh[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):Dn()}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<RE.length;a++){const i=RE[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=rq(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=ao(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"&&(VM(a)||$M(a))?a=parseFloat(a):!JV(a)&&yi.test(n)&&(a=MP(t,n)),this.setBaseTarget(t,Gn(a)?a.get():a)),Gn(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=uw(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&&!Gn(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 X0),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){hw.render(this.render)}}class UP extends sq{constructor(){super(...arguments),this.KeyframeResolver=UV}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;Gn(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class ji{constructor(t){this.isMounted=!1,this.node=t}update(){}}function VP({top:e,left:t,right:n,bottom:a}){return{x:{min:t,max:n},y:{min:e,max:a}}}function iq({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function oq(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 Gg(e){return e===void 0||e===1}function zb({scale:e,scaleX:t,scaleY:n}){return!Gg(e)||!Gg(t)||!Gg(n)}function Xi(e){return zb(e)||qP(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function qP(e){return OE(e.x)||OE(e.y)}function OE(e){return e&&e!=="0%"}function ih(e,t,n){const a=e-n,i=t*a;return n+i}function ME(e,t,n,a,i){return i!==void 0&&(e=ih(e,i,a)),ih(e,n,a)+t}function Hb(e,t=0,n=1,a,i){e.min=ME(e.min,t,n,a,i),e.max=ME(e.max,t,n,a,i)}function $P(e,{x:t,y:n}){Hb(e.x,t.translate,t.scale,t.originPoint),Hb(e.y,n.translate,n.scale,n.originPoint)}const PE=.999999999999,DE=1.0000000000001;function lq(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&&Dl(e,{x:-l.scroll.offset.x,y:-l.scroll.offset.y}),u&&(t.x*=u.x.scale,t.y*=u.y.scale,$P(e,u)),a&&Xi(l.latestValues)&&Dl(e,l.latestValues))}t.x<DE&&t.x>PE&&(t.x=1),t.y<DE&&t.y>PE&&(t.y=1)}function Pl(e,t){e.min=e.min+t,e.max=e.max+t}function kE(e,t,n,a,i=.5){const l=mn(e.min,e.max,i);Hb(e,t,n,l,a)}function Dl(e,t){kE(e.x,t.x,t.scaleX,t.scale,t.originX),kE(e.y,t.y,t.scaleY,t.scale,t.originY)}function GP(e,t){return VP(oq(e.getBoundingClientRect(),t))}function cq(e,t,n){const a=GP(e,n),{scroll:i}=t;return i&&(Pl(a.x,i.offset.x),Pl(a.y,i.offset.y)),a}const uq={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},dq=Ql.length;function fq(e,t,n){let a="",i=!0;for(let l=0;l<dq;l++){const u=Ql[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=PP(d,fw[u]);if(!h){i=!1;const g=uq[u]||u;a+=`${g}(${p}) `}n&&(t[u]=p)}}return a=a.trim(),n?a=n(t,i?"":a):i&&(a="none"),a}function vw(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(Zl.has(h)){u=!0;continue}else if(sP(h)){i[h]=p;continue}else{const g=PP(p,fw[h]);h.startsWith("origin")?(d=!0,l[h]=g):a[h]=g}}if(t.transform||(u||n?a.transform=fq(t,e.transform,n):a.transform&&(a.transform="none")),d){const{originX:h="50%",originY:p="50%",originZ:g=0}=l;a.transformOrigin=`${h} ${p} ${g}`}}function KP(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 LE(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(Fe.test(e))e=parseFloat(e);else return e;const n=LE(e,t.target.x),a=LE(e,t.target.y);return`${n}% ${a}%`}},hq={correct:(e,{treeScale:t,projectionDelta:n})=>{const a=e,i=yi.parse(e);if(i.length>5)return a;const l=yi.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=mn(d,h,.5);return typeof i[2+u]=="number"&&(i[2+u]/=p),typeof i[3+u]=="number"&&(i[3+u]/=p),l(i)}},Ub={borderRadius:{...au,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:au,borderTopRightRadius:au,borderBottomLeftRadius:au,borderBottomRightRadius:au,boxShadow:hq};function YP(e,{layout:t,layoutId:n}){return Zl.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Ub[e]||e==="opacity")}function xw(e,t,n){const a=e.style,i=t?.style,l={};if(!a)return l;for(const u in a)(Gn(a[u])||i&&Gn(i[u])||YP(u,e)||n?.getValue(u)?.liveStyle!==void 0)&&(l[u]=a[u]);return l}function pq(e){return window.getComputedStyle(e)}class mq extends UP{constructor(){super(...arguments),this.type="html",this.renderInstance=KP}readValueFromInstance(t,n){if(Zl.has(n))return this.projection?.isProjecting?Ab(n):VU(t,n);{const a=pq(t),i=(sP(n)?a.getPropertyValue(n):a[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return GP(t,n)}build(t,n,a){vw(t,n,a.transformTemplate)}scrapeMotionValuesFromProps(t,n,a){return xw(t,n,a)}}const gq={offset:"stroke-dashoffset",array:"stroke-dasharray"},vq={offset:"strokeDashoffset",array:"strokeDasharray"};function xq(e,t,n=1,a=0,i=!0){e.pathLength=1;const l=i?gq:vq;e[l.offset]=Fe.transform(-a);const u=Fe.transform(t),d=Fe.transform(n);e[l.array]=`${u} ${d}`}const yq=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function WP(e,{attrX:t,attrY:n,attrScale:a,pathLength:i,pathSpacing:l=1,pathOffset:u=0,...d},h,p,g){if(vw(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=g?.transformBox??"fill-box",delete m.transformBox);for(const S of yq)m[S]!==void 0&&(b[S]=m[S],delete m[S]);t!==void 0&&(m.x=t),n!==void 0&&(m.y=n),a!==void 0&&(m.scale=a),i!==void 0&&xq(m,i,l,u,!1)}const XP=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"]),QP=e=>typeof e=="string"&&e.toLowerCase()==="svg";function bq(e,t,n,a){KP(e,t,void 0,a);for(const i in t.attrs)e.setAttribute(XP.has(i)?i:dw(i),t.attrs[i])}function ZP(e,t,n){const a=xw(e,t,n);for(const i in e)if(Gn(e[i])||Gn(t[i])){const l=Ql.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;a[l]=e[i]}return a}class wq extends UP{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Dn}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Zl.has(n)){const a=OP(n);return a&&a.default||0}return n=XP.has(n)?n:dw(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,a){return ZP(t,n,a)}build(t,n,a){WP(t,n,this.isSVGTag,a.transformTemplate,a.style)}renderInstance(t,n,a,i){bq(t,n,a,i)}mount(t){this.isSVGTag=QP(t.tagName),super.mount(t)}}const Sq=gw.length;function JP(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?JP(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<Sq;n++){const a=gw[n],i=e.props[a];(ku(i)||i===!1)&&(t[a]=i)}return t}function eD(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 jq=[...mw].reverse(),Cq=mw.length;function Nq(e){return t=>Promise.all(t.map(({animation:n,options:a})=>MV(e,n,a)))}function Eq(e){let t=Nq(e),n=BE(),a=!0;const i=h=>(p,g)=>{const m=Bl(e,g,h==="exit"?e.presenceContext?.custom:void 0);if(m){const{transition:b,transitionEnd:S,...j}=m;p={...p,...j,...S}}return p};function l(h){t=h(e)}function u(h){const{props:p}=e,g=JP(e.parent)||{},m=[],b=new Set;let S={},j=1/0;for(let C=0;C<Cq;C++){const N=jq[C],_=n[N],T=p[N]!==void 0?p[N]:g[N],O=ku(T),M=N===h?_.isActive:null;M===!1&&(j=C);let B=T===g[N]&&T!==p[N]&&O;if(B&&a&&e.manuallyAnimateOnMount&&(B=!1),_.protectedKeys={...S},!_.isActive&&M===null||!T&&!_.prevProp||Hh(T)||typeof T=="boolean")continue;const k=_q(_.prevProp,T);let F=k||N===h&&_.isActive&&!B&&O||C>j&&O,W=!1;const ce=Array.isArray(T)?T:[T];let G=ce.reduce(i(N),{});M===!1&&(G={});const{prevResolvedValues:ie={}}=_,Q={...ie,...G},Z=V=>{F=!0,b.has(V)&&(W=!0,b.delete(V)),_.needsAnimating[V]=!0;const H=e.getValue(V);H&&(H.liveStyle=!1)};for(const V in Q){const H=G[V],se=ie[V];if(S.hasOwnProperty(V))continue;let we=!1;kb(H)&&kb(se)?we=!eD(H,se):we=H!==se,we?H!=null?Z(V):b.add(V):H!==void 0&&b.has(V)?Z(V):_.protectedKeys[V]=!0}_.prevProp=T,_.prevResolvedValues=G,_.isActive&&(S={...S,...G}),a&&e.blockInitialAnimation&&(F=!1);const ve=B&&k;F&&(!ve||W)&&m.push(...ce.map(V=>{const H={type:N};if(typeof V=="string"&&a&&!ve&&e.manuallyAnimateOnMount&&e.parent){const{parent:se}=e,we=Bl(se,V);if(se.enteringChildren&&we){const{delayChildren:L}=we.transition||{};H.delay=jP(se.enteringChildren,e,L)}}return{animation:V,options:H}}))}if(b.size){const C={};if(typeof p.initial!="boolean"){const N=Bl(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 w=!!m.length;return a&&(p.initial===!1||p.initial===p.animate)&&!e.manuallyAnimateOnMount&&(w=!1),a=!1,w?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 g=u(h);for(const m in n)n[m].protectedKeys={};return g}return{animateChanges:u,setActive:d,setAnimateFunction:l,getState:()=>n,reset:()=>{n=BE()}}}function _q(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!eD(t,e):!1}function Yi(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function BE(){return{animate:Yi(!0),whileInView:Yi(),whileHover:Yi(),whileTap:Yi(),whileDrag:Yi(),whileFocus:Yi(),exit:Yi()}}function FE(e,t){e.min=t.min,e.max=t.max}function ua(e,t){FE(e.x,t.x),FE(e.y,t.y)}function IE(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const tD=1e-4,Tq=1-tD,Aq=1+tD,nD=.01,Rq=0-nD,Oq=0+nD;function Zn(e){return e.max-e.min}function Mq(e,t,n){return Math.abs(e-t)<=n}function zE(e,t,n,a=.5){e.origin=a,e.originPoint=mn(t.min,t.max,e.origin),e.scale=Zn(n)/Zn(t),e.translate=mn(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Tq&&e.scale<=Aq||isNaN(e.scale))&&(e.scale=1),(e.translate>=Rq&&e.translate<=Oq||isNaN(e.translate))&&(e.translate=0)}function wu(e,t,n,a){zE(e.x,t.x,n.x,a?a.originX:void 0),zE(e.y,t.y,n.y,a?a.originY:void 0)}function HE(e,t,n){e.min=n.min+t.min,e.max=e.min+Zn(t)}function Pq(e,t,n){HE(e.x,t.x,n.x),HE(e.y,t.y,n.y)}function UE(e,t,n){e.min=t.min-n.min,e.max=e.min+Zn(t)}function oh(e,t,n){UE(e.x,t.x,n.x),UE(e.y,t.y,n.y)}function VE(e,t,n,a,i){return e-=t,e=ih(e,1/n,a),i!==void 0&&(e=ih(e,1/i,a)),e}function Dq(e,t=0,n=1,a=.5,i,l=e,u=e){if($a.test(t)&&(t=parseFloat(t),t=mn(u.min,u.max,t/100)-u.min),typeof t!="number")return;let d=mn(l.min,l.max,a);e===l&&(d-=t),e.min=VE(e.min,t,n,d,i),e.max=VE(e.max,t,n,d,i)}function qE(e,t,[n,a,i],l,u){Dq(e,t[n],t[a],t[i],t.scale,l,u)}const kq=["x","scaleX","originX"],Lq=["y","scaleY","originY"];function $E(e,t,n,a){qE(e.x,t,kq,n?n.x:void 0,a?a.x:void 0),qE(e.y,t,Lq,n?n.y:void 0,a?a.y:void 0)}function GE(e){return e.translate===0&&e.scale===1}function rD(e){return GE(e.x)&&GE(e.y)}function KE(e,t){return e.min===t.min&&e.max===t.max}function Bq(e,t){return KE(e.x,t.x)&&KE(e.y,t.y)}function YE(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function aD(e,t){return YE(e.x,t.x)&&YE(e.y,t.y)}function WE(e){return Zn(e.x)/Zn(e.y)}function XE(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Vr(e){return[e("x"),e("y")]}function Fq(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:g,rotateX:m,rotateY:b,skewX:S,skewY:j}=n;p&&(a=`perspective(${p}px) ${a}`),g&&(a+=`rotate(${g}deg) `),m&&(a+=`rotateX(${m}deg) `),b&&(a+=`rotateY(${b}deg) `),S&&(a+=`skewX(${S}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 sD=["TopLeft","TopRight","BottomLeft","BottomRight"],Iq=sD.length,QE=e=>typeof e=="string"?parseFloat(e):e,ZE=e=>typeof e=="number"||Fe.test(e);function zq(e,t,n,a,i,l){i?(e.opacity=mn(0,n.opacity??1,Hq(a)),e.opacityExit=mn(t.opacity??1,0,Uq(a))):l&&(e.opacity=mn(t.opacity??1,n.opacity??1,a));for(let u=0;u<Iq;u++){const d=`border${sD[u]}Radius`;let h=JE(t,d),p=JE(n,d);if(h===void 0&&p===void 0)continue;h||(h=0),p||(p=0),h===0||p===0||ZE(h)===ZE(p)?(e[d]=Math.max(mn(QE(h),QE(p),a),0),($a.test(p)||$a.test(h))&&(e[d]+="%")):e[d]=p}(t.rotate||n.rotate)&&(e.rotate=mn(t.rotate||0,n.rotate||0,a))}function JE(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const Hq=iD(0,.5,JM),Uq=iD(.5,.95,Qr);function iD(e,t,n){return a=>a<e?0:a>t?1:n(Mu(e,t,a))}function Vq(e,t,n){const a=Gn(e)?e:ao(e);return a.start(cw("",a,t,n)),a.animation}function Lu(e,t,n,a={passive:!0}){return e.addEventListener(t,n,a),()=>e.removeEventListener(t,n)}const qq=(e,t)=>e.depth-t.depth;class $q{constructor(){this.children=[],this.isDirty=!1}add(t){G0(this.children,t),this.isDirty=!0}remove(t){K0(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(qq),this.isDirty=!1,this.children.forEach(t)}}function Gq(e,t){const n=Qn.now(),a=({timestamp:i})=>{const l=i-n;l>=t&&(Wa(a),e(l-t))};return on.setup(a,!0),()=>Wa(a)}function Uf(e){return Gn(e)?e.get():e}class Kq{constructor(){this.members=[]}add(t){G0(this.members,t),t.scheduleRender()}remove(t){if(K0(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 Vf={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Kg=["","X","Y","Z"],Yq=1e3;let Wq=0;function Yg(e,t,n,a){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),a&&(a[e]=0))}function oD(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=_P(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:l}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",on,!(i||l))}const{parent:a}=e;a&&!a.hasCheckedOptimisedAppear&&oD(a)}function lD({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:a,resetTransform:i}){return class{constructor(u={},d=t?.()){this.id=Wq++,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(Zq),this.nodes.forEach(n7),this.nodes.forEach(r7),this.nodes.forEach(Jq)},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 $q)}addEventListener(u,d){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new X0),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=FP(u)&&!XV(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 g,m=0;const b=()=>this.root.updateBlockedByResize=!1;on.read(()=>{m=window.innerWidth}),e(u,()=>{const S=window.innerWidth;S!==m&&(m=S,this.root.updateBlockedByResize=!0,g&&g(),g=Gq(b,250),Vf.hasAnimatedSinceResize&&(Vf.hasAnimatedSinceResize=!1,this.nodes.forEach(n_)))})}d&&this.root.registerSharedNode(d,this),this.options.animate!==!1&&p&&(d||h)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:m,hasRelativeLayoutChanged:b,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||p.getDefaultTransition()||l7,{onLayoutAnimationStart:w,onLayoutAnimationComplete:C}=p.getProps(),N=!this.targetLayout||!aD(this.targetLayout,S),_=!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={...lw(j,"layout"),onPlay:w,onComplete:C};(p.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T),this.setAnimationOrigin(g,_)}else m||n_(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}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(),Wa(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(a7),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&&oD(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let g=0;g<this.path.length;g++){const m=this.path[g];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(e_);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(t_);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(t7),this.nodes.forEach(Xq),this.nodes.forEach(Qq)):this.nodes.forEach(t_),this.clearAllSnapshots();const d=Qn.now();Un.delta=Ya(0,1e3/60,d-Un.timestamp),Un.timestamp=d,Un.isProcessing=!0,Ig.update.process(Un),Ig.preRender.process(Un),Ig.render.process(Un),Un.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,hw.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(e7),this.sharedNodes.forEach(s7)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,on.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){on.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Zn(this.snapshot.measuredBox.x)&&!Zn(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=Dn(),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&&!rD(this.projectionDelta),h=this.getTransformTemplate(),p=h?h(this.latestValues,""):void 0,g=p!==this.prevTransformTemplateValue;u&&this.instance&&(d||Xi(this.latestValues)||g)&&(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)),c7(h),{animationId:this.root.animationId,measuredBox:d,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:u}=this.options;if(!u)return Dn();const d=u.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(u7))){const{scroll:p}=this.root;p&&(Pl(d.x,p.offset.x),Pl(d.y,p.offset.y))}return d}removeElementScroll(u){const d=Dn();if(ua(d,u),this.scroll?.wasRoot)return d;for(let h=0;h<this.path.length;h++){const p=this.path[h],{scroll:g,options:m}=p;p!==this.root&&g&&m.layoutScroll&&(g.wasRoot&&ua(d,u),Pl(d.x,g.offset.x),Pl(d.y,g.offset.y))}return d}applyTransform(u,d=!1){const h=Dn();ua(h,u);for(let p=0;p<this.path.length;p++){const g=this.path[p];!d&&g.options.layoutScroll&&g.scroll&&g!==g.root&&Dl(h,{x:-g.scroll.offset.x,y:-g.scroll.offset.y}),Xi(g.latestValues)&&Dl(h,g.latestValues)}return Xi(this.latestValues)&&Dl(h,this.latestValues),h}removeTransform(u){const d=Dn();ua(d,u);for(let h=0;h<this.path.length;h++){const p=this.path[h];if(!p.instance||!Xi(p.latestValues))continue;zb(p.latestValues)&&p.updateSnapshot();const g=Dn(),m=p.measurePageBox();ua(g,m),$E(d,p.latestValues,p.snapshot?p.snapshot.layoutBox:void 0,g)}return Xi(this.latestValues)&&$E(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!==Un.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:g,layoutId:m}=this.options;if(!this.layout||!(g||m))return;this.resolvedRelativeTargetAt=Un.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=Dn(),this.targetWithTransforms=Dn()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Pq(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):ua(this.target,this.layout.layoutBox),$P(this.target,this.targetDelta)):ua(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||zb(this.parent.latestValues)||qP(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=Dn(),this.relativeTargetOrigin=Dn(),oh(this.relativeTargetOrigin,d,h),ua(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===Un.timestamp&&(h=!1),h)return;const{layout:p,layoutId:g}=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||g))return;ua(this.layoutCorrected,this.layout.layoutBox);const m=this.treeScale.x,b=this.treeScale.y;lq(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=Dn());const{target:S}=u;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(IE(this.prevProjectionDelta.x,this.projectionDelta.x),IE(this.prevProjectionDelta.y,this.projectionDelta.y)),wu(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==m||this.treeScale.y!==b||!XE(this.projectionDelta.x,this.prevProjectionDelta.x)||!XE(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S))}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=Ml(),this.projectionDelta=Ml(),this.projectionDeltaWithTransform=Ml()}setAnimationOrigin(u,d=!1){const h=this.snapshot,p=h?h.latestValues:{},g={...this.latestValues},m=Ml();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!d;const b=Dn(),S=h?h.source:void 0,j=this.layout?this.layout.source:void 0,w=S!==j,C=this.getStack(),N=!C||C.members.length<=1,_=!!(w&&!N&&this.options.crossfade===!0&&!this.path.some(o7));this.animationProgress=0;let T;this.mixTargetDelta=O=>{const M=O/1e3;r_(m.x,u.x,M),r_(m.y,u.y,M),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(oh(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox),i7(this.relativeTarget,this.relativeTargetOrigin,b,M),T&&Bq(this.relativeTarget,T)&&(this.isProjectionDirty=!1),T||(T=Dn()),ua(T,this.relativeTarget)),w&&(this.animationValues=g,zq(g,p,this.latestValues,M,_,N)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=M},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Wa(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=on.update(()=>{Vf.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=ao(0)),this.currentAnimation=Vq(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(Yq),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:d,target:h,layout:p,latestValues:g}=u;if(!(!d||!h||!p)){if(this!==u&&this.layout&&p&&cD(this.options.animationType,this.layout.layoutBox,p.layoutBox)){h=this.target||Dn();const m=Zn(this.layout.layoutBox.x);h.x.min=u.target.x.min,h.x.max=h.x.min+m;const b=Zn(this.layout.layoutBox.y);h.y.min=u.target.y.min,h.y.max=h.y.min+b}ua(d,h),Dl(d,g),wu(this.projectionDeltaWithTransform,this.layoutCorrected,d,g)}}registerSharedNode(u,d){this.sharedNodes.has(u)||this.sharedNodes.set(u,new Kq),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&&Yg("z",u,p,this.animationValues);for(let g=0;g<Kg.length;g++)Yg(`rotate${Kg[g]}`,u,p,this.animationValues),Yg(`skew${Kg[g]}`,u,p,this.animationValues);u.render();for(const g in p)u.setStaticValue(g,p[g]),this.animationValues&&(this.animationValues[g]=p[g]);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=Uf(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=Uf(d?.pointerEvents)||""),this.hasProjected&&!Xi(this.latestValues)&&(u.transform=h?h({},""):"none",this.hasProjected=!1);return}u.visibility="";const g=p.animationValues||p.latestValues;this.applyTransformsToTarget();let m=Fq(this.projectionDeltaWithTransform,this.treeScale,g);h&&(m=h(g,m)),u.transform=m;const{x:b,y:S}=this.projectionDelta;u.transformOrigin=`${b.origin*100}% ${S.origin*100}% 0`,p.animationValues?u.opacity=p===this?g.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:g.opacityExit:u.opacity=p===this?g.opacity!==void 0?g.opacity:"":g.opacityExit!==void 0?g.opacityExit:0;for(const j in Ub){if(g[j]===void 0)continue;const{correct:w,applyTo:C,isCSSVariable:N}=Ub[j],_=m==="none"?g[j]:w(g[j],p);if(C){const T=C.length;for(let O=0;O<T;O++)u[C[O]]=_}else N?this.options.visualElement.renderState.vars[j]=_:u[j]=_}this.options.layoutId&&(u.pointerEvents=p===this?Uf(d?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>u.currentAnimation?.stop()),this.root.nodes.forEach(e_),this.root.sharedNodes.clear()}}}function Xq(e){e.updateLayout()}function Qq(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"?Vr(g=>{const m=l?t.measuredBox[g]:t.layoutBox[g],b=Zn(m);m.min=n[g].min,m.max=m.min+b}):cD(i,t.layoutBox,n)&&Vr(g=>{const m=l?t.measuredBox[g]:t.layoutBox[g],b=Zn(n[g]);m.max=m.min+b,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[g].max=e.relativeTarget[g].min+b)});const u=Ml();wu(u,n,t.layoutBox);const d=Ml();l?wu(d,e.applyTransform(a,!0),t.measuredBox):wu(d,n,t.layoutBox);const h=!rD(u);let p=!1;if(!e.resumeFrom){const g=e.getClosestProjectingParent();if(g&&!g.resumeFrom){const{snapshot:m,layout:b}=g;if(m&&b){const S=Dn();oh(S,t.layoutBox,m.layoutBox);const j=Dn();oh(j,n,b.layoutBox),aD(S,j)||(p=!0),g.options.layoutRoot&&(e.relativeTarget=j,e.relativeTargetOrigin=S,e.relativeParent=g)}}}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 Zq(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 Jq(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function e7(e){e.clearSnapshot()}function e_(e){e.clearMeasurements()}function t_(e){e.isLayoutDirty=!1}function t7(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function n_(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function n7(e){e.resolveTargetDelta()}function r7(e){e.calcProjection()}function a7(e){e.resetSkewAndRotation()}function s7(e){e.removeLeadSnapshot()}function r_(e,t,n){e.translate=mn(t.translate,0,n),e.scale=mn(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function a_(e,t,n,a){e.min=mn(t.min,n.min,a),e.max=mn(t.max,n.max,a)}function i7(e,t,n,a){a_(e.x,t.x,n.x,a),a_(e.y,t.y,n.y,a)}function o7(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const l7={duration:.45,ease:[.4,0,.1,1]},s_=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),i_=s_("applewebkit/")&&!s_("chrome/")?Math.round:Qr;function o_(e){e.min=i_(e.min),e.max=i_(e.max)}function c7(e){o_(e.x),o_(e.y)}function cD(e,t,n){return e==="position"||e==="preserve-aspect"&&!Mq(WE(t),WE(n),.2)}function u7(e){return e!==e.root&&e.scroll?.wasRoot}const d7=lD({attachResizeListener:(e,t)=>Lu(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Wg={current:void 0},uD=lD({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Wg.current){const e=new d7({});e.mount(window),e.setOptions({layoutScroll:!0}),Wg.current=e}return Wg.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Vh=v.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function f7(e=!0){const t=v.useContext($0);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:a,register:i}=t,l=v.useId();v.useEffect(()=>{if(e)return i(l)},[e]);const u=v.useCallback(()=>e&&a&&a(l),[l,a,e]);return!n&&a?[!1,u]:[!0]}const dD=v.createContext({strict:!1}),l_={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 c_=!1;function h7(){if(c_)return;const e={};for(const t in l_)e[t]={isEnabled:n=>l_[t].some(a=>!!n[a])};HP(e),c_=!0}function fD(){return h7(),aq()}function p7(e){const t=fD();for(const n in e)t[n]={...t[n],...e[n]};HP(t)}const m7=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 lh(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||m7.has(e)}let hD=e=>!lh(e);function g7(e){typeof e=="function"&&(hD=t=>t.startsWith("on")?!lh(t):e(t))}try{g7(require("@emotion/is-prop-valid").default)}catch{}function v7(e,t,n){const a={};for(const i in e)i==="values"&&typeof e.values=="object"||(hD(i)||n===!0&&lh(i)||!t&&!lh(i)||e.draggable&&i.startsWith("onDrag"))&&(a[i]=e[i]);return a}const qh=v.createContext({});function x7(e,t){if(Uh(e)){const{initial:n,animate:a}=e;return{initial:n===!1||ku(n)?n:void 0,animate:ku(a)?a:void 0}}return e.inherit!==!1?t:{}}function y7(e){const{initial:t,animate:n}=x7(e,v.useContext(qh));return v.useMemo(()=>({initial:t,animate:n}),[u_(t),u_(n)])}function u_(e){return Array.isArray(e)?e.join(" "):e}const yw=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function pD(e,t,n){for(const a in t)!Gn(t[a])&&!YP(a,n)&&(e[a]=t[a])}function b7({transformTemplate:e},t){return v.useMemo(()=>{const n=yw();return vw(n,t,e),Object.assign({},n.vars,n.style)},[t])}function w7(e,t){const n=e.style||{},a={};return pD(a,n,e),Object.assign(a,b7(e,t)),a}function S7(e,t){const n={},a=w7(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 mD=()=>({...yw(),attrs:{}});function j7(e,t,n,a){const i=v.useMemo(()=>{const l=mD();return WP(l,t,QP(a),e.transformTemplate,e.style),{...l.attrs,style:{...l.style}}},[t]);if(e.style){const l={};pD(l,e.style,e),i.style={...l,...i.style}}return i}const C7=["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 bw(e){return typeof e!="string"||e.includes("-")?!1:!!(C7.indexOf(e)>-1||/[A-Z]/u.test(e))}function N7(e,t,n,{latestValues:a},i,l=!1,u){const h=(u??bw(e)?j7:S7)(t,a,i,e),p=v7(t,typeof e=="string",l),g=e!==v.Fragment?{...p,...h,ref:n}:{},{children:m}=t,b=v.useMemo(()=>Gn(m)?m.get():m,[m]);return v.createElement(e,{...g,children:b})}function E7({scrapeMotionValuesFromProps:e,createRenderState:t},n,a,i){return{latestValues:_7(n,a,i,e),renderState:t()}}function _7(e,t,n,a){const i={},l=a(e,{});for(const b in l)i[b]=Uf(l[b]);let{initial:u,animate:d}=e;const h=Uh(e),p=zP(e);t&&p&&!h&&e.inherit!==!1&&(u===void 0&&(u=t.initial),d===void 0&&(d=t.animate));let g=n?n.initial===!1:!1;g=g||u===!1;const m=g?d:u;if(m&&typeof m!="boolean"&&!Hh(m)){const b=Array.isArray(m)?m:[m];for(let S=0;S<b.length;S++){const j=uw(e,b[S]);if(j){const{transitionEnd:w,transition:C,...N}=j;for(const _ in N){let T=N[_];if(Array.isArray(T)){const O=g?T.length-1:0;T=T[O]}T!==null&&(i[_]=T)}for(const _ in w)i[_]=w[_]}}}return i}const gD=e=>(t,n)=>{const a=v.useContext(qh),i=v.useContext($0),l=()=>E7(e,t,a,i);return n?l():q0(l)},T7=gD({scrapeMotionValuesFromProps:xw,createRenderState:yw}),A7=gD({scrapeMotionValuesFromProps:ZP,createRenderState:mD}),R7=Symbol.for("motionComponentSymbol");function O7(e,t,n){const a=v.useRef(n);v.useInsertionEffect(()=>{a.current=n});const i=v.useRef(null);return v.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 vD=v.createContext({});function cu(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function M7(e,t,n,a,i,l){const{visualElement:u}=v.useContext(qh),d=v.useContext(dD),h=v.useContext($0),p=v.useContext(Vh).reducedMotion,g=v.useRef(null);a=a||d.renderer,!g.current&&a&&(g.current=a(e,{visualState:t,parent:u,props:n,presenceContext:h,blockInitialAnimation:h?h.initial===!1:!1,reducedMotionConfig:p,isSVG:l}));const m=g.current,b=v.useContext(vD);m&&!m.projection&&i&&(m.type==="html"||m.type==="svg")&&P7(g.current,n,i,b);const S=v.useRef(!1);v.useInsertionEffect(()=>{m&&S.current&&m.update(n,h)});const j=n[EP],w=v.useRef(!!j&&!window.MotionHandoffIsComplete?.(j)&&window.MotionHasOptimisedAnimation?.(j));return UM(()=>{m&&(S.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),w.current&&m.animationState&&m.animationState.animateChanges())}),v.useEffect(()=>{m&&(!w.current&&m.animationState&&m.animationState.animateChanges(),w.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(j)}),w.current=!1),m.enteringChildren=void 0)}),m}function P7(e,t,n,a){const{layoutId:i,layout:l,drag:u,dragConstraints:d,layoutScroll:h,layoutRoot:p,layoutCrossfade:g}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:xD(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:g,layoutScroll:h,layoutRoot:p})}function xD(e){if(e)return e.options.allowProjection!==!1?e.projection:xD(e.parent)}function Xg(e,{forwardMotionProps:t=!1,type:n}={},a,i){a&&p7(a);const l=n?n==="svg":bw(e),u=l?A7:T7;function d(p,g){let m;const b={...v.useContext(Vh),...p,layoutId:D7(p)},{isStatic:S}=b,j=y7(p),w=u(p,S);if(!S&&HM){k7();const C=L7(b);m=C.MeasureLayout,j.visualElement=M7(e,w,b,i,C.ProjectionNode,l)}return o.jsxs(qh.Provider,{value:j,children:[m&&j.visualElement?o.jsx(m,{visualElement:j.visualElement,...b}):null,N7(e,p,O7(w,j.visualElement,g),w,S,t,l)]})}d.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const h=v.forwardRef(d);return h[R7]=e,h}function D7({layoutId:e}){const t=v.useContext(zM).id;return t&&e!==void 0?t+"-"+e:e}function k7(e,t){v.useContext(dD).strict}function L7(e){const t=fD(),{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 B7(e,t){if(typeof Proxy>"u")return Xg;const n=new Map,a=(l,u)=>Xg(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,Xg(u,void 0,e,t)),n.get(u))})}const F7=(e,t)=>t.isSVG??bw(e)?new wq(t):new mq(t,{allowProjection:e!==v.Fragment});class I7 extends ji{constructor(t){super(t),t.animationState||(t.animationState=Eq(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Hh(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 z7=0;class H7 extends ji{constructor(){super(...arguments),this.id=z7++}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 U7={animation:{Feature:I7},exit:{Feature:H7}};function Qu(e){return{point:{x:e.pageX,y:e.pageY}}}const V7=e=>t=>pw(t)&&e(t,Qu(t));function Su(e,t,n,a){return Lu(e,t,V7(n),a)}const yD=({current:e})=>e?e.ownerDocument.defaultView:null,d_=(e,t)=>Math.abs(e-t);function q7(e,t){const n=d_(e.x,t.x),a=d_(e.y,t.y);return Math.sqrt(n**2+a**2)}const f_=new Set(["auto","scroll"]);class bD{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=S=>{this.handleScroll(S.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const S=Zg(this.lastMoveEventInfo,this.history),j=this.startEvent!==null,w=q7(S.offset,{x:0,y:0})>=this.distanceThreshold;if(!j&&!w)return;const{point:C}=S,{timestamp:N}=Un;this.history.push({...C,timestamp:N});const{onStart:_,onMove:T}=this.handlers;j||(_&&_(this.lastMoveEvent,S),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,S)},this.handlePointerMove=(S,j)=>{this.lastMoveEvent=S,this.lastMoveEventInfo=Qg(j,this.transformPagePoint),on.update(this.updatePoint,!0)},this.handlePointerUp=(S,j)=>{this.end();const{onEnd:w,onSessionEnd:C,resumeAnimation:N}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const _=Zg(S.type==="pointercancel"?this.lastMoveEventInfo:Qg(j,this.transformPagePoint),this.history);this.startEvent&&w&&w(S,_),C&&C(S,_)},!pw(t))return;this.dragSnapToOrigin=l,this.handlers=n,this.transformPagePoint=a,this.distanceThreshold=u,this.contextWindow=i||window;const h=Qu(t),p=Qg(h,this.transformPagePoint),{point:g}=p,{timestamp:m}=Un;this.history=[{...g,timestamp:m}];const{onSessionStart:b}=n;b&&b(t,Zg(p,this.history)),this.removeListeners=Yu(Su(this.contextWindow,"pointermove",this.handlePointerMove),Su(this.contextWindow,"pointerup",this.handlePointerUp),Su(this.contextWindow,"pointercancel",this.handlePointerUp)),d&&this.startScrollTracking(d)}startScrollTracking(t){let n=t.parentElement;for(;n;){const a=getComputedStyle(n);(f_.has(a.overflowX)||f_.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),on.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Wa(this.updatePoint)}}function Qg(e,t){return t?{point:t(e.point)}:e}function h_(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Zg({point:e},t){return{point:e,delta:h_(e,wD(t)),offset:h_(e,$7(t)),velocity:G7(t,.1)}}function $7(e){return e[0]}function wD(e){return e[e.length-1]}function G7(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,a=null;const i=wD(e);for(;n>=0&&(a=e[n],!(i.timestamp-a.timestamp>Ns(t)));)n--;if(!a)return{x:0,y:0};const l=Wr(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 K7(e,{min:t,max:n},a){return t!==void 0&&e<t?e=a?mn(t,e,a.min):Math.max(e,t):n!==void 0&&e>n&&(e=a?mn(n,e,a.max):Math.min(e,n)),e}function p_(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 Y7(e,{top:t,left:n,bottom:a,right:i}){return{x:p_(e.x,n,i),y:p_(e.y,t,a)}}function m_(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 W7(e,t){return{x:m_(e.x,t.x),y:m_(e.y,t.y)}}function X7(e,t){let n=.5;const a=Zn(e),i=Zn(t);return i>a?n=Mu(t.min,t.max-a,e.min):a>i&&(n=Mu(e.min,e.max-i,t.min)),Ya(0,1,n)}function Q7(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 Vb=.35;function Z7(e=Vb){return e===!1?e=0:e===!0&&(e=Vb),{x:g_(e,"left","right"),y:g_(e,"top","bottom")}}function g_(e,t,n){return{min:v_(e,t),max:v_(e,n)}}function v_(e,t){return typeof e=="number"?e:e[t]||0}const J7=new WeakMap;class e${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=Dn(),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(Qu(m).point)):this.pauseAnimation()},u=(m,b)=>{this.stopAnimation();const{drag:S,dragPropagation:j,onDragStart:w}=this.getProps();if(S&&!j&&(this.openDragLock&&this.openDragLock(),this.openDragLock=$V(S),!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),Vr(N=>{let _=this.getAxisMotionValue(N).get()||0;if($a.test(_)){const{projection:T}=this.visualElement;if(T&&T.layout){const O=T.layout.layoutBox[N];O&&(_=Zn(O)*(parseFloat(_)/100))}}this.originPoint[N]=_}),w&&on.postRender(()=>w(m,b)),Lb(this.visualElement,"transform");const{animationState:C}=this.visualElement;C&&C.setActive("whileDrag",!0)},d=(m,b)=>{this.latestPointerEvent=m,this.latestPanInfo=b;const{dragPropagation:S,dragDirectionLock:j,onDirectionLock:w,onDrag:C}=this.getProps();if(!S&&!this.openDragLock)return;const{offset:N}=b;if(j&&this.currentDirection===null){this.currentDirection=t$(N),this.currentDirection!==null&&w&&w(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=()=>Vr(m=>this.getAnimationState(m)==="paused"&&this.getAxisMotionValue(m).animation?.play()),{dragSnapToOrigin:g}=this.getProps();this.panSession=new bD(t,{onSessionStart:l,onStart:u,onMove:d,onSessionEnd:h,resumeAnimation:p},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,distanceThreshold:a,contextWindow:yD(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&&on.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||!_f(t,i,this.currentDirection))return;const l=this.getAxisMotionValue(t);let u=this.originPoint[t]+a[t];this.constraints&&this.constraints[t]&&(u=K7(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=Y7(a.layoutBox,t):this.constraints=!1,this.elastic=Z7(n),i!==this.constraints&&a&&this.constraints&&!this.hasMutatedConstraints&&Vr(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=Q7(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=cq(a,i.root,this.visualElement.getTransformPagePoint());let u=W7(i.layout.layoutBox,l);if(n){const d=n(iq(u));this.hasMutatedConstraints=!!d,d&&(u=VP(d))}return u}startAnimation(t){const{drag:n,dragMomentum:a,dragElastic:i,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:d}=this.getProps(),h=this.constraints||{},p=Vr(g=>{if(!_f(g,n,this.currentDirection))return;let m=h&&h[g]||{};u&&(m={min:0,max:0});const b=i?200:1e6,S=i?40:1e7,j={type:"inertia",velocity:a?t[g]:0,bounceStiffness:b,bounceDamping:S,timeConstant:750,restDelta:1,restSpeed:10,...l,...m};return this.startAxisValueAnimation(g,j)});return Promise.all(p).then(d)}startAxisValueAnimation(t,n){const a=this.getAxisMotionValue(t);return Lb(this.visualElement,t),a.start(cw(t,a,0,n,this.visualElement,!1))}stopAnimation(){Vr(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Vr(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){Vr(n=>{const{drag:a}=this.getProps();if(!_f(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]-mn(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};Vr(u=>{const d=this.getAxisMotionValue(u);if(d&&this.constraints!==!1){const h=d.get();i[u]=X7({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(),Vr(u=>{if(!_f(u,t,null))return;const d=this.getAxisMotionValue(u),{min:h,max:p}=this.constraints[u];d.set(mn(h,p,i[u]))})}addListeners(){if(!this.visualElement.current)return;J7.set(this.visualElement,this);const t=this.visualElement.current,n=Su(t,"pointerdown",h=>{const{drag:p,dragListener:g=!0}=this.getProps();p&&g&&!BP(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()),on.read(a);const u=Lu(window,"resize",()=>this.scalePositionWithinConstraints()),d=i.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:p})=>{this.isDragging&&p&&(Vr(g=>{const m=this.getAxisMotionValue(g);m&&(this.originPoint[g]+=h[g].translate,m.set(m.get()+h[g].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=Vb,dragMomentum:d=!0}=t;return{...t,drag:n,dragDirectionLock:a,dragPropagation:i,dragConstraints:l,dragElastic:u,dragMomentum:d}}}function _f(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function t$(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class n$ extends ji{constructor(t){super(t),this.removeGroupControls=Qr,this.removeListeners=Qr,this.controls=new e$(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Qr}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 x_=e=>(t,n)=>{e&&on.postRender(()=>e(t,n))};class r$ extends ji{constructor(){super(...arguments),this.removePointerDownListener=Qr}onPointerDown(t){this.session=new bD(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:yD(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:a,onPanEnd:i}=this.node.getProps();return{onSessionStart:x_(t),onStart:x_(n),onMove:a,onEnd:(l,u)=>{delete this.session,i&&on.postRender(()=>i(l,u))}}}mount(){this.removePointerDownListener=Su(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 Jg=!1;class a$ extends v.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),Jg&&l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,onExitComplete:()=>this.safeToRemove()})),Vf.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:a,drag:i,isPresent:l}=this.props,{projection:u}=a;return u&&(u.isPresent=l,Jg=!0,i||t.layoutDependency!==n||n===void 0||t.isPresent!==l?u.willUpdate():this.safeToRemove(),t.isPresent!==l&&(l?u.promote():u.relegate()||on.postRender(()=>{const d=u.getStack();(!d||!d.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),hw.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:a}=this.props,{projection:i}=t;Jg=!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 SD(e){const[t,n]=f7(),a=v.useContext(zM);return o.jsx(a$,{...e,layoutGroup:a,switchLayoutGroup:v.useContext(vD),isPresent:t,safeToRemove:n})}const s$={pan:{Feature:r$},drag:{Feature:n$,ProjectionNode:uD,MeasureLayout:SD}};function y_(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&&on.postRender(()=>l(t,Qu(t)))}class i$ extends ji{mount(){const{current:t}=this.node;t&&(this.unmount=GV(t,(n,a)=>(y_(this.node,a,"Start"),i=>y_(this.node,i,"End"))))}unmount(){}}class o$ extends ji{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=Yu(Lu(this.node.current,"focus",()=>this.onFocus()),Lu(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function b_(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&&on.postRender(()=>l(t,Qu(t)))}class l$ extends ji{mount(){const{current:t}=this.node;t&&(this.unmount=WV(t,(n,a)=>(b_(this.node,a,"Start"),(i,{success:l})=>b_(this.node,i,l?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const qb=new WeakMap,ev=new WeakMap,c$=e=>{const t=qb.get(e.target);t&&t(e)},u$=e=>{e.forEach(c$)};function d$({root:e,...t}){const n=e||document;ev.has(n)||ev.set(n,{});const a=ev.get(n),i=JSON.stringify(t);return a[i]||(a[i]=new IntersectionObserver(u$,{root:e,...t})),a[i]}function f$(e,t,n){const a=d$(t);return qb.set(e,n),a.observe(e),()=>{qb.delete(e),a.unobserve(e)}}const h$={some:0,all:1};class p$ extends ji{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:h$[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:g,onViewportLeave:m}=this.node.getProps(),b=p?g:m;b&&b(h)};return f$(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(m$(t,n))&&this.startObserver()}unmount(){}}function m$({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const g$={inView:{Feature:p$},tap:{Feature:l$},focus:{Feature:o$},hover:{Feature:i$}},v$={layout:{ProjectionNode:uD,MeasureLayout:SD}},x$={...U7,...g$,...s$,...v$},y$=B7(x$,F7);function jD(e){const t=q0(()=>ao(e)),{isStatic:n}=v.useContext(Vh);if(n){const[,a]=v.useState(e);v.useEffect(()=>t.on("change",a),[])}return t}function CD(e,t){const n=jD(t()),a=()=>n.set(t());return a(),UM(()=>{const i=()=>on.preRender(a,!1,!0),l=e.map(u=>u.on("change",i));return()=>{l.forEach(u=>u()),Wa(a)}}),n}function b$(e){bu.current=[],e();const t=CD(bu.current,e);return bu.current=void 0,t}function w$(e,t,n,a){if(typeof e=="function")return b$(e);const l=typeof t=="function"?t:QV(t,n,a);return Array.isArray(e)?w_(e,l):w_([e],([u])=>l(u))}function w_(e,t){const n=q0(()=>[]);return CD(e,()=>{n.length=0;const a=e.length;for(let i=0;i<a;i++)n[i]=e[i].get();return t(n)})}function S$(e){const t=v.useRef(0),{isStatic:n}=v.useContext(Vh);v.useEffect(()=>{if(n)return;const a=({timestamp:i,delta:l})=>{t.current||(t.current=i),e(i-t.current,l)};return on.update(a,!0),()=>Wa(a)},[e])}const j$=({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:g=0})=>{const[m,b]=v.useState(!1),S=jD(0),j=v.useRef(0),w=v.useRef(null),C=v.useRef(p==="left"?1:-1),N=n*1e3,_=g*1e3;S$(k=>{if(t||m){w.current=null;return}if(w.current===null){w.current=k;return}const F=k-w.current;if(w.current=k,j.current+=F,d){const W=N+_,ce=W*2,G=j.current%ce;if(G<N){const ie=G/N*100;S.set(C.current===1?ie:100-ie)}else if(G<W)S.set(C.current===1?100:0);else if(G<W+N){const Q=100-(G-W)/N*100;S.set(C.current===1?Q:100-Q)}else S.set(C.current===1?0:100)}else{const W=N+_,ce=j.current%W;if(ce<N){const G=ce/N*100;S.set(C.current===1?G:100-G)}else S.set(C.current===1?100:0)}}),v.useEffect(()=>{C.current=p==="left"?1:-1,j.current=0,S.set(0)},[p]);const T=w$(S,k=>`${150-k*2}% center`),O=v.useCallback(()=>{h&&b(!0)},[h]),M=v.useCallback(()=>{h&&b(!1)},[h]),B={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(y$.span,{className:`inline-block ${a}`,style:{...B,backgroundPosition:T},onMouseEnter:O,onMouseLeave:M,children:e})};let Ur=null;const tv=tM()((e,t)=>({cacheProgress:null,isConnected:!1,connect:()=>{if(Ur){if(Ur.readyState===WebSocket.CONNECTING||Ur.readyState===WebSocket.OPEN)return;Ur=null}const n=new WebSocket(ue.getWebSocketUrl("/ws/cache-progress"));Ur=n,n.onopen=()=>{if(Ur!==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=()=>{Ur===n&&(Ur=null),e({isConnected:!1})},n.onerror=()=>{}},disconnect:()=>{Ur&&(Ur.readyState===WebSocket.OPEN&&Ur.close(),Ur=null),e({isConnected:!1})}})),nv=[{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"}],S_="Dune Weaver",C$=["captive.apple.com","connectivitycheck.gstatic.com","connectivitycheck.android.com","clients3.google.com","nmcheck.gnome.org","network-test.debian.org","msftconnecttest.com","www.msftconnecttest.com"],rv=C$.some(e=>window.location.hostname===e||window.location.hostname.endsWith("."+e));function N$(){const e=Ms(),t=yh();v.useEffect(()=>{window.scrollTo(0,0)},[e.pathname]),v.useEffect(()=>{rv&&e.pathname!=="/wifi-setup"&&e.pathname!=="/captive"&&!sessionStorage.getItem("captive-dismissed")&&t("/captive",{replace:!0})},[e.pathname,t]);const{activeTable:n,tables:a}=IM(),i=a.length>1,[l,u]=v.useState(()=>{if(rv)return!1;if(typeof window<"u"){const K=localStorage.getItem("theme");return K?K==="dark":!0}return!0}),[d,h]=v.useState(S_),[p,g]=v.useState(null),[m,b]=v.useState(null),[S,j]=v.useState(0),C=a.find(K=>K.id===n?.id)?.name||n?.name,N=m||(i&&C?C:d),_=sn(K=>K.isBackendConnected),T=sn(K=>K.connectionAttempts),O=sn(K=>K.status?.connection_status??!1),M=sn(K=>K.status?.is_homing??!1),B=sn(K=>K.status?.sensor_homing_failed??!1),k=sn(K=>K.status?.is_alarm??!1),F=sn(K=>K.status?.current_file??null),W=sn(K=>K.status?.is_running??!1),ce=sn(K=>K.status?.is_paused??!1),G=sn(K=>K.status?.pause_time_remaining??0),[ie,Q]=v.useState(!1),[Z,ve]=v.useState(!1),[P,V]=v.useState(0),[H,se]=v.useState(!1),we=v.useRef(!1),[L,re]=v.useState(!1),[z,ee]=v.useState(!1),[xe,Ne]=v.useState("off"),[fe,Ce]=v.useState(!1),[Pe,ke]=v.useState(()=>sessionStorage.getItem("security-unlocked")==="true"),[Ue,pe]=v.useState(!1),[it,st]=v.useState(""),[Me,ot]=v.useState(!1),$e=()=>{ue.get("/serial_status").then(K=>b(K.connected&&K.hostname?K.hostname:null)).catch(()=>b(null))},Vt=()=>{ue.get("/api/settings").then(K=>{K.app?.name?h(K.app.name):h(S_),g(K.app?.custom_logo||null);const je=K.security?.mode;Ne(je||"off"),Ce(K.security?.has_password||!1)}).catch(()=>{})};v.useEffect(()=>{Vt(),$e();const K=()=>{Vt()},je=()=>{Vt()},nt=gt=>{$e(),gt.detail?.source!=="settings"&&j(Ht=>Ht+1)};return window.addEventListener("branding-updated",K),window.addEventListener("security-updated",je),window.addEventListener("board-connected",nt),()=>{window.removeEventListener("branding-updated",K),window.removeEventListener("security-updated",je),window.removeEventListener("board-connected",nt)}},[n?.id]),v.useEffect(()=>{$e()},[O]),v.useEffect(()=>{ue.get("/api/version").then(K=>{K.update_available&&ee(!0)}).catch(()=>{})},[n?.id]),v.useEffect(()=>{if(!Z||H)return;if(P<=0){ve(!1),se(!1);return}const K=setTimeout(()=>{V(je=>je-1)},1e3);return()=>clearTimeout(K)},[Z,P,H]);const[dt,Lt]=v.useState(!1),[yt,ft]=v.useState(!1),[Ge,ht]=v.useState(!1),[Ct,Jt]=v.useState(256),[Wt,Xt]=v.useState(!1),de=v.useRef(!1),De=v.useRef(0),Te=v.useRef(0),[Be,_e]=v.useState(""),We=K=>{K.preventDefault(),de.current=!0,Xt(!0),De.current="touches"in K?K.touches[0].clientY:K.clientY,Te.current=Ct,document.body.style.cursor="ns-resize",document.body.style.userSelect="none"};v.useEffect(()=>{const K=nt=>{if(!de.current)return;const gt="touches"in nt?nt.touches[0].clientY:nt.clientY,Ht=De.current-gt,rn=Math.min(Math.max(Te.current+Ht,150),window.innerHeight-150);Jt(rn)},je=()=>{de.current&&(de.current=!1,Xt(!1),document.body.style.cursor="",document.body.style.userSelect="")};return window.addEventListener("mousemove",K),window.addEventListener("mouseup",je),window.addEventListener("touchmove",K),window.addEventListener("touchend",je),()=>{window.removeEventListener("mousemove",K),window.removeEventListener("mouseup",je),window.removeEventListener("touchmove",K),window.removeEventListener("touchend",je)}},[]),v.useEffect(()=>{const K=M;!we.current&&K&&Q(!1),we.current&&!K&&(B||(ve(!0),V(5),Q(!1))),we.current=K},[M,B]);const[Nt,bt]=v.useState(!1),[Tt,Rn]=v.useState(!1),qt=F,[$t,It]=v.useState(()=>{if(typeof window<"u"){const K=localStorage.getItem("nowPlayingButtonPos");if(K==="left"||K==="center"||K==="right")return K}return"center"}),[Pt,jt]=v.useState(!1),[q,Se]=v.useState({x:0,y:0}),Oe=v.useRef(null),Ve=v.useRef(null),At=v.useRef(!1),tt=!!qt,Ut=v.useRef(null),J=!!qt||W||ce||G>0;v.useEffect(()=>{Ut.current!==null&&!J&&Ut.current&&bt(!1),Ut.current=J},[J]),v.useEffect(()=>{const K=()=>{bt(!0),Rn(!0),ht(!1),setTimeout(()=>Rn(!1),500)};return window.addEventListener("playback-started",K),()=>window.removeEventListener("playback-started",K)},[]);const[ye,Re]=v.useState([]),[Le,I]=v.useState("ALL"),[be,Ze]=v.useState(0),[Je,at]=v.useState(!1),[mt,dn]=v.useState(!1),D=v.useRef(null),Ee=v.useRef(null),et=v.useRef(0),[zt,Or]=v.useState("app"),[na,Ra]=v.useState([]),[ra,Bs]=v.useState(!1),[aa,jn]=v.useState(null),[_i,sc]=v.useState(!1),Oa=v.useCallback(async()=>{Bs(!0);try{const K=await ue.get("/api/board/logs?limit=1000");Ra(K.lines||[])}catch{}finally{Bs(!1)}},[]),Ja=v.useCallback(async()=>{sc(!0);try{const K=await ue.get("/api/board/bootlog");jn(K.text??"")}catch{Y.error("Could not read the boot log")}finally{sc(!1)}},[]);v.useEffect(()=>{Ge&&(zt==="table"&&na.length===0&&!ra&&Oa(),zt==="boot"&&aa===null&&!_i&&Ja())},[Ge,zt]),v.useEffect(()=>{if(!Ge){D.current&&D.current.readyState===WebSocket.OPEN&&D.current.close(),D.current=null;return}let K=!0;(async()=>{try{const Ht=await ue.get("/api/logs?limit=200"),rn=(Ht.logs||[]).filter(fn=>fn&&fn.message&&fn.message.trim()!=="");Re(rn.reverse()),Ze(Ht.total||0),at(Ht.has_more||!1),et.current=rn.length,setTimeout(()=>{Ee.current&&(Ee.current.scrollTop=Ee.current.scrollHeight)},100)}catch{}})();let nt=null;const gt=()=>{if(D.current){if(D.current.readyState===WebSocket.CONNECTING)return;D.current.readyState===WebSocket.OPEN&&D.current.close(),D.current=null}const Ht=new WebSocket(ue.getWebSocketUrl("/ws/logs"));D.current=Ht,Ht.onopen=()=>{if(!K){Ht.close();return}console.log("Logs WebSocket connected")},Ht.onmessage=rn=>{try{const fn=JSON.parse(rn.data);if(fn.type==="heartbeat")return;const vn=fn.type==="log_entry"?fn.data:fn;if(!vn||!vn.message||vn.message.trim()==="")return;Re(On=>[...On,vn]),setTimeout(()=>{if(Ee.current){const{scrollTop:On,scrollHeight:Ma,clientHeight:_o}=Ee.current;Ma-On-_o<100&&(Ee.current.scrollTop=Ma)}},10)}catch{}},Ht.onclose=()=>{K&&(console.log("Logs WebSocket closed, reconnecting..."),nt=setTimeout(()=>{K&&D.current===Ht&&gt()},3e3))},Ht.onerror=rn=>{console.error("Logs WebSocket error:",rn)}};return gt(),()=>{K=!1,nt&&clearTimeout(nt),D.current&&(D.current.readyState===WebSocket.OPEN&&D.current.close(),D.current=null)}},[Ge,n?.id]);const ad=v.useCallback(async()=>{if(!(mt||!Je)){dn(!0);try{const K=et.current,je=await ue.get(`/api/logs?limit=100&offset=${K}`),nt=(je.logs||[]).filter(gt=>gt&&gt.message&&gt.message.trim()!=="");nt.length>0?(Re(gt=>[...nt.reverse(),...gt]),et.current+=nt.length,at(je.has_more||!1),Ze(je.total||0),setTimeout(()=>{if(Ee.current){const gt=nt.length*24;Ee.current.scrollTop=gt}},10)):at(!1)}catch{}finally{dn(!1)}}},[mt,Je]);v.useEffect(()=>{const K=Ee.current;if(!K||!Ge)return;const je=()=>{K.scrollTop<50&&Je&&!mt&&ad()};return K.addEventListener("scroll",je),()=>K.removeEventListener("scroll",je)},[Ge,Je,mt,ad]);const ic=()=>{ht(K=>!K)},Fs=v.useMemo(()=>{let K=Le==="ALL"?ye:ye.filter(je=>je.level===Le);if(Be){const je=Be.toLowerCase();K=K.filter(nt=>nt.message?.toLowerCase().includes(je)||nt.logger?.toLowerCase().includes(je))}return K},[ye,Le,Be]),oc=K=>{if(!K)return"--:--:--";try{const je=new Date(K);return isNaN(je.getTime())?"--:--:--":je.toLocaleTimeString()}catch{return"--:--:--"}},Ti=()=>zt==="table"?na.join(`
  52. `):zt==="boot"?aa??"":Fs.map(K=>`${oc(K.timestamp)} [${K.level}] ${K.message}`).join(`
  53. `),xo=()=>{Mr(Ti())},Mr=K=>{if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(K).then(()=>{Y.success("Logs copied to clipboard")}).catch(()=>{Y.error("Failed to copy logs")});else{const je=document.createElement("textarea");je.value=K,je.style.position="fixed",je.style.left="-9999px",document.body.appendChild(je),je.select();try{document.execCommand("copy"),Y.success("Logs copied to clipboard")}catch{Y.error("Failed to copy logs")}document.body.removeChild(je)}},Jn=()=>{const K=zt==="app"?Fs.map(rn=>`${rn.timestamp} [${rn.level}] [${rn.logger}] ${rn.message}`).join(`
  54. `):Ti(),je=zt==="app"?"logs":zt==="table"?"table-log":"boot-log",nt=new Blob([K],{type:"text/plain"}),gt=URL.createObjectURL(nt),Ht=document.createElement("a");Ht.href=gt,Ht.download=`dune-weaver-${je}-${new Date().toISOString().split("T")[0]}.txt`,Ht.click(),URL.revokeObjectURL(gt)},lc=async()=>{if(confirm("Restart the table? The controller (DLC32) will reboot and re-home — any running pattern stops."))try{await ue.post("/api/board/restart"),Y.success("Table is restarting…")}catch{Y.error("Failed to restart the table")}},sd=async()=>{if(confirm("Are you sure you want to shutdown the system?"))try{await ue.post("/api/system/shutdown"),Y.success("System is shutting down...")}catch{Y.error("Failed to shutdown system")}},yo=async K=>{re(!0);try{const je=await ue.post("/recover_sensor_homing",{switch_to_crash_homing:K});je.success?Y.success(je.message||"Homing completed successfully"):je.sensor_homing_failed?Y.error(je.message||"Sensor homing failed again"):Y.error(je.message||"Recovery failed")}catch{Y.error("Failed to recover from sensor homing failure")}finally{re(!1)}},cc=async K=>{K.preventDefault(),ot(!1);try{(await ue.post("/api/security/verify",{password:it})).valid?(sessionStorage.setItem("security-unlocked","true"),ke(!0),st(""),Ue&&(pe(!1),t("/settings"))):ot(!0)}catch{ot(!0)}},Ai=()=>{sessionStorage.removeItem("security-unlocked"),ke(!1),t("/")},bp=xe==="lockdown"&&fe&&!Pe,Cn=xe==="play_only"&&fe&&!Pe,bo=xe!=="off"&&fe&&Pe,id=["/settings","/table-control","/wifi-setup"];v.useEffect(()=>{Cn&&id.includes(e.pathname)&&t("/")},[Cn,e.pathname,t]);const uc=["/settings","/table-control"],es=v.useMemo(()=>Cn?nv.filter(K=>!uc.includes(K.path)):nv,[Cn]);v.useEffect(()=>{const K=nv.find(je=>je.path===e.pathname);K?document.title=`${K.title} | ${N}`:document.title=N},[e.pathname,N]),v.useEffect(()=>{l?(document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark")):(document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light"))},[l]);const[wo,So]=v.useState([]),sa=v.useRef(null),qn=tv(K=>K.cacheProgress);v.useEffect(()=>(_&&tv.getState().connect(),()=>tv.getState().disconnect()),[_]);const[od,jo]=v.useState(!1),[er,Is]=v.useState(null),hr=v.useRef(null);v.useEffect(()=>{if(!(!_||M||Z)){hr.current&&hr.current.readyState===WebSocket.OPEN&&hr.current.close(),hr.current=null;return}if(Z&&!M)return;const je=(nt,gt,Ht)=>{So(rn=>{const fn={timestamp:Ht||new Date().toISOString(),level:nt,message:gt};return[...rn,fn].slice(-100)}),setTimeout(()=>{sa.current&&(sa.current.scrollTop=sa.current.scrollHeight)},10)};if(M&&_){So([]),je("INFO","Homing started...");let nt=!0;if(hr.current){if(hr.current.readyState===WebSocket.CONNECTING)return;hr.current.readyState===WebSocket.OPEN&&hr.current.close(),hr.current=null}const gt=new WebSocket(ue.getWebSocketUrl("/ws/logs"));return hr.current=gt,gt.onopen=()=>{nt||gt.close()},gt.onmessage=Ht=>{try{const rn=JSON.parse(Ht.data);if(rn.type==="heartbeat")return;const fn=rn.type==="log_entry"?rn.data:rn;if(!fn||!fn.message||fn.message.trim()==="")return;const vn=fn.message.toLowerCase();(vn.includes("homing")||vn.includes("home")||vn.includes("$h")||vn.includes("idle")||vn.includes("unlock")||vn.includes("alarm")||vn.includes("grbl")||vn.includes("connect")||vn.includes("serial")||vn.includes("device")||vn.includes("position")||vn.includes("zeroing")||vn.includes("movement")||fn.logger?.includes("connection"))&&je(fn.level,fn.message,fn.timestamp)}catch{}},()=>{nt=!1,gt.readyState===WebSocket.OPEN&&gt.close(),hr.current=null}}if(!_){So([]),je("INFO",`Attempting to connect to backend at ${window.location.host}...`);const nt=setInterval(()=>{je("INFO","Retrying connection to WebSocket /ws/status..."),ue.get("/api/settings").then(()=>{je("INFO","HTTP endpoint responding, waiting for WebSocket...")}).catch(()=>{})},3e3);return()=>clearInterval(nt)}},[_,M,Z]);const Ri=v.useRef(qn);v.useEffect(()=>{const K=Ri.current;Ri.current=qn,K?.is_running&&qn?.stage==="complete"&&(localStorage.getItem("cacheAllPromptShown")||setTimeout(()=>{Is(null),jo(!0)},500))},[qn]);const Pr=qn?.total_files?Math.round(qn.processed_files/qn.total_files*100):0,dc=()=>{if(!qn)return"";switch(qn.stage){case"starting":return"Initializing...";case"metadata":return"Processing pattern metadata";case"images":return"Generating pattern previews";default:return"Processing..."}},fc=async()=>{Is({inProgress:!0,completed:0,total:0,done:!1});const K=await BM(je=>{Is({inProgress:!je.done,...je})});K.success?K.cached===0?Y.success("All patterns are already cached!"):Y.success(`Cached ${K.cached} pattern previews`):(Is(null),Y.error("Failed to cache previews"))},zs=()=>{localStorage.setItem("cacheAllPromptShown","true"),jo(!1),Is(null)},Hs=()=>{localStorage.setItem("cacheAllPromptShown","true"),jo(!1),Is(null)},Oi=v.useCallback(()=>{const je=Oe.current?.offsetWidth||140;return{left:16+je/2,center:window.innerWidth/2,right:window.innerWidth-16-je/2}},[]),Co=v.useCallback((K,je)=>{if(!Oe.current)return;const nt=Oe.current.getBoundingClientRect(),gt=nt.left+nt.width/2;Ve.current={x:K,y:je,buttonX:gt},At.current=!1,jt(!0),Se({x:0,y:0})},[]),No=v.useCallback(K=>{if(!Ve.current||!Pt)return;const je=K-Ve.current.x;Math.abs(je)>8&&(At.current=!0),Se({x:je,y:0})},[Pt]),ts=v.useCallback(()=>{if(!Ve.current||!Oe.current){jt(!1),Se({x:0,y:0});return}const K=Ve.current.buttonX+q.x,je=Oi(),nt={left:Math.abs(K-je.left),center:Math.abs(K-je.center),right:Math.abs(K-je.right)};let gt="center",Ht=nt.center;nt.left<Ht&&(gt="left",Ht=nt.left),nt.right<Ht&&(gt="right"),It(gt),localStorage.setItem("nowPlayingButtonPos",gt),jt(!1),Se({x:0,y:0}),Ve.current=null},[q.x,Oi]);v.useEffect(()=>{if(!Pt)return;const K=nt=>{nt.preventDefault(),No(nt.clientX)},je=()=>{ts()};return window.addEventListener("mousemove",K),window.addEventListener("mouseup",je),()=>{window.removeEventListener("mousemove",K),window.removeEventListener("mouseup",je)}},[Pt,No,ts]);const ia=v.useCallback(()=>{const K={bottom:"calc(4.5rem + env(safe-area-inset-bottom, 0px))"};if(Pt&&Ve.current){const nt=Oi()[$t];return{...K,left:nt,transform:`translateX(calc(-50% + ${q.x}px))`,transition:"none",cursor:"grabbing"}}switch($t){case"left":return{...K,left:"1rem",transform:"translateX(0)"};case"right":return{...K,right:"1rem",left:"auto",transform:"translateX(0)"};default:return{...K,left:"50%",transform:"translateX(-50%)"}}},[Pt,q.x,$t,Oi]),Eo=er?.total?Math.round(er.completed/er.total*100):0;return o.jsxs("div",{className:"min-h-dvh bg-background flex flex-col",children:[bp&&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-display font-bold",children:N}),o.jsx("p",{className:"text-muted-foreground",children:"This table is locked. Enter the password to continue."}),o.jsxs("form",{onSubmit:cc,className:"space-y-3",children:[o.jsx(St,{type:"password",placeholder:"Password",value:it,onChange:K=>{st(K.target.value),ot(!1)},autoFocus:!0}),Me&&o.jsx("p",{className:"text-sm text-destructive",children:"Incorrect password"}),o.jsx(le,{type:"submit",className:"w-full",children:"Unlock"})]})]})}),Ue&&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-display 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:cc,className:"space-y-3",children:[o.jsx(St,{type:"password",placeholder:"Password",value:it,onChange:K=>{st(K.target.value),ot(!1)},autoFocus:!0}),Me&&o.jsx("p",{className:"text-sm text-destructive",children:"Incorrect password"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(le,{type:"button",variant:"ghost",className:"flex-1",onClick:()=>{pe(!1),st(""),ot(!1)},children:"Cancel"}),o.jsx(le,{type:"submit",className:"flex-1",children:"Unlock"})]})]})]})})}),B&&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-display 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-primary/10 border border-primary/20 p-3 rounded-lg text-sm text-left",children:[o.jsx("p",{className:"text-primary font-medium mb-2",children:"Troubleshooting steps:"}),o.jsxs("ul",{className:"text-primary 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."}),L?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(le,{onClick:()=>yo(!1),className:"w-full gap-2",children:[o.jsx("span",{className:"material-icons text-base",children:"refresh"}),"Retry Sensor Homing"]}),o.jsxs(le,{variant:"secondary",onClick:()=>yo(!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."})]})]})})})}),qn?.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-display 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:`${Pr}%`}})}),o.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[o.jsxs("span",{children:[qn.processed_files," of ",qn.total_files," patterns"]}),o.jsxs("span",{children:[Pr,"%"]})]})]}),o.jsxs("div",{className:"text-center space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:dc()}),qn.current_file&&o.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-full",children:qn.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"})]})}),od&&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-display 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-primary/10 border border-primary/20 p-3 rounded-lg text-sm",children:o.jsxs("p",{className:"text-primary",children:[o.jsx("strong",{children:"Note:"})," This cache is browser-specific. You'll need to repeat this for each browser you use."]})}),!er&&o.jsxs("div",{className:"flex gap-3 justify-center",children:[o.jsx(le,{variant:"ghost",onClick:zs,children:"Skip for now"}),o.jsxs(le,{variant:"secondary",onClick:fc,className:"gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-lg",children:"cached"}),"Cache All"]})]}),er&&!er.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:`${Eo}%`}})}),o.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[o.jsxs("span",{children:[er.completed," of ",er.total," previews"]}),o.jsxs("span",{children:[Eo,"%"]})]})]}),er?.done&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("p",{className:"text-success flex items-center justify-center gap-2",children:[o.jsx("span",{className:"material-icons text-base",children:"check_circle"}),"All ",er.total," previews cached successfully!"]}),o.jsx(le,{onClick:Hs,className:"w-full",children:"Done"})]})]})})})}),!rv&&!B&&(!_||M&&!ie||Z)&&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 ${Z?"bg-success/10":"bg-primary/10"}`,children:o.jsx("span",{className:`material-icons-outlined text-4xl ${Z?"text-success":M?"text-primary animate-spin":"text-primary animate-pulse"}`,children:Z?"check_circle":"sync"})}),o.jsx("h2",{className:"text-2xl font-display font-bold",children:Z?"Homing Complete":M?"Homing in Progress":"Connecting to Backend"}),o.jsx("p",{className:"text-muted-foreground",children:Z?"Table is ready to use":M?"Moving to home position... This may take up to 90 seconds.":T===0?"Establishing connection...":`Reconnecting... (attempt ${T})`}),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 ${Z?"bg-success":"bg-primary animate-pulse"}`}),o.jsx("span",{children:Z?H?"Viewing logs":`Closing in ${P}s...`:M?"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:M||Z?"Homing Log":"Connection Log"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("button",{onClick:()=>{const K=wo.map(je=>`[${new Date(je.timestamp).toLocaleTimeString()}] [${je.level}] ${je.message}`).join(`
  55. `);Mr(K)},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:[wo.length," entries"]})]})]}),o.jsx("div",{ref:sa,className:"h-48 overflow-auto p-3 font-mono text-xs space-y-0.5",children:wo.map((K,je)=>o.jsxs("div",{className:"py-0.5 flex gap-2",children:[o.jsx("span",{className:"text-muted-foreground shrink-0",children:oc(K.timestamp)}),o.jsxs("span",{className:`shrink-0 font-semibold ${K.level==="ERROR"?"text-destructive":K.level==="WARNING"?"text-primary":K.level==="DEBUG"?"text-muted-foreground":"text-foreground"}`,children:["[",K.level,"]"]}),o.jsx("span",{className:"break-all",children:K.message})]},je))})]}),Z&&o.jsx("div",{className:"flex justify-center gap-3",children:H?o.jsxs(le,{onClick:()=>{ve(!1),se(!1)},className:"gap-2",children:[o.jsx("span",{className:"material-icons text-base",children:"close"}),"Close Logs"]}):o.jsxs(o.Fragment,{children:[o.jsxs(le,{variant:"secondary",onClick:()=>se(!0),className:"gap-2",children:[o.jsx("span",{className:"material-icons text-base",children:"visibility"}),"Keep Open"]}),o.jsxs(le,{onClick:()=>{ve(!1),se(!1)},className:"gap-2",children:[o.jsx("span",{className:"material-icons text-base",children:"close"}),"Dismiss"]})]})}),M&&!Z&&o.jsx("div",{className:"flex justify-center",children:o.jsxs(le,{variant:"ghost",onClick:()=>Q(!0),className:"gap-2 text-muted-foreground",children:[o.jsx("span",{className:"material-icons text-base",children:"visibility_off"}),"Dismiss"]})}),!Z&&o.jsx("p",{className:"text-center text-xs text-muted-foreground",children:M?"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(Qi,{to:"/",children:o.jsx("img",{src:p?ue.getAssetUrl(`/static/custom/${p}`):ue.getAssetUrl("/static/android-chrome-192x192.png"),alt:N,className:"w-8 h-8 rounded-full object-cover"})}),o.jsx(HH,{children:o.jsxs("button",{className:"flex items-center gap-1.5 hover:opacity-80 transition-opacity group",children:[o.jsx(j$,{text:N,className:"font-display font-semibold text-lg",speed:4,color:l?"#A08F77":"#8A7A63",shineColor:l?"#D9B98A":"#A87F45",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 ${_?O?"bg-success animate-pulse":"bg-destructive":"bg-muted-foreground"}`,title:_?O?"Table connected":"Table disconnected":"Backend not connected"})]})})]}),k&&o.jsxs("div",{className:"flex items-center gap-2 min-w-0 mx-2 text-primary",children:[o.jsx("span",{className:"material-icons-outlined text-base shrink-0",children:"warning"}),o.jsx("span",{className:"text-xs truncate hidden sm:inline",children:"Table alarm"}),o.jsx(le,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs border-primary text-primary hover:bg-primary/10",onClick:async()=>{try{await ue.post("/api/board/unlock"),Y.success("Table unlocked")}catch{Y.error("Could not unlock the table")}},children:"Unlock"})]}),o.jsxs("div",{className:"hidden md:flex items-center gap-0 ml-2",children:[bo&&o.jsx(le,{variant:"ghost",size:"icon",className:"rounded-full",onClick:Ai,title:"Lock",children:o.jsx("span",{className:"material-icons-outlined",children:"lock_open"})}),z&&o.jsx(Qi,{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-live animate-pulse"})]})}),o.jsxs(Ru,{open:yt,onOpenChange:ft,children:[o.jsx(Ou,{asChild:!0,children:o.jsx(le,{variant:"ghost",size:"icon",className:"rounded-full","aria-label":"Open menu",children:o.jsx("span",{className:"material-icons-outlined",children:"menu"})})}),o.jsx(zl,{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:ic,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"),ft(!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(jr,{className:"my-1"}),o.jsxs("button",{onClick:lc,className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors text-primary",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"restart_alt"}),"Restart"]}),o.jsxs("button",{onClick:sd,className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors text-destructive",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:[bo&&o.jsx(le,{variant:"ghost",size:"icon",className:"rounded-full",onClick:Ai,title:"Lock",children:o.jsx("span",{className:"material-icons-outlined",children:"lock_open"})}),z&&o.jsx(Qi,{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-live animate-pulse"})]})}),o.jsxs(Ru,{open:dt,onOpenChange:Lt,children:[o.jsx(Ou,{asChild:!0,children:o.jsx(le,{variant:"ghost",size:"icon",className:"rounded-full","aria-label":"Open menu",children:o.jsx("span",{className:"material-icons-outlined",children:dt?"close":"menu"})})}),o.jsx(zl,{align:"end",className:"w-56 p-2",children:o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsxs("button",{onClick:()=>{u(!l),Lt(!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:()=>{ic(),Lt(!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"),Lt(!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(jr,{className:"my-1"}),o.jsxs("button",{onClick:()=>{lc(),Lt(!1)},className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors text-primary",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"restart_alt"}),"Restart"]}),o.jsxs("button",{onClick:()=>{sd(),Lt(!1)},className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors text-destructive",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:Ge?Nt?`calc(${Ct+256+64}px + env(safe-area-inset-bottom, 0px))`:`calc(${Ct+64}px + env(safe-area-inset-bottom, 0px))`:Nt?"calc(20rem + env(safe-area-inset-bottom, 0px))":"calc(8rem + env(safe-area-inset-bottom, 0px))"},children:o.jsx(I8,{context:{isPlayOnlyActive:Cn}},S)}),o.jsx(Vz,{isLogsOpen:Ge,logsDrawerHeight:Ct,isVisible:Nt,openExpanded:Tt,onClose:()=>bt(!1)}),o.jsx("div",{className:`fixed left-0 right-0 z-30 bg-background border-t border-border ${Wt?"":"transition-[height] duration-300"}`,style:{height:Ge?Ct:0,bottom:"calc(4rem + env(safe-area-inset-bottom, 0px))"},children:Ge&&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:We,onTouchStart:We,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("div",{className:"flex items-center rounded-md bg-background border p-0.5",children:[{id:"app",label:"Application"},{id:"table",label:"Table Log"},{id:"boot",label:"Boot Log"}].map(K=>o.jsx("button",{onClick:()=>Or(K.id),className:`text-xs px-2 py-1 rounded transition-colors whitespace-nowrap ${zt===K.id?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"}`,children:K.label},K.id))}),zt==="app"&&o.jsxs("select",{value:Le,onChange:K=>I(K.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:Be,onChange:K=>_e(K.target.value),placeholder:"Search logs...",className:"text-xs bg-background border rounded px-2 py-1 w-28 sm:w-40"}),Be&&o.jsx(le,{variant:"ghost",size:"icon-sm",onClick:()=>_e(""),className:"rounded-full",title:"Clear search",children:o.jsx("span",{className:"material-icons-outlined text-sm",children:"close"})}),zt!=="app"&&o.jsx(le,{variant:"ghost",size:"icon-sm",onClick:zt==="table"?Oa:Ja,disabled:zt==="table"?ra:_i,className:"rounded-full",title:"Refresh",children:o.jsx("span",{className:`material-icons-outlined text-base ${(zt==="table"?ra:_i)?"animate-spin":""}`,children:"refresh"})}),zt==="app"&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[Fs.length,be>0?` of ${be}`:""," entries",Je&&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(le,{variant:"ghost",size:"icon-sm",onClick:xo,className:"rounded-full",title:"Copy logs",children:o.jsx("span",{className:"material-icons-outlined text-base",children:"content_copy"})}),o.jsx(le,{variant:"ghost",size:"icon-sm",onClick:Jn,className:"rounded-full",title:"Download logs",children:o.jsx("span",{className:"material-icons-outlined text-base",children:"download"})}),o.jsx(le,{variant:"ghost",size:"icon-sm",onClick:()=>ht(!1),className:"rounded-full",title:"Close",children:o.jsx("span",{className:"material-icons-outlined text-base",children:"close"})})]})]}),o.jsxs("div",{ref:Ee,className:"h-[calc(100%-40px)] overflow-auto overscroll-contain p-3 font-mono text-xs space-y-0.5",children:[zt==="app"&&o.jsxs(o.Fragment,{children:[mt&&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..."})]}),Je&&!mt&&o.jsx("div",{className:"text-center py-2 text-muted-foreground text-xs",children:"↑ Scroll up to load older logs"}),Fs.length>0?Fs.map((K,je)=>o.jsxs("div",{className:"py-0.5 flex gap-2",children:[o.jsx("span",{className:"text-muted-foreground shrink-0",children:oc(K.timestamp)}),o.jsxs("span",{className:`shrink-0 font-semibold ${K.level==="ERROR"?"text-destructive":K.level==="WARNING"?"text-primary":K.level==="DEBUG"?"text-muted-foreground":"text-foreground"}`,children:["[",K.level||"LOG","]"]}),o.jsx("span",{className:"break-all",children:K.message||""})]},je)):o.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No logs available"})]}),zt==="table"&&(()=>{const K=Be.toLowerCase(),je=K?na.filter(nt=>nt.toLowerCase().includes(K)):na;return je.length>0?je.map((nt,gt)=>o.jsx("div",{className:"py-0.5 text-muted-foreground break-all whitespace-pre-wrap",children:nt},gt)):o.jsx("p",{className:"text-muted-foreground text-center py-4",children:ra?"Loading…":na.length===0?"No table log collected yet — press refresh. History builds up while the table is connected.":"No lines match your search."})})(),zt==="boot"&&(()=>{if(aa===null)return o.jsx("p",{className:"text-muted-foreground text-center py-4",children:_i?"Reading…":"Press refresh to read the boot log."});const K=Be.toLowerCase(),je=aa.trim();if(!je)return o.jsx("p",{className:"text-muted-foreground text-center py-4",children:"(empty)"});const nt=je.split(`
  56. `),gt=K?nt.filter(Ht=>Ht.toLowerCase().includes(K)):nt;return gt.length===0?o.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No lines match your search."}):gt.map((Ht,rn)=>o.jsx("div",{className:"py-0.5 text-success break-all whitespace-pre-wrap",children:Ht},rn))})()]})]})}),!Nt&&o.jsxs("button",{ref:Oe,onClick:()=>{At.current||bt(!0),At.current=!1},onMouseDown:K=>{K.preventDefault(),Co(K.clientX,K.clientY)},onTouchStart:K=>{const je=K.touches[0];Co(je.clientX,je.clientY)},onTouchMove:K=>{const je=K.touches[0];No(je.clientX)},onTouchEnd:()=>{ts()},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 ${Pt?"cursor-grabbing scale-105 shadow-xl":"cursor-grab transition-all duration-300 hover:shadow-xl hover:scale-105 active:scale-95"}`,style:ia(),"aria-label":tt?"Now Playing":"Not Playing",children:[o.jsx("span",{className:`material-icons-outlined text-xl ${tt?"text-primary":"text-muted-foreground"}`,children:tt?"play_circle":"stop_circle"}),o.jsx("span",{className:"text-sm font-medium",children:tt?"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(${es.length+(Cn?1:0)}, minmax(0, 1fr))`},children:[es.map(K=>{const je=e.pathname===K.path;return o.jsxs(Qi,{to:K.path,className:`relative flex flex-col items-center justify-center gap-1 transition-all duration-200 ${je?"text-primary":"text-muted-foreground hover:text-foreground active:scale-95"}`,children:[je&&o.jsx("span",{className:"absolute -top-0.5 w-8 h-1 rounded-full bg-primary"}),o.jsx("span",{className:`text-xl ${je?"material-icons":"material-icons-outlined"}`,children:K.icon}),o.jsx("span",{className:"text-xs font-medium",children:K.label})]},K.path)}),Cn&&o.jsxs("button",{onClick:()=>{pe(!0),st(""),ot(!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 ww(e){const t=v.useRef(e);v.useEffect(()=>{t.current=e},[e]),v.useEffect(()=>{const n=()=>{t.current()};return window.addEventListener("backend-connected",n),()=>{window.removeEventListener("backend-connected",n)}},[])}var E$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_$=E$.reduce((e,t)=>{const n=jh(`Primitive.${t}`),a=v.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}},{}),T$="Label",ND=v.forwardRef((e,t)=>o.jsx(_$.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));ND.displayName=T$;var ED=ND;const A$=qu("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ye=v.forwardRef(({className:e,...t},n)=>o.jsx(ED,{ref:n,className:lt(A$(),e),...t}));Ye.displayName=ED.displayName;function ch(e,[t,n]){return Math.min(n,Math.max(t,e))}var R$=v.createContext(void 0);function Zu(e){const t=v.useContext(R$);return e||t||"ltr"}function $h(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function j_(e){const t=O$(e),n=v.forwardRef((a,i)=>{const{children:l,...u}=a,d=v.Children.toArray(l),h=d.find(P$);if(h){const p=h.props.children,g=d.map(m=>m===h?v.Children.count(p)>1?v.Children.only(null):v.isValidElement(p)?p.props.children:null:m);return o.jsx(t,{...u,ref:i,children:v.isValidElement(p)?v.cloneElement(p,void 0,g):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function O$(e){const t=v.forwardRef((n,a)=>{const{children:i,...l}=n;if(v.isValidElement(i)){const u=k$(i),d=D$(l,i.props);return i.type!==v.Fragment&&(d.ref=a?co(a,u):u),v.cloneElement(i,d)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var M$=Symbol("radix.slottable");function P$(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===M$}function D$(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 k$(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 Gh(e){const t=e+"CollectionProvider",[n,a]=Rr(t),[i,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),u=w=>{const{scope:C,children:N}=w,_=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=j_(d),p=A.forwardRef((w,C)=>{const{scope:N,children:_}=w,T=l(d,N),O=_t(C,T.collectionRef);return o.jsx(h,{ref:O,children:_})});p.displayName=d;const g=e+"CollectionItemSlot",m="data-radix-collection-item",b=j_(g),S=A.forwardRef((w,C)=>{const{scope:N,children:_,...T}=w,O=A.useRef(null),M=_t(C,O),B=l(g,N);return A.useEffect(()=>(B.itemMap.set(O,{ref:O,...T}),()=>{B.itemMap.delete(O)})),o.jsx(b,{[m]:"",ref:M,children:_})});S.displayName=g;function j(w){const C=l(e+"CollectionConsumer",w);return A.useCallback(()=>{const _=C.collectionRef.current;if(!_)return[];const T=Array.from(_.querySelectorAll(`[${m}]`));return Array.from(C.itemMap.values()).sort((B,k)=>T.indexOf(B.ref.current)-T.indexOf(k.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:u,Slot:p,ItemSlot:S},j,a]}var _D=["PageUp","PageDown"],TD=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],AD={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Jl="Slider",[$b,L$,B$]=Gh(Jl),[RD]=Rr(Jl,[B$]),[F$,Kh]=RD(Jl),OD=v.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:g,onValueChange:m=()=>{},onValueCommit:b=()=>{},inverted:S=!1,form:j,...w}=e,C=v.useRef(new Set),N=v.useRef(0),T=u==="horizontal"?I$:z$,[O=[],M]=Jr({prop:g,defaultProp:p,onChange:G=>{[...C.current][N.current]?.focus(),m(G)}}),B=v.useRef(O);function k(G){const ie=$$(O,G);ce(G,ie)}function F(G){ce(G,N.current)}function W(){const G=B.current[N.current];O[N.current]!==G&&b(O)}function ce(G,ie,{commit:Q}={commit:!1}){const Z=W$(l),ve=X$(Math.round((G-a)/l)*l+a,Z),P=ch(ve,[a,i]);M((V=[])=>{const H=V$(V,P,ie);if(Y$(H,h*l)){N.current=H.indexOf(P);const se=String(H)!==String(V);return se&&Q&&b(H),se?H:V}else return V})}return o.jsx(F$,{scope:e.__scopeSlider,name:n,disabled:d,min:a,max:i,valueIndexToChangeRef:N,thumbs:C.current,values:O,orientation:u,form:j,children:o.jsx($b.Provider,{scope:e.__scopeSlider,children:o.jsx($b.Slot,{scope:e.__scopeSlider,children:o.jsx(T,{"aria-disabled":d,"data-disabled":d?"":void 0,...w,ref:t,onPointerDown:Qe(w.onPointerDown,()=>{d||(B.current=O)}),min:a,max:i,inverted:S,onSlideStart:d?void 0:k,onSlideMove:d?void 0:F,onSlideEnd:d?void 0:W,onHomeKeyDown:()=>!d&&ce(a,0,{commit:!0}),onEndKeyDown:()=>!d&&ce(i,O.length-1,{commit:!0}),onStepKeyDown:({event:G,direction:ie})=>{if(!d){const ve=_D.includes(G.key)||G.shiftKey&&TD.includes(G.key)?10:1,P=N.current,V=O[P],H=l*ve*ie;ce(V+H,P,{commit:!0})}}})})})})});OD.displayName=Jl;var[MD,PD]=RD(Jl,{startEdge:"left",endEdge:"right",size:"width",direction:1}),I$=v.forwardRef((e,t)=>{const{min:n,max:a,dir:i,inverted:l,onSlideStart:u,onSlideMove:d,onSlideEnd:h,onStepKeyDown:p,...g}=e,[m,b]=v.useState(null),S=_t(t,T=>b(T)),j=v.useRef(void 0),w=Zu(i),C=w==="ltr",N=C&&!l||!C&&l;function _(T){const O=j.current||m.getBoundingClientRect(),M=[0,O.width],k=Sw(M,N?[n,a]:[a,n]);return j.current=O,k(T-O.left)}return o.jsx(MD,{scope:e.__scopeSlider,startEdge:N?"left":"right",endEdge:N?"right":"left",direction:N?1:-1,size:"width",children:o.jsx(DD,{dir:w,"data-orientation":"horizontal",...g,ref:S,style:{...g.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:T=>{const O=_(T.clientX);u?.(O)},onSlideMove:T=>{const O=_(T.clientX);d?.(O)},onSlideEnd:()=>{j.current=void 0,h?.()},onStepKeyDown:T=>{const M=AD[N?"from-left":"from-right"].includes(T.key);p?.({event:T,direction:M?-1:1})}})})}),z$=v.forwardRef((e,t)=>{const{min:n,max:a,inverted:i,onSlideStart:l,onSlideMove:u,onSlideEnd:d,onStepKeyDown:h,...p}=e,g=v.useRef(null),m=_t(t,g),b=v.useRef(void 0),S=!i;function j(w){const C=b.current||g.current.getBoundingClientRect(),N=[0,C.height],T=Sw(N,S?[a,n]:[n,a]);return b.current=C,T(w-C.top)}return o.jsx(MD,{scope:e.__scopeSlider,startEdge:S?"bottom":"top",endEdge:S?"top":"bottom",size:"height",direction:S?1:-1,children:o.jsx(DD,{"data-orientation":"vertical",...p,ref:m,style:{...p.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:w=>{const C=j(w.clientY);l?.(C)},onSlideMove:w=>{const C=j(w.clientY);u?.(C)},onSlideEnd:()=>{b.current=void 0,d?.()},onStepKeyDown:w=>{const N=AD[S?"from-bottom":"from-top"].includes(w.key);h?.({event:w,direction:N?-1:1})}})})}),DD=v.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:a,onSlideMove:i,onSlideEnd:l,onHomeKeyDown:u,onEndKeyDown:d,onStepKeyDown:h,...p}=e,g=Kh(Jl,n);return o.jsx(ct.span,{...p,ref:t,onKeyDown:Qe(e.onKeyDown,m=>{m.key==="Home"?(u(m),m.preventDefault()):m.key==="End"?(d(m),m.preventDefault()):_D.concat(TD).includes(m.key)&&(h(m),m.preventDefault())}),onPointerDown:Qe(e.onPointerDown,m=>{const b=m.target;b.setPointerCapture(m.pointerId),m.preventDefault(),g.thumbs.has(b)?b.focus():a(m)}),onPointerMove:Qe(e.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&i(m)}),onPointerUp:Qe(e.onPointerUp,m=>{const b=m.target;b.hasPointerCapture(m.pointerId)&&(b.releasePointerCapture(m.pointerId),l(m))})})}),kD="SliderTrack",LD=v.forwardRef((e,t)=>{const{__scopeSlider:n,...a}=e,i=Kh(kD,n);return o.jsx(ct.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...a,ref:t})});LD.displayName=kD;var Gb="SliderRange",BD=v.forwardRef((e,t)=>{const{__scopeSlider:n,...a}=e,i=Kh(Gb,n),l=PD(Gb,n),u=v.useRef(null),d=_t(t,u),h=i.values.length,p=i.values.map(b=>zD(b,i.min,i.max)),g=h>1?Math.min(...p):0,m=100-Math.max(...p);return o.jsx(ct.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...a,ref:d,style:{...e.style,[l.startEdge]:g+"%",[l.endEdge]:m+"%"}})});BD.displayName=Gb;var Kb="SliderThumb",FD=v.forwardRef((e,t)=>{const n=L$(e.__scopeSlider),[a,i]=v.useState(null),l=_t(t,d=>i(d)),u=v.useMemo(()=>a?n().findIndex(d=>d.ref.current===a):-1,[n,a]);return o.jsx(H$,{...e,ref:l,index:u})}),H$=v.forwardRef((e,t)=>{const{__scopeSlider:n,index:a,name:i,...l}=e,u=Kh(Kb,n),d=PD(Kb,n),[h,p]=v.useState(null),g=_t(t,_=>p(_)),m=h?u.form||!!h.closest("form"):!0,b=Bh(h),S=u.values[a],j=S===void 0?0:zD(S,u.min,u.max),w=q$(a,u.values.length),C=b?.[d.size],N=C?G$(C,j,d.direction):0;return v.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($b.ItemSlot,{scope:e.__scopeSlider,children:o.jsx(ct.span,{role:"slider","aria-label":e["aria-label"]||w,"aria-valuemin":u.min,"aria-valuenow":S,"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:g,style:S===void 0?{display:"none"}:e.style,onFocus:Qe(e.onFocus,()=>{u.valueIndexToChangeRef.current=a})})}),m&&o.jsx(ID,{name:i??(u.name?u.name+(u.values.length>1?"[]":""):void 0),form:u.form,value:S},a)]})});FD.displayName=Kb;var U$="RadioBubbleInput",ID=v.forwardRef(({__scopeSlider:e,value:t,...n},a)=>{const i=v.useRef(null),l=_t(i,a),u=$h(t);return v.useEffect(()=>{const d=i.current;if(!d)return;const h=window.HTMLInputElement.prototype,g=Object.getOwnPropertyDescriptor(h,"value").set;if(u!==t&&g){const m=new Event("input",{bubbles:!0});g.call(d,t),d.dispatchEvent(m)}},[u,t]),o.jsx(ct.input,{style:{display:"none"},...n,ref:l,defaultValue:t})});ID.displayName=U$;function V$(e=[],t,n){const a=[...e];return a[n]=t,a.sort((i,l)=>i-l)}function zD(e,t,n){const l=100/(n-t)*(e-t);return ch(l,[0,100])}function q$(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function $$(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 G$(e,t,n){const a=e/2,l=Sw([0,50],[0,a]);return(a-l(t)*n)*n}function K$(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Y$(e,t){if(t>0){const n=K$(e);return Math.min(...n)>=t}return!0}function Sw(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 W$(e){return(String(e).split(".")[1]||"").length}function X$(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var HD=OD,Q$=LD,Z$=BD,J$=FD;const Ia=v.forwardRef(({className:e,...t},n)=>o.jsxs(HD,{ref:n,className:lt("relative flex w-full touch-none select-none items-center",e),...t,children:[o.jsx(Q$,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:o.jsx(Z$,{className:"absolute h-full bg-primary"})}),o.jsx(J$,{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"})]}));Ia.displayName=HD.displayName;function eG(e){const t=tG(e),n=v.forwardRef((a,i)=>{const{children:l,...u}=a,d=v.Children.toArray(l),h=d.find(rG);if(h){const p=h.props.children,g=d.map(m=>m===h?v.Children.count(p)>1?v.Children.only(null):v.isValidElement(p)?p.props.children:null:m);return o.jsx(t,{...u,ref:i,children:v.isValidElement(p)?v.cloneElement(p,void 0,g):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function tG(e){const t=v.forwardRef((n,a)=>{const{children:i,...l}=n;if(v.isValidElement(i)){const u=sG(i),d=aG(l,i.props);return i.type!==v.Fragment&&(d.ref=a?co(a,u):u),v.cloneElement(i,d)}return v.Children.count(i)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var nG=Symbol("radix.slottable");function rG(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===nG}function aG(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 sG(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 UD=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"}),iG="VisuallyHidden",VD=v.forwardRef((e,t)=>o.jsx(ct.span,{...e,ref:t,style:{...UD,...e.style}}));VD.displayName=iG;var oG=VD,lG=[" ","Enter","ArrowUp","ArrowDown"],cG=[" ","Enter"],so="Select",[Yh,Wh,uG]=Gh(so),[ec]=Rr(so,[uG,Wl]),Xh=Wl(),[dG,Ci]=ec(so),[fG,hG]=ec(so),qD=e=>{const{__scopeSelect:t,children:n,open:a,defaultOpen:i,onOpenChange:l,value:u,defaultValue:d,onValueChange:h,dir:p,name:g,autoComplete:m,disabled:b,required:S,form:j}=e,w=Xh(t),[C,N]=v.useState(null),[_,T]=v.useState(null),[O,M]=v.useState(!1),B=Zu(p),[k,F]=Jr({prop:a,defaultProp:i??!1,onChange:l,caller:so}),[W,ce]=Jr({prop:u,defaultProp:d,onChange:h,caller:so}),G=v.useRef(null),ie=C?j||!!C.closest("form"):!0,[Q,Z]=v.useState(new Set),ve=Array.from(Q).map(P=>P.props.value).join(";");return o.jsx(I0,{...w,children:o.jsxs(dG,{required:S,scope:t,trigger:C,onTriggerChange:N,valueNode:_,onValueNodeChange:T,valueNodeHasChildren:O,onValueNodeHasChildrenChange:M,contentId:wa(),value:W,onValueChange:ce,open:k,onOpenChange:F,dir:B,triggerPointerDownPosRef:G,disabled:b,children:[o.jsx(Yh.Provider,{scope:t,children:o.jsx(fG,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(P=>{Z(V=>new Set(V).add(P))},[]),onNativeOptionRemove:v.useCallback(P=>{Z(V=>{const H=new Set(V);return H.delete(P),H})},[]),children:n})}),ie?o.jsxs(pk,{"aria-hidden":!0,required:S,tabIndex:-1,name:g,autoComplete:m,value:W,onChange:P=>ce(P.target.value),disabled:b,form:j,children:[W===void 0?o.jsx("option",{value:""}):null,Array.from(Q)]},ve):null]})})};qD.displayName=so;var $D="SelectTrigger",GD=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:a=!1,...i}=e,l=Xh(n),u=Ci($D,n),d=u.disabled||a,h=_t(t,u.onTriggerChange),p=Wh(n),g=v.useRef("touch"),[m,b,S]=gk(w=>{const C=p().filter(T=>!T.disabled),N=C.find(T=>T.value===u.value),_=vk(C,w,N);_!==void 0&&u.onValueChange(_.value)}),j=w=>{d||(u.onOpenChange(!0),S()),w&&(u.triggerPointerDownPosRef.current={x:Math.round(w.pageX),y:Math.round(w.pageY)})};return o.jsx(Fh,{asChild:!0,...l,children:o.jsx(ct.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":mk(u.value)?"":void 0,...i,ref:h,onClick:Qe(i.onClick,w=>{w.currentTarget.focus(),g.current!=="mouse"&&j(w)}),onPointerDown:Qe(i.onPointerDown,w=>{g.current=w.pointerType;const C=w.target;C.hasPointerCapture(w.pointerId)&&C.releasePointerCapture(w.pointerId),w.button===0&&w.ctrlKey===!1&&w.pointerType==="mouse"&&(j(w),w.preventDefault())}),onKeyDown:Qe(i.onKeyDown,w=>{const C=m.current!=="";!(w.ctrlKey||w.altKey||w.metaKey)&&w.key.length===1&&b(w.key),!(C&&w.key===" ")&&lG.includes(w.key)&&(j(),w.preventDefault())})})})});GD.displayName=$D;var KD="SelectValue",YD=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:i,children:l,placeholder:u="",...d}=e,h=Ci(KD,n),{onValueNodeHasChildrenChange:p}=h,g=l!==void 0,m=_t(t,h.onValueNodeChange);return Vn(()=>{p(g)},[p,g]),o.jsx(ct.span,{...d,ref:m,style:{pointerEvents:"none"},children:mk(h.value)?o.jsx(o.Fragment,{children:u}):l})});YD.displayName=KD;var pG="SelectIcon",WD=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:a,...i}=e;return o.jsx(ct.span,{"aria-hidden":!0,...i,ref:t,children:a||"▼"})});WD.displayName=pG;var mG="SelectPortal",XD=e=>o.jsx(Nh,{asChild:!0,...e});XD.displayName=mG;var io="SelectContent",QD=v.forwardRef((e,t)=>{const n=Ci(io,e.__scopeSelect),[a,i]=v.useState();if(Vn(()=>{i(new DocumentFragment)},[]),!n.open){const l=a;return l?Vu.createPortal(o.jsx(ZD,{scope:e.__scopeSelect,children:o.jsx(Yh.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),l):null}return o.jsx(JD,{...e,ref:t})});QD.displayName=io;var ga=10,[ZD,Ni]=ec(io),gG="SelectContentImpl",vG=eG("SelectContent.RemoveScroll"),JD=v.forwardRef((e,t)=>{const{__scopeSelect:n,position:a="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:l,onPointerDownOutside:u,side:d,sideOffset:h,align:p,alignOffset:g,arrowPadding:m,collisionBoundary:b,collisionPadding:S,sticky:j,hideWhenDetached:w,avoidCollisions:C,...N}=e,_=Ci(io,n),[T,O]=v.useState(null),[M,B]=v.useState(null),k=_t(t,fe=>O(fe)),[F,W]=v.useState(null),[ce,G]=v.useState(null),ie=Wh(n),[Q,Z]=v.useState(!1),ve=v.useRef(!1);v.useEffect(()=>{if(T)return N0(T)},[T]),C0();const P=v.useCallback(fe=>{const[Ce,...Pe]=ie().map(pe=>pe.ref.current),[ke]=Pe.slice(-1),Ue=document.activeElement;for(const pe of fe)if(pe===Ue||(pe?.scrollIntoView({block:"nearest"}),pe===Ce&&M&&(M.scrollTop=0),pe===ke&&M&&(M.scrollTop=M.scrollHeight),pe?.focus(),document.activeElement!==Ue))return},[ie,M]),V=v.useCallback(()=>P([F,T]),[P,F,T]);v.useEffect(()=>{Q&&V()},[Q,V]);const{onOpenChange:H,triggerPointerDownPosRef:se}=_;v.useEffect(()=>{if(T){let fe={x:0,y:0};const Ce=ke=>{fe={x:Math.abs(Math.round(ke.pageX)-(se.current?.x??0)),y:Math.abs(Math.round(ke.pageY)-(se.current?.y??0))}},Pe=ke=>{fe.x<=10&&fe.y<=10?ke.preventDefault():T.contains(ke.target)||H(!1),document.removeEventListener("pointermove",Ce),se.current=null};return se.current!==null&&(document.addEventListener("pointermove",Ce),document.addEventListener("pointerup",Pe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Ce),document.removeEventListener("pointerup",Pe,{capture:!0})}}},[T,H,se]),v.useEffect(()=>{const fe=()=>H(!1);return window.addEventListener("blur",fe),window.addEventListener("resize",fe),()=>{window.removeEventListener("blur",fe),window.removeEventListener("resize",fe)}},[H]);const[we,L]=gk(fe=>{const Ce=ie().filter(Ue=>!Ue.disabled),Pe=Ce.find(Ue=>Ue.ref.current===document.activeElement),ke=vk(Ce,fe,Pe);ke&&setTimeout(()=>ke.ref.current.focus())}),re=v.useCallback((fe,Ce,Pe)=>{const ke=!ve.current&&!Pe;(_.value!==void 0&&_.value===Ce||ke)&&(W(fe),ke&&(ve.current=!0))},[_.value]),z=v.useCallback(()=>T?.focus(),[T]),ee=v.useCallback((fe,Ce,Pe)=>{const ke=!ve.current&&!Pe;(_.value!==void 0&&_.value===Ce||ke)&&G(fe)},[_.value]),xe=a==="popper"?Yb:ek,Ne=xe===Yb?{side:d,sideOffset:h,align:p,alignOffset:g,arrowPadding:m,collisionBoundary:b,collisionPadding:S,sticky:j,hideWhenDetached:w,avoidCollisions:C}:{};return o.jsx(ZD,{scope:n,content:T,viewport:M,onViewportChange:B,itemRefCallback:re,selectedItem:F,onItemLeave:z,itemTextRefCallback:ee,focusSelectedItem:V,selectedItemText:ce,position:a,isPositioned:Q,searchRef:we,children:o.jsx(_h,{as:vG,allowPinchZoom:!0,children:o.jsx(Ch,{asChild:!0,trapped:_.open,onMountAutoFocus:fe=>{fe.preventDefault()},onUnmountAutoFocus:Qe(i,fe=>{_.trigger?.focus({preventScroll:!0}),fe.preventDefault()}),children:o.jsx($u,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:fe=>fe.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:o.jsx(xe,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:fe=>fe.preventDefault(),...N,...Ne,onPlaced:()=>Z(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...N.style},onKeyDown:Qe(N.onKeyDown,fe=>{const Ce=fe.ctrlKey||fe.altKey||fe.metaKey;if(fe.key==="Tab"&&fe.preventDefault(),!Ce&&fe.key.length===1&&L(fe.key),["ArrowUp","ArrowDown","Home","End"].includes(fe.key)){let ke=ie().filter(Ue=>!Ue.disabled).map(Ue=>Ue.ref.current);if(["ArrowUp","End"].includes(fe.key)&&(ke=ke.slice().reverse()),["ArrowUp","ArrowDown"].includes(fe.key)){const Ue=fe.target,pe=ke.indexOf(Ue);ke=ke.slice(pe+1)}setTimeout(()=>P(ke)),fe.preventDefault()}})})})})})})});JD.displayName=gG;var xG="SelectItemAlignedPosition",ek=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:a,...i}=e,l=Ci(io,n),u=Ni(io,n),[d,h]=v.useState(null),[p,g]=v.useState(null),m=_t(t,k=>g(k)),b=Wh(n),S=v.useRef(!1),j=v.useRef(!0),{viewport:w,selectedItem:C,selectedItemText:N,focusSelectedItem:_}=u,T=v.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&p&&w&&C&&N){const k=l.trigger.getBoundingClientRect(),F=p.getBoundingClientRect(),W=l.valueNode.getBoundingClientRect(),ce=N.getBoundingClientRect();if(l.dir!=="rtl"){const Ue=ce.left-F.left,pe=W.left-Ue,it=k.left-pe,st=k.width+it,Me=Math.max(st,F.width),ot=window.innerWidth-ga,$e=ch(pe,[ga,Math.max(ga,ot-Me)]);d.style.minWidth=st+"px",d.style.left=$e+"px"}else{const Ue=F.right-ce.right,pe=window.innerWidth-W.right-Ue,it=window.innerWidth-k.right-pe,st=k.width+it,Me=Math.max(st,F.width),ot=window.innerWidth-ga,$e=ch(pe,[ga,Math.max(ga,ot-Me)]);d.style.minWidth=st+"px",d.style.right=$e+"px"}const G=b(),ie=window.innerHeight-ga*2,Q=w.scrollHeight,Z=window.getComputedStyle(p),ve=parseInt(Z.borderTopWidth,10),P=parseInt(Z.paddingTop,10),V=parseInt(Z.borderBottomWidth,10),H=parseInt(Z.paddingBottom,10),se=ve+P+Q+H+V,we=Math.min(C.offsetHeight*5,se),L=window.getComputedStyle(w),re=parseInt(L.paddingTop,10),z=parseInt(L.paddingBottom,10),ee=k.top+k.height/2-ga,xe=ie-ee,Ne=C.offsetHeight/2,fe=C.offsetTop+Ne,Ce=ve+P+fe,Pe=se-Ce;if(Ce<=ee){const Ue=G.length>0&&C===G[G.length-1].ref.current;d.style.bottom="0px";const pe=p.clientHeight-w.offsetTop-w.offsetHeight,it=Math.max(xe,Ne+(Ue?z:0)+pe+V),st=Ce+it;d.style.height=st+"px"}else{const Ue=G.length>0&&C===G[0].ref.current;d.style.top="0px";const it=Math.max(ee,ve+w.offsetTop+(Ue?re:0)+Ne)+Pe;d.style.height=it+"px",w.scrollTop=Ce-ee+w.offsetTop}d.style.margin=`${ga}px 0`,d.style.minHeight=we+"px",d.style.maxHeight=ie+"px",a?.(),requestAnimationFrame(()=>S.current=!0)}},[b,l.trigger,l.valueNode,d,p,w,C,N,l.dir,a]);Vn(()=>T(),[T]);const[O,M]=v.useState();Vn(()=>{p&&M(window.getComputedStyle(p).zIndex)},[p]);const B=v.useCallback(k=>{k&&j.current===!0&&(T(),_?.(),j.current=!1)},[T,_]);return o.jsx(bG,{scope:n,contentWrapper:d,shouldExpandOnScrollRef:S,onScrollButtonChange:B,children:o.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:O},children:o.jsx(ct.div,{...i,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});ek.displayName=xG;var yG="SelectPopperPosition",Yb=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:a="start",collisionPadding:i=ga,...l}=e,u=Xh(n);return o.jsx(z0,{...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)"}})});Yb.displayName=yG;var[bG,jw]=ec(io,{}),Wb="SelectViewport",tk=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:a,...i}=e,l=Ni(Wb,n),u=jw(Wb,n),d=_t(t,l.onViewportChange),h=v.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(Yh.Slot,{scope:n,children:o.jsx(ct.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Qe(i.onScroll,p=>{const g=p.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:b}=u;if(b?.current&&m){const S=Math.abs(h.current-g.scrollTop);if(S>0){const j=window.innerHeight-ga*2,w=parseFloat(m.style.minHeight),C=parseFloat(m.style.height),N=Math.max(w,C);if(N<j){const _=N+S,T=Math.min(j,_),O=_-T;m.style.height=T+"px",m.style.bottom==="0px"&&(g.scrollTop=O>0?O:0,m.style.justifyContent="flex-end")}}}h.current=g.scrollTop})})})]})});tk.displayName=Wb;var nk="SelectGroup",[wG,SG]=ec(nk),jG=v.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,i=wa();return o.jsx(wG,{scope:n,id:i,children:o.jsx(ct.div,{role:"group","aria-labelledby":i,...a,ref:t})})});jG.displayName=nk;var rk="SelectLabel",ak=v.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,i=SG(rk,n);return o.jsx(ct.div,{id:i.id,...a,ref:t})});ak.displayName=rk;var uh="SelectItem",[CG,sk]=ec(uh),ik=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:a,disabled:i=!1,textValue:l,...u}=e,d=Ci(uh,n),h=Ni(uh,n),p=d.value===a,[g,m]=v.useState(l??""),[b,S]=v.useState(!1),j=_t(t,_=>h.itemRefCallback?.(_,a,i)),w=wa(),C=v.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(CG,{scope:n,value:a,disabled:i,textId:w,isSelected:p,onItemTextChange:v.useCallback(_=>{m(T=>T||(_?.textContent??"").trim())},[]),children:o.jsx(Yh.ItemSlot,{scope:n,value:a,disabled:i,textValue:g,children:o.jsx(ct.div,{role:"option","aria-labelledby":w,"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:Qe(u.onFocus,()=>S(!0)),onBlur:Qe(u.onBlur,()=>S(!1)),onClick:Qe(u.onClick,()=>{C.current!=="mouse"&&N()}),onPointerUp:Qe(u.onPointerUp,()=>{C.current==="mouse"&&N()}),onPointerDown:Qe(u.onPointerDown,_=>{C.current=_.pointerType}),onPointerMove:Qe(u.onPointerMove,_=>{C.current=_.pointerType,i?h.onItemLeave?.():C.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Qe(u.onPointerLeave,_=>{_.currentTarget===document.activeElement&&h.onItemLeave?.()}),onKeyDown:Qe(u.onKeyDown,_=>{h.searchRef?.current!==""&&_.key===" "||(cG.includes(_.key)&&N(),_.key===" "&&_.preventDefault())})})})})});ik.displayName=uh;var uu="SelectItemText",ok=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:i,...l}=e,u=Ci(uu,n),d=Ni(uu,n),h=sk(uu,n),p=hG(uu,n),[g,m]=v.useState(null),b=_t(t,N=>m(N),h.onItemTextChange,N=>d.itemTextRefCallback?.(N,h.value,h.disabled)),S=g?.textContent,j=v.useMemo(()=>o.jsx("option",{value:h.value,disabled:h.disabled,children:S},h.value),[h.disabled,h.value,S]),{onNativeOptionAdd:w,onNativeOptionRemove:C}=p;return Vn(()=>(w(j),()=>C(j)),[w,C,j]),o.jsxs(o.Fragment,{children:[o.jsx(ct.span,{id:h.textId,...l,ref:b}),h.isSelected&&u.valueNode&&!u.valueNodeHasChildren?Vu.createPortal(l.children,u.valueNode):null]})});ok.displayName=uu;var lk="SelectItemIndicator",ck=v.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return sk(lk,n).isSelected?o.jsx(ct.span,{"aria-hidden":!0,...a,ref:t}):null});ck.displayName=lk;var Xb="SelectScrollUpButton",uk=v.forwardRef((e,t)=>{const n=Ni(Xb,e.__scopeSelect),a=jw(Xb,e.__scopeSelect),[i,l]=v.useState(!1),u=_t(t,a.onScrollButtonChange);return Vn(()=>{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(fk,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=n;d&&h&&(d.scrollTop=d.scrollTop-h.offsetHeight)}}):null});uk.displayName=Xb;var Qb="SelectScrollDownButton",dk=v.forwardRef((e,t)=>{const n=Ni(Qb,e.__scopeSelect),a=jw(Qb,e.__scopeSelect),[i,l]=v.useState(!1),u=_t(t,a.onScrollButtonChange);return Vn(()=>{if(n.viewport&&n.isPositioned){let d=function(){const p=h.scrollHeight-h.clientHeight,g=Math.ceil(h.scrollTop)<p;l(g)};const h=n.viewport;return d(),h.addEventListener("scroll",d),()=>h.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),i?o.jsx(fk,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=n;d&&h&&(d.scrollTop=d.scrollTop+h.offsetHeight)}}):null});dk.displayName=Qb;var fk=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:a,...i}=e,l=Ni("SelectScrollButton",n),u=v.useRef(null),d=Wh(n),h=v.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return v.useEffect(()=>()=>h(),[h]),Vn(()=>{d().find(g=>g.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[d]),o.jsx(ct.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Qe(i.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(a,50))}),onPointerMove:Qe(i.onPointerMove,()=>{l.onItemLeave?.(),u.current===null&&(u.current=window.setInterval(a,50))}),onPointerLeave:Qe(i.onPointerLeave,()=>{h()})})}),NG="SelectSeparator",hk=v.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return o.jsx(ct.div,{"aria-hidden":!0,...a,ref:t})});hk.displayName=NG;var Zb="SelectArrow",EG=v.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,i=Xh(n),l=Ci(Zb,n),u=Ni(Zb,n);return l.open&&u.position==="popper"?o.jsx(H0,{...i,...a,ref:t}):null});EG.displayName=Zb;var _G="SelectBubbleInput",pk=v.forwardRef(({__scopeSelect:e,value:t,...n},a)=>{const i=v.useRef(null),l=_t(a,i),u=$h(t);return v.useEffect(()=>{const d=i.current;if(!d)return;const h=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(h,"value").set;if(u!==t&&g){const m=new Event("change",{bubbles:!0});g.call(d,t),d.dispatchEvent(m)}},[u,t]),o.jsx(ct.select,{...n,style:{...UD,...n.style},ref:l,defaultValue:t})});pk.displayName=_G;function mk(e){return e===""||e===void 0}function gk(e){const t=gi(e),n=v.useRef(""),a=v.useRef(0),i=v.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=v.useCallback(()=>{n.current="",window.clearTimeout(a.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(a.current),[]),[n,i,l]}function vk(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=TG(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 TG(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var AG=qD,xk=GD,RG=YD,OG=WD,MG=XD,yk=QD,PG=tk,bk=ak,wk=ik,DG=ok,kG=ck,Sk=uk,jk=dk,Ck=hk;const lr=AG,Cr=RG,Wn=v.forwardRef(({className:e,children:t,...n},a)=>o.jsxs(xk,{ref:a,className:lt("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(OG,{asChild:!0,children:o.jsx(A0,{className:"h-4 w-4 opacity-50"})})]}));Wn.displayName=xk.displayName;const Nk=v.forwardRef(({className:e,...t},n)=>o.jsx(Sk,{ref:n,className:lt("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(wz,{className:"h-4 w-4"})}));Nk.displayName=Sk.displayName;const Ek=v.forwardRef(({className:e,...t},n)=>o.jsx(jk,{ref:n,className:lt("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(A0,{className:"h-4 w-4"})}));Ek.displayName=jk.displayName;const Xn=v.forwardRef(({className:e,children:t,position:n="popper",...a},i)=>o.jsx(MG,{children:o.jsxs(yk,{ref:i,className:lt("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(Nk,{}),o.jsx(PG,{className:lt("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(Ek,{})]})}));Xn.displayName=yk.displayName;const LG=v.forwardRef(({className:e,...t},n)=>o.jsx(bk,{ref:n,className:lt("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));LG.displayName=bk.displayName;const Mt=v.forwardRef(({className:e,children:t,...n},a)=>o.jsxs(wk,{ref:a,className:lt("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(kG,{children:o.jsx(yb,{className:"h-4 w-4"})})}),o.jsx(DG,{children:t})]}));Mt.displayName=wk.displayName;const BG=v.forwardRef(({className:e,...t},n)=>o.jsx(Ck,{ref:n,className:lt("-mx-1 my-1 h-px bg-muted",e),...t}));BG.displayName=Ck.displayName;const FG=YO,IG=WO,_k=v.forwardRef(({className:e,...t},n)=>o.jsx(Ah,{className:lt("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}));_k.displayName=Ah.displayName;const zG=qu("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"}}),Tk=v.forwardRef(({side:e="right",className:t,children:n,...a},i)=>o.jsxs(IG,{children:[o.jsx(_k,{}),o.jsxs(Rh,{ref:i,className:lt(zG({side:e}),t),...a,children:[n,o.jsxs(XO,{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(JO,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Tk.displayName=Rh.displayName;const Ak=({className:e,...t})=>o.jsx("div",{className:lt("flex flex-col space-y-2 text-center sm:text-left",e),...t});Ak.displayName="SheetHeader";const Rk=v.forwardRef(({className:e,...t},n)=>o.jsx(Oh,{ref:n,className:lt("font-display text-lg font-semibold text-foreground",e),...t}));Rk.displayName=Oh.displayName;const HG=v.forwardRef(({className:e,...t},n)=>o.jsx(Mh,{ref:n,className:lt("text-sm text-muted-foreground",e),...t}));HG.displayName=Mh.displayName;const Jb=[{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"}],Ok=v.createContext(null);function UG(){const{isPlayOnlyActive:e}=IR()||{},[t,n]=v.useState([]),[a,i]=v.useState({}),[l,u]=v.useState(!0),[d,h]=v.useState(""),[p,g]=v.useState("all"),[m,b]=v.useState("name"),[S,j]=v.useState(!0),[w,C]=v.useState(null),[N,_]=v.useState(!1),[T,O]=v.useState(()=>localStorage.getItem("preExecution")||"adaptive"),[M,B]=v.useState(!1),[k,F]=v.useState(!1),[W,ce]=v.useState([]),[G,ie]=v.useState(!1),[Q,Z]=v.useState(!1),[ve,P]=v.useState(1),[V,H]=v.useState(0),[se,we]=v.useState(null),[L,re]=v.useState({}),z=v.useRef(null),ee=v.useRef(null),xe=v.useRef(0),Ne=v.useRef(new Set),fe=v.useRef(null),Ce=v.useRef(null),[Pe,ke]=v.useState(!1),[Ue,pe]=v.useState(0),[it,st]=v.useState(!1),[Me,ot]=v.useState(new Set),$e=v.useRef(null),[Vt,dt]=v.useState(!1),Lt=v.useRef(null),yt=J=>{Lt.current={x:J.touches[0].clientX,y:J.touches[0].clientY}},ft=J=>{if(!Lt.current)return;const ye=J.changedTouches[0].clientX-Lt.current.x,Re=J.changedTouches[0].clientY-Lt.current.y;(ye>80&&ye>Math.abs(Re)||Re>80&&Re>Math.abs(ye))&&_(!1),Lt.current=null};v.useEffect(()=>{const J=()=>{_(!1)};return window.addEventListener("playback-started",J),()=>window.removeEventListener("playback-started",J)},[]),v.useEffect(()=>{localStorage.setItem("preExecution",T)},[T]),v.useEffect(()=>(zh().then(()=>{Ct()}).catch(()=>{Ct()}),Ge(),()=>{fe.current&&clearTimeout(fe.current),Ce.current&&Ce.current.abort(),Ne.current.clear()}),[]),ww(()=>{Ct(),Ge()});const Ge=async()=>{try{const J=await ue.get("/get_playlist?name=Favorites");ot(new Set(J.files||[]))}catch{}},ht=async(J,ye)=>{ye.stopPropagation();const Re=Me.has(J),Le=new Set(Me);try{if(Re)Le.delete(J),await ue.post("/modify_playlist",{playlist_name:"Favorites",files:Array.from(Le)}),ot(Le),Y.success("Removed from favorites");else{Le.add(J);try{await ue.get("/get_playlist?name=Favorites"),await ue.post("/add_to_playlist",{playlist_name:"Favorites",pattern:J})}catch{await ue.post("/create_playlist",{playlist_name:"Favorites",files:[J]})}ot(Le),Y.success("Added to favorites")}}catch{Y.error("Failed to update favorites")}},Ct=async()=>{u(!0);try{const[J,ye]=await Promise.all([ue.get("/list_theta_rho_files_with_metadata"),ue.get("/api/pattern_history_all")]);if(n(J),re(ye),J.length>0){const Re=[...J].sort((at,mt)=>at.name.localeCompare(mt.name)),Le=J.map(at=>at.path),I=Re.slice(0,30).map(at=>at.path),be=await vu(I);if(be.size>0){const at={};be.forEach((mt,dn)=>{at[dn]=mt}),i(at)}const Ze=I.filter(at=>!be.has(at));Ze.length>0&&Jt(Ze);const Je=await vu(Le);st(Je.size===Le.length)}}catch(J){console.error("Error fetching patterns:",J),Y.error("Failed to load patterns")}finally{u(!1)}},Jt=async J=>{Ce.current=new AbortController;const Re=Ce.current.signal;try{const Le=await vu(J);if(Le.size>0){const be={};Le.forEach((Ze,Je)=>{be[Je]=Ze}),i(Ze=>({...Ze,...be}))}const I=J.filter(be=>!Le.has(be));if(I.length>0)for(let be=0;be<I.length&&!Re.aborted;be+=10){const Ze=I.slice(be,be+10);try{const Je=await ue.post("/preview_thr_batch",{file_names:Ze},Re);for(const[at,mt]of Object.entries(Je))mt&&!mt.error&&V0(at,mt);i(at=>({...at,...Je}))}catch(Je){if(Je instanceof Error&&Je.name==="AbortError")break}be+10<I.length&&await new Promise(Je=>setTimeout(Je,100))}}catch(Le){if(Le instanceof Error&&Le.name==="AbortError")return;console.error("Error fetching previews:",Le)}},Wt=async J=>{ie(!0);try{const ye=await ue.post("/get_theta_rho_coordinates",{file_name:J});ce(ye.coordinates||[])}catch(ye){console.error("Error fetching coordinates:",ye),Y.error("Failed to load pattern coordinates")}finally{ie(!1)}},Xt=v.useMemo(()=>{const J=new Set(t.map(ye=>ye.category));return["all",...Array.from(J).sort()]},[t]),de=v.useMemo(()=>{let J=t;return p!=="all"&&(J=J.filter(ye=>ye.category===p)),d&&(J=J.filter(ye=>_u(ye.name,d)||_u(ye.category,d))),J=[...J].sort((ye,Re)=>{let Le=0;switch(m){case"name":Le=ye.name.localeCompare(Re.name);break;case"date":Le=ye.date_modified-Re.date_modified;break;case"size":Le=ye.coordinates_count-Re.coordinates_count;break;case"favorites":{const I=Me.has(ye.path)?1:0;Le=(Me.has(Re.path)?1:0)-I,Le===0&&(Le=ye.name.localeCompare(Re.name));break}case"plays":{const I=ye.path.split("/").pop()||"",be=Re.path.split("/").pop()||"",Ze=L[I]?.play_count??0,Je=L[be]?.play_count??0;Le=Ze-Je,Le===0&&(Le=ye.name.localeCompare(Re.name));break}case"last_played":{const I=ye.path.split("/").pop()||"",be=Re.path.split("/").pop()||"",Ze=L[I]?.last_played||"",Je=L[be]?.last_played||"";Le=Ze.localeCompare(Je),Le===0&&(Le=ye.name.localeCompare(Re.name));break}default:return 0}return S?Le:-Le}),J},[t,p,d,m,S,Me,L]),De=v.useCallback(J=>{a[J]||Ne.current.has(J)||(Ne.current.add(J),fe.current&&clearTimeout(fe.current),fe.current=setTimeout(()=>{const ye=Array.from(Ne.current);ye.length>0&&(Ne.current.clear(),Jt(ye))},50))},[a]),Te=v.useCallback((J,ye,Re)=>{const Le=Re/2,I=Re/2,be=Re/2*.9*ye,Ze=Le+be*Math.cos(J),Je=I+be*Math.sin(J);return{x:Ze,y:Je}},[]),Be=v.useRef(null),_e=v.useRef(-1),We=v.useRef(null),Nt=v.useCallback(()=>{const J=document.documentElement.classList.contains("dark"),ye=getComputedStyle(document.documentElement),Re=(Le,I)=>ye.getPropertyValue(Le).trim()||I;return{isDark:J,bgOuter:Re("--color-background",J?"#171310":"#F5EFE6"),bgInner:Re("--color-card",J?"#211C17":"#FDFAF4"),borderColor:Re("--color-border",J?"#352D23":"#E2D6C2"),lineColor:Re("--color-foreground",J?"#F2EAD9":"#292219"),markerColor:Re("--color-live",J?"#7BC4B0":"#35836F"),markerBorder:Re("--color-card",J?"#211C17":"#FDFAF4")}},[]),bt=v.useCallback((J,ye)=>{const Re=Nt();Be.current||(Be.current=document.createElement("canvas"));const Le=Be.current;Le.width=J,Le.height=J;const I=Le.getContext("2d");if(I){if(I.fillStyle=Re.bgOuter,I.fillRect(0,0,J,J),I.beginPath(),I.arc(J/2,J/2,J/2*.95,0,Math.PI*2),I.fillStyle=Re.bgInner,I.fill(),I.strokeStyle=Re.borderColor,I.lineWidth=1,I.stroke(),I.strokeStyle=Re.lineColor,I.lineWidth=1,I.lineCap="round",I.lineJoin="round",ye.length>0){const be=Te(ye[0][0],ye[0][1],J);I.beginPath(),I.moveTo(be.x,be.y),I.stroke()}_e.current=0,We.current=Re.isDark}},[Nt,Te]),Tt=v.useCallback((J,ye,Re,Le=!1)=>{const be=J.canvas.width,Ze=Nt();(Le||!Be.current||We.current!==Ze.isDark||Re<_e.current)&&bt(be,ye);const at=Be.current;if(!at)return;const mt=at.getContext("2d");if(mt){if(ye.length>0&&Re>_e.current){mt.strokeStyle=Ze.lineColor,mt.lineWidth=1,mt.lineCap="round",mt.lineJoin="round",mt.beginPath();const dn=Te(ye[_e.current][0],ye[_e.current][1],be);mt.moveTo(dn.x,dn.y);for(let D=_e.current+1;D<=Re&&D<ye.length;D++){const Ee=Te(ye[D][0],ye[D][1],be);mt.lineTo(Ee.x,Ee.y)}mt.stroke(),_e.current=Re}if(J.drawImage(at,0,0),Re<ye.length&&ye.length>0){const dn=Te(ye[Re][0],ye[Re][1],be);J.beginPath(),J.arc(dn.x,dn.y,5,0,Math.PI*2),J.fillStyle=Ze.markerColor,J.shadowColor=Ze.markerColor,J.shadowBlur=8,J.fill(),J.shadowBlur=0,J.strokeStyle=Ze.markerBorder,J.lineWidth=1,J.stroke()}}},[Nt,bt,Te]);v.useEffect(()=>{if(!Q||W.length===0||!z.current)return;const J=z.current.getContext("2d");if(!J)return;let ye=performance.now();const Re=100*ve,Le=I=>{const be=(I-ye)/1e3;ye=I;const Ze=Math.floor(be*Re);xe.current=Math.min(xe.current+Math.max(1,Ze),W.length-1),Tt(J,W,xe.current),H(xe.current/(W.length-1)*100),xe.current<W.length-1?ee.current=requestAnimationFrame(Le):Z(!1)};return ee.current=requestAnimationFrame(Le),()=>{ee.current&&cancelAnimationFrame(ee.current)}},[Q,W,ve,Tt]),v.useEffect(()=>{if(W.length>0&&z.current){const J=z.current.getContext("2d");J&&(xe.current=0,H(0),Tt(J,W,0,!0))}},[W,Tt]);const Rn=async J=>{C(J),_(!0),O("adaptive"),we(null);try{const ye=await ue.get(`/api/pattern_history/${encodeURIComponent(J.path)}`);we(ye)}catch{}},qt=async()=>{w&&(_(!1),F(!0),Z(!1),H(0),xe.current=0,await Wt(w.path),Z(!0))},$t=()=>{F(!1),Z(!1),ee.current&&cancelAnimationFrame(ee.current),ce([])},It=()=>{Q?Z(!1):(xe.current>=W.length-1&&(xe.current=0,H(0)),Z(!0))},Pt=()=>{if(Z(!1),xe.current=0,H(0),z.current&&W.length>0){const J=z.current.getContext("2d");J&&Tt(J,W,0,!0)}},jt=J=>{const ye=J[0];if(H(ye),xe.current=Math.floor(ye/100*(W.length-1)),z.current&&W.length>0){const Re=z.current.getContext("2d");Re&&Tt(Re,W,xe.current)}},q=async()=>{if(w){B(!0);try{await ue.post("/run_theta_rho",{file_name:w.path,pre_execution:T}),Y.success(`Running ${w.name}`),_(!1),window.dispatchEvent(new CustomEvent("playback-started"))}catch(J){const ye=J instanceof Error?J.message:"Failed to run pattern";ye.includes("409")||ye.includes("already running")?Y.error("Another pattern is already running"):Y.error(ye)}finally{B(!1)}}},Se=async()=>{if(w){if(!w.path.startsWith("custom_patterns/")){Y.error("Only custom patterns can be deleted");return}if(confirm(`Delete "${w.name}"? This cannot be undone.`))try{await ue.post("/delete_theta_rho_file",{file_name:w.path}),Y.success(`Deleted ${w.name}`),_(!1),C(null),Ct()}catch{Y.error("Failed to delete pattern")}}},Oe=J=>a[J]?.image_data||null,Ve=J=>J?`(${J.x.toFixed(1)}, ${J.y.toFixed(1)})`:"(-, -)",At=w?.path.startsWith("custom_patterns/"),tt=async()=>{if(Pe)return;ke(!0),pe(0);const J=await BM(ye=>{const Re=ye.total>0?Math.round(ye.completed/ye.total*100):0;pe(Re)});J.success?(st(!0),J.cached===0?Y.success("All patterns are already cached!"):Y.success("All pattern previews have been cached!")):Y.error("Failed to cache previews"),ke(!1),pe(0)},Ut=async J=>{const ye=J.target.files;if(!ye||ye.length===0)return;const Re=Array.from(ye).filter(I=>!I.name.endsWith(".thr"));if(Re.length>0){Y.error(`Invalid file${Re.length>1?"s":""}: ${Re.map(I=>I.name).join(", ")}. Only .thr files are accepted.`);return}dt(!0);let Le=0;for(const I of Array.from(ye))try{await ue.uploadFile("/upload_theta_rho",I),Le++}catch(be){console.error(`Upload error for ${I.name}:`,be),Y.error(`Failed to upload "${I.name}"`)}Le>0&&(Y.success(Le===1?`Pattern "${ye[0].name}" uploaded successfully`:`${Le} pattern${Le>1?"s":""} uploaded successfully`),await Ct()),dt(!1),$e.current&&($e.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:$e,type:"file",accept:".thr",multiple:!0,onChange:Ut,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:"font-display 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(le,{variant:"ghost",onClick:()=>$e.current?.click(),disabled:Vt,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:[Vt?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(St,{value:d,onChange:J=>h(J.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(le,{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(lr,{value:p,onValueChange:g,children:[o.jsxs(Wn,{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(Cr,{placeholder:"All"})]}),o.jsx(Xn,{children:Xt.map(J=>o.jsx(Mt,{value:J,children:J==="all"?"All":J==="root"?"Default":J},J))})]}),o.jsxs(lr,{value:m,onValueChange:J=>{const ye=J;b(ye),j(ye!=="plays"&&ye!=="last_played")},children:[o.jsxs(Wn,{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(Cr,{placeholder:"Sort"})]}),o.jsxs(Xn,{children:[o.jsx(Mt,{value:"favorites",children:"Favorites"}),o.jsx(Mt,{value:"name",children:"Name"}),o.jsx(Mt,{value:"date",children:"Modified"}),o.jsx(Mt,{value:"size",children:"Size"}),o.jsx(Mt,{value:"plays",children:"Most Played"}),o.jsx(Mt,{value:"last_played",children:"Last Played"})]})]}),o.jsx(le,{variant:"outline",size:"icon",onClick:()=>j(!S),className:"shrink-0 h-9 w-9 sm:h-11 sm:w-11 rounded-full bg-card shadow-sm",title:S?"Ascending":"Descending",children:o.jsx("span",{className:"material-icons-outlined text-lg sm:text-xl",children:S?"arrow_upward":"arrow_downward"})}),!it&&o.jsx(le,{variant:"outline",onClick:tt,className:`shrink-0 rounded-full bg-card shadow-sm gap-2 ${Pe?"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:Pe?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:[Ue,"%"]})]}):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 ",de.length," of ",t.length," patterns"]}),de.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:"font-display 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(le,{variant:"secondary",onClick:()=>{h(""),g("all")},children:"Clear Filters"})]}):o.jsx(Ok.Provider,{value:{requestPreview:De,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:de.map(J=>o.jsx(VG,{pattern:J,isSelected:w?.path===J.path,isFavorite:Me.has(J.path),playTime:L[J.path.split("/").pop()||""]?.actual_time_formatted||null,playCount:L[J.path.split("/").pop()||""]?.play_count??0,onToggleFavorite:ht,onClick:()=>Rn(J)},J.path))})}),o.jsx("div",{className:"h-48"}),o.jsx(FG,{open:N,onOpenChange:_,children:o.jsxs(Tk,{className:"flex flex-col p-0 overflow-hidden pt-safe",onTouchStart:yt,onTouchEnd:ft,children:[o.jsx(Ak,{className:"px-6 py-4 shrink-0",children:o.jsxs(Rk,{className:"flex items-center gap-2 pr-8",children:[w&&o.jsx("span",{role:"button",tabIndex:0,className:`shrink-0 transition-colors cursor-pointer flex items-center ${Me.has(w.path)?"text-destructive hover:text-destructive/80":"text-muted-foreground hover:text-destructive"}`,onClick:J=>ht(w.path,J),onKeyDown:J=>{(J.key==="Enter"||J.key===" ")&&(J.preventDefault(),ht(w.path,J))},title:Me.has(w.path)?"Remove from favorites":"Add to favorites",children:o.jsx("span",{className:"material-icons",style:{fontSize:"20px"},children:Me.has(w.path)?"favorite":"favorite_border"})}),o.jsx("span",{className:"truncate",children:w?.name||"Pattern Details"})]})}),w&&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:qt,children:[Oe(w.path)?o.jsx("img",{src:Oe(w.path),alt:w.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:Ve(a[w.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:Ve(a[w.path]?.last_coordinate)})]})]}),(()=>{const J=w.path.split("/").pop()||"",ye=L[J]?.play_count??0;return o.jsx(o.Fragment,{children:(se?.actual_time_formatted||ye>0)&&o.jsxs("div",{className:"mb-4 flex justify-between text-sm",children:[se?.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:se.actual_time_formatted})]}),ye>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:ye})]})]})})})(),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:Jb.map(J=>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===J.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:[J.label,o.jsx("input",{type:"radio",name:"preExecutionAction",value:J.value,checked:T===J.value,onChange:()=>O(J.value),className:"sr-only"})]},J.value))}),o.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:Jb.find(J=>J.value===T)?.description})]}),o.jsx("div",{className:"space-y-3",children:o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(le,{onClick:q,disabled:M,className:"flex-1 gap-2",size:"lg",children:[M?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"]}),At&&o.jsx(le,{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"})})]})})]})]})}),k&&o.jsx("div",{className:"fixed inset-0 bg-black/80 z-[60] flex items-center justify-center p-4",onClick:$t,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:J=>J.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between p-6 border-b shrink-0",children:[o.jsx("h3",{className:"font-display text-xl font-semibold",children:w?.name||"Animated Preview"}),o.jsx(le,{variant:"ghost",size:"icon",onClick:$t,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:G?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:z,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:It,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:Q?"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:[ve,"x"]})]}),o.jsx(Ia,{value:[ve],onValueChange:J=>P(J[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(Ia,{value:[V],onValueChange:jt,min:0,max:100,step:.1,className:"py-2"})]}),o.jsxs("div",{className:"flex items-center justify-center gap-4",children:[o.jsxs(le,{onClick:It,className:"gap-2",children:[o.jsx("span",{className:"material-icons",children:Q?"pause":"play_arrow"}),Q?"Pause":"Play"]}),o.jsxs(le,{variant:"secondary",onClick:Pt,className:"gap-2",children:[o.jsx("span",{className:"material-icons",children:"replay"}),"Reset"]})]})]})]})})]})}function VG({pattern:e,isSelected:t,isFavorite:n,playTime:a,playCount:i,onToggleFavorite:l,onClick:u}){const[d,h]=v.useState(!1),[p,g]=v.useState(!1),m=v.useRef(null),b=v.useContext(Ok);v.useEffect(()=>{if(!b||!m.current)return;const j=new IntersectionObserver(w=>{w.forEach(C=>{C.isIntersecting&&(b.requestPreview(e.path),j.disconnect())})},{rootMargin:"100px"});return j.observe(m.current),()=>j.disconnect()},[e.path,b]);const S=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:S&&!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:S,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:()=>g(!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 w=a.match(/(\d+)h\s*(\d+)m|(\d+)\s*min|(\d+)m\s*(\d+)s|(\d+)\s*sec/);if(w){if(w[1]&&w[2])return`${parseInt(w[1])*60+parseInt(w[2])}m`;if(w[3])return`${w[3]}m`;if(w[4]&&w[5]){const C=parseInt(w[4]);return C>0?`${C}m`:"<1m"}else if(w[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:"font-display 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-destructive hover:text-destructive/80":"text-muted-foreground hover:text-destructive"}`,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 qG(){const{isPlayOnlyActive:e}=IR()||{},[t,n]=v.useState([]),[a,i]=v.useState(()=>localStorage.getItem("playlist-selected")),[l,u]=v.useState([]),[d,h]=v.useState(!0),[p,g]=v.useState([]),[m,b]=v.useState({}),[S,j]=v.useState({}),[w,C]=v.useState(!1),[N,_]=v.useState(new Set),[T,O]=v.useState(""),[M,B]=v.useState("all"),[k,F]=v.useState("name"),[W,ce]=v.useState(!0),[G,ie]=v.useState(new Set),[Q,Z]=v.useState(!1),[ve,P]=v.useState(!1),[V,H]=v.useState(""),[se,we]=v.useState(null),[L,re]=v.useState(!1),z=v.useRef(null),ee=q=>{z.current={x:q.touches[0].clientX,y:q.touches[0].clientY}},xe=q=>{if(!z.current||!L)return;const Se=q.changedTouches[0].clientX-z.current.x,Oe=q.changedTouches[0].clientY-z.current.y;Se>80&&Se>Math.abs(Oe)&&re(!1),z.current=null},[Ne,fe]=v.useState(()=>{const q=localStorage.getItem("playlist-runMode");return q==="single"||q==="indefinite"?q:"single"}),[Ce,Pe]=v.useState(()=>localStorage.getItem("playlist-shuffle")==="true"),[ke,Ue]=v.useState(()=>{const q=localStorage.getItem("playlist-pauseTime");return q?Number(q):5}),[pe,it]=v.useState(()=>{const q=localStorage.getItem("playlist-pauseUnit");return q==="sec"||q==="min"||q==="hr"?q:"min"}),[st,Me]=v.useState(()=>localStorage.getItem("preExecution")||"adaptive");v.useEffect(()=>{localStorage.setItem("playlist-runMode",Ne)},[Ne]),v.useEffect(()=>{localStorage.setItem("playlist-shuffle",String(Ce))},[Ce]),v.useEffect(()=>{localStorage.setItem("playlist-pauseTime",String(ke))},[ke]),v.useEffect(()=>{localStorage.setItem("playlist-pauseUnit",pe)},[pe]),v.useEffect(()=>{localStorage.setItem("preExecution",st)},[st]),v.useEffect(()=>{a?localStorage.setItem("playlist-selected",a):localStorage.removeItem("playlist-selected")},[a]);const ot=v.useRef(!1);v.useEffect(()=>{d||a&&(t.includes(a)?ot.current||(ot.current=!0,ht(a)):i(null))},[d,t,a]),v.useEffect(()=>{const q=()=>{C(!1),Z(!1),P(!1)};return window.addEventListener("playback-started",q),()=>window.removeEventListener("playback-started",q)},[]);const[$e,Vt]=v.useState(!1),dt=()=>{switch(pe){case"hr":return ke*3600;case"min":return ke*60;default:return ke}},Lt=v.useRef(new Set),yt=v.useRef(null),ft=v.useRef(null);v.useEffect(()=>(zh().catch(()=>{}),Ge(),Ct(),Jt(),()=>{yt.current&&clearTimeout(yt.current),ft.current&&ft.current.abort(),Lt.current.clear()}),[]),ww(()=>{Ge(),Ct(),Jt()});const Ge=async()=>{h(!0);try{const q=await ue.get("/list_all_playlists");n(Array.isArray(q)?q:[])}catch(q){console.error("Error fetching playlists:",q),Y.error("Failed to load playlists")}finally{h(!1)}},ht=async q=>{try{const Se=await ue.get(`/get_playlist?name=${encodeURIComponent(q)}`);u(Se.files||[])}catch(Se){console.error("Error fetching playlist:",Se),Y.error("Failed to load playlist"),u([])}},Ct=async()=>{try{const[q,Se]=await Promise.all([ue.get("/list_theta_rho_files_with_metadata"),ue.get("/api/pattern_history_all")]);g(q),b(Se)}catch(q){console.error("Error fetching patterns:",q)}},Jt=async()=>{try{const q=await ue.get("/get_playlist?name=Favorites");ie(new Set(q.files||[]))}catch{}},Wt=async q=>{const Se=await vu(q);if(Se.size>0){const Ve={};Se.forEach((At,tt)=>{Ve[tt]=At}),j(At=>({...At,...Ve}))}const Oe=q.filter(Ve=>!Se.has(Ve));Oe.length>0&&Xt(Oe)},Xt=async q=>{ft.current=new AbortController;const Oe=ft.current.signal;for(let Ve=0;Ve<q.length&&!Oe.aborted;Ve+=10){const At=q.slice(Ve,Ve+10);try{const tt=await ue.post("/preview_thr_batch",{file_names:At},Oe),Ut={};for(const[J,ye]of Object.entries(tt))Ut[J]=ye,ye&&!ye.error&&V0(J,ye);j(J=>({...J,...Ut}))}catch(tt){if(tt instanceof Error&&tt.name==="AbortError")break;console.error("Error fetching previews batch:",tt)}Ve+10<q.length&&await new Promise(tt=>setTimeout(tt,100))}},de=v.useCallback(q=>{S[q]||Lt.current.has(q)||(Lt.current.add(q),yt.current&&clearTimeout(yt.current),yt.current=setTimeout(()=>{const Se=Array.from(Lt.current);Lt.current.clear(),Se.length>0&&Wt(Se)},100))},[S]),De=q=>{i(q),ht(q),re(!0)},Te=()=>{re(!1)},Be=async()=>{if(!V.trim()){Y.error("Please enter a playlist name");return}const q=V.trim();try{await ue.post("/create_playlist",{playlist_name:q,files:[]}),Y.success("Playlist created"),Z(!1),H(""),await Ge(),De(q)}catch(Se){console.error("Create playlist error:",Se),Y.error(Se instanceof Error?Se.message:"Failed to create playlist")}},_e=async()=>{if(!(!se||!V.trim()))try{await ue.post("/rename_playlist",{old_name:se,new_name:V.trim()}),Y.success("Playlist renamed"),P(!1),H(""),we(null),Ge(),a===se&&i(V.trim())}catch{Y.error("Failed to rename playlist")}},We=async q=>{if(confirm(`Delete playlist "${q}"?`))try{await ue.delete("/delete_playlist",{playlist_name:q}),Y.success("Playlist deleted"),Ge(),a===q&&(i(null),u([]))}catch{Y.error("Failed to delete playlist")}},Nt=async q=>{if(!a)return;const Se=l.filter(Oe=>Oe!==q);try{await ue.post("/modify_playlist",{playlist_name:a,files:Se}),u(Se),Y.success("Pattern removed")}catch{Y.error("Failed to remove pattern")}},bt=()=>{_(new Set(l)),O(""),C(!0)},Tt=async()=>{if(!a)return;const q=Array.from(N);try{await ue.post("/modify_playlist",{playlist_name:a,files:q}),u(q),C(!1),Y.success("Playlist updated")}catch{Y.error("Failed to update playlist")}},Rn=q=>{_(Se=>{const Oe=new Set(Se);return Oe.has(q)?Oe.delete(q):Oe.add(q),Oe})},qt=async()=>{if(!(!a||l.length===0)){Vt(!0);try{await ue.post("/run_playlist",{playlist_name:a,run_mode:Ne==="indefinite"?"indefinite":"single",pause_time:dt(),clear_pattern:st,shuffle:Ce}),Y.success(`Started playlist: ${a}`),window.dispatchEvent(new CustomEvent("playback-started"))}catch(q){Y.error(q instanceof Error?q.message:"Failed to run playlist")}finally{Vt(!1)}}},$t=v.useMemo(()=>{const q=new Set(p.map(Se=>Se.category));return["all",...Array.from(q).sort()]},[p]),It=v.useMemo(()=>{let q=p;return T&&(q=q.filter(Se=>_u(Se.name,T))),M!=="all"&&(q=q.filter(Se=>Se.category===M)),q=[...q].sort((Se,Oe)=>{let Ve=0;switch(k){case"name":Ve=Se.name.localeCompare(Oe.name);break;case"date":Ve=Se.date_modified-Oe.date_modified;break;case"size":Ve=Se.coordinates_count-Oe.coordinates_count;break;case"favorites":{const At=G.has(Se.path)?1:0;Ve=(G.has(Oe.path)?1:0)-At,Ve===0&&(Ve=Se.name.localeCompare(Oe.name));break}case"plays":{const At=Se.path.split("/").pop()||"",tt=Oe.path.split("/").pop()||"",Ut=m[At]?.play_count??0,J=m[tt]?.play_count??0;Ve=Ut-J,Ve===0&&(Ve=Se.name.localeCompare(Oe.name));break}case"last_played":{const At=Se.path.split("/").pop()||"",tt=Oe.path.split("/").pop()||"",Ut=m[At]?.last_played||"",J=m[tt]?.last_played||"";Ve=Ut.localeCompare(J),Ve===0&&(Ve=Se.name.localeCompare(Oe.name));break}}return W?Ve:-Ve}),q},[p,T,M,k,W,G,m]),Pt=q=>p.find(Oe=>Oe.path===q)?.name||q.split("/").pop()?.replace(".thr","")||q,jt=q=>S[q]?.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:"font-display 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(jr,{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 ${L?"-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:"font-display 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(le,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{H(""),Z(!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(q=>o.jsxs("div",{className:`group flex items-center justify-between rounded-lg px-3 py-2 cursor-pointer transition-colors ${a===q?"bg-accent text-accent-foreground":"hover:bg-muted text-muted-foreground"}`,onClick:()=>De(q),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:"font-display truncate text-sm font-semibold",children:q})]}),!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(le,{variant:"ghost",size:"icon-sm",className:"h-7 w-7",onClick:Se=>{Se.stopPropagation(),we(q),H(q),P(!0)},children:o.jsx("span",{className:"material-icons-outlined text-base",children:"edit"})}),o.jsx(le,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 text-destructive hover:text-destructive hover:bg-destructive/20",onClick:Se=>{Se.stopPropagation(),We(q)},children:o.jsx(ZO,{className:"h-4 w-4"})})]})]},q))})]}),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 ${L?"translate-x-0":"translate-x-full lg:translate-x-0 absolute lg:relative inset-0 lg:inset-auto"}`,onTouchStart:ee,onTouchEnd:xe,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(le,{variant:"ghost",size:"icon",className:"h-8 w-8 lg:hidden shrink-0",onClick:Te,children:o.jsx("span",{className:"material-icons-outlined",children:"arrow_back"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"font-display 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(le,{onClick:bt,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(le,{variant:"secondary",className:"mt-2 gap-2",onClick:bt,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((q,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(C_,{path:q,previewUrl:jt(q),requestPreview:de,alt:Pt(q)})}),!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:()=>Nt(q),title:"Remove from playlist",children:o.jsx("span",{className:"material-icons",style:{fontSize:"12px"},children:"close"})})]}),o.jsx("p",{className:"font-display font-bold text-[10px] sm:text-xs truncate w-full text-center",children:Pt(q)})]},`${q}-${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:()=>Pe(!Ce),className:`w-9 h-9 sm:w-10 sm:h-10 rounded-full flex items-center justify-center transition ${Ce?"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:()=>fe(Ne==="indefinite"?"single":"indefinite"),className:`w-9 h-9 sm:w-10 sm:h-10 rounded-full flex items-center justify-center transition ${Ne==="indefinite"?"text-primary bg-primary/10":"text-muted-foreground hover:bg-muted"}`,title:Ne==="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(le,{variant:"secondary",size:"icon",className:"w-7 h-7 sm:w-8 sm:h-8",onClick:()=>{Ue(Math.max(0,ke-(pe==="hr"?.5:1)))},children:o.jsx("span",{className:"material-icons-outlined text-sm",children:"remove"})}),o.jsxs("button",{onClick:()=>{const q=["sec","min","hr"],Se=q.indexOf(pe);it(q[(Se+1)%q.length])},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:"Click to change unit",children:[ke,pe==="sec"?"s":pe==="min"?"m":"h",o.jsx("span",{className:"material-icons-outlined text-xs opacity-50 scale-75 ml-0.5",children:"swap_vert"})]}),o.jsx(le,{variant:"secondary",size:"icon",className:"w-7 h-7 sm:w-8 sm:h-8",onClick:()=>{Ue(ke+(pe==="hr"?.5:1))},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(lr,{value:st,onValueChange:q=>Me(q),children:[o.jsx(Wn,{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 ${st!=="none"?"!bg-primary/10":"!bg-transparent hover:!bg-muted"}`,children:o.jsx("span",{className:`material-icons-outlined text-lg sm:text-xl ${st!=="none"?"text-primary":"text-muted-foreground"}`,children:"cleaning_services"})}),o.jsx(Xn,{children:Jb.map(q=>o.jsx(Mt,{value:q.value,children:o.jsxs("div",{children:[o.jsx("div",{children:q.label}),o.jsx("div",{className:"text-xs text-muted-foreground font-normal",children:q.description})]})},q.value))})]})})]}),o.jsx("button",{onClick:qt,disabled:$e||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:$e?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(Xr,{open:Q,onOpenChange:Z,children:o.jsxs(_r,{className:"sm:max-w-md",children:[o.jsx(cr,{children:o.jsxs(ur,{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(St,{id:"playlistName",value:V,onChange:q=>H(q.target.value),placeholder:"e.g., Favorites, Morning Patterns...",onKeyDown:q=>q.key==="Enter"&&Be(),autoFocus:!0})]})}),o.jsxs(Sa,{className:"gap-2 sm:gap-0",children:[o.jsx(le,{variant:"secondary",onClick:()=>Z(!1),children:"Cancel"}),o.jsxs(le,{onClick:Be,className:"gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"add"}),"Create Playlist"]})]})]})}),o.jsx(Xr,{open:ve,onOpenChange:P,children:o.jsxs(_r,{className:"sm:max-w-md",children:[o.jsx(cr,{children:o.jsxs(ur,{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(St,{id:"renamePlaylist",value:V,onChange:q=>H(q.target.value),placeholder:"Enter new name",onKeyDown:q=>q.key==="Enter"&&_e(),autoFocus:!0})]})}),o.jsxs(Sa,{className:"gap-2 sm:gap-0",children:[o.jsx(le,{variant:"secondary",onClick:()=>P(!1),children:"Cancel"}),o.jsxs(le,{onClick:_e,className:"gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"save"}),"Save Name"]})]})]})}),o.jsx(Xr,{open:w,onOpenChange:C,children:o.jsxs(_r,{className:"max-w-4xl max-h-[90vh] flex flex-col",children:[o.jsx(cr,{children:o.jsxs(ur,{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(St,{value:T,onChange:q=>O(q.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:()=>O(""),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(lr,{value:M,onValueChange:B,children:[o.jsxs(Wn,{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(Cr,{})]}),o.jsx(Xn,{children:$t.map(q=>o.jsx(Mt,{value:q,children:q==="all"?"All Folders":q},q))})]}),o.jsxs(lr,{value:k,onValueChange:q=>F(q),children:[o.jsxs(Wn,{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(Cr,{})]}),o.jsxs(Xn,{children:[o.jsx(Mt,{value:"favorites",children:"Favorites"}),o.jsx(Mt,{value:"name",children:"Name"}),o.jsx(Mt,{value:"date",children:"Modified"}),o.jsx(Mt,{value:"size",children:"Size"}),o.jsx(Mt,{value:"plays",children:"Most Played"}),o.jsx(Mt,{value:"last_played",children:"Last Played"})]})]}),o.jsx(le,{variant:"outline",size:"icon",className:"h-9 w-9 rounded-full bg-card shadow-sm",onClick:()=>ce(!W),title:W?"Ascending":"Descending",children:o.jsx("span",{className:"material-icons-outlined text-lg",children:W?"arrow_upward":"arrow_downward"})}),o.jsx("div",{className:"flex-1"}),o.jsxs(le,{variant:"outline",size:"sm",className:"h-9 rounded-full bg-card shadow-sm text-sm gap-1.5",onClick:()=>{const q=It.map(Oe=>Oe.path),Se=q.every(Oe=>N.has(Oe));_(Oe=>{const Ve=new Set(Oe);return Se?q.forEach(At=>Ve.delete(At)):q.forEach(At=>Ve.add(At)),Ve})},children:[o.jsx("span",{className:"material-icons-outlined text-base",children:It.length>0&&It.every(q=>N.has(q.path))?"deselect":"select_all"}),o.jsx("span",{className:"hidden sm:inline",children:It.length>0&&It.every(q=>N.has(q.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:It.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:It.map(q=>{const Se=N.has(q.path);return o.jsxs("div",{className:"flex flex-col items-center gap-2 cursor-pointer",onClick:()=>Rn(q.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(C_,{path:q.path,previewUrl:jt(q.path),requestPreview:de,alt:q.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:`font-display font-bold text-xs truncate w-full text-center ${Se?"text-primary":""}`,children:q.name})]},q.path)})})}),o.jsxs(Sa,{className:"gap-2 sm:gap-0",children:[o.jsx(le,{variant:"secondary",onClick:()=>C(!1),children:"Cancel"}),o.jsxs(le,{onClick:Tt,className:"gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"save"}),"Save Selection"]})]})]})})]})}function C_({path:e,previewUrl:t,requestPreview:n,alt:a,className:i=""}){const l=v.useRef(null),u=v.useRef(!1);return v.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 Ln=v.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:lt("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Ln.displayName="Card";const $r=v.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:lt("flex flex-col space-y-1.5 p-6",e),...t}));$r.displayName="CardHeader";const Gr=v.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:lt("font-display text-2xl font-semibold leading-none tracking-tight",e),...t}));Gr.displayName="CardTitle";const za=v.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:lt("text-sm text-muted-foreground",e),...t}));za.displayName="CardDescription";const Bn=v.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:lt("p-6 pt-0",e),...t}));Bn.displayName="CardContent";const $G=v.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:lt("flex items-center p-6 pt-0",e),...t}));$G.displayName="CardFooter";const GG=qu("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"}}),Kr=v.forwardRef(({className:e,variant:t,...n},a)=>o.jsx("div",{ref:a,role:"alert",className:lt(GG({variant:t}),e),...n}));Kr.displayName="Alert";const KG=v.forwardRef(({className:e,...t},n)=>o.jsx("h5",{ref:n,className:lt("mb-1 font-medium leading-none tracking-tight",e),...t}));KG.displayName="AlertTitle";const Yr=v.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:lt("text-sm [&_p]:leading-relaxed",e),...t}));Yr.displayName="AlertDescription";var YG=Symbol("radix.slottable");function WG(e){const t=({children:n})=>o.jsx(o.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=YG,t}var[Qh]=Rr("Tooltip",[Wl]),Zh=Wl(),Mk="TooltipProvider",XG=700,e0="tooltip.open",[QG,Cw]=Qh(Mk),Pk=e=>{const{__scopeTooltip:t,delayDuration:n=XG,skipDelayDuration:a=300,disableHoverableContent:i=!1,children:l}=e,u=v.useRef(!0),d=v.useRef(!1),h=v.useRef(0);return v.useEffect(()=>{const p=h.current;return()=>window.clearTimeout(p)},[]),o.jsx(QG,{scope:t,isOpenDelayedRef:u,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(h.current),u.current=!1},[]),onClose:v.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>u.current=!0,a)},[a]),isPointerInTransitRef:d,onPointerInTransitChange:v.useCallback(p=>{d.current=p},[]),disableHoverableContent:i,children:l})};Pk.displayName=Mk;var Bu="Tooltip",[ZG,Jh]=Qh(Bu),Dk=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:i,onOpenChange:l,disableHoverableContent:u,delayDuration:d}=e,h=Cw(Bu,e.__scopeTooltip),p=Zh(t),[g,m]=v.useState(null),b=wa(),S=v.useRef(0),j=u??h.disableHoverableContent,w=d??h.delayDuration,C=v.useRef(!1),[N,_]=Jr({prop:a,defaultProp:i??!1,onChange:k=>{k?(h.onOpen(),document.dispatchEvent(new CustomEvent(e0))):h.onClose(),l?.(k)},caller:Bu}),T=v.useMemo(()=>N?C.current?"delayed-open":"instant-open":"closed",[N]),O=v.useCallback(()=>{window.clearTimeout(S.current),S.current=0,C.current=!1,_(!0)},[_]),M=v.useCallback(()=>{window.clearTimeout(S.current),S.current=0,_(!1)},[_]),B=v.useCallback(()=>{window.clearTimeout(S.current),S.current=window.setTimeout(()=>{C.current=!0,_(!0),S.current=0},w)},[w,_]);return v.useEffect(()=>()=>{S.current&&(window.clearTimeout(S.current),S.current=0)},[]),o.jsx(I0,{...p,children:o.jsx(ZG,{scope:t,contentId:b,open:N,stateAttribute:T,trigger:g,onTriggerChange:m,onTriggerEnter:v.useCallback(()=>{h.isOpenDelayedRef.current?B():O()},[h.isOpenDelayedRef,B,O]),onTriggerLeave:v.useCallback(()=>{j?M():(window.clearTimeout(S.current),S.current=0)},[M,j]),onOpen:O,onClose:M,disableHoverableContent:j,children:n})})};Dk.displayName=Bu;var t0="TooltipTrigger",kk=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,i=Jh(t0,n),l=Cw(t0,n),u=Zh(n),d=v.useRef(null),h=_t(t,d,i.onTriggerChange),p=v.useRef(!1),g=v.useRef(!1),m=v.useCallback(()=>p.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),o.jsx(Fh,{asChild:!0,...u,children:o.jsx(ct.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...a,ref:h,onPointerMove:Qe(e.onPointerMove,b=>{b.pointerType!=="touch"&&!g.current&&!l.isPointerInTransitRef.current&&(i.onTriggerEnter(),g.current=!0)}),onPointerLeave:Qe(e.onPointerLeave,()=>{i.onTriggerLeave(),g.current=!1}),onPointerDown:Qe(e.onPointerDown,()=>{i.open&&i.onClose(),p.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:Qe(e.onFocus,()=>{p.current||i.onOpen()}),onBlur:Qe(e.onBlur,i.onClose),onClick:Qe(e.onClick,i.onClose)})})});kk.displayName=t0;var JG="TooltipPortal",[Lne,eK]=Qh(JG,{forceMount:void 0}),Hl="TooltipContent",Lk=v.forwardRef((e,t)=>{const n=eK(Hl,e.__scopeTooltip),{forceMount:a=n.forceMount,side:i="top",...l}=e,u=Jh(Hl,e.__scopeTooltip);return o.jsx(Ps,{present:a||u.open,children:u.disableHoverableContent?o.jsx(Bk,{side:i,...l,ref:t}):o.jsx(tK,{side:i,...l,ref:t})})}),tK=v.forwardRef((e,t)=>{const n=Jh(Hl,e.__scopeTooltip),a=Cw(Hl,e.__scopeTooltip),i=v.useRef(null),l=_t(t,i),[u,d]=v.useState(null),{trigger:h,onClose:p}=n,g=i.current,{onPointerInTransitChange:m}=a,b=v.useCallback(()=>{d(null),m(!1)},[m]),S=v.useCallback((j,w)=>{const C=j.currentTarget,N={x:j.clientX,y:j.clientY},_=iK(N,C.getBoundingClientRect()),T=oK(N,_),O=lK(w.getBoundingClientRect()),M=uK([...T,...O]);d(M),m(!0)},[m]);return v.useEffect(()=>()=>b(),[b]),v.useEffect(()=>{if(h&&g){const j=C=>S(C,g),w=C=>S(C,h);return h.addEventListener("pointerleave",j),g.addEventListener("pointerleave",w),()=>{h.removeEventListener("pointerleave",j),g.removeEventListener("pointerleave",w)}}},[h,g,S,b]),v.useEffect(()=>{if(u){const j=w=>{const C=w.target,N={x:w.clientX,y:w.clientY},_=h?.contains(C)||g?.contains(C),T=!cK(N,u);_?b():T&&(b(),p())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[h,g,u,p,b]),o.jsx(Bk,{...e,ref:l})}),[nK,rK]=Qh(Bu,{isInside:!1}),aK=WG("TooltipContent"),Bk=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":i,onEscapeKeyDown:l,onPointerDownOutside:u,...d}=e,h=Jh(Hl,n),p=Zh(n),{onClose:g}=h;return v.useEffect(()=>(document.addEventListener(e0,g),()=>document.removeEventListener(e0,g)),[g]),v.useEffect(()=>{if(h.trigger){const m=b=>{b.target?.contains(h.trigger)&&g()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[h.trigger,g]),o.jsx($u,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:m=>m.preventDefault(),onDismiss:g,children:o.jsxs(z0,{"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(aK,{children:a}),o.jsx(nK,{scope:n,isInside:!0,children:o.jsx(oG,{id:h.contentId,role:"tooltip",children:i||a})})]})})});Lk.displayName=Hl;var Fk="TooltipArrow",sK=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,i=Zh(n);return rK(Fk,n).isInside?null:o.jsx(H0,{...i,...a,ref:t})});sK.displayName=Fk;function iK(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 oK(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 lK(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 cK(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,g=d.y,m=h.x,b=h.y;g>a!=b>a&&n<(m-p)*(a-g)/(b-g)+p&&(i=!i)}return i}function uK(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),dK(t)}function dK(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 fK=Pk,hK=Dk,pK=kk,Ik=Lk;const mK=fK,ys=hK,bs=pK,Fa=v.forwardRef(({className:e,sideOffset:t=4,...n},a)=>o.jsx(Ik,{ref:a,sideOffset:t,className:lt("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}));Fa.displayName=Ik.displayName;const N_=["panic","int_wdt","task_wdt","wdt","brownout"],Tf=e=>e==null?"—":`${Math.round(e/1024)} KB`,gK=e=>{if(e==null)return"—";const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),a=Math.floor(e%3600/60);return t>0?`${t}d ${n}h`:n>0?`${n}h ${a}m`:`${a}m`},E_={power_on:"Power on",software:"Software",panic:"Panic (crash)",int_wdt:"Interrupt watchdog",task_wdt:"Task watchdog",wdt:"Watchdog",brownout:"Brownout",external:"External",deepsleep:"Deep sleep",unknown:"Unknown"};function vK(){const[e,t]=v.useState(""),[n,a]=v.useState(null),[i,l]=v.useState(0),[u,d]=v.useState(null),h=sn(P=>P.status?.speed??null),p=sn(P=>(P.status?.is_running||P.status?.is_paused)??!1),g=sn(P=>P.status?.health??null);v.useEffect(()=>{h!==null&&a(h)},[h]);const[m,b]=v.useState(""),[S,j]=v.useState([]),[w,C]=v.useState(!1),N=v.useRef(null),_=v.useRef(null),T=async(P,V,H)=>{d(P);try{const se=await ue.post(V,H);if(se.success!==!1)return{success:!0,data:se};throw new Error(se.detail||"Action failed")}catch(se){throw console.error(`Error with ${P}:`,se),se}finally{d(null)}},O=P=>p?(Y.error(`Cannot ${P} while a pattern is running. Stop the pattern first.`,{action:{label:"Stop",onClick:()=>B()}}),!0):!1,M=async()=>{try{await T("home","/send_home"),Y.success("Moving to home position...")}catch{Y.error("Failed to move to home position")}},B=async()=>{try{await T("stop","/stop_execution"),Y.success("Execution stopped")}catch{try{await T("stop","/force_stop"),Y.success("Force stopped")}catch{Y.error("Failed to stop execution")}}},k=async()=>{try{await T("reset","/soft_reset"),Y.success("Reset sent. Please home the table.")}catch{Y.error("Failed to send reset command")}},F=async()=>{if(!O("move to center"))try{await T("center","/move_to_center"),Y.success("Moving to center...")}catch{Y.error("Failed to move to center")}},W=async()=>{if(!O("move to perimeter"))try{await T("perimeter","/move_to_perimeter"),Y.success("Moving to perimeter...")}catch{Y.error("Failed to move to perimeter")}},ce=async()=>{const P=parseFloat(e);if(isNaN(P)||P<=0){Y.error("Please enter a valid speed value");return}try{await T("speed","/set_speed",{speed:P}),a(P),Y.success(`Speed set to ${P} mm/s`),t("")}catch{Y.error("Failed to set speed")}},G=async(P,V)=>{try{await T(P,"/run_theta_rho",{file_name:P,pre_execution:"none"}),Y.success(`Running ${V}...`)}catch(H){H instanceof Error&&H.message.includes("409")?Y.error("Another pattern is already running"):Y.error(`Failed to run ${V}`)}},ie=async P=>{if(!O("align"))try{const V=P*(Math.PI/180),H=i+V;await T("rotate","/send_coordinate",{theta:H,rho:1}),l(H),Y.info(`Rotated ${P}°`)}catch{Y.error("Failed to rotate")}},Q=(P,V)=>{const H=new Date().toLocaleTimeString();j(se=>[...se.slice(-200),{type:P,text:V,time:H}]),setTimeout(()=>{N.current&&(N.current.scrollTop=N.current.scrollHeight)},10)},Z=async()=>{if(!m.trim()||w)return;const P=m.trim();b(""),C(!0),Q("cmd",P);try{const V=await ue.post("/api/board/command",{command:P}),H=V.responses??[];H.length>0?H.forEach(se=>Q("resp",se)):V.log?V.log.split(`
  57. `).slice(-5).forEach(se=>Q("resp",se)):Q("resp","(no response — check the board log)")}catch(V){Q("error",`Error: ${V}`)}finally{C(!1),setTimeout(()=>_.current?.focus(),0)}},ve=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),w||Z())};return o.jsx(mK,{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 font-display",children:"Table Control"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Manual controls for your sand table"})]}),o.jsx(jr,{}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[o.jsxs(Ln,{className:"transition-all duration-200 hover:shadow-md hover:border-primary/20",children:[o.jsxs($r,{className:"pb-3",children:[o.jsx(Gr,{className:"text-lg",children:"Primary Actions"}),o.jsx(za,{children:"Calibrate or stop the table"})]}),o.jsx(Bn,{children:o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs(ys,{children:[o.jsx(bs,{asChild:!0,children:o.jsxs(le,{onClick:M,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(Fa,{children:"Return to home position"})]}),o.jsxs(ys,{children:[o.jsx(bs,{asChild:!0,children:o.jsxs(le,{onClick:B,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(Fa,{children:"Gracefully stop"})]}),o.jsxs(Xr,{children:[o.jsxs(ys,{children:[o.jsx(bs,{asChild:!0,children:o.jsx(fl,{asChild:!0,children:o.jsxs(le,{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(Fa,{children:"Send soft reset to controller"})]}),o.jsxs(_r,{className:"sm:max-w-md",children:[o.jsxs(cr,{children:[o.jsx(ur,{children:"Reset Controller?"}),o.jsx(_s,{children:"This will send a soft reset to the controller."})]}),o.jsxs(Kr,{className:"flex items-center border-primary/40",children:[o.jsx("span",{className:"material-icons-outlined text-primary text-base mr-2 shrink-0",children:"warning"}),o.jsx(Yr,{className:"text-primary",children:"Homing is required after resetting. The table will lose its position reference."})]}),o.jsxs(Sa,{className:"gap-2 sm:gap-0",children:[o.jsx(fl,{asChild:!0,children:o.jsx(le,{variant:"outline",children:"Cancel"})}),o.jsx(fl,{asChild:!0,children:o.jsx(le,{variant:"destructive",onClick:k,children:"Reset Controller"})})]})]})]})]})})]}),o.jsxs(Ln,{className:"transition-all duration-200 hover:shadow-md hover:border-primary/20",children:[o.jsx($r,{className:"pb-3",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(Gr,{className:"text-lg",children:"Speed"}),o.jsx(za,{children:"Ball movement speed"})]}),o.jsx(Va,{variant:"secondary",className:"font-mono",children:n!==null?`${n} mm/s`:"-- mm/s"})]})}),o.jsx(Bn,{children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx(St,{type:"number",value:e,onChange:P=>t(P.target.value),placeholder:"mm/s",min:"1",step:"1",className:"flex-1",onKeyDown:P=>P.key==="Enter"&&ce()}),o.jsxs(le,{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(Ln,{className:"transition-all duration-200 hover:shadow-md hover:border-primary/20",children:[o.jsxs($r,{className:"pb-3",children:[o.jsx(Gr,{className:"text-lg",children:"Position"}),o.jsx(za,{children:"Move ball to a specific location"})]}),o.jsx(Bn,{children:o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs(ys,{children:[o.jsx(bs,{asChild:!0,children:o.jsxs(le,{onClick:F,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(Fa,{children:"Move ball to center"})]}),o.jsxs(ys,{children:[o.jsx(bs,{asChild:!0,children:o.jsxs(le,{onClick:W,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(Fa,{children:"Move ball to edge"})]}),o.jsxs(Xr,{children:[o.jsxs(ys,{children:[o.jsx(bs,{asChild:!0,children:o.jsx(fl,{asChild:!0,children:o.jsxs(le,{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(Fa,{children:"Align pattern orientation"})]}),o.jsxs(_r,{className:"sm:max-w-md",children:[o.jsxs(cr,{children:[o.jsx(ur,{children:"Pattern Orientation Alignment"}),o.jsx(_s,{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((P,V)=>o.jsxs("li",{className:"flex gap-3",children:[o.jsx(Va,{variant:"secondary",className:"h-6 w-6 shrink-0 items-center justify-center rounded-full p-0",children:V+1}),o.jsx("span",{className:"text-muted-foreground",children:P})]},V))}),o.jsx(jr,{}),o.jsxs(Kr,{className:"flex items-start border-primary/40",children:[o.jsx("span",{className:"material-icons-outlined text-primary text-base mr-2 shrink-0",children:"warning"}),o.jsx(Yr,{className:"text-primary",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(le,{variant:"secondary",onClick:()=>ie(-10),disabled:u==="rotate",children:[o.jsx("span",{className:"material-icons text-lg mr-1",children:"rotate_left"}),"CCW 10°"]}),o.jsxs(le,{variant:"secondary",onClick:()=>ie(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(Sa,{children:o.jsx(fl,{asChild:!0,children:o.jsx(le,{children:"Got it"})})})]})]})]})})]}),o.jsxs(Ln,{className:"transition-all duration-200 hover:shadow-md hover:border-primary/20",children:[o.jsxs($r,{className:"pb-3",children:[o.jsx(Gr,{className:"text-lg",children:"Clear Sand"}),o.jsx(za,{children:"Erase current pattern from the table"})]}),o.jsx(Bn,{children:o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs(ys,{children:[o.jsx(bs,{asChild:!0,children:o.jsxs(le,{onClick:()=>G("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(Fa,{children:"Spiral outward from center"})]}),o.jsxs(ys,{children:[o.jsx(bs,{asChild:!0,children:o.jsxs(le,{onClick:()=>G("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(Fa,{children:"Spiral inward from edge"})]}),o.jsxs(ys,{children:[o.jsx(bs,{asChild:!0,children:o.jsxs(le,{onClick:()=>G("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(Fa,{children:"Clear with side-to-side motion"})]})]})})]})]}),o.jsxs(Ln,{className:"transition-all duration-200 hover:shadow-md hover:border-primary/20",children:[o.jsxs($r,{className:"pb-3",children:[o.jsxs(Gr,{className:"text-lg flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"monitor_heart"}),"Diagnostics"]}),o.jsx(za,{children:"Board health and crash breadcrumbs reported by the firmware."})]}),o.jsxs(Bn,{className:"space-y-4",children:[g?o.jsxs(o.Fragment,{children:[g.last_reset&&N_.includes(g.last_reset)&&o.jsx(Kr,{variant:"destructive",children:o.jsxs(Yr,{children:["The table last rebooted from a"," ",o.jsx("strong",{children:E_[g.last_reset]??g.last_reset}),". Open the menu → View Logs → Boot Log for the cause."]})}),g.sd_ok===!1&&o.jsx(Kr,{className:"border-primary/40 text-primary",children:o.jsx(Yr,{children:"SD card unreadable at boot — patterns and playlists may be unavailable. Re-seat the card and reboot the table."})}),g.heap_largest!==null&&g.heap_largest!==void 0&&g.heap_largest<12e3&&o.jsx(Kr,{className:"border-primary/40 text-primary",children:o.jsxs(Yr,{children:["Low memory: largest free block is ",Tf(g.heap_largest),". Heap fragmentation is trending toward an out-of-memory reboot."]})}),o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Last reset"}),o.jsx(Va,{variant:g.last_reset&&N_.includes(g.last_reset)?"destructive":"secondary",children:g.last_reset?E_[g.last_reset]??g.last_reset:"—"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"SD card"}),o.jsx(Va,{variant:g.sd_ok===!1?"destructive":"secondary",children:g.sd_ok===!0?"OK":g.sd_ok===!1?"Error":"—"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Uptime"}),o.jsx("div",{className:"text-sm font-medium font-mono",children:gK(g.uptime)})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Free heap"}),o.jsx("div",{className:"text-sm font-medium font-mono",children:Tf(g.heap)})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Min heap"}),o.jsx("div",{className:"text-sm font-medium font-mono",children:Tf(g.heap_min)})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Largest block"}),o.jsx("div",{className:"text-sm font-medium font-mono",children:Tf(g.heap_largest)})]})]})]}):o.jsx("p",{className:"text-sm text-muted-foreground",children:"No telemetry yet — connect to a table running firmware that reports health."}),o.jsx("p",{className:"text-xs text-muted-foreground pt-1",children:"The boot log and the table's full history live in the menu → View Logs drawer."})]})]}),o.jsxs(Ln,{className:"transition-all duration-200 hover:shadow-md hover:border-primary/20",children:[o.jsx($r,{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(Gr,{className:"text-lg flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"terminal"}),"Command Console"]}),o.jsx(za,{className:"hidden sm:block",children:"Send $-commands to the table's firmware (e.g. $Sand/HomingMode, $LED/Effect=fire)"}),o.jsxs(Kr,{className:"flex items-center border-primary/40 py-2",children:[o.jsx("span",{className:"material-icons-outlined text-primary text-base mr-2 shrink-0",children:"warning"}),o.jsx(Yr,{className:"text-xs text-primary",children:"For advanced use. Motion commands sent here can interfere with a running pattern."})]})]}),S.length>0&&o.jsx(le,{variant:"ghost",size:"icon",onClick:()=>j([]),title:"Clear history",children:o.jsx("span",{className:"material-icons-outlined",children:"delete_sweep"})})]})}),o.jsxs(Bn,{children:[o.jsx("div",{ref:N,className:"bg-black/90 rounded-md p-3 h-48 overflow-y-auto font-mono text-sm mb-3",children:S.length>0?S.map((P,V)=>o.jsxs("div",{className:`${P.type==="cmd"?"text-live":P.type==="error"?"text-destructive":"text-success"}`,children:[o.jsx("span",{className:"text-muted-foreground text-xs mr-2",children:P.time}),P.type==="cmd"?"> ":"",P.text]},V)):o.jsx("div",{className:"text-muted-foreground italic",children:"Ready. Enter a firmware command (e.g. $Sand/HomingMode, $Playlist/List)"})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(St,{ref:_,value:m,onChange:P=>b(P.target.value),onKeyDown:ve,readOnly:w,placeholder:"Enter command (e.g. $Sand/HomingMode)",className:"font-mono text-base h-11"}),o.jsx(le,{onClick:Z,disabled:!m.trim()||w,className:"h-11 px-6",children:w?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"send"})})]})]})]})]})})}var ep="Switch",[xK]=Rr(ep),[yK,bK]=xK(ep),zk=v.forwardRef((e,t)=>{const{__scopeSwitch:n,name:a,checked:i,defaultChecked:l,required:u,disabled:d,value:h="on",onCheckedChange:p,form:g,...m}=e,[b,S]=v.useState(null),j=_t(t,T=>S(T)),w=v.useRef(!1),C=b?g||!!b.closest("form"):!0,[N,_]=Jr({prop:i,defaultProp:l??!1,onChange:p,caller:ep});return o.jsxs(yK,{scope:n,checked:N,disabled:d,children:[o.jsx(ct.button,{type:"button",role:"switch","aria-checked":N,"aria-required":u,"data-state":qk(N),"data-disabled":d?"":void 0,disabled:d,value:h,...m,ref:j,onClick:Qe(e.onClick,T=>{_(O=>!O),C&&(w.current=T.isPropagationStopped(),w.current||T.stopPropagation())})}),C&&o.jsx(Vk,{control:b,bubbles:!w.current,name:a,value:h,checked:N,required:u,disabled:d,form:g,style:{transform:"translateX(-100%)"}})]})});zk.displayName=ep;var Hk="SwitchThumb",Uk=v.forwardRef((e,t)=>{const{__scopeSwitch:n,...a}=e,i=bK(Hk,n);return o.jsx(ct.span,{"data-state":qk(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t})});Uk.displayName=Hk;var wK="SwitchBubbleInput",Vk=v.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:a=!0,...i},l)=>{const u=v.useRef(null),d=_t(u,l),h=$h(n),p=Bh(t);return v.useEffect(()=>{const g=u.current;if(!g)return;const m=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(m,"checked").set;if(h!==n&&S){const j=new Event("click",{bubbles:a});S.call(g,n),g.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}})});Vk.displayName=wK;function qk(e){return e?"checked":"unchecked"}var $k=zk,SK=Uk;const qr=v.forwardRef(({className:e,...t},n)=>o.jsx($k,{className:lt("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(SK,{className:lt("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")})}));qr.displayName=$k.displayName;var ir={},ol={},av,__;function Gk(){if(__)return av;__=1;var e=typeof hf=="object"&&hf&&hf.Object===Object&&hf;return av=e,av}var sv,T_;function Za(){if(T_)return sv;T_=1;var e=Gk(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return sv=n,sv}var iv,A_;function Ju(){if(A_)return iv;A_=1;var e=Za(),t=e.Symbol;return iv=t,iv}var ov,R_;function jK(){if(R_)return ov;R_=1;var e=Ju(),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 g=a.call(u);return p&&(d?u[i]=h:delete u[i]),g}return ov=l,ov}var lv,O_;function CK(){if(O_)return lv;O_=1;var e=Object.prototype,t=e.toString;function n(a){return t.call(a)}return lv=n,lv}var cv,M_;function uo(){if(M_)return cv;M_=1;var e=Ju(),t=jK(),n=CK(),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 cv=u,cv}var uv,P_;function _a(){if(P_)return uv;P_=1;var e=Array.isArray;return uv=e,uv}var dv,D_;function Ds(){if(D_)return dv;D_=1;function e(t){return t!=null&&typeof t=="object"}return dv=e,dv}var fv,k_;function NK(){if(k_)return fv;k_=1;var e=uo(),t=_a(),n=Ds(),a="[object String]";function i(l){return typeof l=="string"||!t(l)&&n(l)&&e(l)==a}return fv=i,fv}var hv,L_;function EK(){if(L_)return hv;L_=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 hv=e,hv}var pv,B_;function _K(){if(B_)return pv;B_=1;var e=EK(),t=e();return pv=t,pv}var mv,F_;function TK(){if(F_)return mv;F_=1;function e(t,n){for(var a=-1,i=Array(t);++a<t;)i[a]=n(a);return i}return mv=e,mv}var gv,I_;function AK(){if(I_)return gv;I_=1;var e=uo(),t=Ds(),n="[object Arguments]";function a(i){return t(i)&&e(i)==n}return gv=a,gv}var vv,z_;function Kk(){if(z_)return vv;z_=1;var e=AK(),t=Ds(),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 vv=l,vv}var du={exports:{}},xv,H_;function RK(){if(H_)return xv;H_=1;function e(){return!1}return xv=e,xv}du.exports;var U_;function Nw(){return U_||(U_=1,(function(e,t){var n=Za(),a=RK(),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 yv,V_;function Yk(){if(V_)return yv;V_=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 yv=n,yv}var bv,q_;function Ew(){if(q_)return bv;q_=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return bv=t,bv}var wv,$_;function OK(){if($_)return wv;$_=1;var e=uo(),t=Ew(),n=Ds(),a="[object Arguments]",i="[object Array]",l="[object Boolean]",u="[object Date]",d="[object Error]",h="[object Function]",p="[object Map]",g="[object Number]",m="[object Object]",b="[object RegExp]",S="[object Set]",j="[object String]",w="[object WeakMap]",C="[object ArrayBuffer]",N="[object DataView]",_="[object Float32Array]",T="[object Float64Array]",O="[object Int8Array]",M="[object Int16Array]",B="[object Int32Array]",k="[object Uint8Array]",F="[object Uint8ClampedArray]",W="[object Uint16Array]",ce="[object Uint32Array]",G={};G[_]=G[T]=G[O]=G[M]=G[B]=G[k]=G[F]=G[W]=G[ce]=!0,G[a]=G[i]=G[C]=G[l]=G[N]=G[u]=G[d]=G[h]=G[p]=G[g]=G[m]=G[b]=G[S]=G[j]=G[w]=!1;function ie(Q){return n(Q)&&t(Q.length)&&!!G[e(Q)]}return wv=ie,wv}var Sv,G_;function _w(){if(G_)return Sv;G_=1;function e(t){return function(n){return t(n)}}return Sv=e,Sv}var fu={exports:{}};fu.exports;var K_;function Tw(){return K_||(K_=1,(function(e,t){var n=Gk(),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,Y_;function Wk(){if(Y_)return jv;Y_=1;var e=OK(),t=_w(),n=Tw(),a=n&&n.isTypedArray,i=a?t(a):e;return jv=i,jv}var Cv,W_;function Xk(){if(W_)return Cv;W_=1;var e=TK(),t=Kk(),n=_a(),a=Nw(),i=Yk(),l=Wk(),u=Object.prototype,d=u.hasOwnProperty;function h(p,g){var m=n(p),b=!m&&t(p),S=!m&&!b&&a(p),j=!m&&!b&&!S&&l(p),w=m||b||S||j,C=w?e(p.length,String):[],N=C.length;for(var _ in p)(g||d.call(p,_))&&!(w&&(_=="length"||S&&(_=="offset"||_=="parent")||j&&(_=="buffer"||_=="byteLength"||_=="byteOffset")||i(_,N)))&&C.push(_);return C}return Cv=h,Cv}var Nv,X_;function Aw(){if(X_)return Nv;X_=1;var e=Object.prototype;function t(n){var a=n&&n.constructor,i=typeof a=="function"&&a.prototype||e;return n===i}return Nv=t,Nv}var Ev,Q_;function Qk(){if(Q_)return Ev;Q_=1;function e(t,n){return function(a){return t(n(a))}}return Ev=e,Ev}var _v,Z_;function MK(){if(Z_)return _v;Z_=1;var e=Qk(),t=e(Object.keys,Object);return _v=t,_v}var Tv,J_;function PK(){if(J_)return Tv;J_=1;var e=Aw(),t=MK(),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 Tv=i,Tv}var Av,eT;function tc(){if(eT)return Av;eT=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Av=e,Av}var Rv,tT;function Zk(){if(tT)return Rv;tT=1;var e=uo(),t=tc(),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 Rv=u,Rv}var Ov,nT;function tp(){if(nT)return Ov;nT=1;var e=Zk(),t=Ew();function n(a){return a!=null&&t(a.length)&&!e(a)}return Ov=n,Ov}var Mv,rT;function ed(){if(rT)return Mv;rT=1;var e=Xk(),t=PK(),n=tp();function a(i){return n(i)?e(i):t(i)}return Mv=a,Mv}var Pv,aT;function Jk(){if(aT)return Pv;aT=1;var e=_K(),t=ed();function n(a,i){return a&&e(a,i,t)}return Pv=n,Pv}var Dv,sT;function e5(){if(sT)return Dv;sT=1;function e(t){return t}return Dv=e,Dv}var kv,iT;function DK(){if(iT)return kv;iT=1;var e=e5();function t(n){return typeof n=="function"?n:e}return kv=t,kv}var Lv,oT;function Rw(){if(oT)return Lv;oT=1;var e=Jk(),t=DK();function n(a,i){return a&&e(a,t(i))}return Lv=n,Lv}var Bv,lT;function Ow(){if(lT)return Bv;lT=1;var e=Qk(),t=e(Object.getPrototypeOf,Object);return Bv=t,Bv}var Fv,cT;function kK(){if(cT)return Fv;cT=1;var e=uo(),t=Ow(),n=Ds(),a="[object Object]",i=Function.prototype,l=Object.prototype,u=i.toString,d=l.hasOwnProperty,h=u.call(Object);function p(g){if(!n(g)||e(g)!=a)return!1;var m=t(g);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 Fv=p,Fv}var Iv,uT;function t5(){if(uT)return Iv;uT=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 Iv=e,Iv}var zv,dT;function LK(){if(dT)return zv;dT=1;function e(){this.__data__=[],this.size=0}return zv=e,zv}var Hv,fT;function Mw(){if(fT)return Hv;fT=1;function e(t,n){return t===n||t!==t&&n!==n}return Hv=e,Hv}var Uv,hT;function np(){if(hT)return Uv;hT=1;var e=Mw();function t(n,a){for(var i=n.length;i--;)if(e(n[i][0],a))return i;return-1}return Uv=t,Uv}var Vv,pT;function BK(){if(pT)return Vv;pT=1;var e=np(),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 Vv=a,Vv}var qv,mT;function FK(){if(mT)return qv;mT=1;var e=np();function t(n){var a=this.__data__,i=e(a,n);return i<0?void 0:a[i][1]}return qv=t,qv}var $v,gT;function IK(){if(gT)return $v;gT=1;var e=np();function t(n){return e(this.__data__,n)>-1}return $v=t,$v}var Gv,vT;function zK(){if(vT)return Gv;vT=1;var e=np();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 Gv=t,Gv}var Kv,xT;function rp(){if(xT)return Kv;xT=1;var e=LK(),t=BK(),n=FK(),a=IK(),i=zK();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,Kv=l,Kv}var Yv,yT;function HK(){if(yT)return Yv;yT=1;var e=rp();function t(){this.__data__=new e,this.size=0}return Yv=t,Yv}var Wv,bT;function UK(){if(bT)return Wv;bT=1;function e(t){var n=this.__data__,a=n.delete(t);return this.size=n.size,a}return Wv=e,Wv}var Xv,wT;function VK(){if(wT)return Xv;wT=1;function e(t){return this.__data__.get(t)}return Xv=e,Xv}var Qv,ST;function qK(){if(ST)return Qv;ST=1;function e(t){return this.__data__.has(t)}return Qv=e,Qv}var Zv,jT;function $K(){if(jT)return Zv;jT=1;var e=Za(),t=e["__core-js_shared__"];return Zv=t,Zv}var Jv,CT;function GK(){if(CT)return Jv;CT=1;var e=$K(),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 Jv=n,Jv}var ex,NT;function n5(){if(NT)return ex;NT=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 ex=n,ex}var tx,ET;function KK(){if(ET)return tx;ET=1;var e=Zk(),t=GK(),n=tc(),a=n5(),i=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,u=Function.prototype,d=Object.prototype,h=u.toString,p=d.hasOwnProperty,g=RegExp("^"+h.call(p).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(b){if(!n(b)||t(b))return!1;var S=e(b)?g:l;return S.test(a(b))}return tx=m,tx}var nx,_T;function YK(){if(_T)return nx;_T=1;function e(t,n){return t?.[n]}return nx=e,nx}var rx,TT;function fo(){if(TT)return rx;TT=1;var e=KK(),t=YK();function n(a,i){var l=t(a,i);return e(l)?l:void 0}return rx=n,rx}var ax,AT;function Pw(){if(AT)return ax;AT=1;var e=fo(),t=Za(),n=e(t,"Map");return ax=n,ax}var sx,RT;function ap(){if(RT)return sx;RT=1;var e=fo(),t=e(Object,"create");return sx=t,sx}var ix,OT;function WK(){if(OT)return ix;OT=1;var e=ap();function t(){this.__data__=e?e(null):{},this.size=0}return ix=t,ix}var ox,MT;function XK(){if(MT)return ox;MT=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return ox=e,ox}var lx,PT;function QK(){if(PT)return lx;PT=1;var e=ap(),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 lx=i,lx}var cx,DT;function ZK(){if(DT)return cx;DT=1;var e=ap(),t=Object.prototype,n=t.hasOwnProperty;function a(i){var l=this.__data__;return e?l[i]!==void 0:n.call(l,i)}return cx=a,cx}var ux,kT;function JK(){if(kT)return ux;kT=1;var e=ap(),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 ux=n,ux}var dx,LT;function eY(){if(LT)return dx;LT=1;var e=WK(),t=XK(),n=QK(),a=ZK(),i=JK();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,dx=l,dx}var fx,BT;function tY(){if(BT)return fx;BT=1;var e=eY(),t=rp(),n=Pw();function a(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return fx=a,fx}var hx,FT;function nY(){if(FT)return hx;FT=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return hx=e,hx}var px,IT;function sp(){if(IT)return px;IT=1;var e=nY();function t(n,a){var i=n.__data__;return e(a)?i[typeof a=="string"?"string":"hash"]:i.map}return px=t,px}var mx,zT;function rY(){if(zT)return mx;zT=1;var e=sp();function t(n){var a=e(this,n).delete(n);return this.size-=a?1:0,a}return mx=t,mx}var gx,HT;function aY(){if(HT)return gx;HT=1;var e=sp();function t(n){return e(this,n).get(n)}return gx=t,gx}var vx,UT;function sY(){if(UT)return vx;UT=1;var e=sp();function t(n){return e(this,n).has(n)}return vx=t,vx}var xx,VT;function iY(){if(VT)return xx;VT=1;var e=sp();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 xx=t,xx}var yx,qT;function Dw(){if(qT)return yx;qT=1;var e=tY(),t=rY(),n=aY(),a=sY(),i=iY();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,yx=l,yx}var bx,$T;function oY(){if($T)return bx;$T=1;var e=rp(),t=Pw(),n=Dw(),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 bx=i,bx}var wx,GT;function kw(){if(GT)return wx;GT=1;var e=rp(),t=HK(),n=UK(),a=VK(),i=qK(),l=oY();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,wx=u,wx}var Sx,KT;function lY(){if(KT)return Sx;KT=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return Sx=t,Sx}var jx,YT;function cY(){if(YT)return jx;YT=1;function e(t){return this.__data__.has(t)}return jx=e,jx}var Cx,WT;function uY(){if(WT)return Cx;WT=1;var e=Dw(),t=lY(),n=cY();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,Cx=a,Cx}var Nx,XT;function dY(){if(XT)return Nx;XT=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 Nx=e,Nx}var Ex,QT;function fY(){if(QT)return Ex;QT=1;function e(t,n){return t.has(n)}return Ex=e,Ex}var _x,ZT;function r5(){if(ZT)return _x;ZT=1;var e=uY(),t=dY(),n=fY(),a=1,i=2;function l(u,d,h,p,g,m){var b=h&a,S=u.length,j=d.length;if(S!=j&&!(b&&j>S))return!1;var w=m.get(u),C=m.get(d);if(w&&C)return w==d&&C==u;var N=-1,_=!0,T=h&i?new e:void 0;for(m.set(u,d),m.set(d,u);++N<S;){var O=u[N],M=d[N];if(p)var B=b?p(M,O,N,d,u,m):p(O,M,N,u,d,m);if(B!==void 0){if(B)continue;_=!1;break}if(T){if(!t(d,function(k,F){if(!n(T,F)&&(O===k||g(O,k,h,p,m)))return T.push(F)})){_=!1;break}}else if(!(O===M||g(O,M,h,p,m))){_=!1;break}}return m.delete(u),m.delete(d),_}return _x=l,_x}var Tx,JT;function a5(){if(JT)return Tx;JT=1;var e=Za(),t=e.Uint8Array;return Tx=t,Tx}var Ax,e2;function hY(){if(e2)return Ax;e2=1;function e(t){var n=-1,a=Array(t.size);return t.forEach(function(i,l){a[++n]=[l,i]}),a}return Ax=e,Ax}var Rx,t2;function pY(){if(t2)return Rx;t2=1;function e(t){var n=-1,a=Array(t.size);return t.forEach(function(i){a[++n]=i}),a}return Rx=e,Rx}var Ox,n2;function mY(){if(n2)return Ox;n2=1;var e=Ju(),t=a5(),n=Mw(),a=r5(),i=hY(),l=pY(),u=1,d=2,h="[object Boolean]",p="[object Date]",g="[object Error]",m="[object Map]",b="[object Number]",S="[object RegExp]",j="[object Set]",w="[object String]",C="[object Symbol]",N="[object ArrayBuffer]",_="[object DataView]",T=e?e.prototype:void 0,O=T?T.valueOf:void 0;function M(B,k,F,W,ce,G,ie){switch(F){case _:if(B.byteLength!=k.byteLength||B.byteOffset!=k.byteOffset)return!1;B=B.buffer,k=k.buffer;case N:return!(B.byteLength!=k.byteLength||!G(new t(B),new t(k)));case h:case p:case b:return n(+B,+k);case g:return B.name==k.name&&B.message==k.message;case S:case w:return B==k+"";case m:var Q=i;case j:var Z=W&u;if(Q||(Q=l),B.size!=k.size&&!Z)return!1;var ve=ie.get(B);if(ve)return ve==k;W|=d,ie.set(B,k);var P=a(Q(B),Q(k),W,ce,G,ie);return ie.delete(B),P;case C:if(O)return O.call(B)==O.call(k)}return!1}return Ox=M,Ox}var Mx,r2;function s5(){if(r2)return Mx;r2=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 Mx=e,Mx}var Px,a2;function i5(){if(a2)return Px;a2=1;var e=s5(),t=_a();function n(a,i,l){var u=i(a);return t(a)?u:e(u,l(a))}return Px=n,Px}var Dx,s2;function gY(){if(s2)return Dx;s2=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 Dx=e,Dx}var kx,i2;function o5(){if(i2)return kx;i2=1;function e(){return[]}return kx=e,kx}var Lx,o2;function Lw(){if(o2)return Lx;o2=1;var e=gY(),t=o5(),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 Lx=l,Lx}var Bx,l2;function l5(){if(l2)return Bx;l2=1;var e=i5(),t=Lw(),n=ed();function a(i){return e(i,n,t)}return Bx=a,Bx}var Fx,c2;function vY(){if(c2)return Fx;c2=1;var e=l5(),t=1,n=Object.prototype,a=n.hasOwnProperty;function i(l,u,d,h,p,g){var m=d&t,b=e(l),S=b.length,j=e(u),w=j.length;if(S!=w&&!m)return!1;for(var C=S;C--;){var N=b[C];if(!(m?N in u:a.call(u,N)))return!1}var _=g.get(l),T=g.get(u);if(_&&T)return _==u&&T==l;var O=!0;g.set(l,u),g.set(u,l);for(var M=m;++C<S;){N=b[C];var B=l[N],k=u[N];if(h)var F=m?h(k,B,N,u,l,g):h(B,k,N,l,u,g);if(!(F===void 0?B===k||p(B,k,d,h,g):F)){O=!1;break}M||(M=N=="constructor")}if(O&&!M){var W=l.constructor,ce=u.constructor;W!=ce&&"constructor"in l&&"constructor"in u&&!(typeof W=="function"&&W instanceof W&&typeof ce=="function"&&ce instanceof ce)&&(O=!1)}return g.delete(l),g.delete(u),O}return Fx=i,Fx}var Ix,u2;function xY(){if(u2)return Ix;u2=1;var e=fo(),t=Za(),n=e(t,"DataView");return Ix=n,Ix}var zx,d2;function yY(){if(d2)return zx;d2=1;var e=fo(),t=Za(),n=e(t,"Promise");return zx=n,zx}var Hx,f2;function bY(){if(f2)return Hx;f2=1;var e=fo(),t=Za(),n=e(t,"Set");return Hx=n,Hx}var Ux,h2;function wY(){if(h2)return Ux;h2=1;var e=fo(),t=Za(),n=e(t,"WeakMap");return Ux=n,Ux}var Vx,p2;function ip(){if(p2)return Vx;p2=1;var e=xY(),t=Pw(),n=yY(),a=bY(),i=wY(),l=uo(),u=n5(),d="[object Map]",h="[object Object]",p="[object Promise]",g="[object Set]",m="[object WeakMap]",b="[object DataView]",S=u(e),j=u(t),w=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)!=g||i&&_(new i)!=m)&&(_=function(T){var O=l(T),M=O==h?T.constructor:void 0,B=M?u(M):"";if(B)switch(B){case S:return b;case j:return d;case w:return p;case C:return g;case N:return m}return O}),Vx=_,Vx}var qx,m2;function SY(){if(m2)return qx;m2=1;var e=kw(),t=r5(),n=mY(),a=vY(),i=ip(),l=_a(),u=Nw(),d=Wk(),h=1,p="[object Arguments]",g="[object Array]",m="[object Object]",b=Object.prototype,S=b.hasOwnProperty;function j(w,C,N,_,T,O){var M=l(w),B=l(C),k=M?g:i(w),F=B?g:i(C);k=k==p?m:k,F=F==p?m:F;var W=k==m,ce=F==m,G=k==F;if(G&&u(w)){if(!u(C))return!1;M=!0,W=!1}if(G&&!W)return O||(O=new e),M||d(w)?t(w,C,N,_,T,O):n(w,C,k,N,_,T,O);if(!(N&h)){var ie=W&&S.call(w,"__wrapped__"),Q=ce&&S.call(C,"__wrapped__");if(ie||Q){var Z=ie?w.value():w,ve=Q?C.value():C;return O||(O=new e),T(Z,ve,N,_,O)}}return G?(O||(O=new e),a(w,C,N,_,T,O)):!1}return qx=j,qx}var $x,g2;function c5(){if(g2)return $x;g2=1;var e=SY(),t=Ds();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 $x=n,$x}var Gx,v2;function jY(){if(v2)return Gx;v2=1;var e=kw(),t=c5(),n=1,a=2;function i(l,u,d,h){var p=d.length,g=p,m=!h;if(l==null)return!g;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<g;){b=d[p];var S=b[0],j=l[S],w=b[1];if(m&&b[2]){if(j===void 0&&!(S in l))return!1}else{var C=new e;if(h)var N=h(j,w,S,l,u,C);if(!(N===void 0?t(w,j,n|a,h,C):N))return!1}}return!0}return Gx=i,Gx}var Kx,x2;function u5(){if(x2)return Kx;x2=1;var e=tc();function t(n){return n===n&&!e(n)}return Kx=t,Kx}var Yx,y2;function CY(){if(y2)return Yx;y2=1;var e=u5(),t=ed();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 Yx=n,Yx}var Wx,b2;function d5(){if(b2)return Wx;b2=1;function e(t,n){return function(a){return a==null?!1:a[t]===n&&(n!==void 0||t in Object(a))}}return Wx=e,Wx}var Xx,w2;function NY(){if(w2)return Xx;w2=1;var e=jY(),t=CY(),n=d5();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 Xx=a,Xx}var Qx,S2;function Bw(){if(S2)return Qx;S2=1;var e=uo(),t=Ds(),n="[object Symbol]";function a(i){return typeof i=="symbol"||t(i)&&e(i)==n}return Qx=a,Qx}var Zx,j2;function Fw(){if(j2)return Zx;j2=1;var e=_a(),t=Bw(),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 Zx=i,Zx}var Jx,C2;function EY(){if(C2)return Jx;C2=1;var e=Dw(),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,Jx=n,Jx}var ey,N2;function _Y(){if(N2)return ey;N2=1;var e=EY(),t=500;function n(a){var i=e(a,function(u){return l.size===t&&l.clear(),u}),l=i.cache;return i}return ey=n,ey}var ty,E2;function TY(){if(E2)return ty;E2=1;var e=_Y(),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 ty=a,ty}var ny,_2;function AY(){if(_2)return ny;_2=1;var e=Ju(),t=t5(),n=_a(),a=Bw(),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 ny=u,ny}var ry,T2;function RY(){if(T2)return ry;T2=1;var e=AY();function t(n){return n==null?"":e(n)}return ry=t,ry}var ay,A2;function f5(){if(A2)return ay;A2=1;var e=_a(),t=Fw(),n=TY(),a=RY();function i(l,u){return e(l)?l:t(l,u)?[l]:n(a(l))}return ay=i,ay}var sy,R2;function op(){if(R2)return sy;R2=1;var e=Bw();function t(n){if(typeof n=="string"||e(n))return n;var a=n+"";return a=="0"&&1/n==-1/0?"-0":a}return sy=t,sy}var iy,O2;function h5(){if(O2)return iy;O2=1;var e=f5(),t=op();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 iy=n,iy}var oy,M2;function OY(){if(M2)return oy;M2=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 oy=t,oy}var ly,P2;function MY(){if(P2)return ly;P2=1;function e(t,n){return t!=null&&n in Object(t)}return ly=e,ly}var cy,D2;function PY(){if(D2)return cy;D2=1;var e=f5(),t=Kk(),n=_a(),a=Yk(),i=Ew(),l=op();function u(d,h,p){h=e(h,d);for(var g=-1,m=h.length,b=!1;++g<m;){var S=l(h[g]);if(!(b=d!=null&&p(d,S)))break;d=d[S]}return b||++g!=m?b:(m=d==null?0:d.length,!!m&&i(m)&&a(S,m)&&(n(d)||t(d)))}return cy=u,cy}var uy,k2;function DY(){if(k2)return uy;k2=1;var e=MY(),t=PY();function n(a,i){return a!=null&&t(a,i,e)}return uy=n,uy}var dy,L2;function kY(){if(L2)return dy;L2=1;var e=c5(),t=OY(),n=DY(),a=Fw(),i=u5(),l=d5(),u=op(),d=1,h=2;function p(g,m){return a(g)&&i(m)?l(u(g),m):function(b){var S=t(b,g);return S===void 0&&S===m?n(b,g):e(m,S,d|h)}}return dy=p,dy}var fy,B2;function LY(){if(B2)return fy;B2=1;function e(t){return function(n){return n?.[t]}}return fy=e,fy}var hy,F2;function BY(){if(F2)return hy;F2=1;var e=h5();function t(n){return function(a){return e(a,n)}}return hy=t,hy}var py,I2;function FY(){if(I2)return py;I2=1;var e=LY(),t=BY(),n=Fw(),a=op();function i(l){return n(l)?e(a(l)):t(l)}return py=i,py}var my,z2;function IY(){if(z2)return my;z2=1;var e=NY(),t=kY(),n=e5(),a=_a(),i=FY();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 my=l,my}var gy,H2;function zY(){if(H2)return gy;H2=1;var e=tp();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 vy,U2;function HY(){if(U2)return vy;U2=1;var e=Jk(),t=zY(),n=t(e);return vy=n,vy}var xy,V2;function UY(){if(V2)return xy;V2=1;var e=HY(),t=tp();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 xy=n,xy}var yy,q2;function VY(){if(q2)return yy;q2=1;var e=t5(),t=IY(),n=UY(),a=_a();function i(l,u){var d=a(l)?e:n;return d(l,t(u,3))}return yy=i,yy}var $2;function qY(){if($2)return ol;$2=1,Object.defineProperty(ol,"__esModule",{value:!0}),ol.flattenNames=void 0;var e=NK(),t=h(e),n=Rw(),a=h(n),i=kK(),l=h(i),u=VY(),d=h(u);function h(g){return g&&g.__esModule?g:{default:g}}var p=ol.flattenNames=function g(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],b=[];return(0,d.default)(m,function(S){Array.isArray(S)?g(S).map(function(j){return b.push(j)}):(0,l.default)(S)?(0,a.default)(S,function(j,w){j===!0&&b.push(w),b.push(w+"-"+j)}):(0,t.default)(S)&&b.push(S)}),b};return ol.default=p,ol}var ll={},by,G2;function $Y(){if(G2)return by;G2=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 by=e,by}var wy,K2;function GY(){if(K2)return wy;K2=1;var e=fo(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return wy=t,wy}var Sy,Y2;function p5(){if(Y2)return Sy;Y2=1;var e=GY();function t(n,a,i){a=="__proto__"&&e?e(n,a,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[a]=i}return Sy=t,Sy}var jy,W2;function m5(){if(W2)return jy;W2=1;var e=p5(),t=Mw(),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 Cy,X2;function lp(){if(X2)return Cy;X2=1;var e=m5(),t=p5();function n(a,i,l,u){var d=!l;l||(l={});for(var h=-1,p=i.length;++h<p;){var g=i[h],m=u?u(l[g],a[g],g,l,a):void 0;m===void 0&&(m=a[g]),d?t(l,g,m):e(l,g,m)}return l}return Cy=n,Cy}var Ny,Q2;function KY(){if(Q2)return Ny;Q2=1;var e=lp(),t=ed();function n(a,i){return a&&e(i,t(i),a)}return Ny=n,Ny}var Ey,Z2;function YY(){if(Z2)return Ey;Z2=1;function e(t){var n=[];if(t!=null)for(var a in Object(t))n.push(a);return n}return Ey=e,Ey}var _y,J2;function WY(){if(J2)return _y;J2=1;var e=tc(),t=Aw(),n=YY(),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 _y=l,_y}var Ty,eA;function Iw(){if(eA)return Ty;eA=1;var e=Xk(),t=WY(),n=tp();function a(i){return n(i)?e(i,!0):t(i)}return Ty=a,Ty}var Ay,tA;function XY(){if(tA)return Ay;tA=1;var e=lp(),t=Iw();function n(a,i){return a&&e(i,t(i),a)}return Ay=n,Ay}var hu={exports:{}};hu.exports;var nA;function QY(){return nA||(nA=1,(function(e,t){var n=Za(),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,g){if(g)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 Ry,rA;function ZY(){if(rA)return Ry;rA=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 Ry=e,Ry}var Oy,aA;function JY(){if(aA)return Oy;aA=1;var e=lp(),t=Lw();function n(a,i){return e(a,t(a),i)}return Oy=n,Oy}var My,sA;function g5(){if(sA)return My;sA=1;var e=s5(),t=Ow(),n=Lw(),a=o5(),i=Object.getOwnPropertySymbols,l=i?function(u){for(var d=[];u;)e(d,n(u)),u=t(u);return d}:a;return My=l,My}var Py,iA;function eW(){if(iA)return Py;iA=1;var e=lp(),t=g5();function n(a,i){return e(a,t(a),i)}return Py=n,Py}var Dy,oA;function tW(){if(oA)return Dy;oA=1;var e=i5(),t=g5(),n=Iw();function a(i){return e(i,n,t)}return Dy=a,Dy}var ky,lA;function nW(){if(lA)return ky;lA=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 ky=n,ky}var Ly,cA;function zw(){if(cA)return Ly;cA=1;var e=a5();function t(n){var a=new n.constructor(n.byteLength);return new e(a).set(new e(n)),a}return Ly=t,Ly}var By,uA;function rW(){if(uA)return By;uA=1;var e=zw();function t(n,a){var i=a?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.byteLength)}return By=t,By}var Fy,dA;function aW(){if(dA)return Fy;dA=1;var e=/\w*$/;function t(n){var a=new n.constructor(n.source,e.exec(n));return a.lastIndex=n.lastIndex,a}return Fy=t,Fy}var Iy,fA;function sW(){if(fA)return Iy;fA=1;var e=Ju(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function a(i){return n?Object(n.call(i)):{}}return Iy=a,Iy}var zy,hA;function iW(){if(hA)return zy;hA=1;var e=zw();function t(n,a){var i=a?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.length)}return zy=t,zy}var Hy,pA;function oW(){if(pA)return Hy;pA=1;var e=zw(),t=rW(),n=aW(),a=sW(),i=iW(),l="[object Boolean]",u="[object Date]",d="[object Map]",h="[object Number]",p="[object RegExp]",g="[object Set]",m="[object String]",b="[object Symbol]",S="[object ArrayBuffer]",j="[object DataView]",w="[object Float32Array]",C="[object Float64Array]",N="[object Int8Array]",_="[object Int16Array]",T="[object Int32Array]",O="[object Uint8Array]",M="[object Uint8ClampedArray]",B="[object Uint16Array]",k="[object Uint32Array]";function F(W,ce,G){var ie=W.constructor;switch(ce){case S:return e(W);case l:case u:return new ie(+W);case j:return t(W,G);case w:case C:case N:case _:case T:case O:case M:case B:case k:return i(W,G);case d:return new ie;case h:case m:return new ie(W);case p:return n(W);case g:return new ie;case b:return a(W)}}return Hy=F,Hy}var Uy,mA;function lW(){if(mA)return Uy;mA=1;var e=tc(),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 Uy=n,Uy}var Vy,gA;function cW(){if(gA)return Vy;gA=1;var e=lW(),t=Ow(),n=Aw();function a(i){return typeof i.constructor=="function"&&!n(i)?e(t(i)):{}}return Vy=a,Vy}var qy,vA;function uW(){if(vA)return qy;vA=1;var e=ip(),t=Ds(),n="[object Map]";function a(i){return t(i)&&e(i)==n}return qy=a,qy}var $y,xA;function dW(){if(xA)return $y;xA=1;var e=uW(),t=_w(),n=Tw(),a=n&&n.isMap,i=a?t(a):e;return $y=i,$y}var Gy,yA;function fW(){if(yA)return Gy;yA=1;var e=ip(),t=Ds(),n="[object Set]";function a(i){return t(i)&&e(i)==n}return Gy=a,Gy}var Ky,bA;function hW(){if(bA)return Ky;bA=1;var e=fW(),t=_w(),n=Tw(),a=n&&n.isSet,i=a?t(a):e;return Ky=i,Ky}var Yy,wA;function pW(){if(wA)return Yy;wA=1;var e=kw(),t=$Y(),n=m5(),a=KY(),i=XY(),l=QY(),u=ZY(),d=JY(),h=eW(),p=l5(),g=tW(),m=ip(),b=nW(),S=oW(),j=cW(),w=_a(),C=Nw(),N=dW(),_=tc(),T=hW(),O=ed(),M=Iw(),B=1,k=2,F=4,W="[object Arguments]",ce="[object Array]",G="[object Boolean]",ie="[object Date]",Q="[object Error]",Z="[object Function]",ve="[object GeneratorFunction]",P="[object Map]",V="[object Number]",H="[object Object]",se="[object RegExp]",we="[object Set]",L="[object String]",re="[object Symbol]",z="[object WeakMap]",ee="[object ArrayBuffer]",xe="[object DataView]",Ne="[object Float32Array]",fe="[object Float64Array]",Ce="[object Int8Array]",Pe="[object Int16Array]",ke="[object Int32Array]",Ue="[object Uint8Array]",pe="[object Uint8ClampedArray]",it="[object Uint16Array]",st="[object Uint32Array]",Me={};Me[W]=Me[ce]=Me[ee]=Me[xe]=Me[G]=Me[ie]=Me[Ne]=Me[fe]=Me[Ce]=Me[Pe]=Me[ke]=Me[P]=Me[V]=Me[H]=Me[se]=Me[we]=Me[L]=Me[re]=Me[Ue]=Me[pe]=Me[it]=Me[st]=!0,Me[Q]=Me[Z]=Me[z]=!1;function ot($e,Vt,dt,Lt,yt,ft){var Ge,ht=Vt&B,Ct=Vt&k,Jt=Vt&F;if(dt&&(Ge=yt?dt($e,Lt,yt,ft):dt($e)),Ge!==void 0)return Ge;if(!_($e))return $e;var Wt=w($e);if(Wt){if(Ge=b($e),!ht)return u($e,Ge)}else{var Xt=m($e),de=Xt==Z||Xt==ve;if(C($e))return l($e,ht);if(Xt==H||Xt==W||de&&!yt){if(Ge=Ct||de?{}:j($e),!ht)return Ct?h($e,i(Ge,$e)):d($e,a(Ge,$e))}else{if(!Me[Xt])return yt?$e:{};Ge=S($e,Xt,ht)}}ft||(ft=new e);var De=ft.get($e);if(De)return De;ft.set($e,Ge),T($e)?$e.forEach(function(_e){Ge.add(ot(_e,Vt,dt,_e,$e,ft))}):N($e)&&$e.forEach(function(_e,We){Ge.set(We,ot(_e,Vt,dt,We,$e,ft))});var Te=Jt?Ct?g:p:Ct?M:O,Be=Wt?void 0:Te($e);return t(Be||$e,function(_e,We){Be&&(We=_e,_e=$e[We]),n(Ge,We,ot(_e,Vt,dt,We,$e,ft))}),Ge}return Yy=ot,Yy}var Wy,SA;function mW(){if(SA)return Wy;SA=1;var e=pW(),t=1,n=4;function a(i){return e(i,t|n)}return Wy=a,Wy}var jA;function gW(){if(jA)return ll;jA=1,Object.defineProperty(ll,"__esModule",{value:!0}),ll.mergeClasses=void 0;var e=Rw(),t=l(e),n=mW(),a=l(n),i=Object.assign||function(d){for(var h=1;h<arguments.length;h++){var p=arguments[h];for(var g in p)Object.prototype.hasOwnProperty.call(p,g)&&(d[g]=p[g])}return d};function l(d){return d&&d.__esModule?d:{default:d}}var u=ll.mergeClasses=function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],g=h.default&&(0,a.default)(h.default)||{};return p.map(function(m){var b=h[m];return b&&(0,t.default)(b,function(S,j){g[j]||(g[j]={}),g[j]=i({},g[j],b[j])}),m}),g};return ll.default=u,ll}var cl={},CA;function vW(){if(CA)return cl;CA=1,Object.defineProperty(cl,"__esModule",{value:!0}),cl.autoprefix=void 0;var e=Rw(),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=cl.autoprefix=function(d){var h={};return(0,t.default)(d,function(p,g){var m={};(0,t.default)(p,function(b,S){var j=i[S];j?m=n({},m,j(b)):m[S]=b}),h[g]=m}),h};return cl.default=l,cl}var ul={},NA;function xW(){if(NA)return ul;NA=1,Object.defineProperty(ul,"__esModule",{value:!0}),ul.hover=void 0;var e=Object.assign||function(h){for(var p=1;p<arguments.length;p++){var g=arguments[p];for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&(h[m]=g[m])}return h},t=lo(),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=ul.hover=function(p){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return(function(m){u(b,m);function b(){var S,j,w,C;i(this,b);for(var N=arguments.length,_=Array(N),T=0;T<N;T++)_[T]=arguments[T];return C=(j=(w=l(this,(S=b.__proto__||Object.getPrototypeOf(b)).call.apply(S,[this].concat(_))),w),w.state={hover:!1},w.handleMouseOver=function(){return w.setState({hover:!0})},w.handleMouseOut=function(){return w.setState({hover:!1})},w.render=function(){return n.default.createElement(g,{onMouseOver:w.handleMouseOver,onMouseOut:w.handleMouseOut},n.default.createElement(p,e({},w.props,w.state)))},j),l(w,C)}return b})(n.default.Component)};return ul.default=d,ul}var dl={},EA;function yW(){if(EA)return dl;EA=1,Object.defineProperty(dl,"__esModule",{value:!0}),dl.active=void 0;var e=Object.assign||function(h){for(var p=1;p<arguments.length;p++){var g=arguments[p];for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&(h[m]=g[m])}return h},t=lo(),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=dl.active=function(p){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return(function(m){u(b,m);function b(){var S,j,w,C;i(this,b);for(var N=arguments.length,_=Array(N),T=0;T<N;T++)_[T]=arguments[T];return C=(j=(w=l(this,(S=b.__proto__||Object.getPrototypeOf(b)).call.apply(S,[this].concat(_))),w),w.state={active:!1},w.handleMouseDown=function(){return w.setState({active:!0})},w.handleMouseUp=function(){return w.setState({active:!1})},w.render=function(){return n.default.createElement(g,{onMouseDown:w.handleMouseDown,onMouseUp:w.handleMouseUp},n.default.createElement(p,e({},w.props,w.state)))},j),l(w,C)}return b})(n.default.Component)};return dl.default=d,dl}var Af={},_A;function bW(){if(_A)return Af;_A=1,Object.defineProperty(Af,"__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 Af.default=e,Af}var TA;function wW(){if(TA)return ir;TA=1,Object.defineProperty(ir,"__esModule",{value:!0}),ir.ReactCSS=ir.loop=ir.handleActive=ir.handleHover=ir.hover=void 0;var e=qY(),t=b(e),n=gW(),a=b(n),i=vW(),l=b(i),u=xW(),d=b(u),h=yW(),p=b(h),g=bW(),m=b(g);function b(j){return j&&j.__esModule?j:{default:j}}ir.hover=d.default,ir.handleHover=d.default,ir.handleActive=p.default,ir.loop=m.default;var S=ir.ReactCSS=function(w){for(var C=arguments.length,N=Array(C>1?C-1:0),_=1;_<C;_++)N[_-1]=arguments[_];var T=(0,t.default)(N),O=(0,a.default)(w,T);return(0,l.default)(O)};return ir.default=S,ir}var Hw=wW();const ut=Ul(Hw);var SW=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,g=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 S=void 0;if(g<0?S=0:g>u?S=1:S=Math.round(g*100/u)/100,i!==S)return{h:n.h,s:n.s,l:n.l,a:S,source:"rgb"}}return null},Xy={},jW=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},CW=function(t,n,a,i){var l=t+"-"+n+"-"+a+(i?"-server":"");if(Xy[l])return Xy[l];var u=jW(t,n,a,i);return Xy[l]=u,u},AA=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},nc=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=ut({default:{grid:{borderRadius:u,boxShadow:d,absolute:"0px 0px 0px 0px",background:"url("+CW(n,a,i,l.canvas)+") center left"}}});return v.isValidElement(h)?A.cloneElement(h,AA({},h.props,{style:AA({},h.props.style,p.grid)})):A.createElement("div",{style:p.grid})};nc.defaultProps={size:8,white:"transparent",grey:"rgba(0,0,0,.08)",renderers:{}};var NW=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},EW=(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 _W(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function RA(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 TW(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 Uw=(function(e){TW(t,e);function t(){var n,a,i,l;_W(this,t);for(var u=arguments.length,d=Array(u),h=0;h<u;h++)d[h]=arguments[h];return l=(a=(i=RA(this,(n=t.__proto__||Object.getPrototypeOf(t)).call.apply(n,[this].concat(d))),i),i.handleChange=function(p){var g=SW(p,i.props.hsl,i.props.direction,i.props.a,i.container);g&&typeof i.props.onChange=="function"&&i.props.onChange(g,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),RA(i,l)}return EW(t,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"render",value:function(){var a=this,i=this.props.rgb,l=ut({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%,
  58. 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%,
  59. rgba(`+i.r+","+i.g+","+i.b+", 1) 100%)"},pointer:{left:0,top:i.a*100+"%"}},overwrite:NW({},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(nc,{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})(v.PureComponent||v.Component),AW=(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 RW(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function OW(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function MW(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 PW(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 DW=1,v5=38,kW=40,LW=[v5,kW],BW=function(t){return LW.indexOf(t)>-1},FW=function(t){return Number(String(t).replace(/%/g,""))},IW=1,Ft=(function(e){PW(t,e);function t(n){OW(this,t);var a=MW(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=FW(i.target.value);if(!isNaN(l)&&BW(i.keyCode)){var u=a.getArrowOffset(),d=i.keyCode===v5?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-"+IW++,a}return AW(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 RW({},this.props.label,a)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||DW}},{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=ut({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})(v.PureComponent||v.Component),zW=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),g=h-(i.getBoundingClientRect().top+window.pageYOffset);if(n==="vertical"){var m=void 0;if(g<0)m=359;else if(g>u)m=0;else{var b=-(g*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 S=void 0;if(p<0)S=0;else if(p>l)S=359;else{var j=p*100/l;S=360*j/100}if(a.h!==S)return{h:S,s:a.s,l:a.l,a:a.a,source:"hsl"}}return null},HW=(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 UW(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function OA(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 VW(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 rc=(function(e){VW(t,e);function t(){var n,a,i,l;UW(this,t);for(var u=arguments.length,d=Array(u),h=0;h<u;h++)d[h]=arguments[h];return l=(a=(i=OA(this,(n=t.__proto__||Object.getPrototypeOf(t)).call.apply(n,[this].concat(d))),i),i.handleChange=function(p){var g=zW(p,i.props.direction,i.props.hsl,i.container);g&&typeof i.props.onChange=="function"&&i.props.onChange(g,p)},i.handleMouseDown=function(p){i.handleChange(p),window.addEventListener("mousemove",i.handleChange),window.addEventListener("mouseup",i.handleMouseUp)},i.handleMouseUp=function(){i.unbindEventListeners()},a),OA(i,l)}return HW(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=ut({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,`
  60. .hue-horizontal {
  61. background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0
  62. 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
  63. background: -webkit-linear-gradient(to right, #f00 0%, #ff0
  64. 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
  65. }
  66. .hue-vertical {
  67. background: linear-gradient(to top, #f00 0%, #ff0 17%, #0f0 33%,
  68. #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
  69. background: -webkit-linear-gradient(to top, #f00 0%, #ff0 17%,
  70. #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
  71. }
  72. `),A.createElement("div",{style:u.pointer},this.props.pointer?A.createElement(this.props.pointer,this.props):A.createElement("div",{style:u.slider}))))}}]),t})(v.PureComponent||v.Component),Qy={exports:{}},Zy,MA;function qW(){if(MA)return Zy;MA=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Zy=e,Zy}var Jy,PA;function $W(){if(PA)return Jy;PA=1;var e=qW();function t(){}function n(){}return n.resetWarningCache=t,Jy=function(){function a(u,d,h,p,g,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},Jy}var DA;function GW(){return DA||(DA=1,Qy.exports=$W()()),Qy.exports}var KW=GW();const Ae=Ul(KW);function YW(){this.__data__=[],this.size=0}function td(e,t){return e===t||e!==e&&t!==t}function cp(e,t){for(var n=e.length;n--;)if(td(e[n][0],t))return n;return-1}var WW=Array.prototype,XW=WW.splice;function QW(e){var t=this.__data__,n=cp(t,e);if(n<0)return!1;var a=t.length-1;return n==a?t.pop():XW.call(t,n,1),--this.size,!0}function ZW(e){var t=this.__data__,n=cp(t,e);return n<0?void 0:t[n][1]}function JW(e){return cp(this.__data__,e)>-1}function eX(e,t){var n=this.__data__,a=cp(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this}function ks(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])}}ks.prototype.clear=YW;ks.prototype.delete=QW;ks.prototype.get=ZW;ks.prototype.has=JW;ks.prototype.set=eX;function tX(){this.__data__=new ks,this.size=0}function nX(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function rX(e){return this.__data__.get(e)}function aX(e){return this.__data__.has(e)}var x5=typeof global=="object"&&global&&global.Object===Object&&global,sX=typeof self=="object"&&self&&self.Object===Object&&self,Ta=x5||sX||Function("return this")(),bi=Ta.Symbol,y5=Object.prototype,iX=y5.hasOwnProperty,oX=y5.toString,su=bi?bi.toStringTag:void 0;function lX(e){var t=iX.call(e,su),n=e[su];try{e[su]=void 0;var a=!0}catch{}var i=oX.call(e);return a&&(t?e[su]=n:delete e[su]),i}var cX=Object.prototype,uX=cX.toString;function dX(e){return uX.call(e)}var fX="[object Null]",hX="[object Undefined]",kA=bi?bi.toStringTag:void 0;function ho(e){return e==null?e===void 0?hX:fX:kA&&kA in Object(e)?lX(e):dX(e)}function ea(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var pX="[object AsyncFunction]",mX="[object Function]",gX="[object GeneratorFunction]",vX="[object Proxy]";function Vw(e){if(!ea(e))return!1;var t=ho(e);return t==mX||t==gX||t==pX||t==vX}var eb=Ta["__core-js_shared__"],LA=(function(){var e=/[^.]+$/.exec(eb&&eb.keys&&eb.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function xX(e){return!!LA&&LA in e}var yX=Function.prototype,bX=yX.toString;function po(e){if(e!=null){try{return bX.call(e)}catch{}try{return e+""}catch{}}return""}var wX=/[\\^$.*+?()[\]{}|]/g,SX=/^\[object .+?Constructor\]$/,jX=Function.prototype,CX=Object.prototype,NX=jX.toString,EX=CX.hasOwnProperty,_X=RegExp("^"+NX.call(EX).replace(wX,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function TX(e){if(!ea(e)||xX(e))return!1;var t=Vw(e)?_X:SX;return t.test(po(e))}function AX(e,t){return e?.[t]}function mo(e,t){var n=AX(e,t);return TX(n)?n:void 0}var Fu=mo(Ta,"Map"),Iu=mo(Object,"create");function RX(){this.__data__=Iu?Iu(null):{},this.size=0}function OX(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var MX="__lodash_hash_undefined__",PX=Object.prototype,DX=PX.hasOwnProperty;function kX(e){var t=this.__data__;if(Iu){var n=t[e];return n===MX?void 0:n}return DX.call(t,e)?t[e]:void 0}var LX=Object.prototype,BX=LX.hasOwnProperty;function FX(e){var t=this.__data__;return Iu?t[e]!==void 0:BX.call(t,e)}var IX="__lodash_hash_undefined__";function zX(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Iu&&t===void 0?IX:t,this}function oo(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])}}oo.prototype.clear=RX;oo.prototype.delete=OX;oo.prototype.get=kX;oo.prototype.has=FX;oo.prototype.set=zX;function HX(){this.size=0,this.__data__={hash:new oo,map:new(Fu||ks),string:new oo}}function UX(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function up(e,t){var n=e.__data__;return UX(t)?n[typeof t=="string"?"string":"hash"]:n.map}function VX(e){var t=up(this,e).delete(e);return this.size-=t?1:0,t}function qX(e){return up(this,e).get(e)}function $X(e){return up(this,e).has(e)}function GX(e,t){var n=up(this,e),a=n.size;return n.set(e,t),this.size+=n.size==a?0:1,this}function Ls(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])}}Ls.prototype.clear=HX;Ls.prototype.delete=VX;Ls.prototype.get=qX;Ls.prototype.has=$X;Ls.prototype.set=GX;var KX=200;function YX(e,t){var n=this.__data__;if(n instanceof ks){var a=n.__data__;if(!Fu||a.length<KX-1)return a.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ls(a)}return n.set(e,t),this.size=n.size,this}function Ga(e){var t=this.__data__=new ks(e);this.size=t.size}Ga.prototype.clear=tX;Ga.prototype.delete=nX;Ga.prototype.get=rX;Ga.prototype.has=aX;Ga.prototype.set=YX;var dh=(function(){try{var e=mo(Object,"defineProperty");return e({},"",{}),e}catch{}})();function qw(e,t,n){t=="__proto__"&&dh?dh(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function n0(e,t,n){(n!==void 0&&!td(e[t],n)||n===void 0&&!(t in e))&&qw(e,t,n)}function WX(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 b5=WX(),w5=typeof Nr=="object"&&Nr&&!Nr.nodeType&&Nr,BA=w5&&typeof Er=="object"&&Er&&!Er.nodeType&&Er,XX=BA&&BA.exports===w5,FA=XX?Ta.Buffer:void 0;FA&&FA.allocUnsafe;function QX(e,t){return e.slice()}var fh=Ta.Uint8Array;function ZX(e){var t=new e.constructor(e.byteLength);return new fh(t).set(new fh(e)),t}function JX(e,t){var n=ZX(e.buffer);return new e.constructor(n,e.byteOffset,e.length)}function eQ(e,t){var n=-1,a=e.length;for(t||(t=Array(a));++n<a;)t[n]=e[n];return t}var IA=Object.create,tQ=(function(){function e(){}return function(t){if(!ea(t))return{};if(IA)return IA(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}})();function S5(e,t){return function(n){return e(t(n))}}var j5=S5(Object.getPrototypeOf,Object),nQ=Object.prototype;function $w(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||nQ;return e===n}function rQ(e){return typeof e.constructor=="function"&&!$w(e)?tQ(j5(e)):{}}function wi(e){return e!=null&&typeof e=="object"}var aQ="[object Arguments]";function zA(e){return wi(e)&&ho(e)==aQ}var C5=Object.prototype,sQ=C5.hasOwnProperty,iQ=C5.propertyIsEnumerable,hh=zA((function(){return arguments})())?zA:function(e){return wi(e)&&sQ.call(e,"callee")&&!iQ.call(e,"callee")},Ar=Array.isArray,oQ=9007199254740991;function Gw(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=oQ}function ac(e){return e!=null&&Gw(e.length)&&!Vw(e)}function lQ(e){return wi(e)&&ac(e)}function cQ(){return!1}var N5=typeof Nr=="object"&&Nr&&!Nr.nodeType&&Nr,HA=N5&&typeof Er=="object"&&Er&&!Er.nodeType&&Er,uQ=HA&&HA.exports===N5,UA=uQ?Ta.Buffer:void 0,dQ=UA?UA.isBuffer:void 0,ph=dQ||cQ,fQ="[object Object]",hQ=Function.prototype,pQ=Object.prototype,E5=hQ.toString,mQ=pQ.hasOwnProperty,gQ=E5.call(Object);function vQ(e){if(!wi(e)||ho(e)!=fQ)return!1;var t=j5(e);if(t===null)return!0;var n=mQ.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&E5.call(n)==gQ}var xQ="[object Arguments]",yQ="[object Array]",bQ="[object Boolean]",wQ="[object Date]",SQ="[object Error]",jQ="[object Function]",CQ="[object Map]",NQ="[object Number]",EQ="[object Object]",_Q="[object RegExp]",TQ="[object Set]",AQ="[object String]",RQ="[object WeakMap]",OQ="[object ArrayBuffer]",MQ="[object DataView]",PQ="[object Float32Array]",DQ="[object Float64Array]",kQ="[object Int8Array]",LQ="[object Int16Array]",BQ="[object Int32Array]",FQ="[object Uint8Array]",IQ="[object Uint8ClampedArray]",zQ="[object Uint16Array]",HQ="[object Uint32Array]",un={};un[PQ]=un[DQ]=un[kQ]=un[LQ]=un[BQ]=un[FQ]=un[IQ]=un[zQ]=un[HQ]=!0;un[xQ]=un[yQ]=un[OQ]=un[bQ]=un[MQ]=un[wQ]=un[SQ]=un[jQ]=un[CQ]=un[NQ]=un[EQ]=un[_Q]=un[TQ]=un[AQ]=un[RQ]=!1;function UQ(e){return wi(e)&&Gw(e.length)&&!!un[ho(e)]}function VQ(e){return function(t){return e(t)}}var _5=typeof Nr=="object"&&Nr&&!Nr.nodeType&&Nr,ju=_5&&typeof Er=="object"&&Er&&!Er.nodeType&&Er,qQ=ju&&ju.exports===_5,tb=qQ&&x5.process,VA=(function(){try{var e=ju&&ju.require&&ju.require("util").types;return e||tb&&tb.binding&&tb.binding("util")}catch{}})(),qA=VA&&VA.isTypedArray,Kw=qA?VQ(qA):UQ;function r0(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var $Q=Object.prototype,GQ=$Q.hasOwnProperty;function KQ(e,t,n){var a=e[t];(!(GQ.call(e,t)&&td(a,n))||n===void 0&&!(t in e))&&qw(e,t,n)}function YQ(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?qw(n,d,h):KQ(n,d,h)}return n}function WQ(e,t){for(var n=-1,a=Array(e);++n<e;)a[n]=t(n);return a}var XQ=9007199254740991,QQ=/^(?:0|[1-9]\d*)$/;function Yw(e,t){var n=typeof e;return t=t??XQ,!!t&&(n=="number"||n!="symbol"&&QQ.test(e))&&e>-1&&e%1==0&&e<t}var ZQ=Object.prototype,JQ=ZQ.hasOwnProperty;function T5(e,t){var n=Ar(e),a=!n&&hh(e),i=!n&&!a&&ph(e),l=!n&&!a&&!i&&Kw(e),u=n||a||i||l,d=u?WQ(e.length,String):[],h=d.length;for(var p in e)(t||JQ.call(e,p))&&!(u&&(p=="length"||i&&(p=="offset"||p=="parent")||l&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||Yw(p,h)))&&d.push(p);return d}function eZ(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var tZ=Object.prototype,nZ=tZ.hasOwnProperty;function rZ(e){if(!ea(e))return eZ(e);var t=$w(e),n=[];for(var a in e)a=="constructor"&&(t||!nZ.call(e,a))||n.push(a);return n}function A5(e){return ac(e)?T5(e,!0):rZ(e)}function aZ(e){return YQ(e,A5(e))}function sZ(e,t,n,a,i,l,u){var d=r0(e,n),h=r0(t,n),p=u.get(h);if(p){n0(e,n,p);return}var g=l?l(d,h,n+"",e,t,u):void 0,m=g===void 0;if(m){var b=Ar(h),S=!b&&ph(h),j=!b&&!S&&Kw(h);g=h,b||S||j?Ar(d)?g=d:lQ(d)?g=eQ(d):S?(m=!1,g=QX(h)):j?(m=!1,g=JX(h)):g=[]:vQ(h)||hh(h)?(g=d,hh(d)?g=aZ(d):(!ea(d)||Vw(d))&&(g=rQ(h))):m=!1}m&&(u.set(h,g),i(g,h,a,l,u),u.delete(h)),n0(e,n,g)}function R5(e,t,n,a,i){e!==t&&b5(t,function(l,u){if(i||(i=new Ga),ea(l))sZ(e,t,u,n,R5,a,i);else{var d=a?a(r0(e,u),l,u+"",e,t,i):void 0;d===void 0&&(d=l),n0(e,u,d)}},A5)}function dp(e){return e}function iZ(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 $A=Math.max;function oZ(e,t,n){return t=$A(t===void 0?e.length-1:t,0),function(){for(var a=arguments,i=-1,l=$A(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),iZ(e,this,d)}}function lZ(e){return function(){return e}}var cZ=dh?function(e,t){return dh(e,"toString",{configurable:!0,enumerable:!1,value:lZ(t),writable:!0})}:dp,uZ=800,dZ=16,fZ=Date.now;function hZ(e){var t=0,n=0;return function(){var a=fZ(),i=dZ-(a-n);if(n=a,i>0){if(++t>=uZ)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var pZ=hZ(cZ);function mZ(e,t){return pZ(oZ(e,t,dp),e+"")}function gZ(e,t,n){if(!ea(n))return!1;var a=typeof t;return(a=="number"?ac(n)&&Yw(t,n.length):a=="string"&&t in n)?td(n[t],e):!1}function vZ(e){return mZ(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&&gZ(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 dr=vZ(function(e,t,n){R5(e,t,n)}),nd=function(t){var n=t.zDepth,a=t.radius,i=t.background,l=t.children,u=t.styles,d=u===void 0?{}:u,h=ut(dr({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))};nd.propTypes={background:Ae.string,zDepth:Ae.oneOf([0,1,2,3,4,5]),radius:Ae.number,styles:Ae.object};nd.defaultProps={background:"#fff",zDepth:1,radius:2,styles:{}};var nb=function(){return Ta.Date.now()},xZ=/\s/;function yZ(e){for(var t=e.length;t--&&xZ.test(e.charAt(t)););return t}var bZ=/^\s+/;function wZ(e){return e&&e.slice(0,yZ(e)+1).replace(bZ,"")}var SZ="[object Symbol]";function fp(e){return typeof e=="symbol"||wi(e)&&ho(e)==SZ}var GA=NaN,jZ=/^[-+]0x[0-9a-f]+$/i,CZ=/^0b[01]+$/i,NZ=/^0o[0-7]+$/i,EZ=parseInt;function KA(e){if(typeof e=="number")return e;if(fp(e))return GA;if(ea(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ea(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=wZ(e);var n=CZ.test(e);return n||NZ.test(e)?EZ(e.slice(2),n?2:8):jZ.test(e)?GA:+e}var _Z="Expected a function",TZ=Math.max,AZ=Math.min;function O5(e,t,n){var a,i,l,u,d,h,p=0,g=!1,m=!1,b=!0;if(typeof e!="function")throw new TypeError(_Z);t=KA(t)||0,ea(n)&&(g=!!n.leading,m="maxWait"in n,l=m?TZ(KA(n.maxWait)||0,t):l,b="trailing"in n?!!n.trailing:b);function S(B){var k=a,F=i;return a=i=void 0,p=B,u=e.apply(F,k),u}function j(B){return p=B,d=setTimeout(N,t),g?S(B):u}function w(B){var k=B-h,F=B-p,W=t-k;return m?AZ(W,l-F):W}function C(B){var k=B-h,F=B-p;return h===void 0||k>=t||k<0||m&&F>=l}function N(){var B=nb();if(C(B))return _(B);d=setTimeout(N,w(B))}function _(B){return d=void 0,b&&a?S(B):(a=i=void 0,u)}function T(){d!==void 0&&clearTimeout(d),p=0,a=h=i=d=void 0}function O(){return d===void 0?u:_(nb())}function M(){var B=nb(),k=C(B);if(a=arguments,i=this,h=B,k){if(d===void 0)return j(h);if(m)return clearTimeout(d),d=setTimeout(N,t),S(h)}return d===void 0&&(d=setTimeout(N,t)),u}return M.cancel=T,M.flush=O,M}var RZ="Expected a function";function OZ(e,t,n){var a=!0,i=!0;if(typeof e!="function")throw new TypeError(RZ);return ea(n)&&(a="leading"in n?!!n.leading:a,i="trailing"in n?!!n.trailing:i),O5(e,t,{leading:a,maxWait:t,trailing:i})}var MZ=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),g=h-(a.getBoundingClientRect().top+window.pageYOffset);p<0?p=0:p>l&&(p=l),g<0?g=0:g>u&&(g=u);var m=p/l,b=1-g/u;return{h:n.h,s:m,v:b,a:n.a,source:"hsv"}},PZ=(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 DZ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kZ(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 LZ(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 hp=(function(e){LZ(t,e);function t(n){DZ(this,t);var a=kZ(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,n));return a.handleChange=function(i){typeof a.props.onChange=="function"&&a.throttle(a.props.onChange,MZ(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=OZ(function(i,l,u){i(l,u)},50),a}return PZ(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,g=ut({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),
  73. 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:g.color,ref:function(b){return a.container=b},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},A.createElement("style",null,`
  74. .saturation-white {
  75. background: -webkit-linear-gradient(to right, #fff, rgba(255,255,255,0));
  76. background: linear-gradient(to right, #fff, rgba(255,255,255,0));
  77. }
  78. .saturation-black {
  79. background: -webkit-linear-gradient(to top, #000, rgba(0,0,0,0));
  80. background: linear-gradient(to top, #000, rgba(0,0,0,0));
  81. }
  82. `),A.createElement("div",{style:g.white,className:"saturation-white"},A.createElement("div",{style:g.black,className:"saturation-black"}),A.createElement("div",{style:g.pointer},this.props.pointer?A.createElement(this.props.pointer,this.props):A.createElement("div",{style:g.circle}))))}}]),t})(v.PureComponent||v.Component);function BZ(e,t){for(var n=-1,a=e==null?0:e.length;++n<a&&t(e[n],n,e)!==!1;);return e}var FZ=S5(Object.keys,Object),IZ=Object.prototype,zZ=IZ.hasOwnProperty;function HZ(e){if(!$w(e))return FZ(e);var t=[];for(var n in Object(e))zZ.call(e,n)&&n!="constructor"&&t.push(n);return t}function Ww(e){return ac(e)?T5(e):HZ(e)}function UZ(e,t){return e&&b5(e,t,Ww)}function VZ(e,t){return function(n,a){if(n==null)return n;if(!ac(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 M5=VZ(UZ);function qZ(e){return typeof e=="function"?e:dp}function $Z(e,t){var n=Ar(e)?BZ:M5;return n(e,qZ(t))}function mh(e){"@babel/helpers - typeof";return mh=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},mh(e)}var GZ=/^\s+/,KZ=/\s+$/;function Ke(e,t){if(e=e||"",t=t||{},e instanceof Ke)return e;if(!(this instanceof Ke))return new Ke(e,t);var n=YZ(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}Ke.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=P5(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=WA(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=WA(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=YA(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=YA(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 XA(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return ZZ(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(pn(this._r,255)*100)+"%",g:Math.round(pn(this._g,255)*100)+"%",b:Math.round(pn(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(pn(this._r,255)*100)+"%, "+Math.round(pn(this._g,255)*100)+"%, "+Math.round(pn(this._b,255)*100)+"%)":"rgba("+Math.round(pn(this._r,255)*100)+"%, "+Math.round(pn(this._g,255)*100)+"%, "+Math.round(pn(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:uJ[XA(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var n="#"+QA(this._r,this._g,this._b,this._a),a=n,i=this._gradientType?"GradientType = 1, ":"";if(t){var l=Ke(t);a="#"+QA(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 Ke(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(nJ,arguments)},brighten:function(){return this._applyModification(rJ,arguments)},darken:function(){return this._applyModification(aJ,arguments)},desaturate:function(){return this._applyModification(JZ,arguments)},saturate:function(){return this._applyModification(eJ,arguments)},greyscale:function(){return this._applyModification(tJ,arguments)},spin:function(){return this._applyModification(sJ,arguments)},_applyCombination:function(t,n){return t.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(lJ,arguments)},complement:function(){return this._applyCombination(iJ,arguments)},monochromatic:function(){return this._applyCombination(cJ,arguments)},splitcomplement:function(){return this._applyCombination(oJ,arguments)},triad:function(){return this._applyCombination(ZA,[3])},tetrad:function(){return this._applyCombination(ZA,[4])}};Ke.fromRatio=function(e,t){if(mh(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 Ke(e,t)};function YZ(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=pJ(e)),mh(e)=="object"&&(ws(e.r)&&ws(e.g)&&ws(e.b)?(t=WZ(e.r,e.g,e.b),u=!0,d=String(e.r).substr(-1)==="%"?"prgb":"rgb"):ws(e.h)&&ws(e.s)&&ws(e.v)?(a=pu(e.s),i=pu(e.v),t=QZ(e.h,a,i),u=!0,d="hsv"):ws(e.h)&&ws(e.s)&&ws(e.l)&&(a=pu(e.s),l=pu(e.l),t=XZ(e.h,a,l),u=!0,d="hsl"),e.hasOwnProperty("a")&&(n=e.a)),n=P5(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 WZ(e,t,n){return{r:pn(e,255)*255,g:pn(t,255)*255,b:pn(n,255)*255}}function YA(e,t,n){e=pn(e,255),t=pn(t,255),n=pn(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 XZ(e,t,n){var a,i,l;e=pn(e,360),t=pn(t,100),n=pn(n,100);function u(p,g,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?p+(g-p)*6*m:m<1/2?g:m<2/3?p+(g-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 WA(e,t,n){e=pn(e,255),t=pn(t,255),n=pn(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 QZ(e,t,n){e=pn(e,360)*6,t=pn(t,100),n=pn(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],g=[d,n,n,u,l,l][h],m=[l,l,d,n,n,u][h];return{r:p*255,g:g*255,b:m*255}}function XA(e,t,n,a){var i=[ba(Math.round(e).toString(16)),ba(Math.round(t).toString(16)),ba(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 ZZ(e,t,n,a,i){var l=[ba(Math.round(e).toString(16)),ba(Math.round(t).toString(16)),ba(Math.round(n).toString(16)),ba(D5(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 QA(e,t,n,a){var i=[ba(D5(a)),ba(Math.round(e).toString(16)),ba(Math.round(t).toString(16)),ba(Math.round(n).toString(16))];return i.join("")}Ke.equals=function(e,t){return!e||!t?!1:Ke(e).toRgbString()==Ke(t).toRgbString()};Ke.random=function(){return Ke.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function JZ(e,t){t=t===0?0:t||10;var n=Ke(e).toHsl();return n.s-=t/100,n.s=pp(n.s),Ke(n)}function eJ(e,t){t=t===0?0:t||10;var n=Ke(e).toHsl();return n.s+=t/100,n.s=pp(n.s),Ke(n)}function tJ(e){return Ke(e).desaturate(100)}function nJ(e,t){t=t===0?0:t||10;var n=Ke(e).toHsl();return n.l+=t/100,n.l=pp(n.l),Ke(n)}function rJ(e,t){t=t===0?0:t||10;var n=Ke(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)))),Ke(n)}function aJ(e,t){t=t===0?0:t||10;var n=Ke(e).toHsl();return n.l-=t/100,n.l=pp(n.l),Ke(n)}function sJ(e,t){var n=Ke(e).toHsl(),a=(n.h+t)%360;return n.h=a<0?360+a:a,Ke(n)}function iJ(e){var t=Ke(e).toHsl();return t.h=(t.h+180)%360,Ke(t)}function ZA(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var n=Ke(e).toHsl(),a=[Ke(e)],i=360/t,l=1;l<t;l++)a.push(Ke({h:(n.h+l*i)%360,s:n.s,l:n.l}));return a}function oJ(e){var t=Ke(e).toHsl(),n=t.h;return[Ke(e),Ke({h:(n+72)%360,s:t.s,l:t.l}),Ke({h:(n+216)%360,s:t.s,l:t.l})]}function lJ(e,t,n){t=t||6,n=n||30;var a=Ke(e).toHsl(),i=360/n,l=[Ke(e)];for(a.h=(a.h-(i*t>>1)+720)%360;--t;)a.h=(a.h+i)%360,l.push(Ke(a));return l}function cJ(e,t){t=t||6;for(var n=Ke(e).toHsv(),a=n.h,i=n.s,l=n.v,u=[],d=1/t;t--;)u.push(Ke({h:a,s:i,v:l})),l=(l+d)%1;return u}Ke.mix=function(e,t,n){n=n===0?0:n||50;var a=Ke(e).toRgb(),i=Ke(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 Ke(u)};Ke.readability=function(e,t){var n=Ke(e),a=Ke(t);return(Math.max(n.getLuminance(),a.getLuminance())+.05)/(Math.min(n.getLuminance(),a.getLuminance())+.05)};Ke.isReadable=function(e,t,n){var a=Ke.readability(e,t),i,l;switch(l=!1,i=mJ(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};Ke.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=Ke.readability(e,t[p]),l>i&&(i=l,a=Ke(t[p]));return Ke.isReadable(e,a,{level:d,size:h})||!u?a:(n.includeFallbackColors=!1,Ke.mostReadable(e,["#fff","#000"],n))};var a0=Ke.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"},uJ=Ke.hexNames=dJ(a0);function dJ(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function P5(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function pn(e,t){fJ(e)&&(e="100%");var n=hJ(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 pp(e){return Math.min(1,Math.max(0,e))}function wr(e){return parseInt(e,16)}function fJ(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function hJ(e){return typeof e=="string"&&e.indexOf("%")!=-1}function ba(e){return e.length==1?"0"+e:""+e}function pu(e){return e<=1&&(e=e*100+"%"),e}function D5(e){return Math.round(parseFloat(e)*255).toString(16)}function JA(e){return wr(e)/255}var da=(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 ws(e){return!!da.CSS_UNIT.exec(e)}function pJ(e){e=e.replace(GZ,"").replace(KZ,"").toLowerCase();var t=!1;if(a0[e])e=a0[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=da.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=da.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=da.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=da.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=da.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=da.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=da.hex8.exec(e))?{r:wr(n[1]),g:wr(n[2]),b:wr(n[3]),a:JA(n[4]),format:t?"name":"hex8"}:(n=da.hex6.exec(e))?{r:wr(n[1]),g:wr(n[2]),b:wr(n[3]),format:t?"name":"hex"}:(n=da.hex4.exec(e))?{r:wr(n[1]+""+n[1]),g:wr(n[2]+""+n[2]),b:wr(n[3]+""+n[3]),a:JA(n[4]+""+n[4]),format:t?"name":"hex8"}:(n=da.hex3.exec(e))?{r:wr(n[1]+""+n[1]),g:wr(n[2]+""+n[2]),b:wr(n[3]+""+n[3]),format:t?"name":"hex"}:!1}function mJ(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 eR=function(t){var n=["r","g","b","a","h","s","l","v"],a=0,i=0;return $Z(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?Ke(t.hex):Ke(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&&Ke(t).isValid()},Xw=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"},rb=function(t,n){var a=t.replace("°","");return Ke(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},gJ=(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 vJ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xJ(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 yJ(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 fr=function(t){var n=(function(a){yJ(i,a);function i(l){vJ(this,i);var u=xJ(this,(i.__proto__||Object.getPrototypeOf(i)).call(this));return u.handleChange=function(d,h){var p=eR(d);if(p){var g=mu(d,d.h||u.state.oldHue);u.setState(g),u.props.onChangeComplete&&u.debounce(u.props.onChangeComplete,g,h),u.props.onChange&&u.props.onChange(g,h)}},u.handleSwatchHover=function(d,h){var p=eR(d);if(p){var g=mu(d,d.h||u.state.oldHue);u.props.onSwatchHover&&u.props.onSwatchHover(g,h)}},u.state=iu({},mu(l.color,0)),u.debounce=O5(function(d,h,p){d(h,p)},100),u}return gJ(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})(v.PureComponent||v.Component);return n.propTypes=iu({},t.propTypes),n.defaultProps=iu({},t.defaultProps,{color:{h:250,s:.5,l:.2,a:1}}),n},bJ=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},wJ=(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 SJ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tR(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 jJ(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 CJ=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return(function(a){jJ(i,a);function i(){var l,u,d,h;SJ(this,i);for(var p=arguments.length,g=Array(p),m=0;m<p;m++)g[m]=arguments[m];return h=(u=(d=tR(this,(l=i.__proto__||Object.getPrototypeOf(i)).call.apply(l,[this].concat(g))),d),d.state={focus:!1},d.handleFocus=function(){return d.setState({focus:!0})},d.handleBlur=function(){return d.setState({focus:!1})},u),tR(d,h)}return wJ(i,[{key:"render",value:function(){return A.createElement(n,{onFocus:this.handleFocus,onBlur:this.handleBlur},A.createElement(t,bJ({},this.props,this.state)))}}]),i})(A.Component)},nR=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},NJ=13,EJ=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,g=t.focus,m=t.focusStyle,b=m===void 0?{}:m,S=n==="transparent",j=ut({default:{swatch:nR({background:n,height:"100%",width:"100%",cursor:"pointer",position:"relative",outline:"none"},a,g?b:{})}}),w=function(O){return l(n,O)},C=function(O){return O.keyCode===NJ&&l(n,O)},N=function(O){return u(n,O)},_={};return u&&(_.onMouseOver=N),A.createElement("div",nR({style:j.swatch,onClick:w,title:h,tabIndex:0,onKeyDown:C},_),p,S&&A.createElement(nc,{borderRadius:j.swatch.borderRadius,boxShadow:"inset 0 0 0 1px rgba(0,0,0,0.1)"}))};const go=CJ(EJ);var _J=function(t){var n=t.direction,a=ut({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})},TJ=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},k5=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,g=t.pointer,m=t.className,b=m===void 0?"":m,S=ut({default:{picker:{position:"relative",width:i,height:l},alpha:{radius:"2px",style:h}}});return A.createElement("div",{style:S.picker,className:"alpha-picker "+b},A.createElement(Uw,TJ({},S.alpha,{rgb:n,hsl:a,pointer:g,renderers:p,onChange:u,direction:d})))};k5.defaultProps={width:"316px",height:"16px",direction:"horizontal",pointer:_J};fr(k5);function L5(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 AJ="__lodash_hash_undefined__";function RJ(e){return this.__data__.set(e,AJ),this}function OJ(e){return this.__data__.has(e)}function gh(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Ls;++t<n;)this.add(e[t])}gh.prototype.add=gh.prototype.push=RJ;gh.prototype.has=OJ;function MJ(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 PJ(e,t){return e.has(t)}var DJ=1,kJ=2;function B5(e,t,n,a,i,l){var u=n&DJ,d=e.length,h=t.length;if(d!=h&&!(u&&h>d))return!1;var p=l.get(e),g=l.get(t);if(p&&g)return p==t&&g==e;var m=-1,b=!0,S=n&kJ?new gh:void 0;for(l.set(e,t),l.set(t,e);++m<d;){var j=e[m],w=t[m];if(a)var C=u?a(w,j,m,t,e,l):a(j,w,m,e,t,l);if(C!==void 0){if(C)continue;b=!1;break}if(S){if(!MJ(t,function(N,_){if(!PJ(S,_)&&(j===N||i(j,N,n,a,l)))return S.push(_)})){b=!1;break}}else if(!(j===w||i(j,w,n,a,l))){b=!1;break}}return l.delete(e),l.delete(t),b}function LJ(e){var t=-1,n=Array(e.size);return e.forEach(function(a,i){n[++t]=[i,a]}),n}function BJ(e){var t=-1,n=Array(e.size);return e.forEach(function(a){n[++t]=a}),n}var FJ=1,IJ=2,zJ="[object Boolean]",HJ="[object Date]",UJ="[object Error]",VJ="[object Map]",qJ="[object Number]",$J="[object RegExp]",GJ="[object Set]",KJ="[object String]",YJ="[object Symbol]",WJ="[object ArrayBuffer]",XJ="[object DataView]",rR=bi?bi.prototype:void 0,ab=rR?rR.valueOf:void 0;function QJ(e,t,n,a,i,l,u){switch(n){case XJ:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case WJ:return!(e.byteLength!=t.byteLength||!l(new fh(e),new fh(t)));case zJ:case HJ:case qJ:return td(+e,+t);case UJ:return e.name==t.name&&e.message==t.message;case $J:case KJ:return e==t+"";case VJ:var d=LJ;case GJ:var h=a&FJ;if(d||(d=BJ),e.size!=t.size&&!h)return!1;var p=u.get(e);if(p)return p==t;a|=IJ,u.set(e,t);var g=B5(d(e),d(t),a,i,l,u);return u.delete(e),g;case YJ:if(ab)return ab.call(e)==ab.call(t)}return!1}function ZJ(e,t){for(var n=-1,a=t.length,i=e.length;++n<a;)e[i+n]=t[n];return e}function JJ(e,t,n){var a=t(e);return Ar(e)?a:ZJ(a,n(e))}function eee(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 tee(){return[]}var nee=Object.prototype,ree=nee.propertyIsEnumerable,aR=Object.getOwnPropertySymbols,aee=aR?function(e){return e==null?[]:(e=Object(e),eee(aR(e),function(t){return ree.call(e,t)}))}:tee;function sR(e){return JJ(e,Ww,aee)}var see=1,iee=Object.prototype,oee=iee.hasOwnProperty;function lee(e,t,n,a,i,l){var u=n&see,d=sR(e),h=d.length,p=sR(t),g=p.length;if(h!=g&&!u)return!1;for(var m=h;m--;){var b=d[m];if(!(u?b in t:oee.call(t,b)))return!1}var S=l.get(e),j=l.get(t);if(S&&j)return S==t&&j==e;var w=!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)){w=!1;break}C||(C=b=="constructor")}if(w&&!C){var O=e.constructor,M=t.constructor;O!=M&&"constructor"in e&&"constructor"in t&&!(typeof O=="function"&&O instanceof O&&typeof M=="function"&&M instanceof M)&&(w=!1)}return l.delete(e),l.delete(t),w}var s0=mo(Ta,"DataView"),i0=mo(Ta,"Promise"),o0=mo(Ta,"Set"),l0=mo(Ta,"WeakMap"),iR="[object Map]",cee="[object Object]",oR="[object Promise]",lR="[object Set]",cR="[object WeakMap]",uR="[object DataView]",uee=po(s0),dee=po(Fu),fee=po(i0),hee=po(o0),pee=po(l0),hi=ho;(s0&&hi(new s0(new ArrayBuffer(1)))!=uR||Fu&&hi(new Fu)!=iR||i0&&hi(i0.resolve())!=oR||o0&&hi(new o0)!=lR||l0&&hi(new l0)!=cR)&&(hi=function(e){var t=ho(e),n=t==cee?e.constructor:void 0,a=n?po(n):"";if(a)switch(a){case uee:return uR;case dee:return iR;case fee:return oR;case hee:return lR;case pee:return cR}return t});var mee=1,dR="[object Arguments]",fR="[object Array]",Rf="[object Object]",gee=Object.prototype,hR=gee.hasOwnProperty;function vee(e,t,n,a,i,l){var u=Ar(e),d=Ar(t),h=u?fR:hi(e),p=d?fR:hi(t);h=h==dR?Rf:h,p=p==dR?Rf:p;var g=h==Rf,m=p==Rf,b=h==p;if(b&&ph(e)){if(!ph(t))return!1;u=!0,g=!1}if(b&&!g)return l||(l=new Ga),u||Kw(e)?B5(e,t,n,a,i,l):QJ(e,t,h,n,a,i,l);if(!(n&mee)){var S=g&&hR.call(e,"__wrapped__"),j=m&&hR.call(t,"__wrapped__");if(S||j){var w=S?e.value():e,C=j?t.value():t;return l||(l=new Ga),i(w,C,n,a,l)}}return b?(l||(l=new Ga),lee(e,t,n,a,i,l)):!1}function Qw(e,t,n,a,i){return e===t?!0:e==null||t==null||!wi(e)&&!wi(t)?e!==e&&t!==t:vee(e,t,n,a,Qw,i)}var xee=1,yee=2;function bee(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 g=new Ga,m;if(!(m===void 0?Qw(p,h,xee|yee,a,g):m))return!1}}return!0}function F5(e){return e===e&&!ea(e)}function wee(e){for(var t=Ww(e),n=t.length;n--;){var a=t[n],i=e[a];t[n]=[a,i,F5(i)]}return t}function I5(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function See(e){var t=wee(e);return t.length==1&&t[0][2]?I5(t[0][0],t[0][1]):function(n){return n===e||bee(n,e,t)}}var jee=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Cee=/^\w*$/;function Zw(e,t){if(Ar(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||fp(e)?!0:Cee.test(e)||!jee.test(e)||t!=null&&e in Object(t)}var Nee="Expected a function";function Jw(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Nee);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(Jw.Cache||Ls),n}Jw.Cache=Ls;var Eee=500;function _ee(e){var t=Jw(e,function(a){return n.size===Eee&&n.clear(),a}),n=t.cache;return t}var Tee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Aee=/\\(\\)?/g,Ree=_ee(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Tee,function(n,a,i,l){t.push(i?l.replace(Aee,"$1"):a||n)}),t}),pR=bi?bi.prototype:void 0,mR=pR?pR.toString:void 0;function z5(e){if(typeof e=="string")return e;if(Ar(e))return L5(e,z5)+"";if(fp(e))return mR?mR.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Oee(e){return e==null?"":z5(e)}function H5(e,t){return Ar(e)?e:Zw(e,t)?[e]:Ree(Oee(e))}function mp(e){if(typeof e=="string"||fp(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function U5(e,t){t=H5(t,e);for(var n=0,a=t.length;e!=null&&n<a;)e=e[mp(t[n++])];return n&&n==a?e:void 0}function Mee(e,t,n){var a=e==null?void 0:U5(e,t);return a===void 0?n:a}function Pee(e,t){return e!=null&&t in Object(e)}function Dee(e,t,n){t=H5(t,e);for(var a=-1,i=t.length,l=!1;++a<i;){var u=mp(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&&Gw(i)&&Yw(u,i)&&(Ar(e)||hh(e)))}function kee(e,t){return e!=null&&Dee(e,t,Pee)}var Lee=1,Bee=2;function Fee(e,t){return Zw(e)&&F5(t)?I5(mp(e),t):function(n){var a=Mee(n,e);return a===void 0&&a===t?kee(n,e):Qw(t,a,Lee|Bee)}}function Iee(e){return function(t){return t?.[e]}}function zee(e){return function(t){return U5(t,e)}}function Hee(e){return Zw(e)?Iee(mp(e)):zee(e)}function Uee(e){return typeof e=="function"?e:e==null?dp:typeof e=="object"?Ar(e)?Fee(e[0],e[1]):See(e):Hee(e)}function Vee(e,t){var n=-1,a=ac(e)?Array(e.length):[];return M5(e,function(i,l,u){a[++n]=t(i,l,u)}),a}function vo(e,t){var n=Ar(e)?L5:Vee;return n(e,Uee(t))}var qee=function(t){var n=t.colors,a=t.onClick,i=t.onSwatchHover,l=ut({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},vo(n,function(u){return A.createElement(go,{key:u,color:u,style:l.swatch,onClick:a,onHover:i,focusStyle:{boxShadow:"0 0 4px "+u}})}),A.createElement("div",{style:l.clear}))},e1=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,g=t.className,m=g===void 0?"":g,b=i==="transparent",S=function(C,N){Ei(C)&&n({hex:C,source:"hex"},N)},j=ut(dr({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:Xw(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(nc,{borderRadius:"6px 6px 0 0"}),A.createElement("div",{style:j.label},i)),A.createElement("div",{style:j.body},A.createElement(qee,{colors:l,onClick:S,onSwatchHover:a}),A.createElement(Ft,{style:{input:j.input},value:i,onChange:S})))};e1.propTypes={width:Ae.oneOfType([Ae.string,Ae.number]),colors:Ae.arrayOf(Ae.string),triangle:Ae.oneOf(["top","hide"]),styles:Ae.object};e1.defaultProps={width:170,colors:["#D9E3F0","#F47373","#697689","#37D67A","#2CCCE4","#555555","#dce775","#ff8a65","#ba68c8"],triangle:"top",styles:{}};fr(e1);var pl={100:"#ffcdd2",300:"#e57373",500:"#f44336",700:"#d32f2f",900:"#b71c1c"},ml={100:"#f8bbd0",300:"#f06292",500:"#e91e63",700:"#c2185b",900:"#880e4f"},gl={100:"#e1bee7",300:"#ba68c8",500:"#9c27b0",700:"#7b1fa2",900:"#4a148c"},vl={100:"#d1c4e9",300:"#9575cd",500:"#673ab7",700:"#512da8",900:"#311b92"},xl={100:"#c5cae9",300:"#7986cb",500:"#3f51b5",700:"#303f9f",900:"#1a237e"},yl={100:"#bbdefb",300:"#64b5f6",500:"#2196f3",700:"#1976d2",900:"#0d47a1"},bl={100:"#b3e5fc",300:"#4fc3f7",500:"#03a9f4",700:"#0288d1",900:"#01579b"},wl={100:"#b2ebf2",300:"#4dd0e1",500:"#00bcd4",700:"#0097a7",900:"#006064"},Sl={100:"#b2dfdb",300:"#4db6ac",500:"#009688",700:"#00796b",900:"#004d40"},gu={100:"#c8e6c9",300:"#81c784",500:"#4caf50",700:"#388e3c"},jl={100:"#dcedc8",300:"#aed581",500:"#8bc34a",700:"#689f38",900:"#33691e"},Cl={100:"#f0f4c3",300:"#dce775",500:"#cddc39",700:"#afb42b",900:"#827717"},Nl={100:"#fff9c4",300:"#fff176",500:"#ffeb3b",700:"#fbc02d",900:"#f57f17"},El={100:"#ffecb3",300:"#ffd54f",500:"#ffc107",700:"#ffa000",900:"#ff6f00"},_l={100:"#ffe0b2",300:"#ffb74d",500:"#ff9800",700:"#f57c00",900:"#e65100"},Tl={100:"#ffccbc",300:"#ff8a65",500:"#ff5722",700:"#e64a19",900:"#bf360c"},Al={100:"#d7ccc8",300:"#a1887f",500:"#795548",700:"#5d4037",900:"#3e2723"},Rl={100:"#cfd8dc",300:"#90a4ae",500:"#607d8b",700:"#455a64",900:"#263238"},V5=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=ut({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(go,{style:p.Swatch,color:n,onClick:a,onHover:i,focusStyle:{boxShadow:p.Swatch.boxShadow+", 0 0 5px "+n}}))};V5.defaultProps={circleSize:28,circleSpacing:14};const $ee=Hw.handleHover(V5);var t1=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,g=t.circleSpacing,m=t.className,b=m===void 0?"":m,S=ut(dr({default:{card:{width:n,display:"flex",flexWrap:"wrap",marginRight:-g,marginBottom:-g}}},p)),j=function(C,N){return a({hex:C,source:"hex"},N)};return A.createElement("div",{style:S.card,className:"circle-picker "+b},vo(l,function(w){return A.createElement($ee,{key:w,color:w,onClick:j,onSwatchHover:i,active:u===w.toLowerCase(),circleSize:d,circleSpacing:g})}))};t1.propTypes={width:Ae.oneOfType([Ae.string,Ae.number]),circleSize:Ae.number,circleSpacing:Ae.number,styles:Ae.object};t1.defaultProps={width:252,circleSize:28,circleSpacing:14,colors:[pl[500],ml[500],gl[500],vl[500],xl[500],yl[500],bl[500],wl[500],Sl[500],gu[500],jl[500],Cl[500],Nl[500],El[500],_l[500],Tl[500],Al[500],Rl[500]],styles:{}};fr(t1);function gR(e){return e===void 0}var Of={},vR;function Gee(){if(vR)return Of;vR=1,Object.defineProperty(Of,"__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=lo(),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 Of.default=function(u){var d=u.fill,h=d===void 0?"currentColor":d,p=u.width,g=p===void 0?l:p,m=u.height,b=m===void 0?l:m,S=u.style,j=S===void 0?{}:S,w=i(u,["fill","width","height","style"]);return n.default.createElement("svg",e({viewBox:"0 0 "+l+" "+l,style:e({fill:h,width:g,height:b},j)},w),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"}))},Of}var Kee=Gee();const Yee=Ul(Kee);var Wee=(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 Xee(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qee(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 Zee(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 q5=(function(e){Zee(t,e);function t(n){Xee(this,t);var a=Qee(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(gR(i.s)?a.props.hsl.s:i.s),l:Number(gR(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 Wee(t,[{key:"render",value:function(){var a=this,i=ut({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(Ft,{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(Ft,{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(Ft,{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(Ft,{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(Ft,{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(Ft,{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(Ft,{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(Ft,{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(Ft,{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(Yee,{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);q5.defaultProps={view:"hex"};var xR=function(){var t=ut({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})},Jee=function(){var t=ut({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})},n1=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,g=t.styles,m=g===void 0?{}:g,b=t.className,S=b===void 0?"":b,j=t.defaultView,w=ut(dr({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:w.picker,className:"chrome-picker "+S},A.createElement("div",{style:w.saturation},A.createElement(hp,{style:w.Saturation,hsl:u,hsv:d,pointer:Jee,onChange:a})),A.createElement("div",{style:w.body},A.createElement("div",{style:w.controls,className:"flexbox-fix"},A.createElement("div",{style:w.color},A.createElement("div",{style:w.swatch},A.createElement("div",{style:w.active}),A.createElement(nc,{renderers:p}))),A.createElement("div",{style:w.toggles},A.createElement("div",{style:w.hue},A.createElement(rc,{style:w.Hue,hsl:u,pointer:xR,onChange:a})),A.createElement("div",{style:w.alpha},A.createElement(Uw,{style:w.Alpha,rgb:l,hsl:u,pointer:xR,renderers:p,onChange:a})))),A.createElement(q5,{rgb:l,hsl:u,hex:h,view:j,onChange:a,disableAlpha:i})))};n1.propTypes={width:Ae.oneOfType([Ae.string,Ae.number]),disableAlpha:Ae.bool,styles:Ae.object,defaultView:Ae.oneOf(["hex","rgb","hsl"])};n1.defaultProps={width:225,disableAlpha:!1,styles:{}};fr(n1);var ete=function(t){var n=t.color,a=t.onClick,i=a===void 0?function(){}:a,l=t.onSwatchHover,u=t.active,d=ut({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:Xw(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(go,{style:d.color,color:n,onClick:i,onHover:l,focusStyle:{boxShadow:"0 0 4px "+n}},A.createElement("div",{style:d.dot}))},tte=function(t){var n=t.hex,a=t.rgb,i=t.onChange,l=ut({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(Ft,{style:{wrap:l.HEXwrap,input:l.HEXinput,label:l.HEXlabel},label:"hex",value:n,onChange:u}),A.createElement(Ft,{style:{wrap:l.RGBwrap,input:l.RGBinput,label:l.RGBlabel},label:"r",value:a.r,onChange:u}),A.createElement(Ft,{style:{wrap:l.RGBwrap,input:l.RGBinput,label:l.RGBlabel},label:"g",value:a.g,onChange:u}),A.createElement(Ft,{style:{wrap:l.RGBwrap,input:l.RGBinput,label:l.RGBlabel},label:"b",value:a.b,onChange:u}))},r1=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,g=p===void 0?"":p,m=ut(dr({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},h)),b=function(j,w){j.hex?Ei(j.hex)&&n({hex:j.hex,source:"hex"},w):n(j,w)};return A.createElement(nd,{style:m.Compact,styles:h},A.createElement("div",{style:m.compact,className:"compact-picker "+g},A.createElement("div",null,vo(i,function(S){return A.createElement(ete,{key:S,color:S,active:S.toLowerCase()===l,onClick:b,onSwatchHover:a})}),A.createElement("div",{style:m.clear})),A.createElement(tte,{hex:l,rgb:u,onChange:b})))};r1.propTypes={colors:Ae.arrayOf(Ae.string),styles:Ae.object};r1.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:{}};fr(r1);var nte=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=ut({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:u}},{hover:n});return A.createElement("div",{style:d.swatch},A.createElement(go,{color:a,onClick:i,onHover:l,focusStyle:u}))};const rte=Hw.handleHover(nte);var a1=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,g=p===void 0?"":p,m=ut(dr({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,w){return i({hex:j,source:"hex"},w)};return A.createElement("div",{style:m.card,className:"github-picker "+g},A.createElement("div",{style:m.triangleShadow}),A.createElement("div",{style:m.triangle}),vo(a,function(S){return A.createElement(rte,{color:S,key:S,onClick:b,onSwatchHover:l})}))};a1.propTypes={width:Ae.oneOfType([Ae.string,Ae.number]),colors:Ae.arrayOf(Ae.string),triangle:Ae.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:Ae.object};a1.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};fr(a1);var ate=function(t){var n=t.direction,a=ut({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})},ste=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},s1=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,g=t.className,m=g===void 0?"":g,b=ut(dr({default:{picker:{position:"relative",width:n,height:a},hue:{radius:"2px"}}},p)),S=function(w){return i({a:1,h:w.h,l:.5,s:1})};return A.createElement("div",{style:b.picker,className:"hue-picker "+m},A.createElement(rc,ste({},b.hue,{hsl:l,pointer:d,onChange:S,direction:u})))};s1.propTypes={styles:Ae.object};s1.defaultProps={width:"316px",height:"16px",direction:"horizontal",pointer:ate,styles:{}};fr(s1);var ite=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=ut(dr({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)),g=function(b,S){b.hex?Ei(b.hex)&&n({hex:b.hex,source:"hex"},S):(b.r||b.g||b.b)&&n({r:b.r||i.r,g:b.g||i.g,b:b.b||i.b,source:"rgb"},S)};return A.createElement(nd,{styles:u},A.createElement("div",{style:p.material,className:"material-picker "+h},A.createElement(Ft,{style:{wrap:p.HEXwrap,input:p.HEXinput,label:p.HEXlabel},label:"hex",value:a,onChange:g}),A.createElement("div",{style:p.split,className:"flexbox-fix"},A.createElement("div",{style:p.third},A.createElement(Ft,{style:{wrap:p.RGBwrap,input:p.RGBinput,label:p.RGBlabel},label:"r",value:i.r,onChange:g})),A.createElement("div",{style:p.third},A.createElement(Ft,{style:{wrap:p.RGBwrap,input:p.RGBinput,label:p.RGBlabel},label:"g",value:i.g,onChange:g})),A.createElement("div",{style:p.third},A.createElement(Ft,{style:{wrap:p.RGBwrap,input:p.RGBinput,label:p.RGBlabel},label:"b",value:i.b,onChange:g})))))};fr(ite);var ote=function(t){var n=t.onChange,a=t.rgb,i=t.hsv,l=t.hex,u=ut({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,g){p["#"]?Ei(p["#"])&&n({hex:p["#"],source:"hex"},g):p.r||p.g||p.b?n({r:p.r||a.r,g:p.g||a.g,b:p.b||a.b,source:"rgb"},g):(p.h||p.s||p.v)&&n({h:p.h||i.h,s:p.s||i.s,v:p.v||i.v,source:"hsv"},g)};return A.createElement("div",{style:u.fields},A.createElement(Ft,{style:{wrap:u.RGBwrap,input:u.RGBinput,label:u.RGBlabel},label:"h",value:Math.round(i.h),onChange:d}),A.createElement(Ft,{style:{wrap:u.RGBwrap,input:u.RGBinput,label:u.RGBlabel},label:"s",value:Math.round(i.s*100),onChange:d}),A.createElement(Ft,{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(Ft,{style:{wrap:u.RGBwrap,input:u.RGBinput,label:u.RGBlabel},label:"r",value:a.r,onChange:d}),A.createElement(Ft,{style:{wrap:u.RGBwrap,input:u.RGBinput,label:u.RGBlabel},label:"g",value:a.g,onChange:d}),A.createElement(Ft,{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(Ft,{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},"%")))},lte=function(t){var n=t.hsl,a=ut({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})},cte=function(){var t=ut({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})))},yR=function(t){var n=t.onClick,a=t.label,i=t.children,l=t.active,u=ut({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)},ute=function(t){var n=t.rgb,a=t.currentColor,i=ut({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"))},dte=(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 fte(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hte(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 pte(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 i1=(function(e){pte(t,e);function t(n){fte(this,t);var a=hte(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.state={currentColor:n.hex},a}return dte(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=ut(dr({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(hp,{hsl:this.props.hsl,hsv:this.props.hsv,pointer:lte,onChange:this.props.onChange})),A.createElement("div",{style:h.hue},A.createElement(rc,{direction:"vertical",hsl:this.props.hsl,pointer:cte,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(ute,{rgb:this.props.rgb,currentColor:this.state.currentColor})),A.createElement("div",{style:h.actions},A.createElement(yR,{label:"OK",onClick:this.props.onAccept,active:!0}),A.createElement(yR,{label:"Cancel",onClick:this.props.onCancel}),A.createElement(ote,{onChange:this.props.onChange,rgb:this.props.rgb,hsv:this.props.hsv,hex:this.props.hex}))))))}}]),t})(A.Component);i1.propTypes={header:Ae.string,styles:Ae.object};i1.defaultProps={header:"Color Picker",styles:{}};fr(i1);var mte=function(t){var n=t.onChange,a=t.rgb,i=t.hsl,l=t.hex,u=t.disableAlpha,d=ut({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(g,m){g.hex?Ei(g.hex)&&n({hex:g.hex,source:"hex"},m):g.r||g.g||g.b?n({r:g.r||a.r,g:g.g||a.g,b:g.b||a.b,a:a.a,source:"rgb"},m):g.a&&(g.a<0?g.a=0:g.a>100&&(g.a=100),g.a/=100,n({h:i.h,s:i.s,l:i.l,a:g.a,source:"rgb"},m))};return A.createElement("div",{style:d.fields,className:"flexbox-fix"},A.createElement("div",{style:d.double},A.createElement(Ft,{style:{input:d.input,label:d.label},label:"hex",value:l.replace("#",""),onChange:h})),A.createElement("div",{style:d.single},A.createElement(Ft,{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(Ft,{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(Ft,{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(Ft,{style:{input:d.input,label:d.label},label:"a",value:Math.round(a.a*100),onChange:h,dragLabel:"true",dragMax:"100"})))},gte=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},$5=function(t){var n=t.colors,a=t.onClick,i=a===void 0?function(){}:a,l=t.onSwatchHover,u=ut({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,g){i({hex:p,source:"hex"},g)};return A.createElement("div",{style:u.colors,className:"flexbox-fix"},n.map(function(h){var p=typeof h=="string"?{color:h}:h,g=""+p.color+(p.title||"");return A.createElement("div",{key:g,style:u.swatchWrap},A.createElement(go,gte({},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}})))}))};$5.propTypes={colors:Ae.arrayOf(Ae.oneOfType([Ae.string,Ae.shape({color:Ae.string,title:Ae.string})])).isRequired};var vte=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},o1=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,g=t.presetColors,m=t.renderers,b=t.styles,S=b===void 0?{}:b,j=t.className,w=j===void 0?"":j,C=ut(dr({default:vte({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)"}},S),disableAlpha:{color:{height:"10px"},hue:{height:"10px"},alpha:{display:"none"}}},S),{disableAlpha:p});return A.createElement("div",{style:C.picker,className:"sketch-picker "+w},A.createElement("div",{style:C.saturation},A.createElement(hp,{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(rc,{style:C.Hue,hsl:u,onChange:d})),A.createElement("div",{style:C.alpha},A.createElement(Uw,{style:C.Alpha,rgb:a,hsl:u,renderers:m,onChange:d}))),A.createElement("div",{style:C.color},A.createElement(nc,null),A.createElement("div",{style:C.activeColor}))),A.createElement(mte,{rgb:a,hsl:u,hex:i,onChange:d,disableAlpha:p}),A.createElement($5,{colors:g,onClick:d,onSwatchHover:h}))};o1.propTypes={disableAlpha:Ae.bool,width:Ae.oneOfType([Ae.string,Ae.number]),styles:Ae.object};o1.defaultProps={disableAlpha:!1,width:200,styles:{},presetColors:["#D0021B","#F5A623","#F8E71C","#8B572A","#7ED321","#417505","#BD10E0","#9013FE","#4A90E2","#50E3C2","#B8E986","#000000","#4A4A4A","#9B9B9B","#FFFFFF"]};const xte=fr(o1);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=ut({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}),g=function(b){return l({h:n.h,s:.5,l:a,source:"hsl"},b)};return A.createElement("div",{style:p.swatch,onClick:g})},yte=function(t){var n=t.onClick,a=t.hsl,i=ut({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}))},bte=function(){var t=ut({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})},l1=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=ut(dr({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(rc,{style:p.Hue,hsl:n,pointer:i,onChange:a})),A.createElement("div",{style:p.swatches},A.createElement(yte,{hsl:n,onClick:a})))};l1.propTypes={styles:Ae.object};l1.defaultProps={pointer:bte,styles:{}};fr(l1);var Mf={},bR;function wte(){if(bR)return Mf;bR=1,Object.defineProperty(Mf,"__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=lo(),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 Mf.default=function(u){var d=u.fill,h=d===void 0?"currentColor":d,p=u.width,g=p===void 0?l:p,m=u.height,b=m===void 0?l:m,S=u.style,j=S===void 0?{}:S,w=i(u,["fill","width","height","style"]);return n.default.createElement("svg",e({viewBox:"0 0 "+l+" "+l,style:e({fill:h,width:g,height:b},j)},w),n.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},Mf}var Ste=wte();const jte=Ul(Ste);var Cte=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=ut({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:n,marginBottom:"1px"},check:{color:Xw(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(go,{color:n,style:p.color,onClick:i,onHover:l,focusStyle:{boxShadow:"0 0 4px "+n}},A.createElement("div",{style:p.check},A.createElement(jte,null)))},Nte=function(t){var n=t.onClick,a=t.onSwatchHover,i=t.group,l=t.active,u=ut({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return A.createElement("div",{style:u.group},vo(i,function(d,h){return A.createElement(Cte,{key:d,color:d,active:d.toLowerCase()===l,first:h===0,last:h===i.length-1,onClick:n,onSwatchHover:a})}))},c1=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,g=t.className,m=g===void 0?"":g,b=ut(dr({default:{picker:{width:n,height:a},overflow:{height:a,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},p)),S=function(w,C){return i({hex:w,source:"hex"},C)};return A.createElement("div",{style:b.picker,className:"swatches-picker "+m},A.createElement(nd,null,A.createElement("div",{style:b.overflow},A.createElement("div",{style:b.body},vo(u,function(j){return A.createElement(Nte,{key:j.toString(),group:j,active:d,onClick:S,onSwatchHover:l})}),A.createElement("div",{style:b.clear})))))};c1.propTypes={width:Ae.oneOfType([Ae.string,Ae.number]),height:Ae.oneOfType([Ae.string,Ae.number]),colors:Ae.arrayOf(Ae.arrayOf(Ae.string)),styles:Ae.object};c1.defaultProps={width:320,height:240,colors:[[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]],[xl[900],xl[700],xl[500],xl[300],xl[100]],[yl[900],yl[700],yl[500],yl[300],yl[100]],[bl[900],bl[700],bl[500],bl[300],bl[100]],[wl[900],wl[700],wl[500],wl[300],wl[100]],[Sl[900],Sl[700],Sl[500],Sl[300],Sl[100]],["#194D33",gu[700],gu[500],gu[300],gu[100]],[jl[900],jl[700],jl[500],jl[300],jl[100]],[Cl[900],Cl[700],Cl[500],Cl[300],Cl[100]],[Nl[900],Nl[700],Nl[500],Nl[300],Nl[100]],[El[900],El[700],El[500],El[300],El[100]],[_l[900],_l[700],_l[500],_l[300],_l[100]],[Tl[900],Tl[700],Tl[500],Tl[300],Tl[100]],[Al[900],Al[700],Al[500],Al[300],Al[100]],[Rl[900],Rl[700],Rl[500],Rl[300],Rl[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};fr(c1);var u1=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,g=t.className,m=g===void 0?"":g,b=ut(dr({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"}),S=function(w,C){Ei(w)&&n({hex:w,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},vo(l,function(j,w){return A.createElement(go,{key:w,color:j,hex:j,style:b.swatch,onClick:S,onHover:a,focusStyle:{boxShadow:"0 0 4px "+j}})}),A.createElement("div",{style:b.hash},"#"),A.createElement(Ft,{label:null,style:{input:b.input},value:i.replace("#",""),onChange:S}),A.createElement("div",{style:b.clear})))};u1.propTypes={width:Ae.oneOfType([Ae.string,Ae.number]),triangle:Ae.oneOf(["hide","top-left","top-right"]),colors:Ae.arrayOf(Ae.string),styles:Ae.object};u1.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};fr(u1);var d1=function(t){var n=ut({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})};d1.propTypes={hsl:Ae.shape({h:Ae.number,s:Ae.number,l:Ae.number,a:Ae.number})};d1.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var f1=function(t){var n=ut({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})};f1.propTypes={hsl:Ae.shape({h:Ae.number,s:Ae.number,l:Ae.number,a:Ae.number})};f1.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var Ete=function(t){var n=t.onChange,a=t.rgb,i=t.hsl,l=t.hex,u=t.hsv,d=function(S,j){if(S.hex)Ei(S.hex)&&n({hex:S.hex,source:"hex"},j);else if(S.rgb){var w=S.rgb.split(",");rb(S.rgb,"rgb")&&n({r:w[0],g:w[1],b:w[2],a:1,source:"rgb"},j)}else if(S.hsv){var C=S.hsv.split(",");rb(S.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(S.hsl){var N=S.hsl.split(",");rb(S.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=ut({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,g=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(Ft,{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(Ft,{style:{input:h.input2,label:h.label2},label:"rgb",value:p,onChange:d})),A.createElement("div",{style:h.single},A.createElement(Ft,{style:{input:h.input2,label:h.label2},label:"hsv",value:m,onChange:d})),A.createElement("div",{style:h.single},A.createElement(Ft,{style:{input:h.input2,label:h.label2},label:"hsl",value:g,onChange:d})))))},h1=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,g=p===void 0?{}:p,m=t.className,b=m===void 0?"":m,S=ut(dr({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"}}},g));return A.createElement("div",{style:S.picker,className:"google-picker "+b},A.createElement("div",{style:S.head},h),A.createElement("div",{style:S.swatch}),A.createElement("div",{style:S.saturation},A.createElement(hp,{hsl:l,hsv:u,pointer:d1,onChange:a})),A.createElement("div",{style:S.body},A.createElement("div",{style:S.controls,className:"flexbox-fix"},A.createElement("div",{style:S.hue},A.createElement(rc,{style:S.Hue,hsl:l,radius:"4px",pointer:f1,onChange:a}))),A.createElement(Ete,{rgb:i,hsl:l,hex:d,hsv:u,onChange:a})))};h1.propTypes={width:Ae.oneOfType([Ae.string,Ae.number]),styles:Ae.object,header:Ae.string};h1.defaultProps={width:652,styles:{},header:"Color picker"};fr(h1);const _te=["#ff0000","#ff8000","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff","#ffffff","#2a9d8f","#e9c46a","#dc143c","#000000"];function sb({value:e,onChange:t,className:n,presets:a=_te}){const[i,l]=v.useState(!1),u=d=>{t(d.hex)};return o.jsxs(Ru,{open:i,onOpenChange:l,children:[o.jsx(Ou,{asChild:!0,children:o.jsx(le,{variant:"secondary",className:lt("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(zl,{className:"w-auto p-0",align:"start",children:o.jsx(xte,{color:e,onChange:u,presetColors:a,disableAlpha:!0})})]})}const pi=60,c0=33,xt={OFF:0,STATIC:1,RAINBOW:2,BREATHE:3,COLORLOOP:4,THEATER:5,SCAN:6,RUNNING:7,SINE:8,GRADIENT:9,SINELON:10,TWINKLE:11,SPARKLE:12,FIRE:13,CANDLE:14,METEOR:15,BOUNCING:16,WIPE:17,DUALSCAN:18,JUGGLE:19,MULTICOMET:20,GLITTER:21,DISSOLVE:22,RIPPLE:23,DRIP:24,LIGHTNING:25,FIREWORKS:26,PLASMA:27,HEARTBEAT:28,STROBE:29,POLICE:30,CHASE:31,RAILWAY:32,PACIFICA:33,AURORA:34,PRIDE:35,COLORWAVES:36,BPM:37,BALL:38},u0=[[1644912,139,1644912,128,139,205,3050327,32896,6266528,255,35723,6591981,8388564,3050327,65535,8900346],[0,8388608,0,8388608,9109504,8388608,9109504,9109504,9109504,9109504,16711680,16753920,16777215,16753920,16711680,9109504],[25600,25600,5597999,25600,32768,2263842,7048739,32768,3050327,6737322,3329330,10145074,9498256,8190976,6737322,2263842],[5570731,8650876,11862091,15007771,15210240,12076800,11237120,11250432,11228416,14492160,15859726,12714046,9371761,6226081,3080400,458985],[255,139,139,139,139,139,139,139,255,139,8900331,8900331,11393254,16777215,11393254,8900331],[0,3342336,6684672,10027008,13369344,16711680,16724736,16737792,16750848,16763904,16776960,16777011,16777062,16777113,16777164,16777215],[139,4915330,8388736,13047173,16716947,16729344,16747520,16766720,16753920,16729344,13047173,8388736,4915330,1644912,139,51]],Tte=u0[0],Ate=[6666,13073,19738,26146,39245,52326,65407,3050327,32896,4915330,8388736,9699539,4915330,32896,39245,13073];function wR(e){const t=parseInt(e.replace("#",""),16)||0;return[t>>16&255,t>>8&255,t&255]}const qf=new Uint8Array(256);for(let e=0;e<256;e++)qf[e]=Math.round(255*Math.pow(e/255,1/2.2));class Rte{fb=new Uint8Array(pi*3);heat=new Uint8Array(pi);rng=Math.floor(performance.now())*2654435761>>>0||1;phase=0;candle=200;aux=0;ballPos=[0,0,0];ballVel=[4.4,3.9,3.4];lastEffect=-1;lastBgEffect=-1;ballTrack=-1;simBallFrac=0;p;random8(){let t=this.rng;return t=(t^t<<13)>>>0,t=(t^t>>>17)>>>0,t=(t^t<<5)>>>0,this.rng=t,t&255}random8lim(t){return this.random8()*t>>8}sin8(t){return Math.sin((t&255)*2*Math.PI/256)*127.5+127.5|0}scale8(t,n){return t*(n+1)>>8}qadd8(t,n){return Math.min(255,t+n)}qsub8(t,n){return Math.max(0,t-n)}lerp8(t,n,a){return t+((n-t)*a>>8)}setFb(t,n,a,i){t<0||t>=pi||(this.fb[t*3]=n,this.fb[t*3+1]=a,this.fb[t*3+2]=i)}addFb(t,n,a,i){t<0||t>=pi||(this.fb[t*3]=this.qadd8(this.fb[t*3],n),this.fb[t*3+1]=this.qadd8(this.fb[t*3+1],a),this.fb[t*3+2]=this.qadd8(this.fb[t*3+2],i))}fadeBy(t){const n=256-t;for(let a=0;a<pi*3;a++)this.fb[a]=this.fb[a]*n>>8}wheel(t){return t=255-t&255,t<85?[255-t*3,0,t*3]:t<170?(t-=85,[0,t*3,255-t*3]):(t-=170,[t*3,255-t*3,0])}heatColor(t){const n=this.scale8(t,191),a=(n&63)<<2;return n&128?[255,255,a]:n&64?[255,a,0]:[a,0,0]}sampleTable(t,n){const a=n>>4,i=(n&15)<<4,l=t[a],u=t[a+1&15];return[this.lerp8(l>>16&255,u>>16&255,i),this.lerp8(l>>8&255,u>>8&255,i),this.lerp8(l&255,u&255,i)]}palColor(t){const n=this.p.paletteId;return n<=0||n>u0.length?this.wheel(t&255):this.sampleTable(u0[n-1],t&255)}tick(){this.phase=this.phase+this.p.speed*8&65535,this.simBallFrac=(this.simBallFrac+c0/15e3)%1,this.renderEffect(this.p.effectId,this.p.speed,!1)}renderEffect(t,n,a){if(a?t!==this.lastBgEffect:t!==this.lastEffect){a?this.lastBgEffect=t:this.lastEffect=t,this.fb.fill(0),this.heat.fill(0),this.candle=200,this.aux=0;for(let d=0;d<3;d++)this.ballPos[d]=0,this.ballVel[d]=4.4-.5*d;a||(this.ballTrack=-1)}const i=this.phase>>8&255,l=pi;let u;switch(t){case xt.STATIC:{const[d,h,p]=this.p.color1;for(let g=0;g<l;g++)this.setFb(g,d,h,p);break}case xt.RAINBOW:for(let d=0;d<l;d++)u=this.palColor(i+d*256/l&255),this.setFb(d,u[0],u[1],u[2]);break;case xt.BREATHE:{const[d,h,p]=this.p.color1,g=16+(this.sin8(i)*239>>8);for(let m=0;m<l;m++)this.setFb(m,d*g>>8,h*g>>8,p*g>>8);break}case xt.COLORLOOP:{u=this.palColor(i);for(let d=0;d<l;d++)this.setFb(d,u[0],u[1],u[2]);break}case xt.THEATER:{const[d,h,p]=this.p.color1,g=(this.phase>>9)%3;for(let m=0;m<l;m++)m%3===g?this.setFb(m,d,h,p):this.setFb(m,0,0,0);break}case xt.SCAN:{const[d,h,p]=this.p.color1;this.fadeBy(90),this.setFb(this.scale8(this.sin8(i),l-1),d,h,p);break}case xt.RUNNING:{const[d,h,p]=this.p.color1;for(let g=0;g<l;g++){const m=this.sin8(g*(256/l|0)-i&255);this.setFb(g,d*m>>8,h*m>>8,p*m>>8)}break}case xt.SINE:{const[d,h,p]=this.p.color1;for(let g=0;g<l;g++){const m=this.sin8(g*(512/l|0)+i&255);this.setFb(g,d*m>>8,h*m>>8,p*m>>8)}break}case xt.GRADIENT:{const[d,h,p]=this.p.color1,[g,m,b]=this.p.color2;for(let S=0;S<l;S++){const j=S*256/l+i&255,w=j<128?j*2:(255-j)*2;this.setFb(S,this.lerp8(d,g,w),this.lerp8(h,m,w),this.lerp8(p,b,w))}break}case xt.SINELON:{this.fadeBy(40);const d=this.scale8(this.sin8(i),l-1);u=this.palColor(this.phase>>7&255),this.addFb(d,u[0],u[1],u[2]);break}case xt.TWINKLE:this.fadeBy(28),this.random8()<n&&(u=this.palColor(this.random8()),this.setFb(this.random8lim(l),u[0],u[1],u[2]));break;case xt.SPARKLE:{const[d,h,p]=this.p.color1;for(let g=0;g<l;g++)this.setFb(g,d*40>>8,h*40>>8,p*40>>8);this.setFb(this.random8lim(l),255,255,255);break}case xt.FIRE:{for(let d=0;d<l;d++)this.heat[d]=this.qsub8(this.heat[d],this.random8lim(550/l+2|0));for(let d=l-1;d>=2;d--)this.heat[d]=(this.heat[d-1]+this.heat[d-2]+this.heat[d-2])/3|0;if(this.random8()<120){const d=this.random8lim(7);this.heat[d]=this.qadd8(this.heat[d],this.random8lim(95)+160)}for(let d=0;d<l;d++)u=this.heatColor(this.heat[d]),this.setFb(d,u[0],u[1],u[2]);break}case xt.CANDLE:{const[d,h,p]=this.p.color1,g=100+this.random8lim(155);this.candle=this.candle*7+g>>3;for(let m=0;m<l;m++)this.setFb(m,d*this.candle>>8,h*this.candle>>8,p*this.candle>>8);break}case xt.METEOR:{const[d,h,p]=this.p.color1;this.fadeBy(40+this.random8lim(40)),this.setFb((this.phase>>8)%l,d,h,p);break}case xt.BOUNCING:{const[d,h,p]=this.p.color1;this.fadeBy(120);const g=c0/1e3*(n/50);for(let m=0;m<3;m++)this.ballVel[m]-=9.8*g,this.ballPos[m]+=this.ballVel[m]*g,this.ballPos[m]<0&&(this.ballPos[m]=0,this.ballVel[m]=-this.ballVel[m]*.9,this.ballVel[m]<.6&&(this.ballVel[m]=4.4-.5*m)),this.addFb(this.ballPos[m]*(l-1)|0,d,h,p);break}case xt.WIPE:{const[d,h,p]=this.p.color1,[g,m,b]=this.p.color2,S=(this.phase>>7)%(2*l);for(let j=0;j<l;j++)S<l?j<=S?this.setFb(j,d,h,p):this.setFb(j,g,m,b):j<=S-l?this.setFb(j,g,m,b):this.setFb(j,d,h,p);break}case xt.DUALSCAN:{const[d,h,p]=this.p.color1,[g,m,b]=this.p.color2;this.fadeBy(80);const S=this.scale8(this.sin8(i),l-1);this.addFb(S,d,h,p),this.addFb(l-1-S,g,m,b);break}case xt.JUGGLE:this.fadeBy(40);for(let d=0;d<3;d++){const h=this.scale8(this.sin8((this.phase>>8)*(d+2)&255),l-1);u=this.palColor(d*85+i&255),this.addFb(h,u[0],u[1],u[2])}break;case xt.MULTICOMET:this.fadeBy(48);for(let d=0;d<3;d++){const h=(((this.phase>>8)*(d+1)>>1)+d*(l/3|0))%l;u=this.palColor(d*85&255),this.addFb(h,u[0],u[1],u[2])}break;case xt.GLITTER:for(let d=0;d<l;d++)u=this.palColor(i+d*256/l&255),this.setFb(d,u[0]*180>>8,u[1]*180>>8,u[2]*180>>8);this.random8()<60&&this.setFb(this.random8lim(l),255,255,255);break;case xt.DISSOLVE:{const[d,h,p]=this.p.color1,[g,m,b]=this.p.color2,S=(l/12|0)+1;for(let w=0;w<S;w++)this.heat[this.random8lim(l)]=this.aux;let j=0;for(let w=0;w<l;w++)this.heat[w]!==this.aux&&j++,this.heat[w]?this.setFb(w,g,m,b):this.setFb(w,d,h,p);j===0&&(this.aux^=1);break}case xt.RIPPLE:{this.fadeBy(40);const d=.5*(n/50);for(let h=0;h<3;h++){(this.ballVel[h]<=0||this.ballVel[h]>l/2)&&(this.ballPos[h]=this.random8lim(l),this.ballVel[h]=.01);const p=this.ballPos[h]|0,g=this.ballVel[h]|0,m=255-this.scale8(this.ballVel[h]*512/l&255,255);u=this.palColor(p*5&255),this.addFb((p+g)%l,u[0]*m>>8,u[1]*m>>8,u[2]*m>>8),this.addFb((p-g+l)%l,u[0]*m>>8,u[1]*m>>8,u[2]*m>>8),this.ballVel[h]+=d}break}case xt.DRIP:{const[d,h,p]=this.p.color1;this.fadeBy(60);const g=.02*(n/50);for(let m=0;m<3;m++)this.ballVel[m]+=g,this.ballPos[m]-=this.ballVel[m],this.ballPos[m]<=0&&(this.setFb(0,255,255,255),this.setFb(1,d*128>>8,h*128>>8,p*128>>8),this.ballPos[m]=l-1-this.random8lim(l>>1),this.ballVel[m]=0),this.addFb(this.ballPos[m]|0,d,h,p);break}case xt.LIGHTNING:if(this.fadeBy(120),this.random8()<12){const d=this.random8lim(l),h=2+this.random8lim(l/3|0);for(let p=0;p<h;p++)this.setFb((d+p)%l,255,255,255)}break;case xt.FIREWORKS:if(this.fadeBy(48),this.random8()<50){const d=this.random8lim(l);u=this.palColor(this.random8()),this.addFb(d,u[0],u[1],u[2]),this.addFb((d+1)%l,u[0]>>1,u[1]>>1,u[2]>>1),this.addFb((d-1+l)%l,u[0]>>1,u[1]>>1,u[2]>>1)}break;case xt.PLASMA:for(let d=0;d<l;d++){const h=d*256/l&255,p=this.sin8(h*2+i&255),g=this.sin8(h*3-i*2&255);u=this.palColor(p+g>>1),this.setFb(d,u[0],u[1],u[2])}break;case xt.HEARTBEAT:{const[d,h,p]=this.p.color1,g=i;let m;g<32?m=this.sin8(g*4&255):g<96?m=24:g<128?m=this.sin8((g-96)*4&255):m=24,m<24&&(m=24);for(let b=0;b<l;b++)this.setFb(b,d*m>>8,h*m>>8,p*m>>8);break}case xt.STROBE:{const[d,h,p]=this.p.color1,g=i<32;for(let m=0;m<l;m++)g?this.setFb(m,d,h,p):this.setFb(m,0,0,0);break}case xt.POLICE:{const d=this.phase>>9&1,h=l>>1;for(let p=0;p<l;p++){const g=p<h;g===!!d?this.setFb(p,g?255:0,0,g?0:255):this.setFb(p,0,0,0)}break}case xt.CHASE:{const[d,h,p]=this.p.color1,[g,m,b]=this.p.color2;for(let j=0;j<l;j++)this.setFb(j,g*40>>8,m*40>>8,b*40>>8);const S=(this.phase>>8)%l;for(let j=0;j<3;j++)this.setFb((S+j)%l,d,h,p);break}case xt.RAILWAY:{const[d,h,p]=this.p.color1,[g,m,b]=this.p.color2;for(let S=0;S<l;S++){const w=100+(this.sin8(S*(256/l|0)-i&255)*155>>8);S&1?this.setFb(S,d*w>>8,h*w>>8,p*w>>8):this.setFb(S,g*w>>8,m*w>>8,b*w>>8)}break}case xt.PACIFICA:for(let d=0;d<l;d++){const h=this.sin8(d*4+(this.phase>>8)&255),p=this.sin8(d*5-(this.phase>>7)&255),g=this.sin8(d*3+(this.phase>>9)&255);u=this.sampleTable(Tte,(h+p+g)/3|0),this.setFb(d,u[0],u[1],u[2]);const m=this.sin8(d*9-(this.phase>>5)&255);if(m>236){const b=(m-236)*8;this.addFb(d,b,b,b)}}break;case xt.AURORA:for(let d=0;d<l;d++){const h=this.sin8(d*3+(this.phase>>8)&255),p=this.sin8(d*2-(this.phase>>9)&255);u=this.sampleTable(Ate,h+p>>1);const m=40+(this.sin8(d*5+(this.phase>>7)&255)*215>>8);this.setFb(d,u[0]*m>>8,u[1]*m>>8,u[2]*m>>8)}break;case xt.PRIDE:for(let d=0;d<l;d++){u=this.wheel((this.phase>>8)+d*2&255);const p=60+(this.sin8(d*7+(this.phase>>6)&255)*195>>8);this.setFb(d,u[0]*p>>8,u[1]*p>>8,u[2]*p>>8)}break;case xt.COLORWAVES:for(let d=0;d<l;d++){u=this.palColor((this.phase>>8)+d*3&255);const p=60+(this.sin8(d*7+(this.phase>>6)&255)*195>>8);this.setFb(d,u[0]*p>>8,u[1]*p>>8,u[2]*p>>8)}break;case xt.BPM:{const d=this.sin8(this.phase>>6&255);for(let h=0;h<l;h++){u=this.palColor((this.phase>>8)+h*3&255);let p=this.qsub8(d,h*2&255);p<40&&(p=40),this.setFb(h,u[0]*p>>8,u[1]*p>>8,u[2]*p>>8)}break}case xt.BALL:{const d=this.p.ball;let h=d.bgEffectId;if(h===xt.BALL&&(h=xt.STATIC),h===xt.OFF)this.fb.fill(0);else if(h===xt.STATIC){const[N,_,T]=this.p.color2;for(let O=0;O<l;O++)this.setFb(O,N,_,T)}else this.renderEffect(h,n,!0);if(d.bgbright<255)for(let N=0;N<l*3;N++)this.fb[N]=this.scale8(this.fb[N],d.bgbright);let p=this.simBallFrac*(d.direction==="ccw"?-1:1)+d.align/360;p-=Math.floor(p),this.ballTrack<0&&(this.ballTrack=p);const g=Math.max(n/255,.03);let m=p-this.ballTrack;m-=Math.round(m),this.ballTrack+=m*g,this.ballTrack-=Math.floor(this.ballTrack);const b=this.ballTrack*l,S=Math.max(1,d.size);let[j,w,C]=this.p.color1;j=this.scale8(j,d.fgbright),w=this.scale8(w,d.fgbright),C=this.scale8(C,d.fgbright);for(let N=0;N<l;N++){let _=Math.abs(N-b);_=Math.min(_,l-_);let T=1-_/S;if(T<=0)continue;T=T*T*(3-2*T);const O=this.fb[N*3],M=this.fb[N*3+1],B=this.fb[N*3+2];this.setFb(N,O+(j-O)*T|0,M+(w-M)*T|0,B+(C-B)*T|0)}break}default:this.fb.fill(0);break}}}function Ote({effectId:e,paletteId:t,color1:n,color2:a,brightness:i,speed:l,powerOn:u,ball:d,className:h}){const p=v.useRef(null),g=v.useRef(null),m=v.useRef(null);m.current={effectId:e,paletteId:t,color1:wR(n),color2:wR(a),brightness255:Math.round(Math.max(0,Math.min(100,i))*255/100),speed:Math.max(1,Math.min(255,l)),ball:d,powerOn:u};const b=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,S=b?JSON.stringify([e,t,n,a,i,l,d]):"";return v.useEffect(()=>{const j=p.current;if(!j)return;const w=j.getContext("2d");if(!w)return;g.current||(g.current=new Rte);const C=g.current,N=j.clientWidth||144,_=window.devicePixelRatio||1;j.width=N*_,j.height=N*_,w.setTransform(_,0,0,_,0,0);const T=N*.075,O=N/2-T/2-N*.06,M=N/2,B=N/2,k=2*Math.PI/pi,F=.6/O,W=()=>{const Q=m.current;w.clearRect(0,0,N,N),w.lineWidth=T,w.lineCap="butt";for(let Z=0;Z<pi;Z++){let ve=0,P=0,V=0;if(Q.powerOn){const L=Q.brightness255+1;ve=qf[C.fb[Z*3]*L>>8],P=qf[C.fb[Z*3+1]*L>>8],V=qf[C.fb[Z*3+2]*L>>8]}const H=-Math.PI/2+Z*k-F,se=H+k+2*F,we=ve+P+V>6;w.beginPath(),w.arc(M,B,O,H,se),we?(w.shadowColor=`rgb(${ve},${P},${V})`,w.shadowBlur=N*.05,w.strokeStyle=`rgb(${ve},${P},${V})`):(w.shadowBlur=0,w.strokeStyle=Q.powerOn?"rgba(127,127,127,0.12)":"rgba(127,127,127,0.22)"),w.stroke()}w.shadowBlur=0};if(b){C.p=m.current;for(let Q=0;Q<45;Q++)C.tick();W();return}let ce=0,G=0;const ie=Q=>{ce=requestAnimationFrame(ie),!(Q-G<c0)&&(G=Q,m.current.powerOn&&(C.p=m.current,C.tick()),W())};return ce=requestAnimationFrame(ie),()=>cancelAnimationFrame(ce)},[u,b,S]),o.jsx("canvas",{ref:p,className:h,"aria-hidden":"true"})}const Mte={off:{},static:{color:!0},rainbow:{palette:!0},breathe:{color:!0},colorloop:{palette:!0},theater:{color:!0},scan:{color:!0},running:{color:!0},sine:{color:!0},gradient:{color:!0,color2:!0},sinelon:{palette:!0},twinkle:{palette:!0},sparkle:{color:!0},fire:{palette:!0},candle:{color:!0},meteor:{color:!0},bouncing:{color:!0},wipe:{color:!0,color2:!0},dualscan:{color:!0,color2:!0},juggle:{palette:!0},multicomet:{palette:!0},glitter:{palette:!0},dissolve:{color:!0,color2:!0},ripple:{palette:!0},drip:{color:!0},lightning:{},fireworks:{palette:!0},plasma:{palette:!0},heartbeat:{color:!0},strobe:{color:!0},police:{},chase:{color:!0,color2:!0},railway:{color:!0,color2:!0},pacifica:{},aurora:{},pride:{},colorwaves:{palette:!0},bpm:{palette:!0},ball:{color:!0,color2:!0}};function Pte(){const[e,t]=v.useState(null),[n,a]=v.useState(!0),[i,l]=v.useState(null),[u,d]=v.useState([]),[h,p]=v.useState([]),[g,m]=v.useState([]),[b,S]=v.useState(35),[j,w]=v.useState(128),[C,N]=v.useState("128"),[_,T]=v.useState(128),[O,M]=v.useState("128"),[B,k]=v.useState(""),[F,W]=v.useState(""),[ce,G]=v.useState("#ff0000"),[ie,Q]=v.useState("#000000"),[Z,ve]=v.useState("#0000ff"),[P,V]=v.useState(255),[H,se]=v.useState(255),[we,L]=v.useState(3),[re,z]=v.useState("static"),[ee,xe]=v.useState("cw"),[Ne,fe]=v.useState(0),Ce=v.useRef(null),Pe=v.useRef(""),[ke,Ue]=v.useState("automated"),[pe,it]=v.useState(null),[st,Me]=v.useState(null),[ot,$e]=v.useState(!1),[Vt,dt]=v.useState(30),[Lt,yt]=v.useState("30");v.useEffect(()=>{(async()=>{try{const[be,Ze]=await Promise.all([ue.get("/get_led_config"),ue.get("/api/settings")]);t({provider:be.provider||"none",wled_ip:be.wled_ip,num_leds:be.dw_led_num_leds,gpio_pin:be.dw_led_gpio_pin}),Ze.led?.control_mode&&Ue(Ze.led.control_mode)}catch(be){console.error("Error fetching LED config:",be)}finally{a(!1)}})()},[]),v.useEffect(()=>{e?.provider==="board"&&(ft(),ht(),Ct())},[e]),v.useEffect(()=>{const I=h.find(([be])=>String(be)===B)?.[1];I&&I!=="ball"&&(Pe.current=B)},[B,h]);const ft=async()=>{try{const I=await ue.get("/api/dw_leds/status");l(I),I.connected&&(S(I.brightness||35),w(I.speed||128),N(String(I.speed||128)),T(I.intensity||128),M(String(I.intensity||128)),k(String(I.current_effect||0)),W(String(I.current_palette||0)),I.colors&&(G(I.colors[0]||"#ff0000"),Q(I.colors[1]||"#000000"),ve(I.colors[2]||"#0000ff")),I.ball&&(V(I.ball.fgbright??255),se(I.ball.bgbright??255),L(I.ball.size??3),z(I.ball.bg||"static"),xe(I.ball.direction==="ccw"?"ccw":"cw"),fe(I.ball.align??0)))}catch(I){console.error("Error fetching DW LEDs status:",I)}},Ge=async I=>{try{await ue.post("/api/dw_leds/ball",I)}catch{Y.error("Failed to update ball tracker")}},ht=async()=>{try{const[I,be]=await Promise.all([ue.get("/api/dw_leds/effects"),ue.get("/api/dw_leds/palettes")]);if(I.effects){const Ze=[...I.effects].sort((Je,at)=>Je[1].localeCompare(at[1]));d(Ze)}if(I.names&&p(I.names),be.palettes){const Ze=[...be.palettes].sort((Je,at)=>Je[1].localeCompare(at[1]));m(Ze)}}catch(I){console.error("Error fetching effects/palettes:",I)}},Ct=async()=>{try{const I=await ue.get("/api/dw_leds/get_effect_settings");it(I.idle_effect||null),Me(I.playing_effect||null)}catch(I){console.error("Error fetching effect settings:",I)}},Jt=async I=>{Ue(I);try{await ue.patch("/api/settings",{led:{control_mode:I}}),Y.success(I==="manual"?"Manual / HA mode":"DW Automated mode")}catch{Y.error("Failed to update control mode")}},Wt=async()=>{try{const I=await ue.post("/api/dw_leds/power",{state:2});I.connected?(Y.success(`Power ${I.power_on?"ON":"OFF"}`),await ft()):Y.error(I.error||"Failed to toggle power")}catch{Y.error("Failed to toggle power")}},Xt=v.useCallback(async I=>{S(I[0])},[]),de=async I=>{try{(await ue.post("/api/dw_leds/brightness",{value:I[0]})).connected&&Y.success(`Brightness: ${I[0]}%`)}catch{Y.error("Failed to set brightness")}},De=v.useCallback(I=>{w(I[0]),N(String(I[0]))},[]),Te=async I=>{try{await ue.post("/api/dw_leds/speed",{speed:I[0]}),Y.success(`Speed: ${I[0]}`)}catch{Y.error("Failed to set speed")}},Be=v.useCallback(I=>{T(I[0]),M(String(I[0]))},[]),_e=async I=>{try{await ue.post("/api/dw_leds/intensity",{intensity:I[0]}),Y.success(`Intensity: ${I[0]}`)}catch{Y.error("Failed to set intensity")}},We=async I=>{k(I);try{const be=await ue.post("/api/dw_leds/effect",{effect_id:parseInt(I)});if(be.connected&&(Y.success("Effect changed"),be.power_on!==void 0)){const Ze=be.power_on;l(Je=>Je?{...Je,power_on:Ze}:null)}}catch{Y.error("Failed to set effect")}},Nt=async I=>{W(I);try{(await ue.post("/api/dw_leds/palette",{palette_id:parseInt(I)})).connected&&Y.success("Palette changed")}catch{Y.error("Failed to set palette")}},bt=(I,be)=>{I===1?G(be):I===2?Q(be):ve(be),Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout(async()=>{try{const Ze=at=>{const mt=parseInt(at.slice(1,3),16),dn=parseInt(at.slice(3,5),16),D=parseInt(at.slice(5,7),16);return[mt,dn,D]},Je={};Je[`color${I}`]=Ze(be),await ue.post("/api/dw_leds/colors",Je)}catch(Ze){console.error("Failed to set color:",Ze)}},300)},Tt=async I=>{try{const be={type:I,effect_id:parseInt(B)||0,palette_id:parseInt(F)||0,speed:j,intensity:_,color1:ce,color2:ie,color3:Z};await ue.post("/api/dw_leds/save_effect_settings",be),Y.success(`${I.charAt(0).toUpperCase()+I.slice(1)} effect saved`),await Ct()}catch{Y.error(`Failed to save ${I} effect`)}},Rn=async I=>{try{await ue.post("/api/dw_leds/clear_effect_settings",{type:I}),Y.success(`${I.charAt(0).toUpperCase()+I.slice(1)} effect cleared`),await Ct()}catch{Y.error(`Failed to clear ${I} effect`)}},qt=async(I,be)=>{const Ze=I!==void 0?I:ot,Je=be!==void 0?be:Vt;try{await ue.post("/api/dw_leds/idle_timeout",{enabled:Ze,minutes:Je}),Y.success(`Idle timeout ${Ze?"enabled":"disabled"}`)}catch{Y.error("Failed to save idle timeout")}},$t=async I=>{$e(I),await qt(I,Vt)},It=I=>{if(!I)return"Not configured";const be=u.find(Je=>Je[0]===I.effect_id)?.[1]||I.effect_id;if(I.palette_id==null)return String(be);const Ze=g.find(Je=>Je[0]===I.palette_id)?.[1]||I.palette_id;return`${be} | ${Ze} | Speed: ${I.speed} | Intensity: ${I.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 font-display",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 (the table's built-in LEDs or WLED) in the Settings page to control your lights."})]}),o.jsx(le,{asChild:!0,className:"gap-2",children:o.jsxs(Qi,{to:"/settings?section=led",children:[o.jsx("span",{className:"material-icons-outlined",children:"settings"}),"Go to Settings"]})})]});const Pt=o.jsxs(Ln,{children:[o.jsxs($r,{className:"pb-3",children:[o.jsxs(Gr,{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(za,{children:"Choose how Dune Weaver manages LED effects during playback and idle states"})]}),o.jsx(Bn,{children:o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[o.jsxs("button",{onClick:()=>Jt("manual"),className:`p-4 rounded-lg border-2 text-left transition-all ${ke==="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:()=>Jt("automated"),className:`p-4 rounded-lg border-2 text-left transition-all ${ke==="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."})]})]})})]});if(e.provider==="wled"&&e.wled_ip)return 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:[Pt,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"})})]});const jt=e.provider==="board",q=Object.fromEntries(h.map(([I,be])=>[be,I])),Se=q.ball,Oe=Se!==void 0&&B===String(Se),Ve=I=>{if(Se===void 0)return;if(I){We(String(Se));return}const be=u.find(([Ze])=>Ze!==Se)?.[0];We(Pe.current||String(be??2))},At=h.find(([I])=>String(I)===B)?.[1],tt=jt&&At?Mte[At]??{color:!0,color2:!0,palette:!0}:{color:!0,color2:!0,palette:!0},Ut=Oe||!!tt.color,J=Oe?re==="static":!!tt.color2,ye=!Oe&&!!tt.palette,Re=[{value:"static",label:"Solid color"},{value:"off",label:"Off (black)"},...h.filter(([,I])=>!["ball","off","static"].includes(I)).map(([I,be])=>({value:be,label:u.find(([Ze])=>Ze===I)?.[1]||be})).sort((I,be)=>I.label.localeCompare(be.label))],Le=!!i?.power_on;return o.jsxs("div",{className:"flex flex-col w-full max-w-4xl 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 font-display",children:"LED Control"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:jt?"Table's built-in LED ring, controlled by the firmware":"DW LEDs - GPIO controlled LED strip"})]}),o.jsx(jr,{}),!jt&&Pt,o.jsx(Ln,{children:o.jsx(Bn,{className:"pt-6",children:o.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-8",children:[o.jsxs("div",{className:"relative h-40 w-40 shrink-0",children:[o.jsx(Ote,{className:"absolute inset-0 h-full w-full",effectId:jt&&B!==""?parseInt(B):9,paletteId:parseInt(F)||0,color1:ce,color2:ie,brightness:b,speed:j,powerOn:Le,ball:{size:we,direction:ee,align:Ne,fgbright:P,bgbright:H,bgEffectId:q[re]??1}}),o.jsx("button",{onClick:Wt,"aria-pressed":Le,"aria-label":Le?"Turn LEDs off":"Turn LEDs on",className:"absolute inset-0 m-auto flex h-20 w-20 items-center justify-center rounded-full border bg-card shadow-md transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card",children:o.jsx("span",{className:`material-icons text-3xl transition-colors ${Le?"text-success":"text-muted-foreground"}`,children:"power_settings_new"})})]}),o.jsxs("div",{className:"w-full flex-1 space-y-5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:`flex items-center gap-2 text-sm ${i?.connected?"text-success":"text-destructive"}`,children:[o.jsx("span",{className:"material-icons-outlined text-base",children:i?.connected?"check_circle":"error"}),i?.connected?jt?"Table LEDs connected":`${i.num_leds} LEDs on GPIO ${i.gpio_pin}`:"Not connected"]}),o.jsx("span",{className:`text-xs font-semibold uppercase tracking-wider font-display ${Le?"text-success":"text-muted-foreground"}`,children:Le?"On":"Off"})]}),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:[b,"%"]})]}),o.jsx(Ia,{value:[b],onValueChange:Xt,onValueCommit:de,max:100,step:1})]})]})]})})}),o.jsxs(Ln,{children:[o.jsx($r,{className:"pb-3",children:o.jsxs(Gr,{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(Bn,{className:"space-y-6",children:[o.jsxs("div",{className:`grid grid-cols-1 gap-4 ${ye?"sm:grid-cols-2":""}`,children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{children:"Effect"}),o.jsxs(lr,{value:B,onValueChange:We,disabled:Oe,children:[o.jsx(Wn,{children:o.jsx(Cr,{placeholder:"Select effect..."})}),o.jsx(Xn,{children:u.filter(([I])=>I!==Se||Oe).map(([I,be])=>o.jsx(Mt,{value:String(I),children:be},I))})]}),Oe&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"Ball tracker is on — turn it off to pick an effect."})]}),ye&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{children:"Palette"}),o.jsxs(lr,{value:F,onValueChange:Nt,children:[o.jsx(Wn,{children:o.jsx(Cr,{placeholder:"Select palette..."})}),o.jsx(Xn,{children:g.map(([I,be])=>o.jsx(Mt,{value:String(I),children:be},I))})]})]})]}),(Ut||J)&&o.jsxs("div",{children:[o.jsxs(Ye,{children:[o.jsx("span",{className:"material-icons-outlined text-sm mr-2 align-[-6px] text-muted-foreground",children:"palette"}),Ut&&!J&&!Oe?"Color":"Colors"]}),o.jsxs("div",{className:"flex items-start gap-5",children:[Ut&&o.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[o.jsx(sb,{value:ce,onChange:I=>bt(1,I)}),o.jsx("span",{className:"text-xs text-muted-foreground",children:Oe?"Blob":J?"Primary":"Color"})]}),J&&o.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[o.jsx(sb,{value:ie,onChange:I=>bt(2,I)}),o.jsx("span",{className:"text-xs text-muted-foreground",children:Oe?"Background":"Secondary"})]}),!jt&&o.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[o.jsx(sb,{value:Z,onChange:I=>bt(3,I)}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"Accent"})]})]})]}),o.jsxs("div",{className:`grid grid-cols-1 gap-x-8 gap-y-6 ${jt?"":"sm:grid-cols-2"}`,children:[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:"speed"}),"Speed"]}),o.jsx(St,{type:"text",inputMode:"numeric",value:C,onChange:I=>{const be=I.target.value.replace(/[^0-9]/g,"");N(be)},onBlur:()=>{const I=Math.min(255,Math.max(0,parseInt(C)||0));w(I),N(String(I)),Te([I])},onKeyDown:I=>{if(I.key==="Enter"){const be=Math.min(255,Math.max(0,parseInt(C)||0));w(be),N(String(be)),Te([be])}},className:"w-16 h-7 text-center text-sm font-medium px-2"})]}),o.jsx(Ia,{value:[j],onValueChange:De,onValueCommit:Te,max:255,step:1})]}),!jt&&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:"tungsten"}),"Intensity"]}),o.jsx(St,{type:"text",inputMode:"numeric",value:O,onChange:I=>{const be=I.target.value.replace(/[^0-9]/g,"");M(be)},onBlur:()=>{const I=Math.min(255,Math.max(0,parseInt(O)||0));T(I),M(String(I)),_e([I])},onKeyDown:I=>{if(I.key==="Enter"){const be=Math.min(255,Math.max(0,parseInt(O)||0));T(be),M(String(be)),_e([be])}},className:"w-16 h-7 text-center text-sm font-medium px-2"})]}),o.jsx(Ia,{value:[_],onValueChange:Be,onValueCommit:_e,max:255,step:1})]})]})]})]}),!jt&&ke==="automated"&&o.jsxs(Ln,{children:[o.jsx($r,{className:"pb-3",children:o.jsxs(Gr,{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(Bn,{className:"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(qr,{checked:ot,onCheckedChange:$t})]}),ot&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(St,{type:"text",inputMode:"numeric",value:Lt,onChange:I=>{const be=I.target.value.replace(/[^0-9]/g,"");yt(be)},onBlur:()=>{const I=Math.min(1440,Math.max(1,parseInt(Lt)||30));dt(I),yt(String(I))},onKeyDown:I=>{if(I.key==="Enter"){const be=Math.min(1440,Math.max(1,parseInt(Lt)||30));dt(be),yt(String(be)),qt(ot,be)}},className:"w-20"}),o.jsx("span",{className:"text-sm text-muted-foreground flex-1",children:"minutes"}),o.jsx(le,{size:"sm",onClick:()=>qt(),children:"Save"})]})]})]}),jt&&Se!==void 0&&o.jsxs(Ln,{children:[o.jsx($r,{className:"pb-3",children:o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs(Gr,{className:"text-lg flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"sports_baseball"}),"Ball Tracker"]}),o.jsx(za,{children:"A glowing dot that follows the sand ball around the ring. While on, the Colors above set the blob and background."})]}),o.jsx(qr,{checked:Oe,onCheckedChange:Ve,"aria-label":"Ball tracker"})]})}),Oe&&o.jsx(Bn,{children:o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-x-8 gap-y-6",children:[o.jsxs("div",{className:"space-y-4",children:[o.jsxs("p",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base text-muted-foreground",children:"circle"}),"Blob",o.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:"the dot that tracks the ball"})]}),o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx(Ye,{children:"Brightness"}),o.jsx("span",{className:"text-sm font-medium",children:P})]}),o.jsx(Ia,{value:[P],onValueChange:I=>V(I[0]),onValueCommit:I=>{V(I[0]),Ge({fgbright:I[0]})},max:255,step:1})]}),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:"Direction"}),o.jsxs(lr,{value:ee,onValueChange:I=>{const be=I;xe(be),Ge({direction:be})},children:[o.jsx(Wn,{children:o.jsx(Cr,{})}),o.jsxs(Xn,{children:[o.jsx(Mt,{value:"cw",children:"Clockwise"}),o.jsx(Mt,{value:"ccw",children:"Counter-clockwise"})]})]})]}),o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx(Ye,{children:"Glow size"}),o.jsx("span",{className:"text-sm font-medium",children:we})]}),o.jsx(Ia,{value:[we],onValueChange:I=>L(I[0]),onValueCommit:I=>{L(I[0]),Ge({size:I[0]})},min:1,max:30,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.jsx(Ye,{children:"Alignment (°)"}),o.jsx("span",{className:"text-sm font-medium",children:Ne})]}),o.jsx(Ia,{value:[Ne],onValueChange:I=>fe(I[0]),onValueCommit:I=>{fe(I[0]),Ge({align:I[0]})},max:359,step:1}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Rotate the blob so it sits on the ball."})]})]}),o.jsxs("div",{className:"space-y-4 lg:border-l lg:pl-8",children:[o.jsxs("p",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base text-muted-foreground",children:"gradient"}),"Background",o.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:"behind the blob"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{children:"Style"}),o.jsxs(lr,{value:re,onValueChange:I=>{z(I),Ge({bg:I})},children:[o.jsx(Wn,{children:o.jsx(Cr,{})}),o.jsx(Xn,{children:Re.map(I=>o.jsx(Mt,{value:I.value,children:I.label},I.value))})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:re==="static"?"Solid fill using the Background color from the Colors panel above.":re==="off"?"The ring stays dark behind the blob.":"Runs another effect behind the blob."})]}),re!=="off"&&o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx(Ye,{children:"Background brightness"}),o.jsx("span",{className:"text-sm font-medium",children:H})]}),o.jsx(Ia,{value:[H],onValueChange:I=>se(I[0]),onValueCommit:I=>{se(I[0]),Ge({bgbright:I[0]})},max:255,step:1})]})]})]})})]}),(jt||ke==="automated")&&o.jsxs(Ln,{children:[o.jsxs($r,{className:"pb-3",children:[o.jsxs(Gr,{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(za,{children:jt?"The table switches to these effects by itself while drawing and at rest":"Save current settings to automatically apply when table state changes"})]}),o.jsx(Bn,{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-live",children:"play_circle"}),o.jsx("span",{className:"font-medium",children:"While Playing"})]})}),st?o.jsx("div",{className:"text-xs p-2 bg-muted/50 rounded border min-h-[40px]",children:It(st)}):o.jsx("div",{className:"text-xs text-muted-foreground italic p-2 rounded border border-dashed min-h-[40px]",children:"Not configured — save the current effect to use it here"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(le,{size:"sm",onClick:()=>Tt("playing"),className:"flex-1 gap-1",children:[o.jsx("span",{className:"material-icons text-sm",children:"save"}),"Save Current"]}),o.jsx(le,{size:"sm",variant:"secondary",onClick:()=>Rn("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-primary",children:"bedtime"}),o.jsx("span",{className:"font-medium",children:"When Idle"})]})}),pe?o.jsx("div",{className:"text-xs p-2 bg-muted/50 rounded border min-h-[40px]",children:It(pe)}):o.jsx("div",{className:"text-xs text-muted-foreground italic p-2 rounded border border-dashed min-h-[40px]",children:"Not configured — save the current effect to use it here"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(le,{size:"sm",onClick:()=>Tt("idle"),className:"flex-1 gap-1",children:[o.jsx("span",{className:"material-icons text-sm",children:"save"}),"Save Current"]}),o.jsx(le,{size:"sm",variant:"secondary",onClick:()=>Rn("idle"),children:"Clear"})]})]})]})})]})]})}var gp="Collapsible",[Dte,G5]=Rr(gp),[kte,p1]=Dte(gp),K5=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:a,defaultOpen:i,disabled:l,onOpenChange:u,...d}=e,[h,p]=Jr({prop:a,defaultProp:i??!1,onChange:u,caller:gp});return o.jsx(kte,{scope:n,disabled:l,contentId:wa(),open:h,onOpenToggle:v.useCallback(()=>p(g=>!g),[p]),children:o.jsx(ct.div,{"data-state":g1(h),"data-disabled":l?"":void 0,...d,ref:t})})});K5.displayName=gp;var Y5="CollapsibleTrigger",W5=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,...a}=e,i=p1(Y5,n);return o.jsx(ct.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":g1(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...a,ref:t,onClick:Qe(e.onClick,i.onOpenToggle)})});W5.displayName=Y5;var m1="CollapsibleContent",X5=v.forwardRef((e,t)=>{const{forceMount:n,...a}=e,i=p1(m1,e.__scopeCollapsible);return o.jsx(Ps,{present:n||i.open,children:({present:l})=>o.jsx(Lte,{...a,ref:t,present:l})})});X5.displayName=m1;var Lte=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:a,children:i,...l}=e,u=p1(m1,n),[d,h]=v.useState(a),p=v.useRef(null),g=_t(t,p),m=v.useRef(0),b=m.current,S=v.useRef(0),j=S.current,w=u.open||d,C=v.useRef(w),N=v.useRef(void 0);return v.useEffect(()=>{const _=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(_)},[]),Vn(()=>{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,S.current=T.width,C.current||(_.style.transitionDuration=N.current.transitionDuration,_.style.animationName=N.current.animationName),h(a)}},[u.open,a]),o.jsx(ct.div,{"data-state":g1(u.open),"data-disabled":u.disabled?"":void 0,id:u.contentId,hidden:!w,...l,ref:g,style:{"--radix-collapsible-content-height":b?`${b}px`:void 0,"--radix-collapsible-content-width":j?`${j}px`:void 0,...e.style},children:w&&i})});function g1(e){return e?"open":"closed"}var Bte=K5,Fte=W5,Ite=X5,Aa="Accordion",zte=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[v1,Hte,Ute]=Gh(Aa),[vp]=Rr(Aa,[Ute,G5]),x1=G5(),Q5=A.forwardRef((e,t)=>{const{type:n,...a}=e,i=a,l=a;return o.jsx(v1.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?o.jsx(Gte,{...l,ref:t}):o.jsx($te,{...i,ref:t})})});Q5.displayName=Aa;var[Z5,Vte]=vp(Aa),[J5,qte]=vp(Aa,{collapsible:!1}),$te=A.forwardRef((e,t)=>{const{value:n,defaultValue:a,onValueChange:i=()=>{},collapsible:l=!1,...u}=e,[d,h]=Jr({prop:n,defaultProp:a??"",onChange:i,caller:Aa});return o.jsx(Z5,{scope:e.__scopeAccordion,value:A.useMemo(()=>d?[d]:[],[d]),onItemOpen:h,onItemClose:A.useCallback(()=>l&&h(""),[l,h]),children:o.jsx(J5,{scope:e.__scopeAccordion,collapsible:l,children:o.jsx(e3,{...u,ref:t})})})}),Gte=A.forwardRef((e,t)=>{const{value:n,defaultValue:a,onValueChange:i=()=>{},...l}=e,[u,d]=Jr({prop:n,defaultProp:a??[],onChange:i,caller:Aa}),h=A.useCallback(g=>d((m=[])=>[...m,g]),[d]),p=A.useCallback(g=>d((m=[])=>m.filter(b=>b!==g)),[d]);return o.jsx(Z5,{scope:e.__scopeAccordion,value:u,onItemOpen:h,onItemClose:p,children:o.jsx(J5,{scope:e.__scopeAccordion,collapsible:!0,children:o.jsx(e3,{...l,ref:t})})})}),[Kte,xp]=vp(Aa),e3=A.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:a,dir:i,orientation:l="vertical",...u}=e,d=A.useRef(null),h=_t(d,t),p=Hte(n),m=Zu(i)==="ltr",b=Qe(e.onKeyDown,S=>{if(!zte.includes(S.key))return;const j=S.target,w=p().filter(F=>!F.ref.current?.disabled),C=w.findIndex(F=>F.ref.current===j),N=w.length;if(C===-1)return;S.preventDefault();let _=C;const T=0,O=N-1,M=()=>{_=C+1,_>O&&(_=T)},B=()=>{_=C-1,_<T&&(_=O)};switch(S.key){case"Home":_=T;break;case"End":_=O;break;case"ArrowRight":l==="horizontal"&&(m?M():B());break;case"ArrowDown":l==="vertical"&&M();break;case"ArrowLeft":l==="horizontal"&&(m?B():M());break;case"ArrowUp":l==="vertical"&&B();break}const k=_%N;w[k].ref.current?.focus()});return o.jsx(Kte,{scope:n,disabled:a,direction:i,orientation:l,children:o.jsx(v1.Slot,{scope:n,children:o.jsx(ct.div,{...u,"data-orientation":l,ref:h,onKeyDown:a?void 0:b})})})}),vh="AccordionItem",[Yte,y1]=vp(vh),t3=A.forwardRef((e,t)=>{const{__scopeAccordion:n,value:a,...i}=e,l=xp(vh,n),u=Vte(vh,n),d=x1(n),h=wa(),p=a&&u.value.includes(a)||!1,g=l.disabled||e.disabled;return o.jsx(Yte,{scope:n,open:p,disabled:g,triggerId:h,children:o.jsx(Bte,{"data-orientation":l.orientation,"data-state":o3(p),...d,...i,ref:t,disabled:g,open:p,onOpenChange:m=>{m?u.onItemOpen(a):u.onItemClose(a)}})})});t3.displayName=vh;var n3="AccordionHeader",r3=A.forwardRef((e,t)=>{const{__scopeAccordion:n,...a}=e,i=xp(Aa,n),l=y1(n3,n);return o.jsx(ct.h3,{"data-orientation":i.orientation,"data-state":o3(l.open),"data-disabled":l.disabled?"":void 0,...a,ref:t})});r3.displayName=n3;var d0="AccordionTrigger",a3=A.forwardRef((e,t)=>{const{__scopeAccordion:n,...a}=e,i=xp(Aa,n),l=y1(d0,n),u=qte(d0,n),d=x1(n);return o.jsx(v1.ItemSlot,{scope:n,children:o.jsx(Fte,{"aria-disabled":l.open&&!u.collapsible||void 0,"data-orientation":i.orientation,id:l.triggerId,...d,...a,ref:t})})});a3.displayName=d0;var s3="AccordionContent",i3=A.forwardRef((e,t)=>{const{__scopeAccordion:n,...a}=e,i=xp(Aa,n),l=y1(s3,n),u=x1(n);return o.jsx(Ite,{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}})});i3.displayName=s3;function o3(e){return e?"open":"closed"}var Wte=Q5,Xte=t3,Qte=r3,l3=a3,c3=i3;const Zte=Wte,fa=v.forwardRef(({className:e,...t},n)=>o.jsx(Xte,{ref:n,className:lt("border-b",e),...t}));fa.displayName="AccordionItem";const ha=v.forwardRef(({className:e,children:t,...n},a)=>o.jsx(Qte,{className:"flex",children:o.jsxs(l3,{ref:a,className:lt("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(A0,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));ha.displayName=l3.displayName;const pa=v.forwardRef(({className:e,children:t,...n},a)=>o.jsx(c3,{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:lt("pb-4 pt-0 px-2",e),children:t})}));pa.displayName=c3.displayName;var ib="rovingFocusGroup.onEntryFocus",Jte={bubbles:!1,cancelable:!0},rd="RovingFocusGroup",[f0,u3,ene]=Gh(rd),[tne,d3]=Rr(rd,[ene]),[nne,rne]=tne(rd),f3=v.forwardRef((e,t)=>o.jsx(f0.Provider,{scope:e.__scopeRovingFocusGroup,children:o.jsx(f0.Slot,{scope:e.__scopeRovingFocusGroup,children:o.jsx(ane,{...e,ref:t})})}));f3.displayName=rd;var ane=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:a,loop:i=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:h,onEntryFocus:p,preventScrollOnEntryFocus:g=!1,...m}=e,b=v.useRef(null),S=_t(t,b),j=Zu(l),[w,C]=Jr({prop:u,defaultProp:d??null,onChange:h,caller:rd}),[N,_]=v.useState(!1),T=gi(p),O=u3(n),M=v.useRef(!1),[B,k]=v.useState(0);return v.useEffect(()=>{const F=b.current;if(F)return F.addEventListener(ib,T),()=>F.removeEventListener(ib,T)},[T]),o.jsx(nne,{scope:n,orientation:a,dir:j,loop:i,currentTabStopId:w,onItemFocus:v.useCallback(F=>C(F),[C]),onItemShiftTab:v.useCallback(()=>_(!0),[]),onFocusableItemAdd:v.useCallback(()=>k(F=>F+1),[]),onFocusableItemRemove:v.useCallback(()=>k(F=>F-1),[]),children:o.jsx(ct.div,{tabIndex:N||B===0?-1:0,"data-orientation":a,...m,ref:S,style:{outline:"none",...e.style},onMouseDown:Qe(e.onMouseDown,()=>{M.current=!0}),onFocus:Qe(e.onFocus,F=>{const W=!M.current;if(F.target===F.currentTarget&&W&&!N){const ce=new CustomEvent(ib,Jte);if(F.currentTarget.dispatchEvent(ce),!ce.defaultPrevented){const G=O().filter(P=>P.focusable),ie=G.find(P=>P.active),Q=G.find(P=>P.id===w),ve=[ie,Q,...G].filter(Boolean).map(P=>P.ref.current);m3(ve,g)}}M.current=!1}),onBlur:Qe(e.onBlur,()=>_(!1))})})}),h3="RovingFocusGroupItem",p3=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:a=!0,active:i=!1,tabStopId:l,children:u,...d}=e,h=wa(),p=l||h,g=rne(h3,n),m=g.currentTabStopId===p,b=u3(n),{onFocusableItemAdd:S,onFocusableItemRemove:j,currentTabStopId:w}=g;return v.useEffect(()=>{if(a)return S(),()=>j()},[a,S,j]),o.jsx(f0.ItemSlot,{scope:n,id:p,focusable:a,active:i,children:o.jsx(ct.span,{tabIndex:m?0:-1,"data-orientation":g.orientation,...d,ref:t,onMouseDown:Qe(e.onMouseDown,C=>{a?g.onItemFocus(p):C.preventDefault()}),onFocus:Qe(e.onFocus,()=>g.onItemFocus(p)),onKeyDown:Qe(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){g.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const N=one(C,g.orientation,g.dir);if(N!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let T=b().filter(O=>O.focusable).map(O=>O.ref.current);if(N==="last")T.reverse();else if(N==="prev"||N==="next"){N==="prev"&&T.reverse();const O=T.indexOf(C.currentTarget);T=g.loop?lne(T,O+1):T.slice(O+1)}setTimeout(()=>m3(T))}}),children:typeof u=="function"?u({isCurrentTabStop:m,hasTabStop:w!=null}):u})})});p3.displayName=h3;var sne={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ine(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function one(e,t,n){const a=ine(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(a))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(a)))return sne[a]}function m3(e,t=!1){const n=document.activeElement;for(const a of e)if(a===n||(a.focus({preventScroll:t}),document.activeElement!==n))return}function lne(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var cne=f3,une=p3,b1="Radio",[dne,g3]=Rr(b1),[fne,hne]=dne(b1),v3=v.forwardRef((e,t)=>{const{__scopeRadio:n,name:a,checked:i=!1,required:l,disabled:u,value:d="on",onCheck:h,form:p,...g}=e,[m,b]=v.useState(null),S=_t(t,C=>b(C)),j=v.useRef(!1),w=m?p||!!m.closest("form"):!0;return o.jsxs(fne,{scope:n,checked:i,disabled:u,children:[o.jsx(ct.button,{type:"button",role:"radio","aria-checked":i,"data-state":w3(i),"data-disabled":u?"":void 0,disabled:u,value:d,...g,ref:S,onClick:Qe(e.onClick,C=>{i||h?.(),w&&(j.current=C.isPropagationStopped(),j.current||C.stopPropagation())})}),w&&o.jsx(b3,{control:m,bubbles:!j.current,name:a,value:d,checked:i,required:l,disabled:u,form:p,style:{transform:"translateX(-100%)"}})]})});v3.displayName=b1;var x3="RadioIndicator",y3=v.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:a,...i}=e,l=hne(x3,n);return o.jsx(Ps,{present:a||l.checked,children:o.jsx(ct.span,{"data-state":w3(l.checked),"data-disabled":l.disabled?"":void 0,...i,ref:t})})});y3.displayName=x3;var pne="RadioBubbleInput",b3=v.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:a=!0,...i},l)=>{const u=v.useRef(null),d=_t(u,l),h=$h(n),p=Bh(t);return v.useEffect(()=>{const g=u.current;if(!g)return;const m=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(m,"checked").set;if(h!==n&&S){const j=new Event("click",{bubbles:a});S.call(g,n),g.dispatchEvent(j)}},[h,n,a]),o.jsx(ct.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}})});b3.displayName=pne;function w3(e){return e?"checked":"unchecked"}var mne=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],yp="RadioGroup",[gne]=Rr(yp,[d3,g3]),S3=d3(),j3=g3(),[vne,xne]=gne(yp),C3=v.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:a,defaultValue:i,value:l,required:u=!1,disabled:d=!1,orientation:h,dir:p,loop:g=!0,onValueChange:m,...b}=e,S=S3(n),j=Zu(p),[w,C]=Jr({prop:l,defaultProp:i??null,onChange:m,caller:yp});return o.jsx(vne,{scope:n,name:a,required:u,disabled:d,value:w,onValueChange:C,children:o.jsx(cne,{asChild:!0,...S,orientation:h,dir:j,loop:g,children:o.jsx(ct.div,{role:"radiogroup","aria-required":u,"aria-orientation":h,"data-disabled":d?"":void 0,dir:j,...b,ref:t})})})});C3.displayName=yp;var N3="RadioGroupItem",E3=v.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:a,...i}=e,l=xne(N3,n),u=l.disabled||a,d=S3(n),h=j3(n),p=v.useRef(null),g=_t(t,p),m=l.value===i.value,b=v.useRef(!1);return v.useEffect(()=>{const S=w=>{mne.includes(w.key)&&(b.current=!0)},j=()=>b.current=!1;return document.addEventListener("keydown",S),document.addEventListener("keyup",j),()=>{document.removeEventListener("keydown",S),document.removeEventListener("keyup",j)}},[]),o.jsx(une,{asChild:!0,...d,focusable:!u,active:m,children:o.jsx(v3,{disabled:u,required:l.required,checked:m,...h,...i,name:l.name,ref:g,onCheck:()=>l.onValueChange(i.value),onKeyDown:Qe(S=>{S.key==="Enter"&&S.preventDefault()}),onFocus:Qe(i.onFocus,()=>{b.current&&p.current?.click()})})})});E3.displayName=N3;var yne="RadioGroupIndicator",_3=v.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...a}=e,i=j3(n);return o.jsx(y3,{...i,...a,ref:t})});_3.displayName=yne;var T3=C3,A3=E3,bne=_3;const $f=v.forwardRef(({className:e,...t},n)=>o.jsx(T3,{className:lt("grid gap-2",e),...t,ref:n}));$f.displayName=T3.displayName;const js=v.forwardRef(({className:e,...t},n)=>o.jsx(A3,{ref:n,className:lt("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(bne,{className:"flex items-center justify-center",children:o.jsx(jz,{className:"h-2.5 w-2.5 fill-current text-current"})})}));js.displayName=A3.displayName;function ob({value:e,onValueChange:t,options:n,placeholder:a="Select...",searchPlaceholder:i="Search...",emptyMessage:l="No results found",className:u,disabled:d}){const[h,p]=v.useState(!1),[g,m]=v.useState(""),b=n.find(w=>w.value===e),S=v.useMemo(()=>g?n.filter(w=>_u(w.label,g)||_u(w.value,g)):n,[n,g]),j=w=>{t(w),p(!1),m("")};return o.jsxs(Ru,{open:h,onOpenChange:p,children:[o.jsx(Ou,{asChild:!0,children:o.jsxs(le,{variant:"secondary",role:"combobox","aria-expanded":h,disabled:d,className:lt("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(zl,{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(St,{placeholder:i,value:g,onChange:w=>m(w.target.value),className:"h-8",autoFocus:!0})}),o.jsx("div",{className:"max-h-[200px] overflow-y-auto",children:S.length===0?o.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:l}):S.map(w=>o.jsxs("button",{type:"button",className:lt("w-full px-3 py-2 text-left text-sm hover:bg-accent hover:text-accent-foreground flex items-center gap-2",e===w.value&&"bg-accent"),onClick:()=>j(w.value),children:[o.jsx("span",{className:lt("material-icons text-base",e===w.value?"opacity-100":"opacity-0"),children:"check"}),o.jsx("span",{className:"truncate",children:w.label})]},w.value))})]})})]})}const SR=["Shifting the sands...","Aligning the stars...","Polishing the steel ball...","Recalculating the spirals...","Tuning the motors...","Almost there..."];function wne({open:e,onOpenChange:t,currentVersion:n,latestVersion:a}){const[i,l]=v.useState("confirming"),[u,d]=v.useState(""),[h,p]=v.useState(0),g=v.useRef(null),m=v.useRef(!1),b=sn(w=>w.isBackendConnected);v.useEffect(()=>{e||(g.current&&clearInterval(g.current),l("confirming"),d(""),p(0),m.current=!1)},[e]),v.useEffect(()=>{i==="updating"&&(b?m.current&&l("complete"):m.current=!0)},[i,b]),v.useEffect(()=>{if(i!=="complete")return;const w=setTimeout(()=>window.location.reload(),2e3);return()=>clearTimeout(w)},[i]),v.useEffect(()=>{if(i==="updating")return g.current=setInterval(()=>{p(w=>(w+1)%SR.length)},4e3),()=>{g.current&&clearInterval(g.current)}},[i]);const S=async()=>{l("updating"),p(0),m.current=!1;try{const w=await ue.request("/api/update",{method:"POST"});w.success||(l("error"),d(w.message||"Update failed"))}catch(w){l("error"),d(w instanceof Error?w.message:"Failed to start update")}},j=i==="updating"||i==="complete";return o.jsx(Xr,{open:e,onOpenChange:j?void 0:t,children:o.jsxs(_r,{onPointerDownOutside:j?w=>w.preventDefault():void 0,onEscapeKeyDown:j?w=>w.preventDefault():void 0,className:j?"[&>button:last-child]:hidden":"",children:[i==="confirming"&&o.jsxs(o.Fragment,{children:[o.jsxs(cr,{children:[o.jsx(ur,{children:"Update Software"}),o.jsxs(_s,{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(Sa,{children:[o.jsx(le,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(le,{onClick:S,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:SR[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-success/15",children:o.jsx("span",{className:"material-icons text-success 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(cr,{children:[o.jsx(ur,{children:"Update Failed"}),o.jsx(_s,{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(Sa,{children:[o.jsx(le,{variant:"outline",onClick:()=>t(!1),children:"Close"}),o.jsx(le,{onClick:S,children:"Retry"})]})]})]})})}const Sne=Math.PI/180;function jne(){const[e,t]=v.useState(!1),[n,a]=v.useState(!1),i=sn(C=>C.status?.is_running??!1),l=sn(C=>C.status?.is_paused??!1),u=sn(C=>C.status?.is_homing??!1),h=!sn(C=>C.status?.is_alarm??!1)&&!i&&!l&&!u,p=!i&&!l&&!u,g=v.useRef(null),m=v.useRef(!1),b=C=>{const N=sn.getState().status?.current_theta??0,_=g.current??N;g.current=_+C*Sne,S()},S=async()=>{if(!m.current){m.current=!0;try{let C=null,N=0;for(;g.current!=null&&g.current!==C;){C=g.current;try{await ue.post("/api/board/rotate",{theta:C}),N=0}catch(_){if(!(_ instanceof Error?_.message:"").startsWith("HTTP 409")||N>15e3)throw _;await new Promise(O=>setTimeout(O,400)),N+=400,C=null}}}catch{Y.error("Could not rotate the arm"),g.current=null}finally{m.current=!1}}},j=async()=>{try{await ue.post("/move_to_perimeter"),Y.success("Moving to the edge")}catch{Y.error("Could not move the ball")}},w=async()=>{a(!0);try{await ue.post("/send_home"),g.current=null,t(!1),Y.success("Orientation set - homing now")}catch{Y.error("Could not home the table")}finally{a(!1)}};return o.jsxs(Xr,{open:e,onOpenChange:C=>{C||(g.current=null),t(C)},children:[o.jsx(fl,{asChild:!0,children:o.jsxs(le,{variant:"outline",className:"gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"screen_rotation"}),"Align Pattern Orientation"]})}),o.jsxs(_r,{className:"max-w-md",children:[o.jsxs(cr,{children:[o.jsx(ur,{children:"Align orientation"}),o.jsx(_s,{children:"With crash homing, patterns are oriented by where the arm points when the table homes. Align it once so patterns come out matching their previews."})]}),o.jsx("div",{className:"flex justify-center py-2",children:o.jsxs("div",{className:"relative w-[190px] h-[190px]",children:[o.jsxs("svg",{width:190,height:190,children:[o.jsx("circle",{cx:95,cy:95,r:83,className:"stroke-border fill-muted/40",strokeWidth:2}),o.jsx("circle",{cx:169,cy:95,r:9,className:"fill-primary"})]}),o.jsxs("div",{className:"absolute left-1/2 -translate-x-1/2 bottom-[-6px] flex items-center gap-1 px-2 py-0.5 rounded-full border bg-background text-muted-foreground text-xs",children:[o.jsx("span",{className:"material-icons-outlined text-sm",children:"person"}),"You"]})]})}),o.jsxs("ol",{className:"text-xs text-muted-foreground list-decimal pl-4 space-y-1",children:[o.jsx("li",{children:"Stand where you normally look at the table from."}),o.jsxs("li",{children:["Use the arrows to walk the ball around the edge until it sits directly to your ",o.jsx("span",{className:"font-medium text-foreground",children:"right"})," (the highlighted spot)."]}),o.jsx("li",{children:'Press "Set orientation" - the table homes and locks that in.'})]}),o.jsx("div",{className:"flex justify-center gap-2",children:[["rotate_left",-45,"45°"],["rotate_left",-10,"10°"],["rotate_right",10,"10°"],["rotate_right",45,"45°"]].map(([C,N,_])=>o.jsxs(le,{variant:"outline",size:"sm",disabled:!h,onClick:()=>b(N),className:"gap-1",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:C}),_]},N))}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs(le,{variant:"secondary",disabled:!h,onClick:j,className:"gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"trip_origin"}),"Move ball to the edge"]}),o.jsxs(le,{disabled:!p||n,onClick:w,className:"gap-2",children:[n?o.jsx("span",{className:"material-icons-outlined text-base animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-base",children:"check"}),"Set orientation (homes the table)"]})]})]})]})}const Cne={sta:"On home Wi-Fi",fallback:"Setup hotspot (could not join home Wi-Fi)",standalone:"Standalone hotspot"};function Nne({isConnected:e}){const[t,n]=v.useState(null),[a,i]=v.useState(!1),[l,u]=v.useState(!1),[d,h]=v.useState([]),[p,g]=v.useState(""),[m,b]=v.useState(""),[S,j]=v.useState(null),w=v.useRef(null),C=async()=>{try{const M=await ue.get("/api/board/wifi/status");n(M)}catch{n(null)}};v.useEffect(()=>(e&&C(),()=>{w.current&&clearTimeout(w.current)}),[e]);const N=async M=>{try{const B=await ue.get(`/api/board/wifi/scan${M?"?rescan=true":""}`);B.status==="ok"?(u(!1),h((B.aps||[]).filter(k=>k.ssid).sort((k,F)=>F.rssi-k.rssi))):w.current=setTimeout(()=>N(!1),2e3)}catch{u(!1),Y.error("Wi-Fi scan failed")}},_=()=>{u(!0),h([]),N(!0)},T=async()=>{if(!(!p||m.length<8)){j("join");try{(await ue.post("/api/board/wifi/save",{ssid:p,password:m})).rebooting?Y.success(`Table is rebooting onto "${p}". If its address changes, it will be re-found automatically.`,{duration:8e3}):Y.success(`Table joined "${p}"`),i(!1),b(""),g("")}catch(M){const B=M instanceof Error?M.message:"";Y.error(B.includes("busy")?"The table is busy - stop the current pattern first":"The table rejected those credentials")}finally{j(null)}}},O=async()=>{if(window.confirm("Switch the table to standalone hotspot mode? It will LEAVE this network and broadcast its own Wi-Fi - this server will lose the connection until the table is back on the same network.")){j("standalone");try{await ue.post("/api/board/wifi/standalone"),Y.success("Table is switching to hotspot mode and leaving this network",{duration:8e3})}catch{Y.error("Could not switch to standalone mode")}finally{j(null)}}};return!e||!t||!t.supported?null:o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",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:"router"}),"Table Wi-Fi"]}),o.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[Cne[t.mode||""]||"Unknown mode",t.mode==="sta"&&t.sta_ssid?` - "${t.sta_ssid}"`:"",t.mode!=="sta"&&t.ap_ssid?` - "${t.ap_ssid}"`:"",t.fail?` (join failed: ${t.fail})`:""]})]}),o.jsx(le,{variant:"outline",size:"sm",onClick:()=>{i(!a),!a&&d.length===0&&_()},children:a?"Close":"Change Wi-Fi"})]}),a&&o.jsxs("div",{className:"space-y-3 pt-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Ye,{children:"Networks in range"}),o.jsxs(le,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground",disabled:l,onClick:_,children:[o.jsx("span",{className:`material-icons-outlined text-base ${l?"animate-spin":""}`,children:l?"sync":"refresh"}),l?"Scanning…":"Rescan"]})]}),o.jsxs("div",{className:"max-h-48 overflow-y-auto space-y-1",children:[d.map(M=>o.jsxs("button",{type:"button",onClick:()=>g(M.ssid),className:`w-full flex items-center justify-between px-3 py-2 rounded-md border text-sm text-left transition-colors ${p===M.ssid?"border-primary bg-primary/5":"hover:bg-muted/50"}`,children:[o.jsx("span",{className:"truncate",children:M.ssid}),o.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground shrink-0",children:[(M.secure===1||M.secure===!0)&&o.jsx("span",{className:"material-icons-outlined text-sm",children:"lock"}),o.jsx("span",{className:"material-icons-outlined text-sm",children:M.rssi>-60?"wifi":M.rssi>-75?"wifi_2_bar":"wifi_1_bar"})]})]},M.ssid)),!l&&d.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground py-2",children:"No networks found - rescan."})]}),p&&o.jsxs("div",{className:"flex gap-3",children:[o.jsx(St,{type:"password",value:m,onChange:M=>b(M.target.value),placeholder:`Password for "${p}" (8-64 chars)`,autoCapitalize:"none",autoCorrect:"off",className:"flex-1"}),o.jsx(le,{disabled:S==="join"||m.length<8,onClick:T,children:S==="join"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):"Connect"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"The table reboots to join the new network. If it lands on a different address, this server re-finds it automatically via mDNS."}),o.jsx("div",{className:"pt-1",children:o.jsx(le,{variant:"outline",size:"sm",className:"text-destructive border-destructive/40 hover:bg-destructive/10",disabled:S==="standalone"||t.mode==="standalone",onClick:O,children:"Switch to standalone hotspot"})})]})]})}function Ene(){const[e,t]=v6(),n=e.get("section"),[a,i]=v.useState(""),[l,u]=v.useState(!1),[d,h]=v.useState("Disconnected"),[p,g]=v.useState(null),[m,b]=v.useState(null),[S,j]=v.useState([]),[w,C]=v.useState(!1),[N,_]=v.useState(!1),[T,O]=v.useState(""),[M,B]=v.useState(""),[k,F]=v.useState({}),[W,ce]=v.useState({provider:"none"}),[G,ie]=v.useState({enabled:!1}),[Q,Z]=v.useState(null),[ve,P]=v.useState(()=>n?[n]:["connection"]),[V,H]=v.useState(new Set),[se,we]=v.useState({enabled:!1,playlist:"",run_mode:"loop",pause_time:0,pause_from_start:!1,clear_pattern:"none",shuffle:!1}),[L,re]=v.useState(!0),[z,ee]=v.useState(null),[xe,Ne]=v.useState("min"),[fe,Ce]=v.useState(5),[Pe,ke]=v.useState("5"),[Ue,pe]=v.useState([]),it=D=>D>=3600&&D%3600===0?{value:D/3600,unit:"hr"}:D>=60&&D%60===0?{value:D/60,unit:"min"}:{value:D,unit:"sec"},st=(D,Ee)=>{switch(Ee){case"hr":return D*3600;case"min":return D*60;default:return D}},[Me,ot]=v.useState({enabled:!1,finish_pattern:!1,control_wled:!1,timezone:"",time_slots:[]}),[$e,Vt]=v.useState([]),[dt,Lt]=v.useState("off"),[yt,ft]=v.useState(""),[Ge,ht]=v.useState(""),[Ct,Jt]=v.useState(!1),[Wt,Xt]=v.useState(null),[de,De]=v.useState(!1),[Te,Be]=v.useState(null),_e=D=>{const Ee=document.getElementById(`section-${D}`);if(Ee){const zt=Ee.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:zt-80,behavior:"smooth"})}};v.useEffect(()=>{n&&setTimeout(()=>{_e(n),t({},{replace:!0})},100)},[n,t]);const We=async D=>{if(!V.has(D))switch(H(Ee=>new Set(Ee).add(D)),D){case"connection":await qt(),V.has("_settings")||(H(Ee=>new Set(Ee).add("_settings")),await It());break;case"application":case"mqtt":case"autoplay":case"stillsands":case"homing":case"clearing":case"security":V.has("_settings")||(H(Ee=>new Set(Ee).add("_settings")),await It()),(D==="autoplay"||D==="clearing")&&!V.has("_playlists")&&(H(Ee=>new Set(Ee).add("_playlists")),await q()),(D==="autoplay"||D==="stillsands")&&!V.has("_board")&&(H(Ee=>new Set(Ee).add("_board")),await jt()),D==="clearing"&&!V.has("_patterns")&&(H(Ee=>new Set(Ee).add("_patterns")),await Nt());break;case"led":await Pt();break;case"version":await bt();break}},Nt=async()=>{try{const D=await ue.get("/list_theta_rho_files");Vt(Array.isArray(D)?D:[])}catch(D){console.error("Error fetching pattern files:",D)}},bt=async()=>{try{const D=await ue.get("/api/version");Xt(D)}catch(D){console.error("Failed to fetch version info:",D)}try{const D=await ue.get("/api/firmware/version");Be(D)}catch(D){console.error("Failed to fetch firmware info:",D)}},Tt=async()=>{Z("firmwareUpdate"),Y.info("Updating the table firmware - this takes a few minutes. Keep the table powered.");try{const D=await ue.post("/api/firmware/update");Y.success(`Firmware updated - table now runs ${D.version||"the latest version"}`),bt(),qt()}catch(D){const Ee=D instanceof Error?D.message:"";Ee.includes("busy")||Ee.includes("Stop the current")?Y.error("The table is busy - stop the current pattern first"):Ee.includes("too old")?Y.error("This firmware is too old for OTA - update once via the web installer"):Y.error("Firmware update failed - the table keeps its old firmware")}finally{Z(null)}},Rn=D=>{const Ee=D.find(et=>!ve.includes(et));P(D),D.forEach(et=>{V.has(et)||We(et)}),Ee&&setTimeout(()=>{_e(Ee)},100)};v.useEffect(()=>{ve.forEach(D=>{We(D)})},[]);const qt=async()=>{try{const D=await ue.get("/serial_status");if(u(D.connected||!1),C(!!D.locked),_(!!D.has_key),g(D.hostname||null),b(D.connected&&D.port||null),h(D.connected?`Connected to ${D.port||"board"}`:"Disconnected"),D.port)i(Ee=>Ee||D.port||"");else{const Ee=await ue.get("/list_serial_ports");Ee?.[0]&&i(et=>et||Ee[0])}}catch(D){console.error("Error fetching connection status:",D)}},$t=async()=>{try{const D=await ue.get("/api/discovered-boards");j(D.boards||[])}catch{}};v.useEffect(()=>{qt(),$t()},[]),ww(()=>{qt(),$t()}),v.useEffect(()=>{const D=()=>{qt(),$t()};return window.addEventListener("board-connected",D),()=>window.removeEventListener("board-connected",D)},[]);const It=async()=>{try{const D=await ue.get("/api/settings");F({app_name:D.app?.name,custom_logo:D.app?.custom_logo,homing_mode:D.homing?.mode,angular_offset:D.homing?.angular_offset_degrees,home_on_connect:D.homing?.home_on_connect,auto_home_enabled:D.homing?.auto_home_enabled,auto_home_after_patterns:D.homing?.auto_home_after_patterns,hard_reset_theta:D.homing?.hard_reset_theta,clear_pattern_speed:D.patterns?.clear_pattern_speed,custom_clear_from_in:D.patterns?.custom_clear_from_in,custom_clear_from_out:D.patterns?.custom_clear_from_out}),D.scheduled_pause&&ot({enabled:D.scheduled_pause.enabled||!1,finish_pattern:D.scheduled_pause.finish_pattern||!1,control_wled:D.scheduled_pause.control_wled||!1,timezone:D.scheduled_pause.timezone||"",time_slots:D.scheduled_pause.time_slots||[]}),D.security&&(Lt(D.security.mode||"off"),Jt(D.security.has_password||!1)),D.mqtt&&ie({enabled:D.mqtt.enabled||!1,broker:D.mqtt.broker,port:D.mqtt.port,username:D.mqtt.username,device_name:D.mqtt.device_name,device_id:D.mqtt.device_id,client_id:D.mqtt.client_id,discovery_prefix:D.mqtt.discovery_prefix})}catch(D){console.error("Error fetching settings:",D)}},Pt=async()=>{try{const D=await ue.get("/get_led_config");ce({provider:D.provider||"none",wled_ip:D.wled_ip})}catch(D){console.error("Error fetching LED config:",D)}},jt=async()=>{try{const D=await ue.get("/api/board/settings");if(re(!!D.reachable),!D.reachable)return;if(D.time&&ee(D.time),D.autostart){const Ee=D.autostart,et=Ee.pause_seconds??0,{value:zt,unit:Or}=it(et);Ce(zt),ke(String(zt)),Ne(Or),we({enabled:!!Ee.playlist,playlist:Ee.playlist||"",run_mode:Ee.run_mode==="single"?"single":"loop",pause_time:et,pause_from_start:!!Ee.pause_from_start,clear_pattern:Ee.clear_pattern||"none",shuffle:!!Ee.shuffle})}}catch(D){console.error("Error fetching board settings:",D),re(!1)}},q=async()=>{try{const D=await ue.get("/list_all_playlists");pe(Array.isArray(D)?D:[])}catch(D){console.error("Error fetching playlists:",D)}},Se=async D=>{const Ee=(D??a).trim();if(!Ee){Y.error("Enter the table IP or hostname");return}D&&i(D),Z("connect");try{const et=await ue.post("/connect",{port:Ee,...T.trim()?{password:T.trim()}:{}});if(et.success)u(!0),b(Ee),C(!1),O(""),h(`Connected to ${Ee}`),Y.success("Connected to the table"),qt(),window.dispatchEvent(new CustomEvent("board-connected",{detail:{source:"settings"}}));else throw new Error(et.message||"Connection failed")}catch(et){et instanceof Error&&et.message.startsWith("HTTP 401")?(C(!0),Y.error("This table is password-protected - enter its password below")):Y.error("Could not reach the table at that address")}finally{Z(null)}},Oe=async()=>{Z("disconnect");try{(await ue.post("/disconnect")).success&&(u(!1),b(null),h("Disconnected"),Y.success("Disconnected"),window.dispatchEvent(new CustomEvent("board-connected",{detail:{source:"settings"}})))}catch{Y.error("Failed to disconnect")}finally{Z(null)}},Ve=async()=>{Z("appName");try{await ue.patch("/api/settings",{app:{name:k.app_name}}),Y.success("App name saved. Refresh to see changes.")}catch{Y.error("Failed to save app name")}finally{Z(null)}},At=D=>{const Ee=Date.now(),et=document.getElementById("favicon-ico"),zt=document.getElementById("apple-touch-icon");D?(et&&(et.href=ue.getAssetUrl(`/static/custom/favicon.ico?v=${Ee}`)),zt&&(zt.href=ue.getAssetUrl(`/static/custom/${D}?v=${Ee}`))):(et&&(et.href=ue.getAssetUrl(`/static/favicon.ico?v=${Ee}`)),zt&&(zt.href=ue.getAssetUrl(`/static/apple-touch-icon.png?v=${Ee}`))),window.dispatchEvent(new CustomEvent("branding-updated"))},tt=async D=>{const Ee=D.target.files?.[0];if(Ee){Z("logo");try{const et=await ue.uploadFile("/api/upload-logo",Ee,"file");F({...k,custom_logo:et.filename}),At(et.filename),Y.success("Logo uploaded!")}catch(et){Y.error(et instanceof Error?et.message:"Failed to upload logo")}finally{Z(null),D.target.value=""}}},Ut=async()=>{if(confirm("Remove custom logo and revert to default?")){Z("logo");try{await ue.delete("/api/custom-logo"),F({...k,custom_logo:void 0}),At(null),Y.success("Logo removed!")}catch{Y.error("Failed to remove logo")}finally{Z(null)}}},J=async()=>{Z("led");try{await ue.post("/set_led_config",{provider:W.provider,ip_address:W.wled_ip}),Y.success("LED configuration saved")}catch(D){Y.error(D instanceof Error?D.message:"Failed to save LED config")}finally{Z(null)}},ye=async()=>{Z("mqtt");try{await ue.patch("/api/settings",{mqtt:{enabled:G.enabled,broker:G.broker,port:G.port,username:G.username,password:G.password,device_name:G.device_name,device_id:G.device_id,client_id:G.client_id,discovery_prefix:G.discovery_prefix}}),Y.success("MQTT configuration saved. Restart required.")}catch{Y.error("Failed to save MQTT config")}finally{Z(null)}},Re=async()=>{if(!G.broker){Y.error("Please enter a broker address");return}Z("mqttTest");try{const D=await ue.post("/api/mqtt-test",{broker:G.broker,port:G.port||1883,username:G.username||"",password:G.password||""});D.success?Y.success("MQTT connection successful!"):Y.error(D.error||"Connection failed")}catch{Y.error("Failed to test MQTT connection")}finally{Z(null)}},Le=async()=>{Z("homing");try{await ue.patch("/api/settings",{homing:{mode:k.homing_mode,angular_offset_degrees:k.angular_offset,home_on_connect:k.home_on_connect,auto_home_enabled:k.auto_home_enabled,auto_home_after_patterns:k.auto_home_after_patterns,hard_reset_theta:k.hard_reset_theta}}),Y.success("Homing configuration saved")}catch{Y.error("Failed to save homing configuration")}finally{Z(null)}},I=async()=>{Z("clearing");try{await ue.patch("/api/settings",{patterns:{clear_pattern_speed:k.clear_pattern_speed??0,custom_clear_from_in:k.custom_clear_from_in||null,custom_clear_from_out:k.custom_clear_from_out||null}}),Y.success("Clearing settings saved")}catch{Y.error("Failed to save clearing settings")}finally{Z(null)}},be=async()=>{if(se.enabled&&!se.playlist){Y.error("Choose a startup playlist first");return}Z("autoplay");try{const D=st(fe,xe);await ue.patch("/api/board/settings",{autostart:{playlist:se.enabled?se.playlist:"",run_mode:se.run_mode,shuffle:se.shuffle,pause_seconds:D,pause_from_start:se.pause_from_start,clear_pattern:se.clear_pattern}}),Y.success("Auto-play saved to the table")}catch{Y.error("Could not save — is the table connected?")}finally{Z(null)}},Ze=async()=>{Z("stillsands");try{await ue.patch("/api/settings",{scheduled_pause:Me}),Y.success("Still Sands settings saved")}catch{Y.error("Failed to save Still Sands settings")}finally{Z(null)}},Je=async()=>{Z("synctime");try{const D=await ue.post("/api/board/sync_time");D.time&&ee(D.time),Y.success("Table clock synced")}catch{Y.error("Could not sync the table clock")}finally{Z(null)}},at=()=>{ot({...Me,time_slots:[...Me.time_slots,{start_time:"22:00",end_time:"06:00",days:"daily",custom_days:[]}]})},mt=D=>{ot({...Me,time_slots:Me.time_slots.filter((Ee,et)=>et!==D)})},dn=(D,Ee)=>{const et=[...Me.time_slots];et[D]={...et[D],...Ee},ot({...Me,time_slots:et})};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 font-display",children:"Settings"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure your sand table"})]}),o.jsx(jr,{}),o.jsxs(Zte,{type:"multiple",value:ve,onValueChange:Rn,className:"space-y-3",children:[o.jsxs(fa,{value:"connection",id:"section-connection",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(ha,{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:"Table Connection"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Controller board address"})]})]})}),o.jsxs(pa,{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 ${l?"bg-success/15":"bg-muted"}`,children:o.jsx("span",{className:`material-icons ${l?"text-success":"text-muted-foreground"}`,children:l?"wifi":"wifi_off"})}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:l&&p?p:"Status"}),o.jsx("p",{className:`text-sm ${l?"text-success":"text-destructive"}`,children:d})]})]}),l&&o.jsx(le,{variant:"destructive",size:"sm",onClick:Oe,disabled:Q==="disconnect",children:"Disconnect"})]}),S.length>0&&o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Ye,{children:"Tables on your network"}),o.jsxs(le,{type:"button",variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground",onClick:$t,children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"refresh"}),"Refresh"]})]}),o.jsx("div",{className:"space-y-2",children:S.map(D=>{const Ee=l&&!!m&&(m.includes(D.host)||!!D.hostname&&m.toLowerCase().includes(D.hostname.toLowerCase()));return o.jsxs("div",{className:"flex items-center justify-between gap-3 p-3 rounded-lg border",children:[o.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"wifi_find"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"font-medium truncate",children:D.name}),o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:D.url})]})]}),Ee?o.jsx("span",{className:"text-xs font-medium text-success shrink-0",children:"Connected"}):o.jsx(le,{size:"sm",variant:"outline",disabled:Q==="connect",onClick:()=>Se(D.url),children:"Connect"})]},D.mac||D.url)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Found automatically on your Wi-Fi via mDNS."})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{htmlFor:"board-address",children:"Table address"}),o.jsxs("div",{className:"flex gap-3",children:[o.jsx(St,{id:"board-address",value:a,onChange:D=>i(D.target.value),placeholder:"IP or host (e.g. 192.168.68.160)",autoCapitalize:"none",autoCorrect:"off",className:"flex-1"}),o.jsxs(le,{onClick:()=>Se(),disabled:Q==="connect"||!a.trim(),className:"gap-2",children:[Q==="connect"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"cable"}),"Connect"]})]}),(w||T)&&o.jsx("div",{className:"flex gap-3",children:o.jsx(St,{type:"password",value:T,onChange:D=>O(D.target.value),placeholder:"Table password",autoCapitalize:"none",autoCorrect:"off",className:"flex-1"})}),w&&o.jsx("p",{className:"text-xs text-primary",children:"This table is password-protected. Enter its password (set from the mobile app) and press Connect - it will be remembered on this server."}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"The FluidNC controller inside the table, on the same network as this server. The address is saved and reconnected automatically on startup."})]}),o.jsx(Nne,{isConnected:l}),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(qr,{checked:k.home_on_connect!==!1,onCheckedChange:async D=>{F({...k,home_on_connect:D});try{await ue.patch("/api/settings",{homing:{home_on_connect:D}}),Y.success(D?"Home on connect enabled":"Home on connect disabled")}catch{Y.error("Failed to save setting")}}})]})})]})]}),o.jsxs(fa,{value:"homing",id:"section-homing",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(ha,{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(pa,{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($f,{value:String(k.homing_mode||0),onValueChange:D=>F({...k,homing_mode:parseInt(D)}),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(js,{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(js,{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"})]})]})]})]}),(k.homing_mode??0)===0&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(jne,{}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Crash homing keeps whatever direction the arm points as the pattern reference. Align it once so patterns match their previews."})]}),k.homing_mode===1&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{htmlFor:"angular-offset",children:"Sensor Offset (degrees)"}),o.jsx(St,{id:"angular-offset",type:"number",min:"0",max:"360",step:"0.1",value:k.angular_offset??"",onChange:D=>F({...k,angular_offset:D.target.value===""?void 0:parseFloat(D.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(qr,{checked:k.auto_home_enabled||!1,onCheckedChange:D=>F({...k,auto_home_enabled:D})})]}),k.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(St,{id:"auto-home-patterns",type:"number",min:"1",max:"100",value:k.auto_home_after_patterns||5,onChange:D=>F({...k,auto_home_after_patterns:parseInt(D.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(le,{onClick:Le,disabled:Q==="homing",className:"gap-2",children:[Q==="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(fa,{value:"application",id:"section-application",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(ha,{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(pa,{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:k.custom_logo?o.jsx("img",{src:ue.getAssetUrl(`/static/custom/${k.custom_logo}`),alt:"Custom Logo",className:"w-full h-full object-cover"}):o.jsx("img",{src:ue.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:k.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(le,{variant:"secondary",size:"sm",className:"gap-2",disabled:Q==="logo",onClick:()=>document.getElementById("logo-upload")?.click(),children:[Q==="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"]}),k.custom_logo&&o.jsx(le,{variant:"secondary",size:"sm",className:"gap-2 text-destructive hover:text-destructive",disabled:Q==="logo",onClick:Ut,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:tt})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"A favicon will be automatically generated from your logo."})]}),o.jsx(jr,{}),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(St,{id:"appName",value:k.app_name||"",onChange:D=>F({...k,app_name:D.target.value}),placeholder:"e.g., Dune Weaver"}),o.jsx(le,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7 p-0",onClick:()=>F({...k,app_name:"Dune Weaver"}),children:o.jsx("span",{className:"material-icons text-base",children:"restart_alt"})})]}),o.jsxs(le,{onClick:Ve,disabled:Q==="appName",className:"gap-2",children:[Q==="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(fa,{value:"clearing",id:"section-clearing",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(ha,{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(pa,{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(St,{id:"clear-speed",type:"number",min:"50",max:"2000",step:"50",value:k.clear_pattern_speed||"",onChange:D=>F({...k,clear_pattern_speed:D.target.value?parseInt(D.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(ob,{value:k.custom_clear_from_in||"__default__",onValueChange:D=>F({...k,custom_clear_from_in:D==="__default__"?void 0:D}),options:[{value:"__default__",label:"Default (built-in)"},...$e.map(D=>({value:D,label:D}))],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(ob,{value:k.custom_clear_from_out||"__default__",onValueChange:D=>F({...k,custom_clear_from_out:D==="__default__"?void 0:D}),options:[{value:"__default__",label:"Default (built-in)"},...$e.map(D=>({value:D,label:D}))],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(le,{onClick:I,disabled:Q==="clearing",className:"gap-2",children:[Q==="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(fa,{value:"led",id:"section-led",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(ha,{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:"Table LEDs or WLED control"})]})]})}),o.jsxs(pa,{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($f,{value:W.provider,onValueChange:D=>ce({...W,provider:D}),className:"flex gap-4",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(js,{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(js,{value:"board",id:"led-board"}),o.jsx(Ye,{htmlFor:"led-board",className:"font-normal",children:"Table LEDs (built-in)"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(js,{value:"wled",id:"led-wled"}),o.jsx(Ye,{htmlFor:"led-wled",className:"font-normal",children:"WLED"})]})]})]}),W.provider==="board"&&o.jsx("div",{className:"space-y-3 p-4 rounded-lg border",children:o.jsxs(Kr,{className:"flex items-start",children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"info"}),o.jsx(Yr,{children:"The LED ring wired to the table's controller board, driven by the firmware. Effects, colors and brightness are controlled from the LED page and persist on the table itself."})]})}),W.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(St,{id:"wledIp",value:W.wled_ip||"",onChange:D=>ce({...W,wled_ip:D.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"})]}),o.jsxs(le,{onClick:J,disabled:Q==="led",className:"gap-2",children:[Q==="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(fa,{value:"mqtt",id:"section-mqtt",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(ha,{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(pa,{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(qr,{checked:G.enabled,onCheckedChange:D=>ie({...G,enabled:D})})]}),G.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(St,{id:"mqttBroker",value:G.broker||"",onChange:D=>ie({...G,broker:D.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(St,{id:"mqttPort",type:"number",value:G.port||1883,onChange:D=>ie({...G,port:parseInt(D.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(St,{id:"mqttUser",value:G.username||"",onChange:D=>ie({...G,username:D.target.value}),placeholder:"Optional"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{htmlFor:"mqttPass",children:"Password"}),o.jsx(St,{id:"mqttPass",type:"password",value:G.password||"",onChange:D=>ie({...G,password:D.target.value}),placeholder:"Optional"})]})]}),o.jsx(jr,{}),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(St,{id:"mqttDeviceName",value:G.device_name||"Dune Weaver",onChange:D=>ie({...G,device_name:D.target.value})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ye,{htmlFor:"mqttDeviceId",children:"Device ID"}),o.jsx(St,{id:"mqttDeviceId",value:G.device_id||"dune_weaver",onChange:D=>ie({...G,device_id:D.target.value})})]})]}),o.jsxs(Kr,{className:"flex items-start",children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"info"}),o.jsx(Yr,{children:"MQTT configuration changes require a restart to take effect."})]})]}),o.jsxs("div",{className:"flex flex-wrap gap-3",children:[o.jsxs(le,{onClick:ye,disabled:Q==="mqtt",className:"gap-2",children:[Q==="mqtt"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save MQTT Configuration"]}),G.enabled&&G.broker&&o.jsxs(le,{variant:"secondary",onClick:Re,disabled:Q==="mqttTest",className:"gap-2",children:[Q==="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(fa,{value:"autoplay",id:"section-autoplay",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(ha,{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 when the table powers on"})]})]})}),o.jsxs(pa,{className:"pt-4 pb-6 space-y-6",children:[!L&&o.jsx(Kr,{children:o.jsx(Yr,{children:"The table is not reachable, so its saved auto-play settings can't be shown. Connect to the table first (Table Connection above)."})}),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 a playlist after the table powers on and homes. Stored on the table, so it works even when this server is off."})]}),o.jsx(qr,{checked:se.enabled,onCheckedChange:D=>we({...se,enabled:D})})]}),se.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(lr,{value:se.playlist||void 0,onValueChange:D=>we({...se,playlist:D}),children:[o.jsx(Wn,{children:o.jsx(Cr,{placeholder:"Select a playlist..."})}),o.jsx(Xn,{children:Ue.length===0?o.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"No playlists found"}):Ue.map(D=>o.jsx(Mt,{value:D,children:D},D))})]}),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(lr,{value:se.run_mode,onValueChange:D=>we({...se,run_mode:D}),children:[o.jsx(Wn,{children:o.jsx(Cr,{})}),o.jsxs(Xn,{children:[o.jsx(Mt,{value:"single",children:"Single (play once)"}),o.jsx(Mt,{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(St,{type:"text",inputMode:"numeric",value:Pe,onChange:D=>{const Ee=D.target.value.replace(/[^0-9]/g,"");ke(Ee)},onBlur:()=>{const D=Math.max(0,parseInt(Pe)||0);Ce(D),ke(String(D))},onKeyDown:D=>{if(D.key==="Enter"){const Ee=Math.max(0,parseInt(Pe)||0);Ce(Ee),ke(String(Ee))}},className:"w-20"}),o.jsxs(lr,{value:xe,onValueChange:D=>Ne(D),children:[o.jsx(Wn,{className:"w-20",children:o.jsx(Cr,{})}),o.jsxs(Xn,{children:[o.jsx(Mt,{value:"sec",children:"sec"}),o.jsx(Mt,{value:"min",children:"min"}),o.jsx(Mt,{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(lr,{value:se.clear_pattern,onValueChange:D=>we({...se,clear_pattern:D}),children:[o.jsx(Wn,{children:o.jsx(Cr,{})}),o.jsxs(Xn,{children:[o.jsx(Mt,{value:"none",children:"None"}),o.jsx(Mt,{value:"adaptive",children:"Adaptive"}),o.jsx(Mt,{value:"in",children:"Clear From Center"}),o.jsx(Mt,{value:"out",children:"Clear From Perimeter"}),o.jsx(Mt,{value:"sideway",children:"Clear Sideways"}),o.jsx(Mt,{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(qr,{checked:se.shuffle,onCheckedChange:D=>we({...se,shuffle:D})})]})]}),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:"Pause From Start"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Measure the gap from each pattern's start, not its end"})]}),o.jsx(qr,{checked:se.pause_from_start,onCheckedChange:D=>we({...se,pause_from_start:D})})]})]}),o.jsxs(le,{onClick:be,disabled:Q==="autoplay",className:"gap-2",children:[Q==="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(fa,{value:"stillsands",id:"section-stillsands",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(ha,{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(pa,{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("span",{className:"material-icons-outlined text-muted-foreground",children:"schedule"}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:"Table Clock"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:z?`${z.local||"—"} · ${z.tz||"no timezone"} · ${z.synced?"synced":"not set"}`:"No clock reported — is the table connected?"}),z&&!z.synced&&o.jsx("p",{className:"text-xs text-destructive mt-1",children:"The table clock isn't set, so schedules won't fire on the table. The server syncs it on connect — sync now to set it immediately."})]})]}),o.jsxs(le,{variant:"secondary",size:"sm",onClick:Je,disabled:Q==="synctime",className:"gap-2",children:[Q==="synctime"?o.jsx("span",{className:"material-icons-outlined animate-spin text-base",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-base",children:"sync"}),"Sync"]})]}),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 scheduled quiet periods. Shared with the table itself, so playlists started from a phone stay quiet too."})]}),o.jsx(qr,{checked:Me.enabled,onCheckedChange:D=>ot({...Me,enabled:D})})]}),Me.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(qr,{checked:Me.finish_pattern,onCheckedChange:D=>ot({...Me,finish_pattern:D})})]}),o.jsx(jr,{}),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:"Turn Off LEDs"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Switch off the lights during still periods (WLED and the table's LED ring)"})]})]}),o.jsx(qr,{checked:Me.control_wled,onCheckedChange:D=>ot({...Me,control_wled:D})})]}),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(ob,{value:Me.timezone||"",onValueChange:D=>ot({...Me,timezone:D}),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(le,{onClick:at,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."}),Me.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:Me.time_slots.map((D,Ee)=>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 ",Ee+1]}),o.jsx(le,{variant:"ghost",size:"icon",onClick:()=>mt(Ee),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(St,{type:"time",value:D.start_time,onChange:et=>dn(Ee,{start_time:et.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(St,{type:"time",value:D.end_time,onChange:et=>dn(Ee,{end_time:et.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(lr,{value:D.days,onValueChange:et=>dn(Ee,{days:et,...et!=="custom"?{custom_days:[]}:{}}),children:[o.jsx(Wn,{children:o.jsx(Cr,{})}),o.jsxs(Xn,{children:[o.jsx(Mt,{value:"daily",children:"Daily"}),o.jsx(Mt,{value:"weekdays",children:"Weekdays"}),o.jsx(Mt,{value:"weekends",children:"Weekends"}),o.jsx(Mt,{value:"custom",children:"Custom"})]})]})]}),D.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(et=>{const zt=D.custom_days?.includes(et.key);return o.jsx("button",{type:"button",onClick:()=>{const Or=D.custom_days||[],na=zt?Or.filter(Ra=>Ra!==et.key):[...Or,et.key];dn(Ee,{custom_days:na})},className:`px-2.5 py-1 text-xs rounded-full border transition-colors ${zt?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-input hover:bg-accent"}`,children:et.label},et.key)})})]})]},Ee))})]}),o.jsxs(Kr,{className:"flex items-start",children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"info"}),o.jsx(Yr,{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(le,{onClick:Ze,disabled:Q==="stillsands",className:"gap-2",children:[Q==="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(fa,{value:"security",id:"section-security",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(ha,{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(pa,{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($f,{value:dt,onValueChange:D=>{const Ee=D;Ee==="off"&&dt!=="off"&&!confirm("Turn off security? This will remove the password and unlock the app.")||(Lt(Ee),ft(""),ht(""))},className:"space-y-2",children:[o.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border",children:[o.jsx(js,{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(js,{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(js,{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."})]})]})]})]}),dt!=="off"&&o.jsxs("div",{className:"space-y-3 pt-2",children:[o.jsx(jr,{}),Ct&&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:Ct?"New Password":"Password"}),o.jsx(St,{id:"security-password",type:"password",placeholder:Ct?"Leave blank to keep current":"Enter password",value:yt,onChange:D=>ft(D.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{htmlFor:"security-password-confirm",children:"Confirm Password"}),o.jsx(St,{id:"security-password-confirm",type:"password",placeholder:"Confirm password",value:Ge,onChange:D=>ht(D.target.value)})]}),yt&&Ge&&yt!==Ge&&o.jsx("p",{className:"text-sm text-destructive",children:"Passwords do not match"})]}),o.jsxs(le,{onClick:async()=>{if(dt!=="off"){if(yt&&yt!==Ge){Y.error("Passwords do not match");return}if(!Ct&&!yt){Y.error("Please set a password");return}}Z("security");try{const D={security:{mode:dt}};yt&&(D.security.password=yt),await ue.patch("/api/settings",D),Y.success("Security settings saved"),ft(""),ht(""),Jt(dt!=="off"),window.dispatchEvent(new CustomEvent("security-updated"))}catch{Y.error("Failed to save security settings")}finally{Z(null)}},disabled:Q==="security"||dt!=="off"&&yt!==""&&yt!==Ge||dt!=="off"&&!Ct&&!yt,className:"w-full gap-2",children:[Q==="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("div",{className:"p-4 rounded-lg border space-y-3",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:"key"}),"Table Password"]}),o.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Locks the table's own API so only clients with the password can control it (needs firmware v0.1.11+). This server"," ",N?"has the password saved.":"has no password saved."]})]}),l?o.jsxs("div",{className:"flex gap-3",children:[o.jsx(St,{type:"password",value:M,onChange:D=>B(D.target.value),placeholder:N?"New password (4-64 chars)":"Password (4-64 chars)",autoCapitalize:"none",autoCorrect:"off",className:"flex-1"}),o.jsx(le,{variant:"outline",disabled:Q==="tablePassword"||M.trim().length<4,onClick:async()=>{Z("tablePassword");try{await ue.post("/api/board/password",{action:"set",password:M.trim()}),_(!0),B(""),Y.success("Table password set")}catch{Y.error("Failed to set the table password")}finally{Z(null)}},children:N?"Change":"Set"}),N&&o.jsx(le,{variant:"destructive",disabled:Q==="tablePassword",onClick:async()=>{Z("tablePassword");try{await ue.post("/api/board/password",{action:"remove"}),_(!1),Y.success("Table password removed")}catch{Y.error("Failed to remove the table password")}finally{Z(null)}},children:"Remove"})]}):o.jsx("p",{className:"text-xs text-muted-foreground",children:"Connect to the table to manage its password."}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["If you lose the password, it can be cleared over USB serial with"," ",o.jsx("code",{className:"font-mono",children:"$Sand/Password="}),"."]})]})]})]}),o.jsxs(fa,{value:"version",id:"section-version",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(ha,{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(pa,{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:"App Version"}),o.jsxs("p",{className:`text-sm ${Wt?.update_available?"text-success font-medium":"text-muted-foreground"}`,children:[o.jsx("span",{className:"font-mono",children:Wt?.current?`v${Wt.current}`:"Loading..."}),Wt?.latest&&o.jsxs(o.Fragment,{children:[" · latest ",o.jsxs("a",{href:`https://github.com/tuanchris/dune-weaver/releases/tag/v${Wt.latest}`,target:"_blank",rel:"noopener noreferrer",className:"font-mono underline underline-offset-2 hover:opacity-80 transition-opacity",children:["v",Wt.latest]})]}),Wt?.update_available&&" (Update available!)"]})]})]}),Wt?.update_available&&o.jsxs(le,{onClick:()=>De(!0),className:"w-full",children:[o.jsx("span",{className:"material-icons text-base mr-2",children:"system_update"}),"Update Now"]}),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:"memory"})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:"font-medium",children:"Table Firmware"}),o.jsxs("p",{className:`text-sm ${Te?.update_available?"text-success font-medium":"text-muted-foreground"}`,children:[o.jsx("span",{className:"font-mono",children:Te?.current||"Unknown (connect to the table)"}),Te?.latest&&o.jsxs(o.Fragment,{children:[" · latest ",Te.release_url?o.jsx("a",{href:Te.release_url,target:"_blank",rel:"noopener noreferrer",className:"font-mono underline underline-offset-2 hover:opacity-80 transition-opacity",children:Te.latest}):o.jsx("span",{className:"font-mono",children:Te.latest})]})]})]})]}),Te?.update_available&&o.jsxs(o.Fragment,{children:[o.jsxs(le,{variant:"outline",className:"w-full",onClick:Tt,disabled:Q==="firmwareUpdate"||!l,children:[Q==="firmwareUpdate"?o.jsx("span",{className:"material-icons text-base mr-2 animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons text-base mr-2",children:"memory"}),Q==="firmwareUpdate"?"Updating table firmware…":`Update Table Firmware to ${Te.latest}`]}),Q==="firmwareUpdate"&&o.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Flashing and rebooting the table - do not power it off. This takes a few minutes."})]}),o.jsx(wne,{open:de,onOpenChange:De,currentVersion:Wt?.current||"",latestVersion:Wt?.latest||""})]})]})]})]})}function jR({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-success":e>=25?"text-primary":"text-destructive";return o.jsx("span",{className:`material-icons text-lg ${n}`,children:t})}function _ne(){const[e,t]=v.useState(null),[n,a]=v.useState([]),[i,l]=v.useState([]),[u,d]=v.useState(null),[h,p]=v.useState(""),[g,m]=v.useState(!1),[b,S]=v.useState(!1),[j,w]=v.useState(!1),[C,N]=v.useState(!1),[_,T]=v.useState(!1),[O,M]=v.useState(""),[B,k]=v.useState(null),[F,W]=v.useState(""),[ce,G]=v.useState(""),[ie,Q]=v.useState(!1),[Z,ve]=v.useState(!1),P=v.useCallback(async()=>{try{const pe=await ue.get("/api/wifi/status");t(pe)}catch{}},[]),V=v.useCallback(async()=>{try{const pe=await ue.get("/api/wifi/saved");l(pe)}catch{}},[]),H=v.useCallback(async()=>{try{const pe=await ue.get("/api/wifi/hotspot/password");W(pe.password),G(pe.password)}catch{}},[]),se=v.useCallback(async()=>{S(!0);try{const pe=await ue.get("/api/wifi/networks");a(pe)}catch{Y.error("Failed to scan networks")}finally{S(!1)}},[]);v.useEffect(()=>{P(),se(),V(),H()},[P,se,V,H]);const we=_||u&&u.security!=="Open"&&!u.saved,L=async()=>{const pe=_?O.trim():u?.ssid;if(pe){w(!0);try{const it=await ue.post("/api/wifi/connect",{ssid:pe,password:we?h:""});it.success&&(Y.success(it.message),Pe(),P(),V(),se())}catch(it){const st=it instanceof Error?it.message:"Connection failed";Y.error(st)}finally{w(!1)}}},re=async()=>{const pe=O.trim();if(pe){N(!0);try{const it=await ue.post("/api/wifi/save",{ssid:pe,password:h||""});it.success&&(Y.success(it.message),Pe(),V())}catch(it){const st=it instanceof Error?it.message:"Failed to save network";Y.error(st)}finally{N(!1)}}},z=async()=>{if(!B)return;const pe=B;k(null);try{await ue.post("/api/wifi/forget",{ssid:pe}),Y.success(`Forgot '${pe}'`),V(),se()}catch{Y.error("Failed to forget network")}},ee=B===e?.ssid,xe=i.filter(pe=>pe.ssid!==B).length,Ne=ee&&xe===0,fe=async()=>{ve(!0);try{const pe=await ue.post("/api/wifi/hotspot/password",{password:ce});pe.success&&(W(ce),Y.success(pe.message))}catch(pe){const it=pe instanceof Error?pe.message:"Failed to update password";Y.error(it)}finally{ve(!1)}},Ce=pe=>{d(pe),p(""),m(!1)},Pe=()=>{!j&&!C&&(d(null),p(""),m(!1),T(!1),M(""))},ke=()=>{T(!0),M(""),p(""),m(!1),d({ssid:"",signal:0,security:"Manual",saved:!1,active:!1})},Ue=e?.mode==="hotspot";return o.jsxs("div",{className:"container max-w-lg mx-auto px-3 py-4 space-y-3",children:[Ue&&o.jsxs(Kr,{className:"border-primary/30 bg-primary/10",children:[o.jsx("span",{className:"material-icons text-primary mr-2",children:"wifi_tethering"}),o.jsxs(Yr,{children:[o.jsx("strong",{children:"Welcome to Dune Weaver!"}),o.jsx("br",{}),"Connect to your home WiFi network below to get started."]})]}),o.jsx(Ln,{children:o.jsxs(Bn,{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(Va,{variant:Ue?"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..."}),!Ue&&o.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"WiFi management requires a Raspberry Pi."})]})}),i.length>0&&o.jsx(Ln,{children:o.jsxs(Bn,{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(pe=>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:pe.ssid})]}),o.jsx(le,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>k(pe.ssid),children:o.jsx("span",{className:"material-icons text-sm text-destructive",children:"delete"})})]},pe.name))})]})}),o.jsx(Ln,{children:o.jsxs(Bn,{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"}),!F&&o.jsx(Va,{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(St,{type:ie?"text":"password",value:ce,onChange:pe=>G(pe.target.value),placeholder:"No password (open)",className:"pr-8 h-8 text-sm",onKeyDown:pe=>{pe.key==="Enter"&&ce!==F&&fe()}}),o.jsx("button",{type:"button",onClick:()=>Q(!ie),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:ie?"visibility_off":"visibility"})})]}),o.jsx(le,{size:"sm",className:"h-8",onClick:fe,disabled:Z||ce===F||ce.length>0&&ce.length<8,children:Z?o.jsx("span",{className:"material-icons text-sm animate-spin",children:"refresh"}):"Save"})]}),ce&&ce.length<8&&ce.length>0&&o.jsx("p",{className:"text-xs text-destructive mt-1",children:"Password must be at least 8 characters"})]})}),Ue&&o.jsxs(o.Fragment,{children:[o.jsx(jr,{}),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(Ln,{children:o.jsxs(Bn,{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(le,{variant:"outline",size:"sm",className:"flex-1 h-8",onClick:async()=>{if(confirm("Restart Dune Weaver?"))try{await ue.post("/api/system/restart"),Y.success("Restarting...")}catch{Y.error("Failed to restart")}},children:[o.jsx("span",{className:"material-icons-outlined text-sm mr-1.5",children:"restart_alt"}),"Restart"]}),o.jsxs(le,{variant:"outline",size:"sm",className:"flex-1 h-8 text-destructive hover:text-destructive",onClick:async()=>{if(confirm("Shutdown the system?"))try{await ue.post("/api/system/shutdown"),Y.success("Shutting down...")}catch{Y.error("Failed to shutdown")}},children:[o.jsx("span",{className:"material-icons-outlined text-sm mr-1.5",children:"power_settings_new"}),"Shutdown"]})]})]})}),o.jsx(Ln,{children:o.jsxs(Bn,{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(le,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:ke,title:"Add network manually",children:o.jsx("span",{className:"material-icons text-base",children:"add"})}),o.jsx(le,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:se,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(pe=>o.jsxs("button",{onClick:()=>Ce(pe),className:`w-full flex items-center gap-2.5 px-2.5 py-2 rounded-lg text-left transition-colors hover:bg-muted/50
  83. ${pe.active?"bg-success/10":""}`,children:[o.jsx(jR,{signal:pe.signal}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-medium text-sm truncate",children:pe.ssid}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[pe.security,pe.saved&&" · Saved",pe.active&&" · Connected"]})]}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[pe.signal,"%"]}),pe.security!=="Open"&&o.jsx("span",{className:"material-icons text-sm text-muted-foreground",children:"lock"})]},pe.ssid))]})]})}),o.jsx(Xr,{open:B!==null,onOpenChange:pe=>{pe||k(null)},children:o.jsxs(_r,{className:"sm:max-w-md",children:[o.jsxs(cr,{children:[o.jsxs(ur,{children:["Forget '",B,"'?"]}),o.jsx(_s,{children:Ne?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."]}):ee?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(Sa,{className:"flex-row gap-2 sm:justify-end",children:[o.jsx(le,{variant:"outline",onClick:()=>k(null),children:"Cancel"}),o.jsx(le,{variant:"destructive",onClick:z,children:"Forget"})]})]})}),o.jsx(Xr,{open:u!==null,onOpenChange:pe=>{pe||Pe()},children:o.jsxs(_r,{className:"sm:max-w-md",children:[o.jsxs(cr,{children:[o.jsx(ur,{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(jR,{signal:u.signal}),u?.ssid]})}),o.jsx(_s,{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(St,{id:"wifi-ssid",type:"text",value:O,onChange:pe=>M(pe.target.value),placeholder:"Enter network name",autoFocus:!0})]}),we&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ye,{htmlFor:"wifi-password",children:"Password"}),o.jsxs("div",{className:"relative",children:[o.jsx(St,{id:"wifi-password",type:g?"text":"password",value:h,onChange:pe=>p(pe.target.value),placeholder:"Enter WiFi password",autoFocus:!_,onKeyDown:pe=>{pe.key==="Enter"&&h&&L()}}),o.jsx("button",{type:"button",onClick:()=>m(!g),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:g?"visibility_off":"visibility"})})]})]}),_?o.jsxs("div",{className:"flex gap-2",children:[o.jsx(le,{variant:"outline",className:"flex-1",onClick:re,disabled:C||j||!O.trim()||!!we&&!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(le,{className:"flex-1",onClick:L,disabled:j||C||!O.trim()||!!we&&!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(le,{className:"w-full",onClick:L,disabled:j||!!we&&!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 Tne(){const e=yh(),[t,n]=v.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 Ane=({...e})=>{const[t,n]=v.useState("light");return v.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(CB,{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 Rne(){return o.jsxs(FH,{children:[o.jsx(H8,{children:o.jsxs(Ss,{path:"/",element:o.jsx(N$,{}),children:[o.jsx(Ss,{index:!0,element:o.jsx(UG,{})}),o.jsx(Ss,{path:"playlists",element:o.jsx(qG,{})}),o.jsx(Ss,{path:"table-control",element:o.jsx(vK,{})}),o.jsx(Ss,{path:"led",element:o.jsx(Pte,{})}),o.jsx(Ss,{path:"settings",element:o.jsx(Ene,{})}),o.jsx(Ss,{path:"wifi-setup",element:o.jsx(_ne,{})}),o.jsx(Ss,{path:"captive",element:o.jsx(Tne,{})})]})}),o.jsx(Ane,{position:"top-center",richColors:!0,closeButton:!0})]})}const One=new W6({defaultOptions:{queries:{staleTime:1e3*60,retry:1}}});UL.createRoot(document.getElementById("root")).render(o.jsx(v.StrictMode,{children:o.jsx(f6,{children:o.jsx(Q6,{client:One,children:o.jsx(Rne,{})})})}))});export default Mne();