bullpane 0.5.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,548 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowsPage-CRkXK3KR.js","assets/flowLayout-CPGuWm9t.js","assets/flowLayout-BnuhLJ6X.css","assets/JobTreePage-CcNNhc6M.js"])))=>i.map(i=>d[i]);
2
+ var tb=Object.defineProperty;var ag=e=>{throw TypeError(e)};var nb=(e,n,r)=>n in e?tb(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var Eh=(e,n,r)=>nb(e,typeof n!="symbol"?n+"":n,r),Rh=(e,n,r)=>n.has(e)||ag("Cannot "+r);var _=(e,n,r)=>(Rh(e,n,"read from private field"),r?r.call(e):n.get(e)),xe=(e,n,r)=>n.has(e)?ag("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(e):n.set(e,r),te=(e,n,r,i)=>(Rh(e,n,"write to private field"),i?i.call(e,r):n.set(e,r),r),Pe=(e,n,r)=>(Rh(e,n,"access private method"),r);var Kc=(e,n,r,i)=>({set _(o){te(e,n,o,r)},get _(){return _(e,n,i)}});function sb(e,n){for(var r=0;r<n.length;r++){const i=n[r];if(typeof i!="string"&&!Array.isArray(i)){for(const o in i)if(o!=="default"&&!(o in e)){const c=Object.getOwnPropertyDescriptor(i,o);c&&Object.defineProperty(e,o,c.get?c:{enumerable:!0,get:()=>i[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function r(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(o){if(o.ep)return;o.ep=!0;const c=r(o);fetch(o.href,c)}})();function rb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Mh={exports:{}},Wl={},Th={exports:{}},De={};/**
3
+ * @license React
4
+ * react.production.min.js
5
+ *
6
+ * Copyright (c) Facebook, Inc. and its affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var ig;function ab(){if(ig)return De;ig=1;var e=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),v=Symbol.iterator;function j(A){return A===null||typeof A!="object"?null:(A=v&&A[v]||A["@@iterator"],typeof A=="function"?A:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,b={};function k(A,K,qe){this.props=A,this.context=K,this.refs=b,this.updater=qe||C}k.prototype.isReactComponent={},k.prototype.setState=function(A,K){if(typeof A!="object"&&typeof A!="function"&&A!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,A,K,"setState")},k.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function S(){}S.prototype=k.prototype;function $(A,K,qe){this.props=A,this.context=K,this.refs=b,this.updater=qe||C}var z=$.prototype=new S;z.constructor=$,y(z,k.prototype),z.isPureReactComponent=!0;var E=Array.isArray,T=Object.prototype.hasOwnProperty,M={current:null},O={key:!0,ref:!0,__self:!0,__source:!0};function Q(A,K,qe){var Ae,Ne={},Le=null,st=null;if(K!=null)for(Ae in K.ref!==void 0&&(st=K.ref),K.key!==void 0&&(Le=""+K.key),K)T.call(K,Ae)&&!O.hasOwnProperty(Ae)&&(Ne[Ae]=K[Ae]);var Je=arguments.length-2;if(Je===1)Ne.children=qe;else if(1<Je){for(var at=Array(Je),Qt=0;Qt<Je;Qt++)at[Qt]=arguments[Qt+2];Ne.children=at}if(A&&A.defaultProps)for(Ae in Je=A.defaultProps,Je)Ne[Ae]===void 0&&(Ne[Ae]=Je[Ae]);return{$$typeof:e,type:A,key:Le,ref:st,props:Ne,_owner:M.current}}function V(A,K){return{$$typeof:e,type:A.type,key:K,ref:A.ref,props:A.props,_owner:A._owner}}function q(A){return typeof A=="object"&&A!==null&&A.$$typeof===e}function B(A){var K={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(qe){return K[qe]})}var ce=/\/+/g;function _e(A,K){return typeof A=="object"&&A!==null&&A.key!=null?B(""+A.key):K.toString(36)}function Ue(A,K,qe,Ae,Ne){var Le=typeof A;(Le==="undefined"||Le==="boolean")&&(A=null);var st=!1;if(A===null)st=!0;else switch(Le){case"string":case"number":st=!0;break;case"object":switch(A.$$typeof){case e:case n:st=!0}}if(st)return st=A,Ne=Ne(st),A=Ae===""?"."+_e(st,0):Ae,E(Ne)?(qe="",A!=null&&(qe=A.replace(ce,"$&/")+"/"),Ue(Ne,K,qe,"",function(Qt){return Qt})):Ne!=null&&(q(Ne)&&(Ne=V(Ne,qe+(!Ne.key||st&&st.key===Ne.key?"":(""+Ne.key).replace(ce,"$&/")+"/")+A)),K.push(Ne)),1;if(st=0,Ae=Ae===""?".":Ae+":",E(A))for(var Je=0;Je<A.length;Je++){Le=A[Je];var at=Ae+_e(Le,Je);st+=Ue(Le,K,qe,at,Ne)}else if(at=j(A),typeof at=="function")for(A=at.call(A),Je=0;!(Le=A.next()).done;)Le=Le.value,at=Ae+_e(Le,Je++),st+=Ue(Le,K,qe,at,Ne);else if(Le==="object")throw K=String(A),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.");return st}function Ge(A,K,qe){if(A==null)return A;var Ae=[],Ne=0;return Ue(A,Ae,"","",function(Le){return K.call(qe,Le,Ne++)}),Ae}function rt(A){if(A._status===-1){var K=A._result;K=K(),K.then(function(qe){(A._status===0||A._status===-1)&&(A._status=1,A._result=qe)},function(qe){(A._status===0||A._status===-1)&&(A._status=2,A._result=qe)}),A._status===-1&&(A._status=0,A._result=K)}if(A._status===1)return A._result.default;throw A._result}var Be={current:null},Z={transition:null},de={ReactCurrentDispatcher:Be,ReactCurrentBatchConfig:Z,ReactCurrentOwner:M};function se(){throw Error("act(...) is not supported in production builds of React.")}return De.Children={map:Ge,forEach:function(A,K,qe){Ge(A,function(){K.apply(this,arguments)},qe)},count:function(A){var K=0;return Ge(A,function(){K++}),K},toArray:function(A){return Ge(A,function(K){return K})||[]},only:function(A){if(!q(A))throw Error("React.Children.only expected to receive a single React element child.");return A}},De.Component=k,De.Fragment=r,De.Profiler=o,De.PureComponent=$,De.StrictMode=i,De.Suspense=m,De.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=de,De.act=se,De.cloneElement=function(A,K,qe){if(A==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+A+".");var Ae=y({},A.props),Ne=A.key,Le=A.ref,st=A._owner;if(K!=null){if(K.ref!==void 0&&(Le=K.ref,st=M.current),K.key!==void 0&&(Ne=""+K.key),A.type&&A.type.defaultProps)var Je=A.type.defaultProps;for(at in K)T.call(K,at)&&!O.hasOwnProperty(at)&&(Ae[at]=K[at]===void 0&&Je!==void 0?Je[at]:K[at])}var at=arguments.length-2;if(at===1)Ae.children=qe;else if(1<at){Je=Array(at);for(var Qt=0;Qt<at;Qt++)Je[Qt]=arguments[Qt+2];Ae.children=Je}return{$$typeof:e,type:A.type,key:Ne,ref:Le,props:Ae,_owner:st}},De.createContext=function(A){return A={$$typeof:d,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},A.Provider={$$typeof:c,_context:A},A.Consumer=A},De.createElement=Q,De.createFactory=function(A){var K=Q.bind(null,A);return K.type=A,K},De.createRef=function(){return{current:null}},De.forwardRef=function(A){return{$$typeof:h,render:A}},De.isValidElement=q,De.lazy=function(A){return{$$typeof:p,_payload:{_status:-1,_result:A},_init:rt}},De.memo=function(A,K){return{$$typeof:g,type:A,compare:K===void 0?null:K}},De.startTransition=function(A){var K=Z.transition;Z.transition={};try{A()}finally{Z.transition=K}},De.unstable_act=se,De.useCallback=function(A,K){return Be.current.useCallback(A,K)},De.useContext=function(A){return Be.current.useContext(A)},De.useDebugValue=function(){},De.useDeferredValue=function(A){return Be.current.useDeferredValue(A)},De.useEffect=function(A,K){return Be.current.useEffect(A,K)},De.useId=function(){return Be.current.useId()},De.useImperativeHandle=function(A,K,qe){return Be.current.useImperativeHandle(A,K,qe)},De.useInsertionEffect=function(A,K){return Be.current.useInsertionEffect(A,K)},De.useLayoutEffect=function(A,K){return Be.current.useLayoutEffect(A,K)},De.useMemo=function(A,K){return Be.current.useMemo(A,K)},De.useReducer=function(A,K,qe){return Be.current.useReducer(A,K,qe)},De.useRef=function(A){return Be.current.useRef(A)},De.useState=function(A){return Be.current.useState(A)},De.useSyncExternalStore=function(A,K,qe){return Be.current.useSyncExternalStore(A,K,qe)},De.useTransition=function(){return Be.current.useTransition()},De.version="18.3.1",De}var lg;function zf(){return lg||(lg=1,Th.exports=ab()),Th.exports}/**
11
+ * @license React
12
+ * react-jsx-runtime.production.min.js
13
+ *
14
+ * Copyright (c) Facebook, Inc. and its affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var og;function ib(){if(og)return Wl;og=1;var e=zf(),n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function d(h,m,g){var p,v={},j=null,C=null;g!==void 0&&(j=""+g),m.key!==void 0&&(j=""+m.key),m.ref!==void 0&&(C=m.ref);for(p in m)i.call(m,p)&&!c.hasOwnProperty(p)&&(v[p]=m[p]);if(h&&h.defaultProps)for(p in m=h.defaultProps,m)v[p]===void 0&&(v[p]=m[p]);return{$$typeof:n,type:h,key:j,ref:C,props:v,_owner:o.current}}return Wl.Fragment=r,Wl.jsx=d,Wl.jsxs=d,Wl}var cg;function lb(){return cg||(cg=1,Mh.exports=ib()),Mh.exports}var t=lb(),N=zf();const ob=rb(N),cb=sb({__proto__:null,default:ob},[N]);var Wc={},qh={exports:{}},Sn={},Ih={exports:{}},$h={};/**
19
+ * @license React
20
+ * scheduler.production.min.js
21
+ *
22
+ * Copyright (c) Facebook, Inc. and its affiliates.
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */var ug;function ub(){return ug||(ug=1,(function(e){function n(Z,de){var se=Z.length;Z.push(de);e:for(;0<se;){var A=se-1>>>1,K=Z[A];if(0<o(K,de))Z[A]=de,Z[se]=K,se=A;else break e}}function r(Z){return Z.length===0?null:Z[0]}function i(Z){if(Z.length===0)return null;var de=Z[0],se=Z.pop();if(se!==de){Z[0]=se;e:for(var A=0,K=Z.length,qe=K>>>1;A<qe;){var Ae=2*(A+1)-1,Ne=Z[Ae],Le=Ae+1,st=Z[Le];if(0>o(Ne,se))Le<K&&0>o(st,Ne)?(Z[A]=st,Z[Le]=se,A=Le):(Z[A]=Ne,Z[Ae]=se,A=Ae);else if(Le<K&&0>o(st,se))Z[A]=st,Z[Le]=se,A=Le;else break e}}return de}function o(Z,de){var se=Z.sortIndex-de.sortIndex;return se!==0?se:Z.id-de.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,h=d.now();e.unstable_now=function(){return d.now()-h}}var m=[],g=[],p=1,v=null,j=3,C=!1,y=!1,b=!1,k=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function z(Z){for(var de=r(g);de!==null;){if(de.callback===null)i(g);else if(de.startTime<=Z)i(g),de.sortIndex=de.expirationTime,n(m,de);else break;de=r(g)}}function E(Z){if(b=!1,z(Z),!y)if(r(m)!==null)y=!0,rt(T);else{var de=r(g);de!==null&&Be(E,de.startTime-Z)}}function T(Z,de){y=!1,b&&(b=!1,S(Q),Q=-1),C=!0;var se=j;try{for(z(de),v=r(m);v!==null&&(!(v.expirationTime>de)||Z&&!B());){var A=v.callback;if(typeof A=="function"){v.callback=null,j=v.priorityLevel;var K=A(v.expirationTime<=de);de=e.unstable_now(),typeof K=="function"?v.callback=K:v===r(m)&&i(m),z(de)}else i(m);v=r(m)}if(v!==null)var qe=!0;else{var Ae=r(g);Ae!==null&&Be(E,Ae.startTime-de),qe=!1}return qe}finally{v=null,j=se,C=!1}}var M=!1,O=null,Q=-1,V=5,q=-1;function B(){return!(e.unstable_now()-q<V)}function ce(){if(O!==null){var Z=e.unstable_now();q=Z;var de=!0;try{de=O(!0,Z)}finally{de?_e():(M=!1,O=null)}}else M=!1}var _e;if(typeof $=="function")_e=function(){$(ce)};else if(typeof MessageChannel<"u"){var Ue=new MessageChannel,Ge=Ue.port2;Ue.port1.onmessage=ce,_e=function(){Ge.postMessage(null)}}else _e=function(){k(ce,0)};function rt(Z){O=Z,M||(M=!0,_e())}function Be(Z,de){Q=k(function(){Z(e.unstable_now())},de)}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(Z){Z.callback=null},e.unstable_continueExecution=function(){y||C||(y=!0,rt(T))},e.unstable_forceFrameRate=function(Z){0>Z||125<Z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<Z?Math.floor(1e3/Z):5},e.unstable_getCurrentPriorityLevel=function(){return j},e.unstable_getFirstCallbackNode=function(){return r(m)},e.unstable_next=function(Z){switch(j){case 1:case 2:case 3:var de=3;break;default:de=j}var se=j;j=de;try{return Z()}finally{j=se}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Z,de){switch(Z){case 1:case 2:case 3:case 4:case 5:break;default:Z=3}var se=j;j=Z;try{return de()}finally{j=se}},e.unstable_scheduleCallback=function(Z,de,se){var A=e.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?A+se:A):se=A,Z){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=se+K,Z={id:p++,callback:de,priorityLevel:Z,startTime:se,expirationTime:K,sortIndex:-1},se>A?(Z.sortIndex=se,n(g,Z),r(m)===null&&Z===r(g)&&(b?(S(Q),Q=-1):b=!0,Be(E,se-A))):(Z.sortIndex=K,n(m,Z),y||C||(y=!0,rt(T))),Z},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(Z){var de=j;return function(){var se=j;j=de;try{return Z.apply(this,arguments)}finally{j=se}}}})($h)),$h}var dg;function db(){return dg||(dg=1,Ih.exports=ub()),Ih.exports}/**
27
+ * @license React
28
+ * react-dom.production.min.js
29
+ *
30
+ * Copyright (c) Facebook, Inc. and its affiliates.
31
+ *
32
+ * This source code is licensed under the MIT license found in the
33
+ * LICENSE file in the root directory of this source tree.
34
+ */var hg;function hb(){if(hg)return Sn;hg=1;var e=zf(),n=db();function r(s){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+s,l=1;l<arguments.length;l++)a+="&args[]="+encodeURIComponent(arguments[l]);return"Minified React error #"+s+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,o={};function c(s,a){d(s,a),d(s+"Capture",a)}function d(s,a){for(o[s]=a,s=0;s<a.length;s++)i.add(a[s])}var h=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),m=Object.prototype.hasOwnProperty,g=/^[: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]*$/,p={},v={};function j(s){return m.call(v,s)?!0:m.call(p,s)?!1:g.test(s)?v[s]=!0:(p[s]=!0,!1)}function C(s,a,l,u){if(l!==null&&l.type===0)return!1;switch(typeof a){case"function":case"symbol":return!0;case"boolean":return u?!1:l!==null?!l.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function y(s,a,l,u){if(a===null||typeof a>"u"||C(s,a,l,u))return!0;if(u)return!1;if(l!==null)switch(l.type){case 3:return!a;case 4:return a===!1;case 5:return isNaN(a);case 6:return isNaN(a)||1>a}return!1}function b(s,a,l,u,f,x,w){this.acceptsBooleans=a===2||a===3||a===4,this.attributeName=u,this.attributeNamespace=f,this.mustUseProperty=l,this.propertyName=s,this.type=a,this.sanitizeURL=x,this.removeEmptyString=w}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){k[s]=new b(s,0,!1,s,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var a=s[0];k[a]=new b(a,1,!1,s[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){k[s]=new b(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){k[s]=new b(s,2,!1,s,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(s){k[s]=new b(s,3,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){k[s]=new b(s,3,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){k[s]=new b(s,4,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){k[s]=new b(s,6,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){k[s]=new b(s,5,!1,s.toLowerCase(),null,!1,!1)});var S=/[\-:]([a-z])/g;function $(s){return s[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(s){var a=s.replace(S,$);k[a]=new b(a,1,!1,s,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var a=s.replace(S,$);k[a]=new b(a,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(s){var a=s.replace(S,$);k[a]=new b(a,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){k[s]=new b(s,1,!1,s.toLowerCase(),null,!1,!1)}),k.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){k[s]=new b(s,1,!1,s.toLowerCase(),null,!0,!0)});function z(s,a,l,u){var f=k.hasOwnProperty(a)?k[a]:null;(f!==null?f.type!==0:u||!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(y(a,l,f,u)&&(l=null),u||f===null?j(a)&&(l===null?s.removeAttribute(a):s.setAttribute(a,""+l)):f.mustUseProperty?s[f.propertyName]=l===null?f.type===3?!1:"":l:(a=f.attributeName,u=f.attributeNamespace,l===null?s.removeAttribute(a):(f=f.type,l=f===3||f===4&&l===!0?"":""+l,u?s.setAttributeNS(u,a,l):s.setAttribute(a,l))))}var E=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),M=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),V=Symbol.for("react.profiler"),q=Symbol.for("react.provider"),B=Symbol.for("react.context"),ce=Symbol.for("react.forward_ref"),_e=Symbol.for("react.suspense"),Ue=Symbol.for("react.suspense_list"),Ge=Symbol.for("react.memo"),rt=Symbol.for("react.lazy"),Be=Symbol.for("react.offscreen"),Z=Symbol.iterator;function de(s){return s===null||typeof s!="object"?null:(s=Z&&s[Z]||s["@@iterator"],typeof s=="function"?s:null)}var se=Object.assign,A;function K(s){if(A===void 0)try{throw Error()}catch(l){var a=l.stack.trim().match(/\n( *(at )?)/);A=a&&a[1]||""}return`
35
+ `+A+s}var qe=!1;function Ae(s,a){if(!s||qe)return"";qe=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(a)if(a=function(){throw Error()},Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch(U){var u=U}Reflect.construct(s,[],a)}else{try{a.call()}catch(U){u=U}s.call(a.prototype)}else{try{throw Error()}catch(U){u=U}s()}}catch(U){if(U&&u&&typeof U.stack=="string"){for(var f=U.stack.split(`
36
+ `),x=u.stack.split(`
37
+ `),w=f.length-1,P=x.length-1;1<=w&&0<=P&&f[w]!==x[P];)P--;for(;1<=w&&0<=P;w--,P--)if(f[w]!==x[P]){if(w!==1||P!==1)do if(w--,P--,0>P||f[w]!==x[P]){var R=`
38
+ `+f[w].replace(" at new "," at ");return s.displayName&&R.includes("<anonymous>")&&(R=R.replace("<anonymous>",s.displayName)),R}while(1<=w&&0<=P);break}}}finally{qe=!1,Error.prepareStackTrace=l}return(s=s?s.displayName||s.name:"")?K(s):""}function Ne(s){switch(s.tag){case 5:return K(s.type);case 16:return K("Lazy");case 13:return K("Suspense");case 19:return K("SuspenseList");case 0:case 2:case 15:return s=Ae(s.type,!1),s;case 11:return s=Ae(s.type.render,!1),s;case 1:return s=Ae(s.type,!0),s;default:return""}}function Le(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case O:return"Fragment";case M:return"Portal";case V:return"Profiler";case Q:return"StrictMode";case _e:return"Suspense";case Ue:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case B:return(s.displayName||"Context")+".Consumer";case q:return(s._context.displayName||"Context")+".Provider";case ce:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case Ge:return a=s.displayName||null,a!==null?a:Le(s.type)||"Memo";case rt:a=s._payload,s=s._init;try{return Le(s(a))}catch{}}return null}function st(s){var a=s.type;switch(s.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return s=a.render,s=s.displayName||s.name||"",a.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Le(a);case 8:return a===Q?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function Je(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function at(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Qt(s){var a=at(s)?"checked":"value",l=Object.getOwnPropertyDescriptor(s.constructor.prototype,a),u=""+s[a];if(!s.hasOwnProperty(a)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,x=l.set;return Object.defineProperty(s,a,{configurable:!0,get:function(){return f.call(this)},set:function(w){u=""+w,x.call(this,w)}}),Object.defineProperty(s,a,{enumerable:l.enumerable}),{getValue:function(){return u},setValue:function(w){u=""+w},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function rr(s){s._valueTracker||(s._valueTracker=Qt(s))}function Fa(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var l=a.getValue(),u="";return s&&(u=at(s)?s.checked?"true":"false":s.value),s=u,s!==l?(a.setValue(s),!0):!1}function ts(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function Ot(s,a){var l=a.checked;return se({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:l??s._wrapperState.initialChecked})}function zo(s,a){var l=a.defaultValue==null?"":a.defaultValue,u=a.checked!=null?a.checked:a.defaultChecked;l=Je(a.value!=null?a.value:l),s._wrapperState={initialChecked:u,initialValue:l,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function Da(s,a){a=a.checked,a!=null&&z(s,"checked",a,!1)}function Rn(s,a){Da(s,a);var l=Je(a.value),u=a.type;if(l!=null)u==="number"?(l===0&&s.value===""||s.value!=l)&&(s.value=""+l):s.value!==""+l&&(s.value=""+l);else if(u==="submit"||u==="reset"){s.removeAttribute("value");return}a.hasOwnProperty("value")?Ua(s,a.type,l):a.hasOwnProperty("defaultValue")&&Ua(s,a.type,Je(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(s.defaultChecked=!!a.defaultChecked)}function Oo(s,a,l){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var u=a.type;if(!(u!=="submit"&&u!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+s._wrapperState.initialValue,l||a===s.value||(s.value=a),s.defaultValue=a}l=s.name,l!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,l!==""&&(s.name=l)}function Ua(s,a,l){(a!=="number"||ts(s.ownerDocument)!==s)&&(l==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+l&&(s.defaultValue=""+l))}var ar=Array.isArray;function yn(s,a,l,u){if(s=s.options,a){a={};for(var f=0;f<l.length;f++)a["$"+l[f]]=!0;for(l=0;l<s.length;l++)f=a.hasOwnProperty("$"+s[l].value),s[l].selected!==f&&(s[l].selected=f),f&&u&&(s[l].defaultSelected=!0)}else{for(l=""+Je(l),a=null,f=0;f<s.length;f++){if(s[f].value===l){s[f].selected=!0,u&&(s[f].defaultSelected=!0);return}a!==null||s[f].disabled||(a=s[f])}a!==null&&(a.selected=!0)}}function Zr(s,a){if(a.dangerouslySetInnerHTML!=null)throw Error(r(91));return se({},a,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function Qa(s,a){var l=a.value;if(l==null){if(l=a.children,a=a.defaultValue,l!=null){if(a!=null)throw Error(r(92));if(ar(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),l=a}s._wrapperState={initialValue:Je(l)}}function on(s,a){var l=Je(a.value),u=Je(a.defaultValue);l!=null&&(l=""+l,l!==s.value&&(s.value=l),a.defaultValue==null&&s.defaultValue!==l&&(s.defaultValue=l)),u!=null&&(s.defaultValue=""+u)}function Ao(s){var a=s.textContent;a===s._wrapperState.initialValue&&a!==""&&a!==null&&(s.value=a)}function Ba(s){switch(s){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Va(s,a){return s==null||s==="http://www.w3.org/1999/xhtml"?Ba(a):s==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var Gr,ll=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,l,u,f){MSApp.execUnsafeLocalFunction(function(){return s(a,l,u,f)})}:s})(function(s,a){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=a;else{for(Gr=Gr||document.createElement("div"),Gr.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=Gr.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;a.firstChild;)s.appendChild(a.firstChild)}});function ir(s,a){if(a){var l=s.firstChild;if(l&&l===s.lastChild&&l.nodeType===3){l.nodeValue=a;return}}s.textContent=a}var ns={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Wu=["Webkit","ms","Moz","O"];Object.keys(ns).forEach(function(s){Wu.forEach(function(a){a=a+s.charAt(0).toUpperCase()+s.substring(1),ns[a]=ns[s]})});function Jr(s,a,l){return a==null||typeof a=="boolean"||a===""?"":l||typeof a!="number"||a===0||ns.hasOwnProperty(s)&&ns[s]?(""+a).trim():a+"px"}function ol(s,a){s=s.style;for(var l in a)if(a.hasOwnProperty(l)){var u=l.indexOf("--")===0,f=Jr(l,a[l],u);l==="float"&&(l="cssFloat"),u?s.setProperty(l,f):s[l]=f}}var Lo=se({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ha(s,a){if(a){if(Lo[s]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(r(137,s));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(r(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(r(61))}if(a.style!=null&&typeof a.style!="object")throw Error(r(62))}}function Ka(s,a){if(s.indexOf("-")===-1)return typeof a.is=="string";switch(s){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 Wa=null;function Za(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Ga=null,qs=null,Is=null;function cl(s){if(s=ql(s)){if(typeof Ga!="function")throw Error(r(280));var a=s.stateNode;a&&(a=oc(a),Ga(s.stateNode,s.type,a))}}function ul(s){qs?Is?Is.push(s):Is=[s]:qs=s}function dl(){if(qs){var s=qs,a=Is;if(Is=qs=null,cl(s),a)for(s=0;s<a.length;s++)cl(a[s])}}function hl(s,a){return s(a)}function fl(){}var Ja=!1;function ml(s,a,l){if(Ja)return s(a,l);Ja=!0;try{return hl(s,a,l)}finally{Ja=!1,(qs!==null||Is!==null)&&(fl(),dl())}}function lr(s,a){var l=s.stateNode;if(l===null)return null;var u=oc(l);if(u===null)return null;l=u[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(s=s.type,u=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!u;break e;default:s=!1}if(s)return null;if(l&&typeof l!="function")throw Error(r(231,a,typeof l));return l}var Xa=!1;if(h)try{var or={};Object.defineProperty(or,"passive",{get:function(){Xa=!0}}),window.addEventListener("test",or,or),window.removeEventListener("test",or,or)}catch{Xa=!1}function Fo(s,a,l,u,f,x,w,P,R){var U=Array.prototype.slice.call(arguments,3);try{a.apply(l,U)}catch(J){this.onError(J)}}var cr=!1,Xr=null,Yr=!1,Ya=null,Do={onError:function(s){cr=!0,Xr=s}};function le(s,a,l,u,f,x,w,P,R){cr=!1,Xr=null,Fo.apply(Do,arguments)}function it(s,a,l,u,f,x,w,P,R){if(le.apply(this,arguments),cr){if(cr){var U=Xr;cr=!1,Xr=null}else throw Error(r(198));Yr||(Yr=!0,Ya=U)}}function Qe(s){var a=s,l=s;if(s.alternate)for(;a.return;)a=a.return;else{s=a;do a=s,(a.flags&4098)!==0&&(l=a.return),s=a.return;while(s)}return a.tag===3?l:null}function Bt(s){if(s.tag===13){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function ei(s){if(Qe(s)!==s)throw Error(r(188))}function dj(s){var a=s.alternate;if(!a){if(a=Qe(s),a===null)throw Error(r(188));return a!==s?null:s}for(var l=s,u=a;;){var f=l.return;if(f===null)break;var x=f.alternate;if(x===null){if(u=f.return,u!==null){l=u;continue}break}if(f.child===x.child){for(x=f.child;x;){if(x===l)return ei(f),s;if(x===u)return ei(f),a;x=x.sibling}throw Error(r(188))}if(l.return!==u.return)l=f,u=x;else{for(var w=!1,P=f.child;P;){if(P===l){w=!0,l=f,u=x;break}if(P===u){w=!0,u=f,l=x;break}P=P.sibling}if(!w){for(P=x.child;P;){if(P===l){w=!0,l=x,u=f;break}if(P===u){w=!0,u=x,l=f;break}P=P.sibling}if(!w)throw Error(r(189))}}if(l.alternate!==u)throw Error(r(190))}if(l.tag!==3)throw Error(r(188));return l.stateNode.current===l?s:a}function Rm(s){return s=dj(s),s!==null?Mm(s):null}function Mm(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var a=Mm(s);if(a!==null)return a;s=s.sibling}return null}var Tm=n.unstable_scheduleCallback,qm=n.unstable_cancelCallback,hj=n.unstable_shouldYield,fj=n.unstable_requestPaint,Pt=n.unstable_now,mj=n.unstable_getCurrentPriorityLevel,Zu=n.unstable_ImmediatePriority,Im=n.unstable_UserBlockingPriority,Uo=n.unstable_NormalPriority,pj=n.unstable_LowPriority,$m=n.unstable_IdlePriority,Qo=null,vs=null;function xj(s){if(vs&&typeof vs.onCommitFiberRoot=="function")try{vs.onCommitFiberRoot(Qo,s,void 0,(s.current.flags&128)===128)}catch{}}var ss=Math.clz32?Math.clz32:yj,gj=Math.log,vj=Math.LN2;function yj(s){return s>>>=0,s===0?32:31-(gj(s)/vj|0)|0}var Bo=64,Vo=4194304;function pl(s){switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return s&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return s}}function Ho(s,a){var l=s.pendingLanes;if(l===0)return 0;var u=0,f=s.suspendedLanes,x=s.pingedLanes,w=l&268435455;if(w!==0){var P=w&~f;P!==0?u=pl(P):(x&=w,x!==0&&(u=pl(x)))}else w=l&~f,w!==0?u=pl(w):x!==0&&(u=pl(x));if(u===0)return 0;if(a!==0&&a!==u&&(a&f)===0&&(f=u&-u,x=a&-a,f>=x||f===16&&(x&4194240)!==0))return a;if((u&4)!==0&&(u|=l&16),a=s.entangledLanes,a!==0)for(s=s.entanglements,a&=u;0<a;)l=31-ss(a),f=1<<l,u|=s[l],a&=~f;return u}function jj(s,a){switch(s){case 1:case 2:case 4:return a+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function bj(s,a){for(var l=s.suspendedLanes,u=s.pingedLanes,f=s.expirationTimes,x=s.pendingLanes;0<x;){var w=31-ss(x),P=1<<w,R=f[w];R===-1?((P&l)===0||(P&u)!==0)&&(f[w]=jj(P,a)):R<=a&&(s.expiredLanes|=P),x&=~P}}function Gu(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function zm(){var s=Bo;return Bo<<=1,(Bo&4194240)===0&&(Bo=64),s}function Ju(s){for(var a=[],l=0;31>l;l++)a.push(s);return a}function xl(s,a,l){s.pendingLanes|=a,a!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,a=31-ss(a),s[a]=l}function wj(s,a){var l=s.pendingLanes&~a;s.pendingLanes=a,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=a,s.mutableReadLanes&=a,s.entangledLanes&=a,a=s.entanglements;var u=s.eventTimes;for(s=s.expirationTimes;0<l;){var f=31-ss(l),x=1<<f;a[f]=0,u[f]=-1,s[f]=-1,l&=~x}}function Xu(s,a){var l=s.entangledLanes|=a;for(s=s.entanglements;l;){var u=31-ss(l),f=1<<u;f&a|s[u]&a&&(s[u]|=a),l&=~f}}var lt=0;function Om(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var Am,Yu,Lm,Fm,Dm,ed=!1,Ko=[],ur=null,dr=null,hr=null,gl=new Map,vl=new Map,fr=[],Nj="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Um(s,a){switch(s){case"focusin":case"focusout":ur=null;break;case"dragenter":case"dragleave":dr=null;break;case"mouseover":case"mouseout":hr=null;break;case"pointerover":case"pointerout":gl.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":vl.delete(a.pointerId)}}function yl(s,a,l,u,f,x){return s===null||s.nativeEvent!==x?(s={blockedOn:a,domEventName:l,eventSystemFlags:u,nativeEvent:x,targetContainers:[f]},a!==null&&(a=ql(a),a!==null&&Yu(a)),s):(s.eventSystemFlags|=u,a=s.targetContainers,f!==null&&a.indexOf(f)===-1&&a.push(f),s)}function kj(s,a,l,u,f){switch(a){case"focusin":return ur=yl(ur,s,a,l,u,f),!0;case"dragenter":return dr=yl(dr,s,a,l,u,f),!0;case"mouseover":return hr=yl(hr,s,a,l,u,f),!0;case"pointerover":var x=f.pointerId;return gl.set(x,yl(gl.get(x)||null,s,a,l,u,f)),!0;case"gotpointercapture":return x=f.pointerId,vl.set(x,yl(vl.get(x)||null,s,a,l,u,f)),!0}return!1}function Qm(s){var a=ea(s.target);if(a!==null){var l=Qe(a);if(l!==null){if(a=l.tag,a===13){if(a=Bt(l),a!==null){s.blockedOn=a,Dm(s.priority,function(){Lm(l)});return}}else if(a===3&&l.stateNode.current.memoizedState.isDehydrated){s.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Wo(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var l=nd(s.domEventName,s.eventSystemFlags,a[0],s.nativeEvent);if(l===null){l=s.nativeEvent;var u=new l.constructor(l.type,l);Wa=u,l.target.dispatchEvent(u),Wa=null}else return a=ql(l),a!==null&&Yu(a),s.blockedOn=l,!1;a.shift()}return!0}function Bm(s,a,l){Wo(s)&&l.delete(a)}function Sj(){ed=!1,ur!==null&&Wo(ur)&&(ur=null),dr!==null&&Wo(dr)&&(dr=null),hr!==null&&Wo(hr)&&(hr=null),gl.forEach(Bm),vl.forEach(Bm)}function jl(s,a){s.blockedOn===a&&(s.blockedOn=null,ed||(ed=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Sj)))}function bl(s){function a(f){return jl(f,s)}if(0<Ko.length){jl(Ko[0],s);for(var l=1;l<Ko.length;l++){var u=Ko[l];u.blockedOn===s&&(u.blockedOn=null)}}for(ur!==null&&jl(ur,s),dr!==null&&jl(dr,s),hr!==null&&jl(hr,s),gl.forEach(a),vl.forEach(a),l=0;l<fr.length;l++)u=fr[l],u.blockedOn===s&&(u.blockedOn=null);for(;0<fr.length&&(l=fr[0],l.blockedOn===null);)Qm(l),l.blockedOn===null&&fr.shift()}var ti=E.ReactCurrentBatchConfig,Zo=!0;function Cj(s,a,l,u){var f=lt,x=ti.transition;ti.transition=null;try{lt=1,td(s,a,l,u)}finally{lt=f,ti.transition=x}}function _j(s,a,l,u){var f=lt,x=ti.transition;ti.transition=null;try{lt=4,td(s,a,l,u)}finally{lt=f,ti.transition=x}}function td(s,a,l,u){if(Zo){var f=nd(s,a,l,u);if(f===null)yd(s,a,u,Go,l),Um(s,u);else if(kj(f,s,a,l,u))u.stopPropagation();else if(Um(s,u),a&4&&-1<Nj.indexOf(s)){for(;f!==null;){var x=ql(f);if(x!==null&&Am(x),x=nd(s,a,l,u),x===null&&yd(s,a,u,Go,l),x===f)break;f=x}f!==null&&u.stopPropagation()}else yd(s,a,u,null,l)}}var Go=null;function nd(s,a,l,u){if(Go=null,s=Za(u),s=ea(s),s!==null)if(a=Qe(s),a===null)s=null;else if(l=a.tag,l===13){if(s=Bt(a),s!==null)return s;s=null}else if(l===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;s=null}else a!==s&&(s=null);return Go=s,null}function Vm(s){switch(s){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(mj()){case Zu:return 1;case Im:return 4;case Uo:case pj:return 16;case $m:return 536870912;default:return 16}default:return 16}}var mr=null,sd=null,Jo=null;function Hm(){if(Jo)return Jo;var s,a=sd,l=a.length,u,f="value"in mr?mr.value:mr.textContent,x=f.length;for(s=0;s<l&&a[s]===f[s];s++);var w=l-s;for(u=1;u<=w&&a[l-u]===f[x-u];u++);return Jo=f.slice(s,1<u?1-u:void 0)}function Xo(s){var a=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&a===13&&(s=13)):s=a,s===10&&(s=13),32<=s||s===13?s:0}function Yo(){return!0}function Km(){return!1}function Mn(s){function a(l,u,f,x,w){this._reactName=l,this._targetInst=f,this.type=u,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var P in s)s.hasOwnProperty(P)&&(l=s[P],this[P]=l?l(x):x[P]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Yo:Km,this.isPropagationStopped=Km,this}return se(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Yo)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Yo)},persist:function(){},isPersistent:Yo}),a}var ni={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},rd=Mn(ni),wl=se({},ni,{view:0,detail:0}),Pj=Mn(wl),ad,id,Nl,ec=se({},wl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:od,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Nl&&(Nl&&s.type==="mousemove"?(ad=s.screenX-Nl.screenX,id=s.screenY-Nl.screenY):id=ad=0,Nl=s),ad)},movementY:function(s){return"movementY"in s?s.movementY:id}}),Wm=Mn(ec),Ej=se({},ec,{dataTransfer:0}),Rj=Mn(Ej),Mj=se({},wl,{relatedTarget:0}),ld=Mn(Mj),Tj=se({},ni,{animationName:0,elapsedTime:0,pseudoElement:0}),qj=Mn(Tj),Ij=se({},ni,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),$j=Mn(Ij),zj=se({},ni,{data:0}),Zm=Mn(zj),Oj={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Aj={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"},Lj={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Fj(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=Lj[s])?!!a[s]:!1}function od(){return Fj}var Dj=se({},wl,{key:function(s){if(s.key){var a=Oj[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=Xo(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?Aj[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:od,charCode:function(s){return s.type==="keypress"?Xo(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Xo(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),Uj=Mn(Dj),Qj=se({},ec,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Gm=Mn(Qj),Bj=se({},wl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:od}),Vj=Mn(Bj),Hj=se({},ni,{propertyName:0,elapsedTime:0,pseudoElement:0}),Kj=Mn(Hj),Wj=se({},ec,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),Zj=Mn(Wj),Gj=[9,13,27,32],cd=h&&"CompositionEvent"in window,kl=null;h&&"documentMode"in document&&(kl=document.documentMode);var Jj=h&&"TextEvent"in window&&!kl,Jm=h&&(!cd||kl&&8<kl&&11>=kl),Xm=" ",Ym=!1;function ep(s,a){switch(s){case"keyup":return Gj.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tp(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var si=!1;function Xj(s,a){switch(s){case"compositionend":return tp(a);case"keypress":return a.which!==32?null:(Ym=!0,Xm);case"textInput":return s=a.data,s===Xm&&Ym?null:s;default:return null}}function Yj(s,a){if(si)return s==="compositionend"||!cd&&ep(s,a)?(s=Hm(),Jo=sd=mr=null,si=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Jm&&a.locale!=="ko"?null:a.data;default:return null}}var e1={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 np(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!e1[s.type]:a==="textarea"}function sp(s,a,l,u){ul(u),a=ac(a,"onChange"),0<a.length&&(l=new rd("onChange","change",null,l,u),s.push({event:l,listeners:a}))}var Sl=null,Cl=null;function t1(s){bp(s,0)}function tc(s){var a=oi(s);if(Fa(a))return s}function n1(s,a){if(s==="change")return a}var rp=!1;if(h){var ud;if(h){var dd="oninput"in document;if(!dd){var ap=document.createElement("div");ap.setAttribute("oninput","return;"),dd=typeof ap.oninput=="function"}ud=dd}else ud=!1;rp=ud&&(!document.documentMode||9<document.documentMode)}function ip(){Sl&&(Sl.detachEvent("onpropertychange",lp),Cl=Sl=null)}function lp(s){if(s.propertyName==="value"&&tc(Cl)){var a=[];sp(a,Cl,s,Za(s)),ml(t1,a)}}function s1(s,a,l){s==="focusin"?(ip(),Sl=a,Cl=l,Sl.attachEvent("onpropertychange",lp)):s==="focusout"&&ip()}function r1(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return tc(Cl)}function a1(s,a){if(s==="click")return tc(a)}function i1(s,a){if(s==="input"||s==="change")return tc(a)}function l1(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var rs=typeof Object.is=="function"?Object.is:l1;function _l(s,a){if(rs(s,a))return!0;if(typeof s!="object"||s===null||typeof a!="object"||a===null)return!1;var l=Object.keys(s),u=Object.keys(a);if(l.length!==u.length)return!1;for(u=0;u<l.length;u++){var f=l[u];if(!m.call(a,f)||!rs(s[f],a[f]))return!1}return!0}function op(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function cp(s,a){var l=op(s);s=0;for(var u;l;){if(l.nodeType===3){if(u=s+l.textContent.length,s<=a&&u>=a)return{node:l,offset:a-s};s=u}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=op(l)}}function up(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?up(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function dp(){for(var s=window,a=ts();a instanceof s.HTMLIFrameElement;){try{var l=typeof a.contentWindow.location.href=="string"}catch{l=!1}if(l)s=a.contentWindow;else break;a=ts(s.document)}return a}function hd(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a&&(a==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||a==="textarea"||s.contentEditable==="true")}function o1(s){var a=dp(),l=s.focusedElem,u=s.selectionRange;if(a!==l&&l&&l.ownerDocument&&up(l.ownerDocument.documentElement,l)){if(u!==null&&hd(l)){if(a=u.start,s=u.end,s===void 0&&(s=a),"selectionStart"in l)l.selectionStart=a,l.selectionEnd=Math.min(s,l.value.length);else if(s=(a=l.ownerDocument||document)&&a.defaultView||window,s.getSelection){s=s.getSelection();var f=l.textContent.length,x=Math.min(u.start,f);u=u.end===void 0?x:Math.min(u.end,f),!s.extend&&x>u&&(f=u,u=x,x=f),f=cp(l,x);var w=cp(l,u);f&&w&&(s.rangeCount!==1||s.anchorNode!==f.node||s.anchorOffset!==f.offset||s.focusNode!==w.node||s.focusOffset!==w.offset)&&(a=a.createRange(),a.setStart(f.node,f.offset),s.removeAllRanges(),x>u?(s.addRange(a),s.extend(w.node,w.offset)):(a.setEnd(w.node,w.offset),s.addRange(a)))}}for(a=[],s=l;s=s.parentNode;)s.nodeType===1&&a.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<a.length;l++)s=a[l],s.element.scrollLeft=s.left,s.element.scrollTop=s.top}}var c1=h&&"documentMode"in document&&11>=document.documentMode,ri=null,fd=null,Pl=null,md=!1;function hp(s,a,l){var u=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;md||ri==null||ri!==ts(u)||(u=ri,"selectionStart"in u&&hd(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Pl&&_l(Pl,u)||(Pl=u,u=ac(fd,"onSelect"),0<u.length&&(a=new rd("onSelect","select",null,a,l),s.push({event:a,listeners:u}),a.target=ri)))}function nc(s,a){var l={};return l[s.toLowerCase()]=a.toLowerCase(),l["Webkit"+s]="webkit"+a,l["Moz"+s]="moz"+a,l}var ai={animationend:nc("Animation","AnimationEnd"),animationiteration:nc("Animation","AnimationIteration"),animationstart:nc("Animation","AnimationStart"),transitionend:nc("Transition","TransitionEnd")},pd={},fp={};h&&(fp=document.createElement("div").style,"AnimationEvent"in window||(delete ai.animationend.animation,delete ai.animationiteration.animation,delete ai.animationstart.animation),"TransitionEvent"in window||delete ai.transitionend.transition);function sc(s){if(pd[s])return pd[s];if(!ai[s])return s;var a=ai[s],l;for(l in a)if(a.hasOwnProperty(l)&&l in fp)return pd[s]=a[l];return s}var mp=sc("animationend"),pp=sc("animationiteration"),xp=sc("animationstart"),gp=sc("transitionend"),vp=new Map,yp="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function pr(s,a){vp.set(s,a),c(a,[s])}for(var xd=0;xd<yp.length;xd++){var gd=yp[xd],u1=gd.toLowerCase(),d1=gd[0].toUpperCase()+gd.slice(1);pr(u1,"on"+d1)}pr(mp,"onAnimationEnd"),pr(pp,"onAnimationIteration"),pr(xp,"onAnimationStart"),pr("dblclick","onDoubleClick"),pr("focusin","onFocus"),pr("focusout","onBlur"),pr(gp,"onTransitionEnd"),d("onMouseEnter",["mouseout","mouseover"]),d("onMouseLeave",["mouseout","mouseover"]),d("onPointerEnter",["pointerout","pointerover"]),d("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var El="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(" "),h1=new Set("cancel close invalid load scroll toggle".split(" ").concat(El));function jp(s,a,l){var u=s.type||"unknown-event";s.currentTarget=l,it(u,a,void 0,s),s.currentTarget=null}function bp(s,a){a=(a&4)!==0;for(var l=0;l<s.length;l++){var u=s[l],f=u.event;u=u.listeners;e:{var x=void 0;if(a)for(var w=u.length-1;0<=w;w--){var P=u[w],R=P.instance,U=P.currentTarget;if(P=P.listener,R!==x&&f.isPropagationStopped())break e;jp(f,P,U),x=R}else for(w=0;w<u.length;w++){if(P=u[w],R=P.instance,U=P.currentTarget,P=P.listener,R!==x&&f.isPropagationStopped())break e;jp(f,P,U),x=R}}}if(Yr)throw s=Ya,Yr=!1,Ya=null,s}function ft(s,a){var l=a[Sd];l===void 0&&(l=a[Sd]=new Set);var u=s+"__bubble";l.has(u)||(wp(a,s,2,!1),l.add(u))}function vd(s,a,l){var u=0;a&&(u|=4),wp(l,s,u,a)}var rc="_reactListening"+Math.random().toString(36).slice(2);function Rl(s){if(!s[rc]){s[rc]=!0,i.forEach(function(l){l!=="selectionchange"&&(h1.has(l)||vd(l,!1,s),vd(l,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[rc]||(a[rc]=!0,vd("selectionchange",!1,a))}}function wp(s,a,l,u){switch(Vm(a)){case 1:var f=Cj;break;case 4:f=_j;break;default:f=td}l=f.bind(null,a,l,s),f=void 0,!Xa||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(f=!0),u?f!==void 0?s.addEventListener(a,l,{capture:!0,passive:f}):s.addEventListener(a,l,!0):f!==void 0?s.addEventListener(a,l,{passive:f}):s.addEventListener(a,l,!1)}function yd(s,a,l,u,f){var x=u;if((a&1)===0&&(a&2)===0&&u!==null)e:for(;;){if(u===null)return;var w=u.tag;if(w===3||w===4){var P=u.stateNode.containerInfo;if(P===f||P.nodeType===8&&P.parentNode===f)break;if(w===4)for(w=u.return;w!==null;){var R=w.tag;if((R===3||R===4)&&(R=w.stateNode.containerInfo,R===f||R.nodeType===8&&R.parentNode===f))return;w=w.return}for(;P!==null;){if(w=ea(P),w===null)return;if(R=w.tag,R===5||R===6){u=x=w;continue e}P=P.parentNode}}u=u.return}ml(function(){var U=x,J=Za(l),X=[];e:{var G=vp.get(s);if(G!==void 0){var he=rd,je=s;switch(s){case"keypress":if(Xo(l)===0)break e;case"keydown":case"keyup":he=Uj;break;case"focusin":je="focus",he=ld;break;case"focusout":je="blur",he=ld;break;case"beforeblur":case"afterblur":he=ld;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":he=Wm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":he=Rj;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":he=Vj;break;case mp:case pp:case xp:he=qj;break;case gp:he=Kj;break;case"scroll":he=Pj;break;case"wheel":he=Zj;break;case"copy":case"cut":case"paste":he=$j;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":he=Gm}var we=(a&4)!==0,Et=!we&&s==="scroll",L=we?G!==null?G+"Capture":null:G;we=[];for(var I=U,D;I!==null;){D=I;var ne=D.stateNode;if(D.tag===5&&ne!==null&&(D=ne,L!==null&&(ne=lr(I,L),ne!=null&&we.push(Ml(I,ne,D)))),Et)break;I=I.return}0<we.length&&(G=new he(G,je,null,l,J),X.push({event:G,listeners:we}))}}if((a&7)===0){e:{if(G=s==="mouseover"||s==="pointerover",he=s==="mouseout"||s==="pointerout",G&&l!==Wa&&(je=l.relatedTarget||l.fromElement)&&(ea(je)||je[$s]))break e;if((he||G)&&(G=J.window===J?J:(G=J.ownerDocument)?G.defaultView||G.parentWindow:window,he?(je=l.relatedTarget||l.toElement,he=U,je=je?ea(je):null,je!==null&&(Et=Qe(je),je!==Et||je.tag!==5&&je.tag!==6)&&(je=null)):(he=null,je=U),he!==je)){if(we=Wm,ne="onMouseLeave",L="onMouseEnter",I="mouse",(s==="pointerout"||s==="pointerover")&&(we=Gm,ne="onPointerLeave",L="onPointerEnter",I="pointer"),Et=he==null?G:oi(he),D=je==null?G:oi(je),G=new we(ne,I+"leave",he,l,J),G.target=Et,G.relatedTarget=D,ne=null,ea(J)===U&&(we=new we(L,I+"enter",je,l,J),we.target=D,we.relatedTarget=Et,ne=we),Et=ne,he&&je)t:{for(we=he,L=je,I=0,D=we;D;D=ii(D))I++;for(D=0,ne=L;ne;ne=ii(ne))D++;for(;0<I-D;)we=ii(we),I--;for(;0<D-I;)L=ii(L),D--;for(;I--;){if(we===L||L!==null&&we===L.alternate)break t;we=ii(we),L=ii(L)}we=null}else we=null;he!==null&&Np(X,G,he,we,!1),je!==null&&Et!==null&&Np(X,Et,je,we,!0)}}e:{if(G=U?oi(U):window,he=G.nodeName&&G.nodeName.toLowerCase(),he==="select"||he==="input"&&G.type==="file")var ke=n1;else if(np(G))if(rp)ke=i1;else{ke=r1;var Re=s1}else(he=G.nodeName)&&he.toLowerCase()==="input"&&(G.type==="checkbox"||G.type==="radio")&&(ke=a1);if(ke&&(ke=ke(s,U))){sp(X,ke,l,J);break e}Re&&Re(s,G,U),s==="focusout"&&(Re=G._wrapperState)&&Re.controlled&&G.type==="number"&&Ua(G,"number",G.value)}switch(Re=U?oi(U):window,s){case"focusin":(np(Re)||Re.contentEditable==="true")&&(ri=Re,fd=U,Pl=null);break;case"focusout":Pl=fd=ri=null;break;case"mousedown":md=!0;break;case"contextmenu":case"mouseup":case"dragend":md=!1,hp(X,l,J);break;case"selectionchange":if(c1)break;case"keydown":case"keyup":hp(X,l,J)}var Me;if(cd)e:{switch(s){case"compositionstart":var Ie="onCompositionStart";break e;case"compositionend":Ie="onCompositionEnd";break e;case"compositionupdate":Ie="onCompositionUpdate";break e}Ie=void 0}else si?ep(s,l)&&(Ie="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&(Ie="onCompositionStart");Ie&&(Jm&&l.locale!=="ko"&&(si||Ie!=="onCompositionStart"?Ie==="onCompositionEnd"&&si&&(Me=Hm()):(mr=J,sd="value"in mr?mr.value:mr.textContent,si=!0)),Re=ac(U,Ie),0<Re.length&&(Ie=new Zm(Ie,s,null,l,J),X.push({event:Ie,listeners:Re}),Me?Ie.data=Me:(Me=tp(l),Me!==null&&(Ie.data=Me)))),(Me=Jj?Xj(s,l):Yj(s,l))&&(U=ac(U,"onBeforeInput"),0<U.length&&(J=new Zm("onBeforeInput","beforeinput",null,l,J),X.push({event:J,listeners:U}),J.data=Me))}bp(X,a)})}function Ml(s,a,l){return{instance:s,listener:a,currentTarget:l}}function ac(s,a){for(var l=a+"Capture",u=[];s!==null;){var f=s,x=f.stateNode;f.tag===5&&x!==null&&(f=x,x=lr(s,l),x!=null&&u.unshift(Ml(s,x,f)),x=lr(s,a),x!=null&&u.push(Ml(s,x,f))),s=s.return}return u}function ii(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function Np(s,a,l,u,f){for(var x=a._reactName,w=[];l!==null&&l!==u;){var P=l,R=P.alternate,U=P.stateNode;if(R!==null&&R===u)break;P.tag===5&&U!==null&&(P=U,f?(R=lr(l,x),R!=null&&w.unshift(Ml(l,R,P))):f||(R=lr(l,x),R!=null&&w.push(Ml(l,R,P)))),l=l.return}w.length!==0&&s.push({event:a,listeners:w})}var f1=/\r\n?/g,m1=/\u0000|\uFFFD/g;function kp(s){return(typeof s=="string"?s:""+s).replace(f1,`
39
+ `).replace(m1,"")}function ic(s,a,l){if(a=kp(a),kp(s)!==a&&l)throw Error(r(425))}function lc(){}var jd=null,bd=null;function wd(s,a){return s==="textarea"||s==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Nd=typeof setTimeout=="function"?setTimeout:void 0,p1=typeof clearTimeout=="function"?clearTimeout:void 0,Sp=typeof Promise=="function"?Promise:void 0,x1=typeof queueMicrotask=="function"?queueMicrotask:typeof Sp<"u"?function(s){return Sp.resolve(null).then(s).catch(g1)}:Nd;function g1(s){setTimeout(function(){throw s})}function kd(s,a){var l=a,u=0;do{var f=l.nextSibling;if(s.removeChild(l),f&&f.nodeType===8)if(l=f.data,l==="/$"){if(u===0){s.removeChild(f),bl(a);return}u--}else l!=="$"&&l!=="$?"&&l!=="$!"||u++;l=f}while(l);bl(a)}function xr(s){for(;s!=null;s=s.nextSibling){var a=s.nodeType;if(a===1||a===3)break;if(a===8){if(a=s.data,a==="$"||a==="$!"||a==="$?")break;if(a==="/$")return null}}return s}function Cp(s){s=s.previousSibling;for(var a=0;s;){if(s.nodeType===8){var l=s.data;if(l==="$"||l==="$!"||l==="$?"){if(a===0)return s;a--}else l==="/$"&&a++}s=s.previousSibling}return null}var li=Math.random().toString(36).slice(2),ys="__reactFiber$"+li,Tl="__reactProps$"+li,$s="__reactContainer$"+li,Sd="__reactEvents$"+li,v1="__reactListeners$"+li,y1="__reactHandles$"+li;function ea(s){var a=s[ys];if(a)return a;for(var l=s.parentNode;l;){if(a=l[$s]||l[ys]){if(l=a.alternate,a.child!==null||l!==null&&l.child!==null)for(s=Cp(s);s!==null;){if(l=s[ys])return l;s=Cp(s)}return a}s=l,l=s.parentNode}return null}function ql(s){return s=s[ys]||s[$s],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function oi(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(r(33))}function oc(s){return s[Tl]||null}var Cd=[],ci=-1;function gr(s){return{current:s}}function mt(s){0>ci||(s.current=Cd[ci],Cd[ci]=null,ci--)}function dt(s,a){ci++,Cd[ci]=s.current,s.current=a}var vr={},Zt=gr(vr),jn=gr(!1),ta=vr;function ui(s,a){var l=s.type.contextTypes;if(!l)return vr;var u=s.stateNode;if(u&&u.__reactInternalMemoizedUnmaskedChildContext===a)return u.__reactInternalMemoizedMaskedChildContext;var f={},x;for(x in l)f[x]=a[x];return u&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=a,s.__reactInternalMemoizedMaskedChildContext=f),f}function bn(s){return s=s.childContextTypes,s!=null}function cc(){mt(jn),mt(Zt)}function _p(s,a,l){if(Zt.current!==vr)throw Error(r(168));dt(Zt,a),dt(jn,l)}function Pp(s,a,l){var u=s.stateNode;if(a=a.childContextTypes,typeof u.getChildContext!="function")return l;u=u.getChildContext();for(var f in u)if(!(f in a))throw Error(r(108,st(s)||"Unknown",f));return se({},l,u)}function uc(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||vr,ta=Zt.current,dt(Zt,s),dt(jn,jn.current),!0}function Ep(s,a,l){var u=s.stateNode;if(!u)throw Error(r(169));l?(s=Pp(s,a,ta),u.__reactInternalMemoizedMergedChildContext=s,mt(jn),mt(Zt),dt(Zt,s)):mt(jn),dt(jn,l)}var zs=null,dc=!1,_d=!1;function Rp(s){zs===null?zs=[s]:zs.push(s)}function j1(s){dc=!0,Rp(s)}function yr(){if(!_d&&zs!==null){_d=!0;var s=0,a=lt;try{var l=zs;for(lt=1;s<l.length;s++){var u=l[s];do u=u(!0);while(u!==null)}zs=null,dc=!1}catch(f){throw zs!==null&&(zs=zs.slice(s+1)),Tm(Zu,yr),f}finally{lt=a,_d=!1}}return null}var di=[],hi=0,hc=null,fc=0,Un=[],Qn=0,na=null,Os=1,As="";function sa(s,a){di[hi++]=fc,di[hi++]=hc,hc=s,fc=a}function Mp(s,a,l){Un[Qn++]=Os,Un[Qn++]=As,Un[Qn++]=na,na=s;var u=Os;s=As;var f=32-ss(u)-1;u&=~(1<<f),l+=1;var x=32-ss(a)+f;if(30<x){var w=f-f%5;x=(u&(1<<w)-1).toString(32),u>>=w,f-=w,Os=1<<32-ss(a)+f|l<<f|u,As=x+s}else Os=1<<x|l<<f|u,As=s}function Pd(s){s.return!==null&&(sa(s,1),Mp(s,1,0))}function Ed(s){for(;s===hc;)hc=di[--hi],di[hi]=null,fc=di[--hi],di[hi]=null;for(;s===na;)na=Un[--Qn],Un[Qn]=null,As=Un[--Qn],Un[Qn]=null,Os=Un[--Qn],Un[Qn]=null}var Tn=null,qn=null,pt=!1,as=null;function Tp(s,a){var l=Kn(5,null,null,0);l.elementType="DELETED",l.stateNode=a,l.return=s,a=s.deletions,a===null?(s.deletions=[l],s.flags|=16):a.push(l)}function qp(s,a){switch(s.tag){case 5:var l=s.type;return a=a.nodeType!==1||l.toLowerCase()!==a.nodeName.toLowerCase()?null:a,a!==null?(s.stateNode=a,Tn=s,qn=xr(a.firstChild),!0):!1;case 6:return a=s.pendingProps===""||a.nodeType!==3?null:a,a!==null?(s.stateNode=a,Tn=s,qn=null,!0):!1;case 13:return a=a.nodeType!==8?null:a,a!==null?(l=na!==null?{id:Os,overflow:As}:null,s.memoizedState={dehydrated:a,treeContext:l,retryLane:1073741824},l=Kn(18,null,null,0),l.stateNode=a,l.return=s,s.child=l,Tn=s,qn=null,!0):!1;default:return!1}}function Rd(s){return(s.mode&1)!==0&&(s.flags&128)===0}function Md(s){if(pt){var a=qn;if(a){var l=a;if(!qp(s,a)){if(Rd(s))throw Error(r(418));a=xr(l.nextSibling);var u=Tn;a&&qp(s,a)?Tp(u,l):(s.flags=s.flags&-4097|2,pt=!1,Tn=s)}}else{if(Rd(s))throw Error(r(418));s.flags=s.flags&-4097|2,pt=!1,Tn=s}}}function Ip(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;Tn=s}function mc(s){if(s!==Tn)return!1;if(!pt)return Ip(s),pt=!0,!1;var a;if((a=s.tag!==3)&&!(a=s.tag!==5)&&(a=s.type,a=a!=="head"&&a!=="body"&&!wd(s.type,s.memoizedProps)),a&&(a=qn)){if(Rd(s))throw $p(),Error(r(418));for(;a;)Tp(s,a),a=xr(a.nextSibling)}if(Ip(s),s.tag===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));e:{for(s=s.nextSibling,a=0;s;){if(s.nodeType===8){var l=s.data;if(l==="/$"){if(a===0){qn=xr(s.nextSibling);break e}a--}else l!=="$"&&l!=="$!"&&l!=="$?"||a++}s=s.nextSibling}qn=null}}else qn=Tn?xr(s.stateNode.nextSibling):null;return!0}function $p(){for(var s=qn;s;)s=xr(s.nextSibling)}function fi(){qn=Tn=null,pt=!1}function Td(s){as===null?as=[s]:as.push(s)}var b1=E.ReactCurrentBatchConfig;function Il(s,a,l){if(s=l.ref,s!==null&&typeof s!="function"&&typeof s!="object"){if(l._owner){if(l=l._owner,l){if(l.tag!==1)throw Error(r(309));var u=l.stateNode}if(!u)throw Error(r(147,s));var f=u,x=""+s;return a!==null&&a.ref!==null&&typeof a.ref=="function"&&a.ref._stringRef===x?a.ref:(a=function(w){var P=f.refs;w===null?delete P[x]:P[x]=w},a._stringRef=x,a)}if(typeof s!="string")throw Error(r(284));if(!l._owner)throw Error(r(290,s))}return s}function pc(s,a){throw s=Object.prototype.toString.call(a),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s))}function zp(s){var a=s._init;return a(s._payload)}function Op(s){function a(L,I){if(s){var D=L.deletions;D===null?(L.deletions=[I],L.flags|=16):D.push(I)}}function l(L,I){if(!s)return null;for(;I!==null;)a(L,I),I=I.sibling;return null}function u(L,I){for(L=new Map;I!==null;)I.key!==null?L.set(I.key,I):L.set(I.index,I),I=I.sibling;return L}function f(L,I){return L=_r(L,I),L.index=0,L.sibling=null,L}function x(L,I,D){return L.index=D,s?(D=L.alternate,D!==null?(D=D.index,D<I?(L.flags|=2,I):D):(L.flags|=2,I)):(L.flags|=1048576,I)}function w(L){return s&&L.alternate===null&&(L.flags|=2),L}function P(L,I,D,ne){return I===null||I.tag!==6?(I=Nh(D,L.mode,ne),I.return=L,I):(I=f(I,D),I.return=L,I)}function R(L,I,D,ne){var ke=D.type;return ke===O?J(L,I,D.props.children,ne,D.key):I!==null&&(I.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===rt&&zp(ke)===I.type)?(ne=f(I,D.props),ne.ref=Il(L,I,D),ne.return=L,ne):(ne=Lc(D.type,D.key,D.props,null,L.mode,ne),ne.ref=Il(L,I,D),ne.return=L,ne)}function U(L,I,D,ne){return I===null||I.tag!==4||I.stateNode.containerInfo!==D.containerInfo||I.stateNode.implementation!==D.implementation?(I=kh(D,L.mode,ne),I.return=L,I):(I=f(I,D.children||[]),I.return=L,I)}function J(L,I,D,ne,ke){return I===null||I.tag!==7?(I=da(D,L.mode,ne,ke),I.return=L,I):(I=f(I,D),I.return=L,I)}function X(L,I,D){if(typeof I=="string"&&I!==""||typeof I=="number")return I=Nh(""+I,L.mode,D),I.return=L,I;if(typeof I=="object"&&I!==null){switch(I.$$typeof){case T:return D=Lc(I.type,I.key,I.props,null,L.mode,D),D.ref=Il(L,null,I),D.return=L,D;case M:return I=kh(I,L.mode,D),I.return=L,I;case rt:var ne=I._init;return X(L,ne(I._payload),D)}if(ar(I)||de(I))return I=da(I,L.mode,D,null),I.return=L,I;pc(L,I)}return null}function G(L,I,D,ne){var ke=I!==null?I.key:null;if(typeof D=="string"&&D!==""||typeof D=="number")return ke!==null?null:P(L,I,""+D,ne);if(typeof D=="object"&&D!==null){switch(D.$$typeof){case T:return D.key===ke?R(L,I,D,ne):null;case M:return D.key===ke?U(L,I,D,ne):null;case rt:return ke=D._init,G(L,I,ke(D._payload),ne)}if(ar(D)||de(D))return ke!==null?null:J(L,I,D,ne,null);pc(L,D)}return null}function he(L,I,D,ne,ke){if(typeof ne=="string"&&ne!==""||typeof ne=="number")return L=L.get(D)||null,P(I,L,""+ne,ke);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case T:return L=L.get(ne.key===null?D:ne.key)||null,R(I,L,ne,ke);case M:return L=L.get(ne.key===null?D:ne.key)||null,U(I,L,ne,ke);case rt:var Re=ne._init;return he(L,I,D,Re(ne._payload),ke)}if(ar(ne)||de(ne))return L=L.get(D)||null,J(I,L,ne,ke,null);pc(I,ne)}return null}function je(L,I,D,ne){for(var ke=null,Re=null,Me=I,Ie=I=0,Ft=null;Me!==null&&Ie<D.length;Ie++){Me.index>Ie?(Ft=Me,Me=null):Ft=Me.sibling;var et=G(L,Me,D[Ie],ne);if(et===null){Me===null&&(Me=Ft);break}s&&Me&&et.alternate===null&&a(L,Me),I=x(et,I,Ie),Re===null?ke=et:Re.sibling=et,Re=et,Me=Ft}if(Ie===D.length)return l(L,Me),pt&&sa(L,Ie),ke;if(Me===null){for(;Ie<D.length;Ie++)Me=X(L,D[Ie],ne),Me!==null&&(I=x(Me,I,Ie),Re===null?ke=Me:Re.sibling=Me,Re=Me);return pt&&sa(L,Ie),ke}for(Me=u(L,Me);Ie<D.length;Ie++)Ft=he(Me,L,Ie,D[Ie],ne),Ft!==null&&(s&&Ft.alternate!==null&&Me.delete(Ft.key===null?Ie:Ft.key),I=x(Ft,I,Ie),Re===null?ke=Ft:Re.sibling=Ft,Re=Ft);return s&&Me.forEach(function(Pr){return a(L,Pr)}),pt&&sa(L,Ie),ke}function we(L,I,D,ne){var ke=de(D);if(typeof ke!="function")throw Error(r(150));if(D=ke.call(D),D==null)throw Error(r(151));for(var Re=ke=null,Me=I,Ie=I=0,Ft=null,et=D.next();Me!==null&&!et.done;Ie++,et=D.next()){Me.index>Ie?(Ft=Me,Me=null):Ft=Me.sibling;var Pr=G(L,Me,et.value,ne);if(Pr===null){Me===null&&(Me=Ft);break}s&&Me&&Pr.alternate===null&&a(L,Me),I=x(Pr,I,Ie),Re===null?ke=Pr:Re.sibling=Pr,Re=Pr,Me=Ft}if(et.done)return l(L,Me),pt&&sa(L,Ie),ke;if(Me===null){for(;!et.done;Ie++,et=D.next())et=X(L,et.value,ne),et!==null&&(I=x(et,I,Ie),Re===null?ke=et:Re.sibling=et,Re=et);return pt&&sa(L,Ie),ke}for(Me=u(L,Me);!et.done;Ie++,et=D.next())et=he(Me,L,Ie,et.value,ne),et!==null&&(s&&et.alternate!==null&&Me.delete(et.key===null?Ie:et.key),I=x(et,I,Ie),Re===null?ke=et:Re.sibling=et,Re=et);return s&&Me.forEach(function(eb){return a(L,eb)}),pt&&sa(L,Ie),ke}function Et(L,I,D,ne){if(typeof D=="object"&&D!==null&&D.type===O&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case T:e:{for(var ke=D.key,Re=I;Re!==null;){if(Re.key===ke){if(ke=D.type,ke===O){if(Re.tag===7){l(L,Re.sibling),I=f(Re,D.props.children),I.return=L,L=I;break e}}else if(Re.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===rt&&zp(ke)===Re.type){l(L,Re.sibling),I=f(Re,D.props),I.ref=Il(L,Re,D),I.return=L,L=I;break e}l(L,Re);break}else a(L,Re);Re=Re.sibling}D.type===O?(I=da(D.props.children,L.mode,ne,D.key),I.return=L,L=I):(ne=Lc(D.type,D.key,D.props,null,L.mode,ne),ne.ref=Il(L,I,D),ne.return=L,L=ne)}return w(L);case M:e:{for(Re=D.key;I!==null;){if(I.key===Re)if(I.tag===4&&I.stateNode.containerInfo===D.containerInfo&&I.stateNode.implementation===D.implementation){l(L,I.sibling),I=f(I,D.children||[]),I.return=L,L=I;break e}else{l(L,I);break}else a(L,I);I=I.sibling}I=kh(D,L.mode,ne),I.return=L,L=I}return w(L);case rt:return Re=D._init,Et(L,I,Re(D._payload),ne)}if(ar(D))return je(L,I,D,ne);if(de(D))return we(L,I,D,ne);pc(L,D)}return typeof D=="string"&&D!==""||typeof D=="number"?(D=""+D,I!==null&&I.tag===6?(l(L,I.sibling),I=f(I,D),I.return=L,L=I):(l(L,I),I=Nh(D,L.mode,ne),I.return=L,L=I),w(L)):l(L,I)}return Et}var mi=Op(!0),Ap=Op(!1),xc=gr(null),gc=null,pi=null,qd=null;function Id(){qd=pi=gc=null}function $d(s){var a=xc.current;mt(xc),s._currentValue=a}function zd(s,a,l){for(;s!==null;){var u=s.alternate;if((s.childLanes&a)!==a?(s.childLanes|=a,u!==null&&(u.childLanes|=a)):u!==null&&(u.childLanes&a)!==a&&(u.childLanes|=a),s===l)break;s=s.return}}function xi(s,a){gc=s,qd=pi=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&a)!==0&&(wn=!0),s.firstContext=null)}function Bn(s){var a=s._currentValue;if(qd!==s)if(s={context:s,memoizedValue:a,next:null},pi===null){if(gc===null)throw Error(r(308));pi=s,gc.dependencies={lanes:0,firstContext:s}}else pi=pi.next=s;return a}var ra=null;function Od(s){ra===null?ra=[s]:ra.push(s)}function Lp(s,a,l,u){var f=a.interleaved;return f===null?(l.next=l,Od(a)):(l.next=f.next,f.next=l),a.interleaved=l,Ls(s,u)}function Ls(s,a){s.lanes|=a;var l=s.alternate;for(l!==null&&(l.lanes|=a),l=s,s=s.return;s!==null;)s.childLanes|=a,l=s.alternate,l!==null&&(l.childLanes|=a),l=s,s=s.return;return l.tag===3?l.stateNode:null}var jr=!1;function Ad(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Fp(s,a){s=s.updateQueue,a.updateQueue===s&&(a.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function Fs(s,a){return{eventTime:s,lane:a,tag:0,payload:null,callback:null,next:null}}function br(s,a,l){var u=s.updateQueue;if(u===null)return null;if(u=u.shared,(Xe&2)!==0){var f=u.pending;return f===null?a.next=a:(a.next=f.next,f.next=a),u.pending=a,Ls(s,l)}return f=u.interleaved,f===null?(a.next=a,Od(u)):(a.next=f.next,f.next=a),u.interleaved=a,Ls(s,l)}function vc(s,a,l){if(a=a.updateQueue,a!==null&&(a=a.shared,(l&4194240)!==0)){var u=a.lanes;u&=s.pendingLanes,l|=u,a.lanes=l,Xu(s,l)}}function Dp(s,a){var l=s.updateQueue,u=s.alternate;if(u!==null&&(u=u.updateQueue,l===u)){var f=null,x=null;if(l=l.firstBaseUpdate,l!==null){do{var w={eventTime:l.eventTime,lane:l.lane,tag:l.tag,payload:l.payload,callback:l.callback,next:null};x===null?f=x=w:x=x.next=w,l=l.next}while(l!==null);x===null?f=x=a:x=x.next=a}else f=x=a;l={baseState:u.baseState,firstBaseUpdate:f,lastBaseUpdate:x,shared:u.shared,effects:u.effects},s.updateQueue=l;return}s=l.lastBaseUpdate,s===null?l.firstBaseUpdate=a:s.next=a,l.lastBaseUpdate=a}function yc(s,a,l,u){var f=s.updateQueue;jr=!1;var x=f.firstBaseUpdate,w=f.lastBaseUpdate,P=f.shared.pending;if(P!==null){f.shared.pending=null;var R=P,U=R.next;R.next=null,w===null?x=U:w.next=U,w=R;var J=s.alternate;J!==null&&(J=J.updateQueue,P=J.lastBaseUpdate,P!==w&&(P===null?J.firstBaseUpdate=U:P.next=U,J.lastBaseUpdate=R))}if(x!==null){var X=f.baseState;w=0,J=U=R=null,P=x;do{var G=P.lane,he=P.eventTime;if((u&G)===G){J!==null&&(J=J.next={eventTime:he,lane:0,tag:P.tag,payload:P.payload,callback:P.callback,next:null});e:{var je=s,we=P;switch(G=a,he=l,we.tag){case 1:if(je=we.payload,typeof je=="function"){X=je.call(he,X,G);break e}X=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=we.payload,G=typeof je=="function"?je.call(he,X,G):je,G==null)break e;X=se({},X,G);break e;case 2:jr=!0}}P.callback!==null&&P.lane!==0&&(s.flags|=64,G=f.effects,G===null?f.effects=[P]:G.push(P))}else he={eventTime:he,lane:G,tag:P.tag,payload:P.payload,callback:P.callback,next:null},J===null?(U=J=he,R=X):J=J.next=he,w|=G;if(P=P.next,P===null){if(P=f.shared.pending,P===null)break;G=P,P=G.next,G.next=null,f.lastBaseUpdate=G,f.shared.pending=null}}while(!0);if(J===null&&(R=X),f.baseState=R,f.firstBaseUpdate=U,f.lastBaseUpdate=J,a=f.shared.interleaved,a!==null){f=a;do w|=f.lane,f=f.next;while(f!==a)}else x===null&&(f.shared.lanes=0);la|=w,s.lanes=w,s.memoizedState=X}}function Up(s,a,l){if(s=a.effects,a.effects=null,s!==null)for(a=0;a<s.length;a++){var u=s[a],f=u.callback;if(f!==null){if(u.callback=null,u=l,typeof f!="function")throw Error(r(191,f));f.call(u)}}}var $l={},js=gr($l),zl=gr($l),Ol=gr($l);function aa(s){if(s===$l)throw Error(r(174));return s}function Ld(s,a){switch(dt(Ol,a),dt(zl,s),dt(js,$l),s=a.nodeType,s){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:Va(null,"");break;default:s=s===8?a.parentNode:a,a=s.namespaceURI||null,s=s.tagName,a=Va(a,s)}mt(js),dt(js,a)}function gi(){mt(js),mt(zl),mt(Ol)}function Qp(s){aa(Ol.current);var a=aa(js.current),l=Va(a,s.type);a!==l&&(dt(zl,s),dt(js,l))}function Fd(s){zl.current===s&&(mt(js),mt(zl))}var bt=gr(0);function jc(s){for(var a=s;a!==null;){if(a.tag===13){var l=a.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||l.data==="$?"||l.data==="$!"))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Dd=[];function Ud(){for(var s=0;s<Dd.length;s++)Dd[s]._workInProgressVersionPrimary=null;Dd.length=0}var bc=E.ReactCurrentDispatcher,Qd=E.ReactCurrentBatchConfig,ia=0,wt=null,qt=null,At=null,wc=!1,Al=!1,Ll=0,w1=0;function Gt(){throw Error(r(321))}function Bd(s,a){if(a===null)return!1;for(var l=0;l<a.length&&l<s.length;l++)if(!rs(s[l],a[l]))return!1;return!0}function Vd(s,a,l,u,f,x){if(ia=x,wt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,bc.current=s===null||s.memoizedState===null?C1:_1,s=l(u,f),Al){x=0;do{if(Al=!1,Ll=0,25<=x)throw Error(r(301));x+=1,At=qt=null,a.updateQueue=null,bc.current=P1,s=l(u,f)}while(Al)}if(bc.current=Sc,a=qt!==null&&qt.next!==null,ia=0,At=qt=wt=null,wc=!1,a)throw Error(r(300));return s}function Hd(){var s=Ll!==0;return Ll=0,s}function bs(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return At===null?wt.memoizedState=At=s:At=At.next=s,At}function Vn(){if(qt===null){var s=wt.alternate;s=s!==null?s.memoizedState:null}else s=qt.next;var a=At===null?wt.memoizedState:At.next;if(a!==null)At=a,qt=s;else{if(s===null)throw Error(r(310));qt=s,s={memoizedState:qt.memoizedState,baseState:qt.baseState,baseQueue:qt.baseQueue,queue:qt.queue,next:null},At===null?wt.memoizedState=At=s:At=At.next=s}return At}function Fl(s,a){return typeof a=="function"?a(s):a}function Kd(s){var a=Vn(),l=a.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=s;var u=qt,f=u.baseQueue,x=l.pending;if(x!==null){if(f!==null){var w=f.next;f.next=x.next,x.next=w}u.baseQueue=f=x,l.pending=null}if(f!==null){x=f.next,u=u.baseState;var P=w=null,R=null,U=x;do{var J=U.lane;if((ia&J)===J)R!==null&&(R=R.next={lane:0,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),u=U.hasEagerState?U.eagerState:s(u,U.action);else{var X={lane:J,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null};R===null?(P=R=X,w=u):R=R.next=X,wt.lanes|=J,la|=J}U=U.next}while(U!==null&&U!==x);R===null?w=u:R.next=P,rs(u,a.memoizedState)||(wn=!0),a.memoizedState=u,a.baseState=w,a.baseQueue=R,l.lastRenderedState=u}if(s=l.interleaved,s!==null){f=s;do x=f.lane,wt.lanes|=x,la|=x,f=f.next;while(f!==s)}else f===null&&(l.lanes=0);return[a.memoizedState,l.dispatch]}function Wd(s){var a=Vn(),l=a.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=s;var u=l.dispatch,f=l.pending,x=a.memoizedState;if(f!==null){l.pending=null;var w=f=f.next;do x=s(x,w.action),w=w.next;while(w!==f);rs(x,a.memoizedState)||(wn=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),l.lastRenderedState=x}return[x,u]}function Bp(){}function Vp(s,a){var l=wt,u=Vn(),f=a(),x=!rs(u.memoizedState,f);if(x&&(u.memoizedState=f,wn=!0),u=u.queue,Zd(Wp.bind(null,l,u,s),[s]),u.getSnapshot!==a||x||At!==null&&At.memoizedState.tag&1){if(l.flags|=2048,Dl(9,Kp.bind(null,l,u,f,a),void 0,null),Lt===null)throw Error(r(349));(ia&30)!==0||Hp(l,a,f)}return f}function Hp(s,a,l){s.flags|=16384,s={getSnapshot:a,value:l},a=wt.updateQueue,a===null?(a={lastEffect:null,stores:null},wt.updateQueue=a,a.stores=[s]):(l=a.stores,l===null?a.stores=[s]:l.push(s))}function Kp(s,a,l,u){a.value=l,a.getSnapshot=u,Zp(a)&&Gp(s)}function Wp(s,a,l){return l(function(){Zp(a)&&Gp(s)})}function Zp(s){var a=s.getSnapshot;s=s.value;try{var l=a();return!rs(s,l)}catch{return!0}}function Gp(s){var a=Ls(s,1);a!==null&&cs(a,s,1,-1)}function Jp(s){var a=bs();return typeof s=="function"&&(s=s()),a.memoizedState=a.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Fl,lastRenderedState:s},a.queue=s,s=s.dispatch=S1.bind(null,wt,s),[a.memoizedState,s]}function Dl(s,a,l,u){return s={tag:s,create:a,destroy:l,deps:u,next:null},a=wt.updateQueue,a===null?(a={lastEffect:null,stores:null},wt.updateQueue=a,a.lastEffect=s.next=s):(l=a.lastEffect,l===null?a.lastEffect=s.next=s:(u=l.next,l.next=s,s.next=u,a.lastEffect=s)),s}function Xp(){return Vn().memoizedState}function Nc(s,a,l,u){var f=bs();wt.flags|=s,f.memoizedState=Dl(1|a,l,void 0,u===void 0?null:u)}function kc(s,a,l,u){var f=Vn();u=u===void 0?null:u;var x=void 0;if(qt!==null){var w=qt.memoizedState;if(x=w.destroy,u!==null&&Bd(u,w.deps)){f.memoizedState=Dl(a,l,x,u);return}}wt.flags|=s,f.memoizedState=Dl(1|a,l,x,u)}function Yp(s,a){return Nc(8390656,8,s,a)}function Zd(s,a){return kc(2048,8,s,a)}function ex(s,a){return kc(4,2,s,a)}function tx(s,a){return kc(4,4,s,a)}function nx(s,a){if(typeof a=="function")return s=s(),a(s),function(){a(null)};if(a!=null)return s=s(),a.current=s,function(){a.current=null}}function sx(s,a,l){return l=l!=null?l.concat([s]):null,kc(4,4,nx.bind(null,a,s),l)}function Gd(){}function rx(s,a){var l=Vn();a=a===void 0?null:a;var u=l.memoizedState;return u!==null&&a!==null&&Bd(a,u[1])?u[0]:(l.memoizedState=[s,a],s)}function ax(s,a){var l=Vn();a=a===void 0?null:a;var u=l.memoizedState;return u!==null&&a!==null&&Bd(a,u[1])?u[0]:(s=s(),l.memoizedState=[s,a],s)}function ix(s,a,l){return(ia&21)===0?(s.baseState&&(s.baseState=!1,wn=!0),s.memoizedState=l):(rs(l,a)||(l=zm(),wt.lanes|=l,la|=l,s.baseState=!0),a)}function N1(s,a){var l=lt;lt=l!==0&&4>l?l:4,s(!0);var u=Qd.transition;Qd.transition={};try{s(!1),a()}finally{lt=l,Qd.transition=u}}function lx(){return Vn().memoizedState}function k1(s,a,l){var u=Sr(s);if(l={lane:u,action:l,hasEagerState:!1,eagerState:null,next:null},ox(s))cx(a,l);else if(l=Lp(s,a,l,u),l!==null){var f=un();cs(l,s,u,f),ux(l,a,u)}}function S1(s,a,l){var u=Sr(s),f={lane:u,action:l,hasEagerState:!1,eagerState:null,next:null};if(ox(s))cx(a,f);else{var x=s.alternate;if(s.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var w=a.lastRenderedState,P=x(w,l);if(f.hasEagerState=!0,f.eagerState=P,rs(P,w)){var R=a.interleaved;R===null?(f.next=f,Od(a)):(f.next=R.next,R.next=f),a.interleaved=f;return}}catch{}finally{}l=Lp(s,a,f,u),l!==null&&(f=un(),cs(l,s,u,f),ux(l,a,u))}}function ox(s){var a=s.alternate;return s===wt||a!==null&&a===wt}function cx(s,a){Al=wc=!0;var l=s.pending;l===null?a.next=a:(a.next=l.next,l.next=a),s.pending=a}function ux(s,a,l){if((l&4194240)!==0){var u=a.lanes;u&=s.pendingLanes,l|=u,a.lanes=l,Xu(s,l)}}var Sc={readContext:Bn,useCallback:Gt,useContext:Gt,useEffect:Gt,useImperativeHandle:Gt,useInsertionEffect:Gt,useLayoutEffect:Gt,useMemo:Gt,useReducer:Gt,useRef:Gt,useState:Gt,useDebugValue:Gt,useDeferredValue:Gt,useTransition:Gt,useMutableSource:Gt,useSyncExternalStore:Gt,useId:Gt,unstable_isNewReconciler:!1},C1={readContext:Bn,useCallback:function(s,a){return bs().memoizedState=[s,a===void 0?null:a],s},useContext:Bn,useEffect:Yp,useImperativeHandle:function(s,a,l){return l=l!=null?l.concat([s]):null,Nc(4194308,4,nx.bind(null,a,s),l)},useLayoutEffect:function(s,a){return Nc(4194308,4,s,a)},useInsertionEffect:function(s,a){return Nc(4,2,s,a)},useMemo:function(s,a){var l=bs();return a=a===void 0?null:a,s=s(),l.memoizedState=[s,a],s},useReducer:function(s,a,l){var u=bs();return a=l!==void 0?l(a):a,u.memoizedState=u.baseState=a,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:a},u.queue=s,s=s.dispatch=k1.bind(null,wt,s),[u.memoizedState,s]},useRef:function(s){var a=bs();return s={current:s},a.memoizedState=s},useState:Jp,useDebugValue:Gd,useDeferredValue:function(s){return bs().memoizedState=s},useTransition:function(){var s=Jp(!1),a=s[0];return s=N1.bind(null,s[1]),bs().memoizedState=s,[a,s]},useMutableSource:function(){},useSyncExternalStore:function(s,a,l){var u=wt,f=bs();if(pt){if(l===void 0)throw Error(r(407));l=l()}else{if(l=a(),Lt===null)throw Error(r(349));(ia&30)!==0||Hp(u,a,l)}f.memoizedState=l;var x={value:l,getSnapshot:a};return f.queue=x,Yp(Wp.bind(null,u,x,s),[s]),u.flags|=2048,Dl(9,Kp.bind(null,u,x,l,a),void 0,null),l},useId:function(){var s=bs(),a=Lt.identifierPrefix;if(pt){var l=As,u=Os;l=(u&~(1<<32-ss(u)-1)).toString(32)+l,a=":"+a+"R"+l,l=Ll++,0<l&&(a+="H"+l.toString(32)),a+=":"}else l=w1++,a=":"+a+"r"+l.toString(32)+":";return s.memoizedState=a},unstable_isNewReconciler:!1},_1={readContext:Bn,useCallback:rx,useContext:Bn,useEffect:Zd,useImperativeHandle:sx,useInsertionEffect:ex,useLayoutEffect:tx,useMemo:ax,useReducer:Kd,useRef:Xp,useState:function(){return Kd(Fl)},useDebugValue:Gd,useDeferredValue:function(s){var a=Vn();return ix(a,qt.memoizedState,s)},useTransition:function(){var s=Kd(Fl)[0],a=Vn().memoizedState;return[s,a]},useMutableSource:Bp,useSyncExternalStore:Vp,useId:lx,unstable_isNewReconciler:!1},P1={readContext:Bn,useCallback:rx,useContext:Bn,useEffect:Zd,useImperativeHandle:sx,useInsertionEffect:ex,useLayoutEffect:tx,useMemo:ax,useReducer:Wd,useRef:Xp,useState:function(){return Wd(Fl)},useDebugValue:Gd,useDeferredValue:function(s){var a=Vn();return qt===null?a.memoizedState=s:ix(a,qt.memoizedState,s)},useTransition:function(){var s=Wd(Fl)[0],a=Vn().memoizedState;return[s,a]},useMutableSource:Bp,useSyncExternalStore:Vp,useId:lx,unstable_isNewReconciler:!1};function is(s,a){if(s&&s.defaultProps){a=se({},a),s=s.defaultProps;for(var l in s)a[l]===void 0&&(a[l]=s[l]);return a}return a}function Jd(s,a,l,u){a=s.memoizedState,l=l(u,a),l=l==null?a:se({},a,l),s.memoizedState=l,s.lanes===0&&(s.updateQueue.baseState=l)}var Cc={isMounted:function(s){return(s=s._reactInternals)?Qe(s)===s:!1},enqueueSetState:function(s,a,l){s=s._reactInternals;var u=un(),f=Sr(s),x=Fs(u,f);x.payload=a,l!=null&&(x.callback=l),a=br(s,x,f),a!==null&&(cs(a,s,f,u),vc(a,s,f))},enqueueReplaceState:function(s,a,l){s=s._reactInternals;var u=un(),f=Sr(s),x=Fs(u,f);x.tag=1,x.payload=a,l!=null&&(x.callback=l),a=br(s,x,f),a!==null&&(cs(a,s,f,u),vc(a,s,f))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var l=un(),u=Sr(s),f=Fs(l,u);f.tag=2,a!=null&&(f.callback=a),a=br(s,f,u),a!==null&&(cs(a,s,u,l),vc(a,s,u))}};function dx(s,a,l,u,f,x,w){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(u,x,w):a.prototype&&a.prototype.isPureReactComponent?!_l(l,u)||!_l(f,x):!0}function hx(s,a,l){var u=!1,f=vr,x=a.contextType;return typeof x=="object"&&x!==null?x=Bn(x):(f=bn(a)?ta:Zt.current,u=a.contextTypes,x=(u=u!=null)?ui(s,f):vr),a=new a(l,x),s.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Cc,s.stateNode=a,a._reactInternals=s,u&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=f,s.__reactInternalMemoizedMaskedChildContext=x),a}function fx(s,a,l,u){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(l,u),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(l,u),a.state!==s&&Cc.enqueueReplaceState(a,a.state,null)}function Xd(s,a,l,u){var f=s.stateNode;f.props=l,f.state=s.memoizedState,f.refs={},Ad(s);var x=a.contextType;typeof x=="object"&&x!==null?f.context=Bn(x):(x=bn(a)?ta:Zt.current,f.context=ui(s,x)),f.state=s.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(Jd(s,a,x,l),f.state=s.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(a=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),a!==f.state&&Cc.enqueueReplaceState(f,f.state,null),yc(s,l,f,u),f.state=s.memoizedState),typeof f.componentDidMount=="function"&&(s.flags|=4194308)}function vi(s,a){try{var l="",u=a;do l+=Ne(u),u=u.return;while(u);var f=l}catch(x){f=`
40
+ Error generating stack: `+x.message+`
41
+ `+x.stack}return{value:s,source:a,stack:f,digest:null}}function Yd(s,a,l){return{value:s,source:null,stack:l??null,digest:a??null}}function eh(s,a){try{console.error(a.value)}catch(l){setTimeout(function(){throw l})}}var E1=typeof WeakMap=="function"?WeakMap:Map;function mx(s,a,l){l=Fs(-1,l),l.tag=3,l.payload={element:null};var u=a.value;return l.callback=function(){qc||(qc=!0,ph=u),eh(s,a)},l}function px(s,a,l){l=Fs(-1,l),l.tag=3;var u=s.type.getDerivedStateFromError;if(typeof u=="function"){var f=a.value;l.payload=function(){return u(f)},l.callback=function(){eh(s,a)}}var x=s.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(l.callback=function(){eh(s,a),typeof u!="function"&&(Nr===null?Nr=new Set([this]):Nr.add(this));var w=a.stack;this.componentDidCatch(a.value,{componentStack:w!==null?w:""})}),l}function xx(s,a,l){var u=s.pingCache;if(u===null){u=s.pingCache=new E1;var f=new Set;u.set(a,f)}else f=u.get(a),f===void 0&&(f=new Set,u.set(a,f));f.has(l)||(f.add(l),s=Q1.bind(null,s,a,l),a.then(s,s))}function gx(s){do{var a;if((a=s.tag===13)&&(a=s.memoizedState,a=a!==null?a.dehydrated!==null:!0),a)return s;s=s.return}while(s!==null);return null}function vx(s,a,l,u,f){return(s.mode&1)===0?(s===a?s.flags|=65536:(s.flags|=128,l.flags|=131072,l.flags&=-52805,l.tag===1&&(l.alternate===null?l.tag=17:(a=Fs(-1,1),a.tag=2,br(l,a,1))),l.lanes|=1),s):(s.flags|=65536,s.lanes=f,s)}var R1=E.ReactCurrentOwner,wn=!1;function cn(s,a,l,u){a.child=s===null?Ap(a,null,l,u):mi(a,s.child,l,u)}function yx(s,a,l,u,f){l=l.render;var x=a.ref;return xi(a,f),u=Vd(s,a,l,u,x,f),l=Hd(),s!==null&&!wn?(a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~f,Ds(s,a,f)):(pt&&l&&Pd(a),a.flags|=1,cn(s,a,u,f),a.child)}function jx(s,a,l,u,f){if(s===null){var x=l.type;return typeof x=="function"&&!wh(x)&&x.defaultProps===void 0&&l.compare===null&&l.defaultProps===void 0?(a.tag=15,a.type=x,bx(s,a,x,u,f)):(s=Lc(l.type,null,u,a,a.mode,f),s.ref=a.ref,s.return=a,a.child=s)}if(x=s.child,(s.lanes&f)===0){var w=x.memoizedProps;if(l=l.compare,l=l!==null?l:_l,l(w,u)&&s.ref===a.ref)return Ds(s,a,f)}return a.flags|=1,s=_r(x,u),s.ref=a.ref,s.return=a,a.child=s}function bx(s,a,l,u,f){if(s!==null){var x=s.memoizedProps;if(_l(x,u)&&s.ref===a.ref)if(wn=!1,a.pendingProps=u=x,(s.lanes&f)!==0)(s.flags&131072)!==0&&(wn=!0);else return a.lanes=s.lanes,Ds(s,a,f)}return th(s,a,l,u,f)}function wx(s,a,l){var u=a.pendingProps,f=u.children,x=s!==null?s.memoizedState:null;if(u.mode==="hidden")if((a.mode&1)===0)a.memoizedState={baseLanes:0,cachePool:null,transitions:null},dt(ji,In),In|=l;else{if((l&1073741824)===0)return s=x!==null?x.baseLanes|l:l,a.lanes=a.childLanes=1073741824,a.memoizedState={baseLanes:s,cachePool:null,transitions:null},a.updateQueue=null,dt(ji,In),In|=s,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},u=x!==null?x.baseLanes:l,dt(ji,In),In|=u}else x!==null?(u=x.baseLanes|l,a.memoizedState=null):u=l,dt(ji,In),In|=u;return cn(s,a,f,l),a.child}function Nx(s,a){var l=a.ref;(s===null&&l!==null||s!==null&&s.ref!==l)&&(a.flags|=512,a.flags|=2097152)}function th(s,a,l,u,f){var x=bn(l)?ta:Zt.current;return x=ui(a,x),xi(a,f),l=Vd(s,a,l,u,x,f),u=Hd(),s!==null&&!wn?(a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~f,Ds(s,a,f)):(pt&&u&&Pd(a),a.flags|=1,cn(s,a,l,f),a.child)}function kx(s,a,l,u,f){if(bn(l)){var x=!0;uc(a)}else x=!1;if(xi(a,f),a.stateNode===null)Pc(s,a),hx(a,l,u),Xd(a,l,u,f),u=!0;else if(s===null){var w=a.stateNode,P=a.memoizedProps;w.props=P;var R=w.context,U=l.contextType;typeof U=="object"&&U!==null?U=Bn(U):(U=bn(l)?ta:Zt.current,U=ui(a,U));var J=l.getDerivedStateFromProps,X=typeof J=="function"||typeof w.getSnapshotBeforeUpdate=="function";X||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(P!==u||R!==U)&&fx(a,w,u,U),jr=!1;var G=a.memoizedState;w.state=G,yc(a,u,w,f),R=a.memoizedState,P!==u||G!==R||jn.current||jr?(typeof J=="function"&&(Jd(a,l,J,u),R=a.memoizedState),(P=jr||dx(a,l,P,u,G,R,U))?(X||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(a.flags|=4194308)):(typeof w.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=u,a.memoizedState=R),w.props=u,w.state=R,w.context=U,u=P):(typeof w.componentDidMount=="function"&&(a.flags|=4194308),u=!1)}else{w=a.stateNode,Fp(s,a),P=a.memoizedProps,U=a.type===a.elementType?P:is(a.type,P),w.props=U,X=a.pendingProps,G=w.context,R=l.contextType,typeof R=="object"&&R!==null?R=Bn(R):(R=bn(l)?ta:Zt.current,R=ui(a,R));var he=l.getDerivedStateFromProps;(J=typeof he=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(P!==X||G!==R)&&fx(a,w,u,R),jr=!1,G=a.memoizedState,w.state=G,yc(a,u,w,f);var je=a.memoizedState;P!==X||G!==je||jn.current||jr?(typeof he=="function"&&(Jd(a,l,he,u),je=a.memoizedState),(U=jr||dx(a,l,U,u,G,je,R)||!1)?(J||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(u,je,R),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(u,je,R)),typeof w.componentDidUpdate=="function"&&(a.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof w.componentDidUpdate!="function"||P===s.memoizedProps&&G===s.memoizedState||(a.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||P===s.memoizedProps&&G===s.memoizedState||(a.flags|=1024),a.memoizedProps=u,a.memoizedState=je),w.props=u,w.state=je,w.context=R,u=U):(typeof w.componentDidUpdate!="function"||P===s.memoizedProps&&G===s.memoizedState||(a.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||P===s.memoizedProps&&G===s.memoizedState||(a.flags|=1024),u=!1)}return nh(s,a,l,u,x,f)}function nh(s,a,l,u,f,x){Nx(s,a);var w=(a.flags&128)!==0;if(!u&&!w)return f&&Ep(a,l,!1),Ds(s,a,x);u=a.stateNode,R1.current=a;var P=w&&typeof l.getDerivedStateFromError!="function"?null:u.render();return a.flags|=1,s!==null&&w?(a.child=mi(a,s.child,null,x),a.child=mi(a,null,P,x)):cn(s,a,P,x),a.memoizedState=u.state,f&&Ep(a,l,!0),a.child}function Sx(s){var a=s.stateNode;a.pendingContext?_p(s,a.pendingContext,a.pendingContext!==a.context):a.context&&_p(s,a.context,!1),Ld(s,a.containerInfo)}function Cx(s,a,l,u,f){return fi(),Td(f),a.flags|=256,cn(s,a,l,u),a.child}var sh={dehydrated:null,treeContext:null,retryLane:0};function rh(s){return{baseLanes:s,cachePool:null,transitions:null}}function _x(s,a,l){var u=a.pendingProps,f=bt.current,x=!1,w=(a.flags&128)!==0,P;if((P=w)||(P=s!==null&&s.memoizedState===null?!1:(f&2)!==0),P?(x=!0,a.flags&=-129):(s===null||s.memoizedState!==null)&&(f|=1),dt(bt,f&1),s===null)return Md(a),s=a.memoizedState,s!==null&&(s=s.dehydrated,s!==null)?((a.mode&1)===0?a.lanes=1:s.data==="$!"?a.lanes=8:a.lanes=1073741824,null):(w=u.children,s=u.fallback,x?(u=a.mode,x=a.child,w={mode:"hidden",children:w},(u&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=w):x=Fc(w,u,0,null),s=da(s,u,l,null),x.return=a,s.return=a,x.sibling=s,a.child=x,a.child.memoizedState=rh(l),a.memoizedState=sh,s):ah(a,w));if(f=s.memoizedState,f!==null&&(P=f.dehydrated,P!==null))return M1(s,a,w,u,P,f,l);if(x){x=u.fallback,w=a.mode,f=s.child,P=f.sibling;var R={mode:"hidden",children:u.children};return(w&1)===0&&a.child!==f?(u=a.child,u.childLanes=0,u.pendingProps=R,a.deletions=null):(u=_r(f,R),u.subtreeFlags=f.subtreeFlags&14680064),P!==null?x=_r(P,x):(x=da(x,w,l,null),x.flags|=2),x.return=a,u.return=a,u.sibling=x,a.child=u,u=x,x=a.child,w=s.child.memoizedState,w=w===null?rh(l):{baseLanes:w.baseLanes|l,cachePool:null,transitions:w.transitions},x.memoizedState=w,x.childLanes=s.childLanes&~l,a.memoizedState=sh,u}return x=s.child,s=x.sibling,u=_r(x,{mode:"visible",children:u.children}),(a.mode&1)===0&&(u.lanes=l),u.return=a,u.sibling=null,s!==null&&(l=a.deletions,l===null?(a.deletions=[s],a.flags|=16):l.push(s)),a.child=u,a.memoizedState=null,u}function ah(s,a){return a=Fc({mode:"visible",children:a},s.mode,0,null),a.return=s,s.child=a}function _c(s,a,l,u){return u!==null&&Td(u),mi(a,s.child,null,l),s=ah(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function M1(s,a,l,u,f,x,w){if(l)return a.flags&256?(a.flags&=-257,u=Yd(Error(r(422))),_c(s,a,w,u)):a.memoizedState!==null?(a.child=s.child,a.flags|=128,null):(x=u.fallback,f=a.mode,u=Fc({mode:"visible",children:u.children},f,0,null),x=da(x,f,w,null),x.flags|=2,u.return=a,x.return=a,u.sibling=x,a.child=u,(a.mode&1)!==0&&mi(a,s.child,null,w),a.child.memoizedState=rh(w),a.memoizedState=sh,x);if((a.mode&1)===0)return _c(s,a,w,null);if(f.data==="$!"){if(u=f.nextSibling&&f.nextSibling.dataset,u)var P=u.dgst;return u=P,x=Error(r(419)),u=Yd(x,u,void 0),_c(s,a,w,u)}if(P=(w&s.childLanes)!==0,wn||P){if(u=Lt,u!==null){switch(w&-w){case 4:f=2;break;case 16:f=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:f=32;break;case 536870912:f=268435456;break;default:f=0}f=(f&(u.suspendedLanes|w))!==0?0:f,f!==0&&f!==x.retryLane&&(x.retryLane=f,Ls(s,f),cs(u,s,f,-1))}return bh(),u=Yd(Error(r(421))),_c(s,a,w,u)}return f.data==="$?"?(a.flags|=128,a.child=s.child,a=B1.bind(null,s),f._reactRetry=a,null):(s=x.treeContext,qn=xr(f.nextSibling),Tn=a,pt=!0,as=null,s!==null&&(Un[Qn++]=Os,Un[Qn++]=As,Un[Qn++]=na,Os=s.id,As=s.overflow,na=a),a=ah(a,u.children),a.flags|=4096,a)}function Px(s,a,l){s.lanes|=a;var u=s.alternate;u!==null&&(u.lanes|=a),zd(s.return,a,l)}function ih(s,a,l,u,f){var x=s.memoizedState;x===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:u,tail:l,tailMode:f}:(x.isBackwards=a,x.rendering=null,x.renderingStartTime=0,x.last=u,x.tail=l,x.tailMode=f)}function Ex(s,a,l){var u=a.pendingProps,f=u.revealOrder,x=u.tail;if(cn(s,a,u.children,l),u=bt.current,(u&2)!==0)u=u&1|2,a.flags|=128;else{if(s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Px(s,l,a);else if(s.tag===19)Px(s,l,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}u&=1}if(dt(bt,u),(a.mode&1)===0)a.memoizedState=null;else switch(f){case"forwards":for(l=a.child,f=null;l!==null;)s=l.alternate,s!==null&&jc(s)===null&&(f=l),l=l.sibling;l=f,l===null?(f=a.child,a.child=null):(f=l.sibling,l.sibling=null),ih(a,!1,f,l,x);break;case"backwards":for(l=null,f=a.child,a.child=null;f!==null;){if(s=f.alternate,s!==null&&jc(s)===null){a.child=f;break}s=f.sibling,f.sibling=l,l=f,f=s}ih(a,!0,l,null,x);break;case"together":ih(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function Pc(s,a){(a.mode&1)===0&&s!==null&&(s.alternate=null,a.alternate=null,a.flags|=2)}function Ds(s,a,l){if(s!==null&&(a.dependencies=s.dependencies),la|=a.lanes,(l&a.childLanes)===0)return null;if(s!==null&&a.child!==s.child)throw Error(r(153));if(a.child!==null){for(s=a.child,l=_r(s,s.pendingProps),a.child=l,l.return=a;s.sibling!==null;)s=s.sibling,l=l.sibling=_r(s,s.pendingProps),l.return=a;l.sibling=null}return a.child}function T1(s,a,l){switch(a.tag){case 3:Sx(a),fi();break;case 5:Qp(a);break;case 1:bn(a.type)&&uc(a);break;case 4:Ld(a,a.stateNode.containerInfo);break;case 10:var u=a.type._context,f=a.memoizedProps.value;dt(xc,u._currentValue),u._currentValue=f;break;case 13:if(u=a.memoizedState,u!==null)return u.dehydrated!==null?(dt(bt,bt.current&1),a.flags|=128,null):(l&a.child.childLanes)!==0?_x(s,a,l):(dt(bt,bt.current&1),s=Ds(s,a,l),s!==null?s.sibling:null);dt(bt,bt.current&1);break;case 19:if(u=(l&a.childLanes)!==0,(s.flags&128)!==0){if(u)return Ex(s,a,l);a.flags|=128}if(f=a.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),dt(bt,bt.current),u)break;return null;case 22:case 23:return a.lanes=0,wx(s,a,l)}return Ds(s,a,l)}var Rx,lh,Mx,Tx;Rx=function(s,a){for(var l=a.child;l!==null;){if(l.tag===5||l.tag===6)s.appendChild(l.stateNode);else if(l.tag!==4&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return;l=l.return}l.sibling.return=l.return,l=l.sibling}},lh=function(){},Mx=function(s,a,l,u){var f=s.memoizedProps;if(f!==u){s=a.stateNode,aa(js.current);var x=null;switch(l){case"input":f=Ot(s,f),u=Ot(s,u),x=[];break;case"select":f=se({},f,{value:void 0}),u=se({},u,{value:void 0}),x=[];break;case"textarea":f=Zr(s,f),u=Zr(s,u),x=[];break;default:typeof f.onClick!="function"&&typeof u.onClick=="function"&&(s.onclick=lc)}Ha(l,u);var w;l=null;for(U in f)if(!u.hasOwnProperty(U)&&f.hasOwnProperty(U)&&f[U]!=null)if(U==="style"){var P=f[U];for(w in P)P.hasOwnProperty(w)&&(l||(l={}),l[w]="")}else U!=="dangerouslySetInnerHTML"&&U!=="children"&&U!=="suppressContentEditableWarning"&&U!=="suppressHydrationWarning"&&U!=="autoFocus"&&(o.hasOwnProperty(U)?x||(x=[]):(x=x||[]).push(U,null));for(U in u){var R=u[U];if(P=f!=null?f[U]:void 0,u.hasOwnProperty(U)&&R!==P&&(R!=null||P!=null))if(U==="style")if(P){for(w in P)!P.hasOwnProperty(w)||R&&R.hasOwnProperty(w)||(l||(l={}),l[w]="");for(w in R)R.hasOwnProperty(w)&&P[w]!==R[w]&&(l||(l={}),l[w]=R[w])}else l||(x||(x=[]),x.push(U,l)),l=R;else U==="dangerouslySetInnerHTML"?(R=R?R.__html:void 0,P=P?P.__html:void 0,R!=null&&P!==R&&(x=x||[]).push(U,R)):U==="children"?typeof R!="string"&&typeof R!="number"||(x=x||[]).push(U,""+R):U!=="suppressContentEditableWarning"&&U!=="suppressHydrationWarning"&&(o.hasOwnProperty(U)?(R!=null&&U==="onScroll"&&ft("scroll",s),x||P===R||(x=[])):(x=x||[]).push(U,R))}l&&(x=x||[]).push("style",l);var U=x;(a.updateQueue=U)&&(a.flags|=4)}},Tx=function(s,a,l,u){l!==u&&(a.flags|=4)};function Ul(s,a){if(!pt)switch(s.tailMode){case"hidden":a=s.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?s.tail=null:l.sibling=null;break;case"collapsed":l=s.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:u.sibling=null}}function Jt(s){var a=s.alternate!==null&&s.alternate.child===s.child,l=0,u=0;if(a)for(var f=s.child;f!==null;)l|=f.lanes|f.childLanes,u|=f.subtreeFlags&14680064,u|=f.flags&14680064,f.return=s,f=f.sibling;else for(f=s.child;f!==null;)l|=f.lanes|f.childLanes,u|=f.subtreeFlags,u|=f.flags,f.return=s,f=f.sibling;return s.subtreeFlags|=u,s.childLanes=l,a}function q1(s,a,l){var u=a.pendingProps;switch(Ed(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Jt(a),null;case 1:return bn(a.type)&&cc(),Jt(a),null;case 3:return u=a.stateNode,gi(),mt(jn),mt(Zt),Ud(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(mc(a)?a.flags|=4:s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,as!==null&&(vh(as),as=null))),lh(s,a),Jt(a),null;case 5:Fd(a);var f=aa(Ol.current);if(l=a.type,s!==null&&a.stateNode!=null)Mx(s,a,l,u,f),s.ref!==a.ref&&(a.flags|=512,a.flags|=2097152);else{if(!u){if(a.stateNode===null)throw Error(r(166));return Jt(a),null}if(s=aa(js.current),mc(a)){u=a.stateNode,l=a.type;var x=a.memoizedProps;switch(u[ys]=a,u[Tl]=x,s=(a.mode&1)!==0,l){case"dialog":ft("cancel",u),ft("close",u);break;case"iframe":case"object":case"embed":ft("load",u);break;case"video":case"audio":for(f=0;f<El.length;f++)ft(El[f],u);break;case"source":ft("error",u);break;case"img":case"image":case"link":ft("error",u),ft("load",u);break;case"details":ft("toggle",u);break;case"input":zo(u,x),ft("invalid",u);break;case"select":u._wrapperState={wasMultiple:!!x.multiple},ft("invalid",u);break;case"textarea":Qa(u,x),ft("invalid",u)}Ha(l,x),f=null;for(var w in x)if(x.hasOwnProperty(w)){var P=x[w];w==="children"?typeof P=="string"?u.textContent!==P&&(x.suppressHydrationWarning!==!0&&ic(u.textContent,P,s),f=["children",P]):typeof P=="number"&&u.textContent!==""+P&&(x.suppressHydrationWarning!==!0&&ic(u.textContent,P,s),f=["children",""+P]):o.hasOwnProperty(w)&&P!=null&&w==="onScroll"&&ft("scroll",u)}switch(l){case"input":rr(u),Oo(u,x,!0);break;case"textarea":rr(u),Ao(u);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(u.onclick=lc)}u=f,a.updateQueue=u,u!==null&&(a.flags|=4)}else{w=f.nodeType===9?f:f.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=Ba(l)),s==="http://www.w3.org/1999/xhtml"?l==="script"?(s=w.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof u.is=="string"?s=w.createElement(l,{is:u.is}):(s=w.createElement(l),l==="select"&&(w=s,u.multiple?w.multiple=!0:u.size&&(w.size=u.size))):s=w.createElementNS(s,l),s[ys]=a,s[Tl]=u,Rx(s,a,!1,!1),a.stateNode=s;e:{switch(w=Ka(l,u),l){case"dialog":ft("cancel",s),ft("close",s),f=u;break;case"iframe":case"object":case"embed":ft("load",s),f=u;break;case"video":case"audio":for(f=0;f<El.length;f++)ft(El[f],s);f=u;break;case"source":ft("error",s),f=u;break;case"img":case"image":case"link":ft("error",s),ft("load",s),f=u;break;case"details":ft("toggle",s),f=u;break;case"input":zo(s,u),f=Ot(s,u),ft("invalid",s);break;case"option":f=u;break;case"select":s._wrapperState={wasMultiple:!!u.multiple},f=se({},u,{value:void 0}),ft("invalid",s);break;case"textarea":Qa(s,u),f=Zr(s,u),ft("invalid",s);break;default:f=u}Ha(l,f),P=f;for(x in P)if(P.hasOwnProperty(x)){var R=P[x];x==="style"?ol(s,R):x==="dangerouslySetInnerHTML"?(R=R?R.__html:void 0,R!=null&&ll(s,R)):x==="children"?typeof R=="string"?(l!=="textarea"||R!=="")&&ir(s,R):typeof R=="number"&&ir(s,""+R):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(o.hasOwnProperty(x)?R!=null&&x==="onScroll"&&ft("scroll",s):R!=null&&z(s,x,R,w))}switch(l){case"input":rr(s),Oo(s,u,!1);break;case"textarea":rr(s),Ao(s);break;case"option":u.value!=null&&s.setAttribute("value",""+Je(u.value));break;case"select":s.multiple=!!u.multiple,x=u.value,x!=null?yn(s,!!u.multiple,x,!1):u.defaultValue!=null&&yn(s,!!u.multiple,u.defaultValue,!0);break;default:typeof f.onClick=="function"&&(s.onclick=lc)}switch(l){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}}u&&(a.flags|=4)}a.ref!==null&&(a.flags|=512,a.flags|=2097152)}return Jt(a),null;case 6:if(s&&a.stateNode!=null)Tx(s,a,s.memoizedProps,u);else{if(typeof u!="string"&&a.stateNode===null)throw Error(r(166));if(l=aa(Ol.current),aa(js.current),mc(a)){if(u=a.stateNode,l=a.memoizedProps,u[ys]=a,(x=u.nodeValue!==l)&&(s=Tn,s!==null))switch(s.tag){case 3:ic(u.nodeValue,l,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&ic(u.nodeValue,l,(s.mode&1)!==0)}x&&(a.flags|=4)}else u=(l.nodeType===9?l:l.ownerDocument).createTextNode(u),u[ys]=a,a.stateNode=u}return Jt(a),null;case 13:if(mt(bt),u=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(pt&&qn!==null&&(a.mode&1)!==0&&(a.flags&128)===0)$p(),fi(),a.flags|=98560,x=!1;else if(x=mc(a),u!==null&&u.dehydrated!==null){if(s===null){if(!x)throw Error(r(318));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[ys]=a}else fi(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Jt(a),x=!1}else as!==null&&(vh(as),as=null),x=!0;if(!x)return a.flags&65536?a:null}return(a.flags&128)!==0?(a.lanes=l,a):(u=u!==null,u!==(s!==null&&s.memoizedState!==null)&&u&&(a.child.flags|=8192,(a.mode&1)!==0&&(s===null||(bt.current&1)!==0?It===0&&(It=3):bh())),a.updateQueue!==null&&(a.flags|=4),Jt(a),null);case 4:return gi(),lh(s,a),s===null&&Rl(a.stateNode.containerInfo),Jt(a),null;case 10:return $d(a.type._context),Jt(a),null;case 17:return bn(a.type)&&cc(),Jt(a),null;case 19:if(mt(bt),x=a.memoizedState,x===null)return Jt(a),null;if(u=(a.flags&128)!==0,w=x.rendering,w===null)if(u)Ul(x,!1);else{if(It!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(w=jc(s),w!==null){for(a.flags|=128,Ul(x,!1),u=w.updateQueue,u!==null&&(a.updateQueue=u,a.flags|=4),a.subtreeFlags=0,u=l,l=a.child;l!==null;)x=l,s=u,x.flags&=14680066,w=x.alternate,w===null?(x.childLanes=0,x.lanes=s,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=w.childLanes,x.lanes=w.lanes,x.child=w.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=w.memoizedProps,x.memoizedState=w.memoizedState,x.updateQueue=w.updateQueue,x.type=w.type,s=w.dependencies,x.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),l=l.sibling;return dt(bt,bt.current&1|2),a.child}s=s.sibling}x.tail!==null&&Pt()>bi&&(a.flags|=128,u=!0,Ul(x,!1),a.lanes=4194304)}else{if(!u)if(s=jc(w),s!==null){if(a.flags|=128,u=!0,l=s.updateQueue,l!==null&&(a.updateQueue=l,a.flags|=4),Ul(x,!0),x.tail===null&&x.tailMode==="hidden"&&!w.alternate&&!pt)return Jt(a),null}else 2*Pt()-x.renderingStartTime>bi&&l!==1073741824&&(a.flags|=128,u=!0,Ul(x,!1),a.lanes=4194304);x.isBackwards?(w.sibling=a.child,a.child=w):(l=x.last,l!==null?l.sibling=w:a.child=w,x.last=w)}return x.tail!==null?(a=x.tail,x.rendering=a,x.tail=a.sibling,x.renderingStartTime=Pt(),a.sibling=null,l=bt.current,dt(bt,u?l&1|2:l&1),a):(Jt(a),null);case 22:case 23:return jh(),u=a.memoizedState!==null,s!==null&&s.memoizedState!==null!==u&&(a.flags|=8192),u&&(a.mode&1)!==0?(In&1073741824)!==0&&(Jt(a),a.subtreeFlags&6&&(a.flags|=8192)):Jt(a),null;case 24:return null;case 25:return null}throw Error(r(156,a.tag))}function I1(s,a){switch(Ed(a),a.tag){case 1:return bn(a.type)&&cc(),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return gi(),mt(jn),mt(Zt),Ud(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 5:return Fd(a),null;case 13:if(mt(bt),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(r(340));fi()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return mt(bt),null;case 4:return gi(),null;case 10:return $d(a.type._context),null;case 22:case 23:return jh(),null;case 24:return null;default:return null}}var Ec=!1,Xt=!1,$1=typeof WeakSet=="function"?WeakSet:Set,ge=null;function yi(s,a){var l=s.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(u){St(s,a,u)}else l.current=null}function oh(s,a,l){try{l()}catch(u){St(s,a,u)}}var qx=!1;function z1(s,a){if(jd=Zo,s=dp(),hd(s)){if("selectionStart"in s)var l={start:s.selectionStart,end:s.selectionEnd};else e:{l=(l=s.ownerDocument)&&l.defaultView||window;var u=l.getSelection&&l.getSelection();if(u&&u.rangeCount!==0){l=u.anchorNode;var f=u.anchorOffset,x=u.focusNode;u=u.focusOffset;try{l.nodeType,x.nodeType}catch{l=null;break e}var w=0,P=-1,R=-1,U=0,J=0,X=s,G=null;t:for(;;){for(var he;X!==l||f!==0&&X.nodeType!==3||(P=w+f),X!==x||u!==0&&X.nodeType!==3||(R=w+u),X.nodeType===3&&(w+=X.nodeValue.length),(he=X.firstChild)!==null;)G=X,X=he;for(;;){if(X===s)break t;if(G===l&&++U===f&&(P=w),G===x&&++J===u&&(R=w),(he=X.nextSibling)!==null)break;X=G,G=X.parentNode}X=he}l=P===-1||R===-1?null:{start:P,end:R}}else l=null}l=l||{start:0,end:0}}else l=null;for(bd={focusedElem:s,selectionRange:l},Zo=!1,ge=a;ge!==null;)if(a=ge,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,ge=s;else for(;ge!==null;){a=ge;try{var je=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(je!==null){var we=je.memoizedProps,Et=je.memoizedState,L=a.stateNode,I=L.getSnapshotBeforeUpdate(a.elementType===a.type?we:is(a.type,we),Et);L.__reactInternalSnapshotBeforeUpdate=I}break;case 3:var D=a.stateNode.containerInfo;D.nodeType===1?D.textContent="":D.nodeType===9&&D.documentElement&&D.removeChild(D.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ne){St(a,a.return,ne)}if(s=a.sibling,s!==null){s.return=a.return,ge=s;break}ge=a.return}return je=qx,qx=!1,je}function Ql(s,a,l){var u=a.updateQueue;if(u=u!==null?u.lastEffect:null,u!==null){var f=u=u.next;do{if((f.tag&s)===s){var x=f.destroy;f.destroy=void 0,x!==void 0&&oh(a,l,x)}f=f.next}while(f!==u)}}function Rc(s,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var l=a=a.next;do{if((l.tag&s)===s){var u=l.create;l.destroy=u()}l=l.next}while(l!==a)}}function ch(s){var a=s.ref;if(a!==null){var l=s.stateNode;switch(s.tag){case 5:s=l;break;default:s=l}typeof a=="function"?a(s):a.current=s}}function Ix(s){var a=s.alternate;a!==null&&(s.alternate=null,Ix(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&(delete a[ys],delete a[Tl],delete a[Sd],delete a[v1],delete a[y1])),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function $x(s){return s.tag===5||s.tag===3||s.tag===4}function zx(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||$x(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function uh(s,a,l){var u=s.tag;if(u===5||u===6)s=s.stateNode,a?l.nodeType===8?l.parentNode.insertBefore(s,a):l.insertBefore(s,a):(l.nodeType===8?(a=l.parentNode,a.insertBefore(s,l)):(a=l,a.appendChild(s)),l=l._reactRootContainer,l!=null||a.onclick!==null||(a.onclick=lc));else if(u!==4&&(s=s.child,s!==null))for(uh(s,a,l),s=s.sibling;s!==null;)uh(s,a,l),s=s.sibling}function dh(s,a,l){var u=s.tag;if(u===5||u===6)s=s.stateNode,a?l.insertBefore(s,a):l.appendChild(s);else if(u!==4&&(s=s.child,s!==null))for(dh(s,a,l),s=s.sibling;s!==null;)dh(s,a,l),s=s.sibling}var Vt=null,ls=!1;function wr(s,a,l){for(l=l.child;l!==null;)Ox(s,a,l),l=l.sibling}function Ox(s,a,l){if(vs&&typeof vs.onCommitFiberUnmount=="function")try{vs.onCommitFiberUnmount(Qo,l)}catch{}switch(l.tag){case 5:Xt||yi(l,a);case 6:var u=Vt,f=ls;Vt=null,wr(s,a,l),Vt=u,ls=f,Vt!==null&&(ls?(s=Vt,l=l.stateNode,s.nodeType===8?s.parentNode.removeChild(l):s.removeChild(l)):Vt.removeChild(l.stateNode));break;case 18:Vt!==null&&(ls?(s=Vt,l=l.stateNode,s.nodeType===8?kd(s.parentNode,l):s.nodeType===1&&kd(s,l),bl(s)):kd(Vt,l.stateNode));break;case 4:u=Vt,f=ls,Vt=l.stateNode.containerInfo,ls=!0,wr(s,a,l),Vt=u,ls=f;break;case 0:case 11:case 14:case 15:if(!Xt&&(u=l.updateQueue,u!==null&&(u=u.lastEffect,u!==null))){f=u=u.next;do{var x=f,w=x.destroy;x=x.tag,w!==void 0&&((x&2)!==0||(x&4)!==0)&&oh(l,a,w),f=f.next}while(f!==u)}wr(s,a,l);break;case 1:if(!Xt&&(yi(l,a),u=l.stateNode,typeof u.componentWillUnmount=="function"))try{u.props=l.memoizedProps,u.state=l.memoizedState,u.componentWillUnmount()}catch(P){St(l,a,P)}wr(s,a,l);break;case 21:wr(s,a,l);break;case 22:l.mode&1?(Xt=(u=Xt)||l.memoizedState!==null,wr(s,a,l),Xt=u):wr(s,a,l);break;default:wr(s,a,l)}}function Ax(s){var a=s.updateQueue;if(a!==null){s.updateQueue=null;var l=s.stateNode;l===null&&(l=s.stateNode=new $1),a.forEach(function(u){var f=V1.bind(null,s,u);l.has(u)||(l.add(u),u.then(f,f))})}}function os(s,a){var l=a.deletions;if(l!==null)for(var u=0;u<l.length;u++){var f=l[u];try{var x=s,w=a,P=w;e:for(;P!==null;){switch(P.tag){case 5:Vt=P.stateNode,ls=!1;break e;case 3:Vt=P.stateNode.containerInfo,ls=!0;break e;case 4:Vt=P.stateNode.containerInfo,ls=!0;break e}P=P.return}if(Vt===null)throw Error(r(160));Ox(x,w,f),Vt=null,ls=!1;var R=f.alternate;R!==null&&(R.return=null),f.return=null}catch(U){St(f,a,U)}}if(a.subtreeFlags&12854)for(a=a.child;a!==null;)Lx(a,s),a=a.sibling}function Lx(s,a){var l=s.alternate,u=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(os(a,s),ws(s),u&4){try{Ql(3,s,s.return),Rc(3,s)}catch(we){St(s,s.return,we)}try{Ql(5,s,s.return)}catch(we){St(s,s.return,we)}}break;case 1:os(a,s),ws(s),u&512&&l!==null&&yi(l,l.return);break;case 5:if(os(a,s),ws(s),u&512&&l!==null&&yi(l,l.return),s.flags&32){var f=s.stateNode;try{ir(f,"")}catch(we){St(s,s.return,we)}}if(u&4&&(f=s.stateNode,f!=null)){var x=s.memoizedProps,w=l!==null?l.memoizedProps:x,P=s.type,R=s.updateQueue;if(s.updateQueue=null,R!==null)try{P==="input"&&x.type==="radio"&&x.name!=null&&Da(f,x),Ka(P,w);var U=Ka(P,x);for(w=0;w<R.length;w+=2){var J=R[w],X=R[w+1];J==="style"?ol(f,X):J==="dangerouslySetInnerHTML"?ll(f,X):J==="children"?ir(f,X):z(f,J,X,U)}switch(P){case"input":Rn(f,x);break;case"textarea":on(f,x);break;case"select":var G=f._wrapperState.wasMultiple;f._wrapperState.wasMultiple=!!x.multiple;var he=x.value;he!=null?yn(f,!!x.multiple,he,!1):G!==!!x.multiple&&(x.defaultValue!=null?yn(f,!!x.multiple,x.defaultValue,!0):yn(f,!!x.multiple,x.multiple?[]:"",!1))}f[Tl]=x}catch(we){St(s,s.return,we)}}break;case 6:if(os(a,s),ws(s),u&4){if(s.stateNode===null)throw Error(r(162));f=s.stateNode,x=s.memoizedProps;try{f.nodeValue=x}catch(we){St(s,s.return,we)}}break;case 3:if(os(a,s),ws(s),u&4&&l!==null&&l.memoizedState.isDehydrated)try{bl(a.containerInfo)}catch(we){St(s,s.return,we)}break;case 4:os(a,s),ws(s);break;case 13:os(a,s),ws(s),f=s.child,f.flags&8192&&(x=f.memoizedState!==null,f.stateNode.isHidden=x,!x||f.alternate!==null&&f.alternate.memoizedState!==null||(mh=Pt())),u&4&&Ax(s);break;case 22:if(J=l!==null&&l.memoizedState!==null,s.mode&1?(Xt=(U=Xt)||J,os(a,s),Xt=U):os(a,s),ws(s),u&8192){if(U=s.memoizedState!==null,(s.stateNode.isHidden=U)&&!J&&(s.mode&1)!==0)for(ge=s,J=s.child;J!==null;){for(X=ge=J;ge!==null;){switch(G=ge,he=G.child,G.tag){case 0:case 11:case 14:case 15:Ql(4,G,G.return);break;case 1:yi(G,G.return);var je=G.stateNode;if(typeof je.componentWillUnmount=="function"){u=G,l=G.return;try{a=u,je.props=a.memoizedProps,je.state=a.memoizedState,je.componentWillUnmount()}catch(we){St(u,l,we)}}break;case 5:yi(G,G.return);break;case 22:if(G.memoizedState!==null){Ux(X);continue}}he!==null?(he.return=G,ge=he):Ux(X)}J=J.sibling}e:for(J=null,X=s;;){if(X.tag===5){if(J===null){J=X;try{f=X.stateNode,U?(x=f.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(P=X.stateNode,R=X.memoizedProps.style,w=R!=null&&R.hasOwnProperty("display")?R.display:null,P.style.display=Jr("display",w))}catch(we){St(s,s.return,we)}}}else if(X.tag===6){if(J===null)try{X.stateNode.nodeValue=U?"":X.memoizedProps}catch(we){St(s,s.return,we)}}else if((X.tag!==22&&X.tag!==23||X.memoizedState===null||X===s)&&X.child!==null){X.child.return=X,X=X.child;continue}if(X===s)break e;for(;X.sibling===null;){if(X.return===null||X.return===s)break e;J===X&&(J=null),X=X.return}J===X&&(J=null),X.sibling.return=X.return,X=X.sibling}}break;case 19:os(a,s),ws(s),u&4&&Ax(s);break;case 21:break;default:os(a,s),ws(s)}}function ws(s){var a=s.flags;if(a&2){try{e:{for(var l=s.return;l!==null;){if($x(l)){var u=l;break e}l=l.return}throw Error(r(160))}switch(u.tag){case 5:var f=u.stateNode;u.flags&32&&(ir(f,""),u.flags&=-33);var x=zx(s);dh(s,x,f);break;case 3:case 4:var w=u.stateNode.containerInfo,P=zx(s);uh(s,P,w);break;default:throw Error(r(161))}}catch(R){St(s,s.return,R)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function O1(s,a,l){ge=s,Fx(s)}function Fx(s,a,l){for(var u=(s.mode&1)!==0;ge!==null;){var f=ge,x=f.child;if(f.tag===22&&u){var w=f.memoizedState!==null||Ec;if(!w){var P=f.alternate,R=P!==null&&P.memoizedState!==null||Xt;P=Ec;var U=Xt;if(Ec=w,(Xt=R)&&!U)for(ge=f;ge!==null;)w=ge,R=w.child,w.tag===22&&w.memoizedState!==null?Qx(f):R!==null?(R.return=w,ge=R):Qx(f);for(;x!==null;)ge=x,Fx(x),x=x.sibling;ge=f,Ec=P,Xt=U}Dx(s)}else(f.subtreeFlags&8772)!==0&&x!==null?(x.return=f,ge=x):Dx(s)}}function Dx(s){for(;ge!==null;){var a=ge;if((a.flags&8772)!==0){var l=a.alternate;try{if((a.flags&8772)!==0)switch(a.tag){case 0:case 11:case 15:Xt||Rc(5,a);break;case 1:var u=a.stateNode;if(a.flags&4&&!Xt)if(l===null)u.componentDidMount();else{var f=a.elementType===a.type?l.memoizedProps:is(a.type,l.memoizedProps);u.componentDidUpdate(f,l.memoizedState,u.__reactInternalSnapshotBeforeUpdate)}var x=a.updateQueue;x!==null&&Up(a,x,u);break;case 3:var w=a.updateQueue;if(w!==null){if(l=null,a.child!==null)switch(a.child.tag){case 5:l=a.child.stateNode;break;case 1:l=a.child.stateNode}Up(a,w,l)}break;case 5:var P=a.stateNode;if(l===null&&a.flags&4){l=P;var R=a.memoizedProps;switch(a.type){case"button":case"input":case"select":case"textarea":R.autoFocus&&l.focus();break;case"img":R.src&&(l.src=R.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(a.memoizedState===null){var U=a.alternate;if(U!==null){var J=U.memoizedState;if(J!==null){var X=J.dehydrated;X!==null&&bl(X)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Xt||a.flags&512&&ch(a)}catch(G){St(a,a.return,G)}}if(a===s){ge=null;break}if(l=a.sibling,l!==null){l.return=a.return,ge=l;break}ge=a.return}}function Ux(s){for(;ge!==null;){var a=ge;if(a===s){ge=null;break}var l=a.sibling;if(l!==null){l.return=a.return,ge=l;break}ge=a.return}}function Qx(s){for(;ge!==null;){var a=ge;try{switch(a.tag){case 0:case 11:case 15:var l=a.return;try{Rc(4,a)}catch(R){St(a,l,R)}break;case 1:var u=a.stateNode;if(typeof u.componentDidMount=="function"){var f=a.return;try{u.componentDidMount()}catch(R){St(a,f,R)}}var x=a.return;try{ch(a)}catch(R){St(a,x,R)}break;case 5:var w=a.return;try{ch(a)}catch(R){St(a,w,R)}}}catch(R){St(a,a.return,R)}if(a===s){ge=null;break}var P=a.sibling;if(P!==null){P.return=a.return,ge=P;break}ge=a.return}}var A1=Math.ceil,Mc=E.ReactCurrentDispatcher,hh=E.ReactCurrentOwner,Hn=E.ReactCurrentBatchConfig,Xe=0,Lt=null,Rt=null,Ht=0,In=0,ji=gr(0),It=0,Bl=null,la=0,Tc=0,fh=0,Vl=null,Nn=null,mh=0,bi=1/0,Us=null,qc=!1,ph=null,Nr=null,Ic=!1,kr=null,$c=0,Hl=0,xh=null,zc=-1,Oc=0;function un(){return(Xe&6)!==0?Pt():zc!==-1?zc:zc=Pt()}function Sr(s){return(s.mode&1)===0?1:(Xe&2)!==0&&Ht!==0?Ht&-Ht:b1.transition!==null?(Oc===0&&(Oc=zm()),Oc):(s=lt,s!==0||(s=window.event,s=s===void 0?16:Vm(s.type)),s)}function cs(s,a,l,u){if(50<Hl)throw Hl=0,xh=null,Error(r(185));xl(s,l,u),((Xe&2)===0||s!==Lt)&&(s===Lt&&((Xe&2)===0&&(Tc|=l),It===4&&Cr(s,Ht)),kn(s,u),l===1&&Xe===0&&(a.mode&1)===0&&(bi=Pt()+500,dc&&yr()))}function kn(s,a){var l=s.callbackNode;bj(s,a);var u=Ho(s,s===Lt?Ht:0);if(u===0)l!==null&&qm(l),s.callbackNode=null,s.callbackPriority=0;else if(a=u&-u,s.callbackPriority!==a){if(l!=null&&qm(l),a===1)s.tag===0?j1(Vx.bind(null,s)):Rp(Vx.bind(null,s)),x1(function(){(Xe&6)===0&&yr()}),l=null;else{switch(Om(u)){case 1:l=Zu;break;case 4:l=Im;break;case 16:l=Uo;break;case 536870912:l=$m;break;default:l=Uo}l=Yx(l,Bx.bind(null,s))}s.callbackPriority=a,s.callbackNode=l}}function Bx(s,a){if(zc=-1,Oc=0,(Xe&6)!==0)throw Error(r(327));var l=s.callbackNode;if(wi()&&s.callbackNode!==l)return null;var u=Ho(s,s===Lt?Ht:0);if(u===0)return null;if((u&30)!==0||(u&s.expiredLanes)!==0||a)a=Ac(s,u);else{a=u;var f=Xe;Xe|=2;var x=Kx();(Lt!==s||Ht!==a)&&(Us=null,bi=Pt()+500,ca(s,a));do try{D1();break}catch(P){Hx(s,P)}while(!0);Id(),Mc.current=x,Xe=f,Rt!==null?a=0:(Lt=null,Ht=0,a=It)}if(a!==0){if(a===2&&(f=Gu(s),f!==0&&(u=f,a=gh(s,f))),a===1)throw l=Bl,ca(s,0),Cr(s,u),kn(s,Pt()),l;if(a===6)Cr(s,u);else{if(f=s.current.alternate,(u&30)===0&&!L1(f)&&(a=Ac(s,u),a===2&&(x=Gu(s),x!==0&&(u=x,a=gh(s,x))),a===1))throw l=Bl,ca(s,0),Cr(s,u),kn(s,Pt()),l;switch(s.finishedWork=f,s.finishedLanes=u,a){case 0:case 1:throw Error(r(345));case 2:ua(s,Nn,Us);break;case 3:if(Cr(s,u),(u&130023424)===u&&(a=mh+500-Pt(),10<a)){if(Ho(s,0)!==0)break;if(f=s.suspendedLanes,(f&u)!==u){un(),s.pingedLanes|=s.suspendedLanes&f;break}s.timeoutHandle=Nd(ua.bind(null,s,Nn,Us),a);break}ua(s,Nn,Us);break;case 4:if(Cr(s,u),(u&4194240)===u)break;for(a=s.eventTimes,f=-1;0<u;){var w=31-ss(u);x=1<<w,w=a[w],w>f&&(f=w),u&=~x}if(u=f,u=Pt()-u,u=(120>u?120:480>u?480:1080>u?1080:1920>u?1920:3e3>u?3e3:4320>u?4320:1960*A1(u/1960))-u,10<u){s.timeoutHandle=Nd(ua.bind(null,s,Nn,Us),u);break}ua(s,Nn,Us);break;case 5:ua(s,Nn,Us);break;default:throw Error(r(329))}}}return kn(s,Pt()),s.callbackNode===l?Bx.bind(null,s):null}function gh(s,a){var l=Vl;return s.current.memoizedState.isDehydrated&&(ca(s,a).flags|=256),s=Ac(s,a),s!==2&&(a=Nn,Nn=l,a!==null&&vh(a)),s}function vh(s){Nn===null?Nn=s:Nn.push.apply(Nn,s)}function L1(s){for(var a=s;;){if(a.flags&16384){var l=a.updateQueue;if(l!==null&&(l=l.stores,l!==null))for(var u=0;u<l.length;u++){var f=l[u],x=f.getSnapshot;f=f.value;try{if(!rs(x(),f))return!1}catch{return!1}}}if(l=a.child,a.subtreeFlags&16384&&l!==null)l.return=a,a=l;else{if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Cr(s,a){for(a&=~fh,a&=~Tc,s.suspendedLanes|=a,s.pingedLanes&=~a,s=s.expirationTimes;0<a;){var l=31-ss(a),u=1<<l;s[l]=-1,a&=~u}}function Vx(s){if((Xe&6)!==0)throw Error(r(327));wi();var a=Ho(s,0);if((a&1)===0)return kn(s,Pt()),null;var l=Ac(s,a);if(s.tag!==0&&l===2){var u=Gu(s);u!==0&&(a=u,l=gh(s,u))}if(l===1)throw l=Bl,ca(s,0),Cr(s,a),kn(s,Pt()),l;if(l===6)throw Error(r(345));return s.finishedWork=s.current.alternate,s.finishedLanes=a,ua(s,Nn,Us),kn(s,Pt()),null}function yh(s,a){var l=Xe;Xe|=1;try{return s(a)}finally{Xe=l,Xe===0&&(bi=Pt()+500,dc&&yr())}}function oa(s){kr!==null&&kr.tag===0&&(Xe&6)===0&&wi();var a=Xe;Xe|=1;var l=Hn.transition,u=lt;try{if(Hn.transition=null,lt=1,s)return s()}finally{lt=u,Hn.transition=l,Xe=a,(Xe&6)===0&&yr()}}function jh(){In=ji.current,mt(ji)}function ca(s,a){s.finishedWork=null,s.finishedLanes=0;var l=s.timeoutHandle;if(l!==-1&&(s.timeoutHandle=-1,p1(l)),Rt!==null)for(l=Rt.return;l!==null;){var u=l;switch(Ed(u),u.tag){case 1:u=u.type.childContextTypes,u!=null&&cc();break;case 3:gi(),mt(jn),mt(Zt),Ud();break;case 5:Fd(u);break;case 4:gi();break;case 13:mt(bt);break;case 19:mt(bt);break;case 10:$d(u.type._context);break;case 22:case 23:jh()}l=l.return}if(Lt=s,Rt=s=_r(s.current,null),Ht=In=a,It=0,Bl=null,fh=Tc=la=0,Nn=Vl=null,ra!==null){for(a=0;a<ra.length;a++)if(l=ra[a],u=l.interleaved,u!==null){l.interleaved=null;var f=u.next,x=l.pending;if(x!==null){var w=x.next;x.next=f,u.next=w}l.pending=u}ra=null}return s}function Hx(s,a){do{var l=Rt;try{if(Id(),bc.current=Sc,wc){for(var u=wt.memoizedState;u!==null;){var f=u.queue;f!==null&&(f.pending=null),u=u.next}wc=!1}if(ia=0,At=qt=wt=null,Al=!1,Ll=0,hh.current=null,l===null||l.return===null){It=1,Bl=a,Rt=null;break}e:{var x=s,w=l.return,P=l,R=a;if(a=Ht,P.flags|=32768,R!==null&&typeof R=="object"&&typeof R.then=="function"){var U=R,J=P,X=J.tag;if((J.mode&1)===0&&(X===0||X===11||X===15)){var G=J.alternate;G?(J.updateQueue=G.updateQueue,J.memoizedState=G.memoizedState,J.lanes=G.lanes):(J.updateQueue=null,J.memoizedState=null)}var he=gx(w);if(he!==null){he.flags&=-257,vx(he,w,P,x,a),he.mode&1&&xx(x,U,a),a=he,R=U;var je=a.updateQueue;if(je===null){var we=new Set;we.add(R),a.updateQueue=we}else je.add(R);break e}else{if((a&1)===0){xx(x,U,a),bh();break e}R=Error(r(426))}}else if(pt&&P.mode&1){var Et=gx(w);if(Et!==null){(Et.flags&65536)===0&&(Et.flags|=256),vx(Et,w,P,x,a),Td(vi(R,P));break e}}x=R=vi(R,P),It!==4&&(It=2),Vl===null?Vl=[x]:Vl.push(x),x=w;do{switch(x.tag){case 3:x.flags|=65536,a&=-a,x.lanes|=a;var L=mx(x,R,a);Dp(x,L);break e;case 1:P=R;var I=x.type,D=x.stateNode;if((x.flags&128)===0&&(typeof I.getDerivedStateFromError=="function"||D!==null&&typeof D.componentDidCatch=="function"&&(Nr===null||!Nr.has(D)))){x.flags|=65536,a&=-a,x.lanes|=a;var ne=px(x,P,a);Dp(x,ne);break e}}x=x.return}while(x!==null)}Zx(l)}catch(ke){a=ke,Rt===l&&l!==null&&(Rt=l=l.return);continue}break}while(!0)}function Kx(){var s=Mc.current;return Mc.current=Sc,s===null?Sc:s}function bh(){(It===0||It===3||It===2)&&(It=4),Lt===null||(la&268435455)===0&&(Tc&268435455)===0||Cr(Lt,Ht)}function Ac(s,a){var l=Xe;Xe|=2;var u=Kx();(Lt!==s||Ht!==a)&&(Us=null,ca(s,a));do try{F1();break}catch(f){Hx(s,f)}while(!0);if(Id(),Xe=l,Mc.current=u,Rt!==null)throw Error(r(261));return Lt=null,Ht=0,It}function F1(){for(;Rt!==null;)Wx(Rt)}function D1(){for(;Rt!==null&&!hj();)Wx(Rt)}function Wx(s){var a=Xx(s.alternate,s,In);s.memoizedProps=s.pendingProps,a===null?Zx(s):Rt=a,hh.current=null}function Zx(s){var a=s;do{var l=a.alternate;if(s=a.return,(a.flags&32768)===0){if(l=q1(l,a,In),l!==null){Rt=l;return}}else{if(l=I1(l,a),l!==null){l.flags&=32767,Rt=l;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{It=6,Rt=null;return}}if(a=a.sibling,a!==null){Rt=a;return}Rt=a=s}while(a!==null);It===0&&(It=5)}function ua(s,a,l){var u=lt,f=Hn.transition;try{Hn.transition=null,lt=1,U1(s,a,l,u)}finally{Hn.transition=f,lt=u}return null}function U1(s,a,l,u){do wi();while(kr!==null);if((Xe&6)!==0)throw Error(r(327));l=s.finishedWork;var f=s.finishedLanes;if(l===null)return null;if(s.finishedWork=null,s.finishedLanes=0,l===s.current)throw Error(r(177));s.callbackNode=null,s.callbackPriority=0;var x=l.lanes|l.childLanes;if(wj(s,x),s===Lt&&(Rt=Lt=null,Ht=0),(l.subtreeFlags&2064)===0&&(l.flags&2064)===0||Ic||(Ic=!0,Yx(Uo,function(){return wi(),null})),x=(l.flags&15990)!==0,(l.subtreeFlags&15990)!==0||x){x=Hn.transition,Hn.transition=null;var w=lt;lt=1;var P=Xe;Xe|=4,hh.current=null,z1(s,l),Lx(l,s),o1(bd),Zo=!!jd,bd=jd=null,s.current=l,O1(l),fj(),Xe=P,lt=w,Hn.transition=x}else s.current=l;if(Ic&&(Ic=!1,kr=s,$c=f),x=s.pendingLanes,x===0&&(Nr=null),xj(l.stateNode),kn(s,Pt()),a!==null)for(u=s.onRecoverableError,l=0;l<a.length;l++)f=a[l],u(f.value,{componentStack:f.stack,digest:f.digest});if(qc)throw qc=!1,s=ph,ph=null,s;return($c&1)!==0&&s.tag!==0&&wi(),x=s.pendingLanes,(x&1)!==0?s===xh?Hl++:(Hl=0,xh=s):Hl=0,yr(),null}function wi(){if(kr!==null){var s=Om($c),a=Hn.transition,l=lt;try{if(Hn.transition=null,lt=16>s?16:s,kr===null)var u=!1;else{if(s=kr,kr=null,$c=0,(Xe&6)!==0)throw Error(r(331));var f=Xe;for(Xe|=4,ge=s.current;ge!==null;){var x=ge,w=x.child;if((ge.flags&16)!==0){var P=x.deletions;if(P!==null){for(var R=0;R<P.length;R++){var U=P[R];for(ge=U;ge!==null;){var J=ge;switch(J.tag){case 0:case 11:case 15:Ql(8,J,x)}var X=J.child;if(X!==null)X.return=J,ge=X;else for(;ge!==null;){J=ge;var G=J.sibling,he=J.return;if(Ix(J),J===U){ge=null;break}if(G!==null){G.return=he,ge=G;break}ge=he}}}var je=x.alternate;if(je!==null){var we=je.child;if(we!==null){je.child=null;do{var Et=we.sibling;we.sibling=null,we=Et}while(we!==null)}}ge=x}}if((x.subtreeFlags&2064)!==0&&w!==null)w.return=x,ge=w;else e:for(;ge!==null;){if(x=ge,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Ql(9,x,x.return)}var L=x.sibling;if(L!==null){L.return=x.return,ge=L;break e}ge=x.return}}var I=s.current;for(ge=I;ge!==null;){w=ge;var D=w.child;if((w.subtreeFlags&2064)!==0&&D!==null)D.return=w,ge=D;else e:for(w=I;ge!==null;){if(P=ge,(P.flags&2048)!==0)try{switch(P.tag){case 0:case 11:case 15:Rc(9,P)}}catch(ke){St(P,P.return,ke)}if(P===w){ge=null;break e}var ne=P.sibling;if(ne!==null){ne.return=P.return,ge=ne;break e}ge=P.return}}if(Xe=f,yr(),vs&&typeof vs.onPostCommitFiberRoot=="function")try{vs.onPostCommitFiberRoot(Qo,s)}catch{}u=!0}return u}finally{lt=l,Hn.transition=a}}return!1}function Gx(s,a,l){a=vi(l,a),a=mx(s,a,1),s=br(s,a,1),a=un(),s!==null&&(xl(s,1,a),kn(s,a))}function St(s,a,l){if(s.tag===3)Gx(s,s,l);else for(;a!==null;){if(a.tag===3){Gx(a,s,l);break}else if(a.tag===1){var u=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Nr===null||!Nr.has(u))){s=vi(l,s),s=px(a,s,1),a=br(a,s,1),s=un(),a!==null&&(xl(a,1,s),kn(a,s));break}}a=a.return}}function Q1(s,a,l){var u=s.pingCache;u!==null&&u.delete(a),a=un(),s.pingedLanes|=s.suspendedLanes&l,Lt===s&&(Ht&l)===l&&(It===4||It===3&&(Ht&130023424)===Ht&&500>Pt()-mh?ca(s,0):fh|=l),kn(s,a)}function Jx(s,a){a===0&&((s.mode&1)===0?a=1:(a=Vo,Vo<<=1,(Vo&130023424)===0&&(Vo=4194304)));var l=un();s=Ls(s,a),s!==null&&(xl(s,a,l),kn(s,l))}function B1(s){var a=s.memoizedState,l=0;a!==null&&(l=a.retryLane),Jx(s,l)}function V1(s,a){var l=0;switch(s.tag){case 13:var u=s.stateNode,f=s.memoizedState;f!==null&&(l=f.retryLane);break;case 19:u=s.stateNode;break;default:throw Error(r(314))}u!==null&&u.delete(a),Jx(s,l)}var Xx;Xx=function(s,a,l){if(s!==null)if(s.memoizedProps!==a.pendingProps||jn.current)wn=!0;else{if((s.lanes&l)===0&&(a.flags&128)===0)return wn=!1,T1(s,a,l);wn=(s.flags&131072)!==0}else wn=!1,pt&&(a.flags&1048576)!==0&&Mp(a,fc,a.index);switch(a.lanes=0,a.tag){case 2:var u=a.type;Pc(s,a),s=a.pendingProps;var f=ui(a,Zt.current);xi(a,l),f=Vd(null,a,u,s,f,l);var x=Hd();return a.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,bn(u)?(x=!0,uc(a)):x=!1,a.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Ad(a),f.updater=Cc,a.stateNode=f,f._reactInternals=a,Xd(a,u,s,l),a=nh(null,a,u,!0,x,l)):(a.tag=0,pt&&x&&Pd(a),cn(null,a,f,l),a=a.child),a;case 16:u=a.elementType;e:{switch(Pc(s,a),s=a.pendingProps,f=u._init,u=f(u._payload),a.type=u,f=a.tag=K1(u),s=is(u,s),f){case 0:a=th(null,a,u,s,l);break e;case 1:a=kx(null,a,u,s,l);break e;case 11:a=yx(null,a,u,s,l);break e;case 14:a=jx(null,a,u,is(u.type,s),l);break e}throw Error(r(306,u,""))}return a;case 0:return u=a.type,f=a.pendingProps,f=a.elementType===u?f:is(u,f),th(s,a,u,f,l);case 1:return u=a.type,f=a.pendingProps,f=a.elementType===u?f:is(u,f),kx(s,a,u,f,l);case 3:e:{if(Sx(a),s===null)throw Error(r(387));u=a.pendingProps,x=a.memoizedState,f=x.element,Fp(s,a),yc(a,u,null,l);var w=a.memoizedState;if(u=w.element,x.isDehydrated)if(x={element:u,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){f=vi(Error(r(423)),a),a=Cx(s,a,u,l,f);break e}else if(u!==f){f=vi(Error(r(424)),a),a=Cx(s,a,u,l,f);break e}else for(qn=xr(a.stateNode.containerInfo.firstChild),Tn=a,pt=!0,as=null,l=Ap(a,null,u,l),a.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(fi(),u===f){a=Ds(s,a,l);break e}cn(s,a,u,l)}a=a.child}return a;case 5:return Qp(a),s===null&&Md(a),u=a.type,f=a.pendingProps,x=s!==null?s.memoizedProps:null,w=f.children,wd(u,f)?w=null:x!==null&&wd(u,x)&&(a.flags|=32),Nx(s,a),cn(s,a,w,l),a.child;case 6:return s===null&&Md(a),null;case 13:return _x(s,a,l);case 4:return Ld(a,a.stateNode.containerInfo),u=a.pendingProps,s===null?a.child=mi(a,null,u,l):cn(s,a,u,l),a.child;case 11:return u=a.type,f=a.pendingProps,f=a.elementType===u?f:is(u,f),yx(s,a,u,f,l);case 7:return cn(s,a,a.pendingProps,l),a.child;case 8:return cn(s,a,a.pendingProps.children,l),a.child;case 12:return cn(s,a,a.pendingProps.children,l),a.child;case 10:e:{if(u=a.type._context,f=a.pendingProps,x=a.memoizedProps,w=f.value,dt(xc,u._currentValue),u._currentValue=w,x!==null)if(rs(x.value,w)){if(x.children===f.children&&!jn.current){a=Ds(s,a,l);break e}}else for(x=a.child,x!==null&&(x.return=a);x!==null;){var P=x.dependencies;if(P!==null){w=x.child;for(var R=P.firstContext;R!==null;){if(R.context===u){if(x.tag===1){R=Fs(-1,l&-l),R.tag=2;var U=x.updateQueue;if(U!==null){U=U.shared;var J=U.pending;J===null?R.next=R:(R.next=J.next,J.next=R),U.pending=R}}x.lanes|=l,R=x.alternate,R!==null&&(R.lanes|=l),zd(x.return,l,a),P.lanes|=l;break}R=R.next}}else if(x.tag===10)w=x.type===a.type?null:x.child;else if(x.tag===18){if(w=x.return,w===null)throw Error(r(341));w.lanes|=l,P=w.alternate,P!==null&&(P.lanes|=l),zd(w,l,a),w=x.sibling}else w=x.child;if(w!==null)w.return=x;else for(w=x;w!==null;){if(w===a){w=null;break}if(x=w.sibling,x!==null){x.return=w.return,w=x;break}w=w.return}x=w}cn(s,a,f.children,l),a=a.child}return a;case 9:return f=a.type,u=a.pendingProps.children,xi(a,l),f=Bn(f),u=u(f),a.flags|=1,cn(s,a,u,l),a.child;case 14:return u=a.type,f=is(u,a.pendingProps),f=is(u.type,f),jx(s,a,u,f,l);case 15:return bx(s,a,a.type,a.pendingProps,l);case 17:return u=a.type,f=a.pendingProps,f=a.elementType===u?f:is(u,f),Pc(s,a),a.tag=1,bn(u)?(s=!0,uc(a)):s=!1,xi(a,l),hx(a,u,f),Xd(a,u,f,l),nh(null,a,u,!0,s,l);case 19:return Ex(s,a,l);case 22:return wx(s,a,l)}throw Error(r(156,a.tag))};function Yx(s,a){return Tm(s,a)}function H1(s,a,l,u){this.tag=s,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kn(s,a,l,u){return new H1(s,a,l,u)}function wh(s){return s=s.prototype,!(!s||!s.isReactComponent)}function K1(s){if(typeof s=="function")return wh(s)?1:0;if(s!=null){if(s=s.$$typeof,s===ce)return 11;if(s===Ge)return 14}return 2}function _r(s,a){var l=s.alternate;return l===null?(l=Kn(s.tag,a,s.key,s.mode),l.elementType=s.elementType,l.type=s.type,l.stateNode=s.stateNode,l.alternate=s,s.alternate=l):(l.pendingProps=a,l.type=s.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=s.flags&14680064,l.childLanes=s.childLanes,l.lanes=s.lanes,l.child=s.child,l.memoizedProps=s.memoizedProps,l.memoizedState=s.memoizedState,l.updateQueue=s.updateQueue,a=s.dependencies,l.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},l.sibling=s.sibling,l.index=s.index,l.ref=s.ref,l}function Lc(s,a,l,u,f,x){var w=2;if(u=s,typeof s=="function")wh(s)&&(w=1);else if(typeof s=="string")w=5;else e:switch(s){case O:return da(l.children,f,x,a);case Q:w=8,f|=8;break;case V:return s=Kn(12,l,a,f|2),s.elementType=V,s.lanes=x,s;case _e:return s=Kn(13,l,a,f),s.elementType=_e,s.lanes=x,s;case Ue:return s=Kn(19,l,a,f),s.elementType=Ue,s.lanes=x,s;case Be:return Fc(l,f,x,a);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case q:w=10;break e;case B:w=9;break e;case ce:w=11;break e;case Ge:w=14;break e;case rt:w=16,u=null;break e}throw Error(r(130,s==null?s:typeof s,""))}return a=Kn(w,l,a,f),a.elementType=s,a.type=u,a.lanes=x,a}function da(s,a,l,u){return s=Kn(7,s,u,a),s.lanes=l,s}function Fc(s,a,l,u){return s=Kn(22,s,u,a),s.elementType=Be,s.lanes=l,s.stateNode={isHidden:!1},s}function Nh(s,a,l){return s=Kn(6,s,null,a),s.lanes=l,s}function kh(s,a,l){return a=Kn(4,s.children!==null?s.children:[],s.key,a),a.lanes=l,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}function W1(s,a,l,u,f){this.tag=a,this.containerInfo=s,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ju(0),this.expirationTimes=Ju(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ju(0),this.identifierPrefix=u,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function Sh(s,a,l,u,f,x,w,P,R){return s=new W1(s,a,l,P,R),a===1?(a=1,x===!0&&(a|=8)):a=0,x=Kn(3,null,null,a),s.current=x,x.stateNode=s,x.memoizedState={element:u,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ad(x),s}function Z1(s,a,l){var u=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:M,key:u==null?null:""+u,children:s,containerInfo:a,implementation:l}}function eg(s){if(!s)return vr;s=s._reactInternals;e:{if(Qe(s)!==s||s.tag!==1)throw Error(r(170));var a=s;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(bn(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(r(171))}if(s.tag===1){var l=s.type;if(bn(l))return Pp(s,l,a)}return a}function tg(s,a,l,u,f,x,w,P,R){return s=Sh(l,u,!0,s,f,x,w,P,R),s.context=eg(null),l=s.current,u=un(),f=Sr(l),x=Fs(u,f),x.callback=a??null,br(l,x,f),s.current.lanes=f,xl(s,f,u),kn(s,u),s}function Dc(s,a,l,u){var f=a.current,x=un(),w=Sr(f);return l=eg(l),a.context===null?a.context=l:a.pendingContext=l,a=Fs(x,w),a.payload={element:s},u=u===void 0?null:u,u!==null&&(a.callback=u),s=br(f,a,w),s!==null&&(cs(s,f,w,x),vc(s,f,w)),w}function Uc(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 5:return s.child.stateNode;default:return s.child.stateNode}}function ng(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<a?l:a}}function Ch(s,a){ng(s,a),(s=s.alternate)&&ng(s,a)}function G1(){return null}var sg=typeof reportError=="function"?reportError:function(s){console.error(s)};function _h(s){this._internalRoot=s}Qc.prototype.render=_h.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(r(409));Dc(s,a,null,null)},Qc.prototype.unmount=_h.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;oa(function(){Dc(null,s,null,null)}),a[$s]=null}};function Qc(s){this._internalRoot=s}Qc.prototype.unstable_scheduleHydration=function(s){if(s){var a=Fm();s={blockedOn:null,target:s,priority:a};for(var l=0;l<fr.length&&a!==0&&a<fr[l].priority;l++);fr.splice(l,0,s),l===0&&Qm(s)}};function Ph(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function Bc(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function rg(){}function J1(s,a,l,u,f){if(f){if(typeof u=="function"){var x=u;u=function(){var U=Uc(w);x.call(U)}}var w=tg(a,u,s,0,null,!1,!1,"",rg);return s._reactRootContainer=w,s[$s]=w.current,Rl(s.nodeType===8?s.parentNode:s),oa(),w}for(;f=s.lastChild;)s.removeChild(f);if(typeof u=="function"){var P=u;u=function(){var U=Uc(R);P.call(U)}}var R=Sh(s,0,!1,null,null,!1,!1,"",rg);return s._reactRootContainer=R,s[$s]=R.current,Rl(s.nodeType===8?s.parentNode:s),oa(function(){Dc(a,R,l,u)}),R}function Vc(s,a,l,u,f){var x=l._reactRootContainer;if(x){var w=x;if(typeof f=="function"){var P=f;f=function(){var R=Uc(w);P.call(R)}}Dc(a,w,s,f)}else w=J1(l,a,s,f,u);return Uc(w)}Am=function(s){switch(s.tag){case 3:var a=s.stateNode;if(a.current.memoizedState.isDehydrated){var l=pl(a.pendingLanes);l!==0&&(Xu(a,l|1),kn(a,Pt()),(Xe&6)===0&&(bi=Pt()+500,yr()))}break;case 13:oa(function(){var u=Ls(s,1);if(u!==null){var f=un();cs(u,s,1,f)}}),Ch(s,1)}},Yu=function(s){if(s.tag===13){var a=Ls(s,134217728);if(a!==null){var l=un();cs(a,s,134217728,l)}Ch(s,134217728)}},Lm=function(s){if(s.tag===13){var a=Sr(s),l=Ls(s,a);if(l!==null){var u=un();cs(l,s,a,u)}Ch(s,a)}},Fm=function(){return lt},Dm=function(s,a){var l=lt;try{return lt=s,a()}finally{lt=l}},Ga=function(s,a,l){switch(a){case"input":if(Rn(s,l),a=l.name,l.type==="radio"&&a!=null){for(l=s;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll("input[name="+JSON.stringify(""+a)+'][type="radio"]'),a=0;a<l.length;a++){var u=l[a];if(u!==s&&u.form===s.form){var f=oc(u);if(!f)throw Error(r(90));Fa(u),Rn(u,f)}}}break;case"textarea":on(s,l);break;case"select":a=l.value,a!=null&&yn(s,!!l.multiple,a,!1)}},hl=yh,fl=oa;var X1={usingClientEntryPoint:!1,Events:[ql,oi,oc,ul,dl,yh]},Kl={findFiberByHostInstance:ea,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Y1={bundleType:Kl.bundleType,version:Kl.version,rendererPackageName:Kl.rendererPackageName,rendererConfig:Kl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:E.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=Rm(s),s===null?null:s.stateNode},findFiberByHostInstance:Kl.findFiberByHostInstance||G1,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hc.isDisabled&&Hc.supportsFiber)try{Qo=Hc.inject(Y1),vs=Hc}catch{}}return Sn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=X1,Sn.createPortal=function(s,a){var l=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ph(a))throw Error(r(200));return Z1(s,a,null,l)},Sn.createRoot=function(s,a){if(!Ph(s))throw Error(r(299));var l=!1,u="",f=sg;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onRecoverableError!==void 0&&(f=a.onRecoverableError)),a=Sh(s,1,!1,null,null,l,!1,u,f),s[$s]=a.current,Rl(s.nodeType===8?s.parentNode:s),new _h(a)},Sn.findDOMNode=function(s){if(s==null)return null;if(s.nodeType===1)return s;var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=Rm(a),s=s===null?null:s.stateNode,s},Sn.flushSync=function(s){return oa(s)},Sn.hydrate=function(s,a,l){if(!Bc(a))throw Error(r(200));return Vc(null,s,a,!0,l)},Sn.hydrateRoot=function(s,a,l){if(!Ph(s))throw Error(r(405));var u=l!=null&&l.hydratedSources||null,f=!1,x="",w=sg;if(l!=null&&(l.unstable_strictMode===!0&&(f=!0),l.identifierPrefix!==void 0&&(x=l.identifierPrefix),l.onRecoverableError!==void 0&&(w=l.onRecoverableError)),a=tg(a,null,s,1,l??null,f,!1,x,w),s[$s]=a.current,Rl(s),u)for(s=0;s<u.length;s++)l=u[s],f=l._getVersion,f=f(l._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[l,f]:a.mutableSourceEagerHydrationData.push(l,f);return new Qc(a)},Sn.render=function(s,a,l){if(!Bc(a))throw Error(r(200));return Vc(null,s,a,!1,l)},Sn.unmountComponentAtNode=function(s){if(!Bc(s))throw Error(r(40));return s._reactRootContainer?(oa(function(){Vc(null,null,s,!1,function(){s._reactRootContainer=null,s[$s]=null})}),!0):!1},Sn.unstable_batchedUpdates=yh,Sn.unstable_renderSubtreeIntoContainer=function(s,a,l,u){if(!Bc(l))throw Error(r(200));if(s==null||s._reactInternals===void 0)throw Error(r(38));return Vc(s,a,l,!1,u)},Sn.version="18.3.1-next-f1338f8080-20240426",Sn}var fg;function Bv(){if(fg)return qh.exports;fg=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(n){console.error(n)}}return e(),qh.exports=hb(),qh.exports}var mg;function fb(){if(mg)return Wc;mg=1;var e=Bv();return Wc.createRoot=e.createRoot,Wc.hydrateRoot=e.hydrateRoot,Wc}var mb=fb();const pb="modulepreload",xb=function(e){return"/"+e},pg={},Eu=function(n,r,i){let o=Promise.resolve();if(r&&r.length>0){let d=function(g){return Promise.all(g.map(p=>Promise.resolve(p).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),m=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));o=d(r.map(g=>{if(g=xb(g),g in pg)return;pg[g]=!0;const p=g.endsWith(".css"),v=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${v}`))return;const j=document.createElement("link");if(j.rel=p?"stylesheet":pb,p||(j.as="script"),j.crossOrigin="",j.href=g,m&&j.setAttribute("nonce",m),document.head.appendChild(j),p)return new Promise((C,y)=>{j.addEventListener("load",C),j.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${g}`)))})}))}function c(d){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=d,window.dispatchEvent(h),!h.defaultPrevented)throw d}return o.then(d=>{for(const h of d||[])h.status==="rejected"&&c(h.reason);return n().catch(c)})};Bv();/**
42
+ * @remix-run/router v1.23.4
43
+ *
44
+ * Copyright (c) Remix Software Inc.
45
+ *
46
+ * This source code is licensed under the MIT license found in the
47
+ * LICENSE.md file in the root directory of this source tree.
48
+ *
49
+ * @license MIT
50
+ */function so(){return so=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},so.apply(null,arguments)}var Fr;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Fr||(Fr={}));const xg="popstate";function gb(e){e===void 0&&(e={});function n(i,o){let{pathname:c,search:d,hash:h}=i.location;return Hh("",{pathname:c,search:d,hash:h},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function r(i,o){return typeof o=="string"?o:iu(o)}return yb(n,r,null,e)}function gt(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Vv(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function vb(){return Math.random().toString(36).substr(2,8)}function gg(e,n){return{usr:e.state,key:e.key,idx:n}}function Hh(e,n,r,i){return r===void 0&&(r=null),so({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof n=="string"?Ji(n):n,{state:r,key:n&&n.key||i||vb()})}function iu(e){let{pathname:n="/",search:r="",hash:i=""}=e;return r&&r!=="?"&&(n+=r.charAt(0)==="?"?r:"?"+r),i&&i!=="#"&&(n+=i.charAt(0)==="#"?i:"#"+i),n}function Ji(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substr(r),e=e.substr(0,r));let i=e.indexOf("?");i>=0&&(n.search=e.substr(i),e=e.substr(0,i)),e&&(n.pathname=e)}return n}function yb(e,n,r,i){i===void 0&&(i={});let{window:o=document.defaultView,v5Compat:c=!1}=i,d=o.history,h=Fr.Pop,m=null,g=p();g==null&&(g=0,d.replaceState(so({},d.state,{idx:g}),""));function p(){return(d.state||{idx:null}).idx}function v(){h=Fr.Pop;let k=p(),S=k==null?null:k-g;g=k,m&&m({action:h,location:b.location,delta:S})}function j(k,S){h=Fr.Push;let $=Hh(b.location,k,S);g=p()+1;let z=gg($,g),E=b.createHref($);try{d.pushState(z,"",E)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;o.location.assign(E)}c&&m&&m({action:h,location:b.location,delta:1})}function C(k,S){h=Fr.Replace;let $=Hh(b.location,k,S);g=p();let z=gg($,g),E=b.createHref($);d.replaceState(z,"",E),c&&m&&m({action:h,location:b.location,delta:0})}function y(k){let S=o.location.origin!=="null"?o.location.origin:o.location.href,$=typeof k=="string"?k:iu(k);return $=$.replace(/ $/,"%20"),gt(S,"No window.location.(origin|href) available to create URL for href: "+$),new URL($,S)}let b={get action(){return h},get location(){return e(o,d)},listen(k){if(m)throw new Error("A history only accepts one active listener");return o.addEventListener(xg,v),m=k,()=>{o.removeEventListener(xg,v),m=null}},createHref(k){return n(o,k)},createURL:y,encodeLocation(k){let S=y(k);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:j,replace:C,go(k){return d.go(k)}};return b}var vg;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(vg||(vg={}));function jb(e,n,r){return r===void 0&&(r="/"),bb(e,n,r)}function bb(e,n,r,i){let o=typeof n=="string"?Ji(n):n,c=Di(o.pathname||"/",r);if(c==null)return null;let d=Hv(e);wb(d);let h=null,m=Wv(c);for(let g=0;h==null&&g<d.length;++g)h=Mb(d[g],m);return h}function Hv(e,n,r,i){n===void 0&&(n=[]),r===void 0&&(r=[]),i===void 0&&(i="");let o=(c,d,h)=>{let m={relativePath:h===void 0?c.path||"":h,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};m.relativePath.startsWith("/")&&(gt(m.relativePath.startsWith(i),'Absolute route path "'+m.relativePath+'" nested under path '+('"'+i+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),m.relativePath=m.relativePath.slice(i.length));let g=Dr([i,m.relativePath]),p=r.concat(m);c.children&&c.children.length>0&&(gt(c.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+g+'".')),Hv(c.children,n,p,g)),!(c.path==null&&!c.index)&&n.push({path:g,score:Eb(g,c.index),routesMeta:p})};return e.forEach((c,d)=>{var h;if(c.path===""||!((h=c.path)!=null&&h.includes("?")))o(c,d);else for(let m of Kv(c.path))o(c,d,m)}),n}function Kv(e){let n=e.split("/");if(n.length===0)return[];let[r,...i]=n,o=r.endsWith("?"),c=r.replace(/\?$/,"");if(i.length===0)return o?[c,""]:[c];let d=Kv(i.join("/")),h=[];return h.push(...d.map(m=>m===""?c:[c,m].join("/"))),o&&h.push(...d),h.map(m=>e.startsWith("/")&&m===""?"/":m)}function wb(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:Rb(n.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}const Nb=/^:[\w-]+$/,kb=3,Sb=2,Cb=1,_b=10,Pb=-2,yg=e=>e==="*";function Eb(e,n){let r=e.split("/"),i=r.length;return r.some(yg)&&(i+=Pb),n&&(i+=Sb),r.filter(o=>!yg(o)).reduce((o,c)=>o+(Nb.test(c)?kb:c===""?Cb:_b),i)}function Rb(e,n){return e.length===n.length&&e.slice(0,-1).every((i,o)=>i===n[o])?e[e.length-1]-n[n.length-1]:0}function Mb(e,n,r){let{routesMeta:i}=e,o={},c="/",d=[];for(let h=0;h<i.length;++h){let m=i[h],g=h===i.length-1,p=c==="/"?n:n.slice(c.length)||"/",v=lu({path:m.relativePath,caseSensitive:m.caseSensitive,end:g},p),j=m.route;if(!v)return null;Object.assign(o,v.params),d.push({params:o,pathname:Dr([c,v.pathname]),pathnameBase:$b(Dr([c,v.pathnameBase])),route:j}),v.pathnameBase!=="/"&&(c=Dr([c,v.pathnameBase]))}return d}function lu(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,i]=Tb(e.path,e.caseSensitive,e.end),o=n.match(r);if(!o)return null;let c=o[0],d=c.replace(/(.)\/+$/,"$1"),h=o.slice(1);return{params:i.reduce((g,p,v)=>{let{paramName:j,isOptional:C}=p;if(j==="*"){let b=h[v]||"";d=c.slice(0,c.length-b.length).replace(/(.)\/+$/,"$1")}const y=h[v];return C&&!y?g[j]=void 0:g[j]=(y||"").replace(/%2F/g,"/"),g},{}),pathname:c,pathnameBase:d,pattern:e}}function Tb(e,n,r){n===void 0&&(n=!1),r===void 0&&(r=!0),Vv(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 i=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,h,m)=>(i.push({paramName:h,isOptional:m!=null}),m?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(i.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,n?void 0:"i"),i]}function Wv(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return Vv(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+n+").")),e}}function Di(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,i=e.charAt(r);return i&&i!=="/"?null:e.slice(r)||"/"}function qb(e,n){n===void 0&&(n="/");let{pathname:r,search:i="",hash:o=""}=typeof e=="string"?Ji(e):e,c;return r?(r=Zv(r),r.startsWith("/")?c=jg(r.substring(1),"/"):c=jg(r,n)):c=n,{pathname:c,search:zb(i),hash:Ob(o)}}function jg(e,n){let r=n.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?r.length>1&&r.pop():o!=="."&&r.push(o)}),r.length>1?r.join("/"):"/"}function zh(e,n,r,i){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+n+"` field ["+JSON.stringify(i)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function Ib(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function Of(e,n){let r=Ib(e);return n?r.map((i,o)=>o===r.length-1?i.pathname:i.pathnameBase):r.map(i=>i.pathnameBase)}function Af(e,n,r,i){i===void 0&&(i=!1);let o;typeof e=="string"?o=Ji(e):(o=so({},e),gt(!o.pathname||!o.pathname.includes("?"),zh("?","pathname","search",o)),gt(!o.pathname||!o.pathname.includes("#"),zh("#","pathname","hash",o)),gt(!o.search||!o.search.includes("#"),zh("#","search","hash",o)));let c=e===""||o.pathname==="",d=c?"/":o.pathname,h;if(d==null)h=r;else{let v=n.length-1;if(!i&&d.startsWith("..")){let j=d.split("/");for(;j[0]==="..";)j.shift(),v-=1;o.pathname=j.join("/")}h=v>=0?n[v]:"/"}let m=qb(o,h),g=d&&d!=="/"&&d.endsWith("/"),p=(c||d===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(g||p)&&(m.pathname+="/"),m}const Zv=e=>e.replace(/\/\/+/g,"/"),Dr=e=>Zv(e.join("/")),$b=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),zb=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Ob=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Ab(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Gv=["post","put","patch","delete"];new Set(Gv);const Lb=["get",...Gv];new Set(Lb);/**
51
+ * React Router v6.30.6
52
+ *
53
+ * Copyright (c) Remix Software Inc.
54
+ *
55
+ * This source code is licensed under the MIT license found in the
56
+ * LICENSE.md file in the root directory of this source tree.
57
+ *
58
+ * @license MIT
59
+ */function ro(){return ro=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},ro.apply(null,arguments)}const Ru=N.createContext(null),Jv=N.createContext(null),sr=N.createContext(null),Mu=N.createContext(null),Ts=N.createContext({outlet:null,matches:[],isDataRoute:!1}),Xv=N.createContext(null);function Fb(e,n){let{relative:r}=n===void 0?{}:n;za()||gt(!1);let{basename:i,navigator:o}=N.useContext(sr),{hash:c,pathname:d,search:h}=Tu(e,{relative:r}),m=d;return i!=="/"&&(m=d==="/"?i:Dr([i,d])),o.createHref({pathname:m,search:h,hash:c})}function za(){return N.useContext(Mu)!=null}function Ln(){return za()||gt(!1),N.useContext(Mu).location}function bg(e){za()||gt(!1);let{pathname:n}=Ln();return N.useMemo(()=>lu(e,Wv(n)),[n,e])}function Yv(e){N.useContext(sr).static||N.useLayoutEffect(e)}function an(){let{isDataRoute:e}=N.useContext(Ts);return e?tw():Db()}function Db(){za()||gt(!1);let e=N.useContext(Ru),{basename:n,future:r,navigator:i}=N.useContext(sr),{matches:o}=N.useContext(Ts),{pathname:c}=Ln(),d=JSON.stringify(Of(o,r.v7_relativeSplatPath)),h=N.useRef(!1);return Yv(()=>{h.current=!0}),N.useCallback(function(g,p){if(p===void 0&&(p={}),!h.current)return;if(typeof g=="number"){i.go(g);return}let v=Af(g,JSON.parse(d),c,p.relative==="path");e==null&&n!=="/"&&(v.pathname=v.pathname==="/"?n:Dr([n,v.pathname])),(p.replace?i.replace:i.push)(v,p.state,p)},[n,i,d,c,e])}const Ub=N.createContext(null);function Qb(e){let n=N.useContext(Ts).outlet;return n&&N.createElement(Ub.Provider,{value:e},n)}function Fn(){let{matches:e}=N.useContext(Ts),n=e[e.length-1];return n?n.params:{}}function Tu(e,n){let{relative:r}=n===void 0?{}:n,{future:i}=N.useContext(sr),{matches:o}=N.useContext(Ts),{pathname:c}=Ln(),d=JSON.stringify(Of(o,i.v7_relativeSplatPath));return N.useMemo(()=>Af(e,JSON.parse(d),c,r==="path"),[e,d,c,r])}function Bb(e,n){return Vb(e,n)}function Vb(e,n,r,i){za()||gt(!1);let{navigator:o}=N.useContext(sr),{matches:c}=N.useContext(Ts),d=c[c.length-1],h=d?d.params:{};d&&d.pathname;let m=d?d.pathnameBase:"/";d&&d.route;let g=Ln(),p;if(n){var v;let k=typeof n=="string"?Ji(n):n;m==="/"||(v=k.pathname)!=null&&v.startsWith(m)||gt(!1),p=k}else p=g;let j=p.pathname||"/",C=j;if(m!=="/"){let k=m.replace(/^\//,"").split("/");C="/"+j.replace(/^\//,"").split("/").slice(k.length).join("/")}let y=jb(e,{pathname:C}),b=Gb(y&&y.map(k=>Object.assign({},k,{params:Object.assign({},h,k.params),pathname:Dr([m,o.encodeLocation?o.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?m:Dr([m,o.encodeLocation?o.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),c,r,i);return n&&b?N.createElement(Mu.Provider,{value:{location:ro({pathname:"/",search:"",hash:"",state:null,key:"default"},p),navigationType:Fr.Pop}},b):b}function Hb(){let e=ew(),n=Ab(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return N.createElement(N.Fragment,null,N.createElement("h2",null,"Unexpected Application Error!"),N.createElement("h3",{style:{fontStyle:"italic"}},n),r?N.createElement("pre",{style:o},r):null,null)}const Kb=N.createElement(Hb,null);class Wb extends N.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,r){return r.location!==n.location||r.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:r.error,location:r.location,revalidation:n.revalidation||r.revalidation}}componentDidCatch(n,r){console.error("React Router caught the following error during render",n,r)}render(){return this.state.error!==void 0?N.createElement(Ts.Provider,{value:this.props.routeContext},N.createElement(Xv.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Zb(e){let{routeContext:n,match:r,children:i}=e,o=N.useContext(Ru);return o&&o.static&&o.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=r.route.id),N.createElement(Ts.Provider,{value:n},i)}function Gb(e,n,r,i){var o;if(n===void 0&&(n=[]),r===void 0&&(r=null),i===void 0&&(i=null),e==null){var c;if(!r)return null;if(r.errors)e=r.matches;else if((c=i)!=null&&c.v7_partialHydration&&n.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let d=e,h=(o=r)==null?void 0:o.errors;if(h!=null){let p=d.findIndex(v=>v.route.id&&(h==null?void 0:h[v.route.id])!==void 0);p>=0||gt(!1),d=d.slice(0,Math.min(d.length,p+1))}let m=!1,g=-1;if(r&&i&&i.v7_partialHydration)for(let p=0;p<d.length;p++){let v=d[p];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(g=p),v.route.id){let{loaderData:j,errors:C}=r,y=v.route.loader&&j[v.route.id]===void 0&&(!C||C[v.route.id]===void 0);if(v.route.lazy||y){m=!0,g>=0?d=d.slice(0,g+1):d=[d[0]];break}}}return d.reduceRight((p,v,j)=>{let C,y=!1,b=null,k=null;r&&(C=h&&v.route.id?h[v.route.id]:void 0,b=v.route.errorElement||Kb,m&&(g<0&&j===0?(nw("route-fallback"),y=!0,k=null):g===j&&(y=!0,k=v.route.hydrateFallbackElement||null)));let S=n.concat(d.slice(0,j+1)),$=()=>{let z;return C?z=b:y?z=k:v.route.Component?z=N.createElement(v.route.Component,null):v.route.element?z=v.route.element:z=p,N.createElement(Zb,{match:v,routeContext:{outlet:p,matches:S,isDataRoute:r!=null},children:z})};return r&&(v.route.ErrorBoundary||v.route.errorElement||j===0)?N.createElement(Wb,{location:r.location,revalidation:r.revalidation,component:b,error:C,children:$(),routeContext:{outlet:null,matches:S,isDataRoute:!0}}):$()},null)}var ey=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(ey||{}),ty=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(ty||{});function Jb(e){let n=N.useContext(Ru);return n||gt(!1),n}function Xb(e){let n=N.useContext(Jv);return n||gt(!1),n}function Yb(e){let n=N.useContext(Ts);return n||gt(!1),n}function ny(e){let n=Yb(),r=n.matches[n.matches.length-1];return r.route.id||gt(!1),r.route.id}function ew(){var e;let n=N.useContext(Xv),r=Xb(),i=ny();return n!==void 0?n:(e=r.errors)==null?void 0:e[i]}function tw(){let{router:e}=Jb(ey.UseNavigateStable),n=ny(ty.UseNavigateStable),r=N.useRef(!1);return Yv(()=>{r.current=!0}),N.useCallback(function(o,c){c===void 0&&(c={}),r.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,ro({fromRouteId:n},c)))},[e,n])}const wg={};function nw(e,n,r){wg[e]||(wg[e]=!0)}function sw(e,n){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Qr(e){let{to:n,replace:r,state:i,relative:o}=e;za()||gt(!1);let{future:c,static:d}=N.useContext(sr),{matches:h}=N.useContext(Ts),{pathname:m}=Ln(),g=an(),p=Af(n,Of(h,c.v7_relativeSplatPath),m,o==="path"),v=JSON.stringify(p);return N.useEffect(()=>g(JSON.parse(v),{replace:r,state:i,relative:o}),[g,v,o,r,i]),null}function sy(e){return Qb(e.context)}function ct(e){gt(!1)}function rw(e){let{basename:n="/",children:r=null,location:i,navigationType:o=Fr.Pop,navigator:c,static:d=!1,future:h}=e;za()&&gt(!1);let m=n.replace(/^\/*/,"/"),g=N.useMemo(()=>({basename:m,navigator:c,static:d,future:ro({v7_relativeSplatPath:!1},h)}),[m,h,c,d]);typeof i=="string"&&(i=Ji(i));let{pathname:p="/",search:v="",hash:j="",state:C=null,key:y="default"}=i,b=N.useMemo(()=>{let k=Di(p,m);return k==null?null:{location:{pathname:k,search:v,hash:j,state:C,key:y},navigationType:o}},[m,p,v,j,C,y,o]);return b==null?null:N.createElement(sr.Provider,{value:g},N.createElement(Mu.Provider,{children:r,value:b}))}function aw(e){let{children:n,location:r}=e;return Bb(Kh(n),r)}new Promise(()=>{});function Kh(e,n){n===void 0&&(n=[]);let r=[];return N.Children.forEach(e,(i,o)=>{if(!N.isValidElement(i))return;let c=[...n,o];if(i.type===N.Fragment){r.push.apply(r,Kh(i.props.children,c));return}i.type!==ct&&gt(!1),!i.props.index||!i.props.children||gt(!1);let d={id:i.props.id||c.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,loader:i.props.loader,action:i.props.action,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(d.children=Kh(i.props.children,c)),r.push(d)}),r}/**
60
+ * React Router DOM v6.30.6
61
+ *
62
+ * Copyright (c) Remix Software Inc.
63
+ *
64
+ * This source code is licensed under the MIT license found in the
65
+ * LICENSE.md file in the root directory of this source tree.
66
+ *
67
+ * @license MIT
68
+ */function ou(){return ou=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},ou.apply(null,arguments)}function ry(e,n){if(e==null)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(n.indexOf(i)!==-1)continue;r[i]=e[i]}return r}function iw(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function lw(e,n){return e.button===0&&(!n||n==="_self")&&!iw(e)}function Wh(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((n,r)=>{let i=e[r];return n.concat(Array.isArray(i)?i.map(o=>[r,o]):[[r,i]])},[]))}function ow(e,n){let r=Wh(e);return n&&n.forEach((i,o)=>{r.has(o)||n.getAll(o).forEach(c=>{r.append(o,c)})}),r}const cw=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],uw=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],dw="6";try{window.__reactRouterVersion=dw}catch{}const hw=N.createContext({isTransitioning:!1}),fw="startTransition",Ng=cb[fw];function mw(e){let{basename:n,children:r,future:i,window:o}=e,c=N.useRef();c.current==null&&(c.current=gb({window:o,v5Compat:!0}));let d=c.current,[h,m]=N.useState({action:d.action,location:d.location}),{v7_startTransition:g}=i||{},p=N.useCallback(v=>{g&&Ng?Ng(()=>m(v)):m(v)},[m,g]);return N.useLayoutEffect(()=>d.listen(p),[d,p]),N.useEffect(()=>sw(i),[i]),N.createElement(rw,{basename:n,children:r,location:h.location,navigationType:h.action,navigator:d,future:i})}const pw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",xw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Te=N.forwardRef(function(n,r){let{onClick:i,relative:o,reloadDocument:c,replace:d,state:h,target:m,to:g,preventScrollReset:p,viewTransition:v}=n,j=ry(n,cw),{basename:C}=N.useContext(sr),y,b=!1;if(typeof g=="string"&&xw.test(g)&&(y=g,pw))try{let z=new URL(window.location.href),E=g.startsWith("//")?new URL(z.protocol+g):new URL(g),T=Di(E.pathname,C);E.origin===z.origin&&T!=null?g=T+E.search+E.hash:b=!0}catch{}let k=Fb(g,{relative:o}),S=vw(g,{replace:d,state:h,target:m,preventScrollReset:p,relative:o,viewTransition:v});function $(z){i&&i(z),z.defaultPrevented||S(z)}return N.createElement("a",ou({},j,{href:y||k,onClick:b||c?i:$,ref:r,target:m}))}),_o=N.forwardRef(function(n,r){let{"aria-current":i="page",caseSensitive:o=!1,className:c="",end:d=!1,style:h,to:m,viewTransition:g,children:p}=n,v=ry(n,uw),j=Tu(m,{relative:v.relative}),C=Ln(),y=N.useContext(Jv),{navigator:b,basename:k}=N.useContext(sr),S=y!=null&&yw(j)&&g===!0,$=b.encodeLocation?b.encodeLocation(j).pathname:j.pathname,z=C.pathname,E=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;o||(z=z.toLowerCase(),E=E?E.toLowerCase():null,$=$.toLowerCase()),E&&k&&(E=Di(E,k)||E);const T=$!=="/"&&$.endsWith("/")?$.length-1:$.length;let M=z===$||!d&&z.startsWith($)&&z.charAt(T)==="/",O=E!=null&&(E===$||!d&&E.startsWith($)&&E.charAt($.length)==="/"),Q={isActive:M,isPending:O,isTransitioning:S},V=M?i:void 0,q;typeof c=="function"?q=c(Q):q=[c,M?"active":null,O?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let B=typeof h=="function"?h(Q):h;return N.createElement(Te,ou({},v,{"aria-current":V,className:q,ref:r,style:B,to:m,viewTransition:g}),typeof p=="function"?p(Q):p)});var Zh;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Zh||(Zh={}));var kg;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(kg||(kg={}));function gw(e){let n=N.useContext(Ru);return n||gt(!1),n}function vw(e,n){let{target:r,replace:i,state:o,preventScrollReset:c,relative:d,viewTransition:h}=n===void 0?{}:n,m=an(),g=Ln(),p=Tu(e,{relative:d});return N.useCallback(v=>{if(lw(v,r)){v.preventDefault();let j=i!==void 0?i:iu(g)===iu(p);m(e,{replace:j,state:o,preventScrollReset:c,relative:d,viewTransition:h})}},[g,m,p,i,o,r,e,c,d,h])}function Po(e){let n=N.useRef(Wh(e)),r=N.useRef(!1),i=Ln(),o=N.useMemo(()=>ow(i.search,r.current?null:n.current),[i.search]),c=an(),d=N.useCallback((h,m)=>{const g=Wh(typeof h=="function"?h(o):h);r.current=!0,c("?"+g,m)},[c,o]);return[o,d]}function yw(e,n){n===void 0&&(n={});let r=N.useContext(hw);r==null&&gt(!1);let{basename:i}=gw(Zh.useViewTransitionState),o=Tu(e,{relative:n.relative});if(!r.isTransitioning)return!1;let c=Di(r.currentLocation.pathname,i)||r.currentLocation.pathname,d=Di(r.nextLocation.pathname,i)||r.nextLocation.pathname;return lu(o.pathname,d)!=null||lu(o.pathname,c)!=null}const ay=N.createContext(void 0),Ze=e=>{const n=N.useContext(ay);if(!n)throw new Error("No QueryClient set, use QueryClientProvider to set one");return n},jw=({client:e,children:n})=>(N.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),t.jsx(ay.Provider,{value:e,children:n})),bw={setTimeout:(e,n)=>setTimeout(e,n),clearTimeout:e=>clearTimeout(e),setInterval:(e,n)=>setInterval(e,n),clearInterval:e=>clearInterval(e)};var Tr,$f,Tv,ww=(Tv=class{constructor(){xe(this,Tr,bw);xe(this,$f,!1)}setTimeoutProvider(e){te(this,Tr,e)}setTimeout(e,n){return _(this,Tr).setTimeout(e,n)}clearTimeout(e){_(this,Tr).clearTimeout(e)}setInterval(e,n){return _(this,Tr).setInterval(e,n)}clearInterval(e){_(this,Tr).clearInterval(e)}},Tr=new WeakMap,$f=new WeakMap,Tv);const pa=new ww;function Nw(e){setTimeout(e,0)}const kw=typeof window>"u"||"Deno"in globalThis;function nn(){}function Sw(e,n){return typeof e=="function"?e(n):e}function iy(e){return typeof e=="number"&&e>=0&&e!==1/0}function ly(e,n){return Math.max(e+(n||0)-Date.now(),0)}function Ct(e,n){return typeof e=="function"?e(n):e}function Sg(e,n){const{type:r="all",exact:i,fetchStatus:o,predicate:c,queryKey:d,stale:h}=e;if(d){if(i){if(n.queryHash!==Lf(d,n.options))return!1}else if(!Ui(n.queryKey,d))return!1}if(r!=="all"){const m=n.isActive();if(r==="active"&&!m||r==="inactive"&&m)return!1}return!(typeof h=="boolean"&&n.isStale()!==h||o&&o!==n.state.fetchStatus||c&&!c(n))}function Cg(e,n){const{exact:r,status:i,predicate:o,mutationKey:c}=e;if(c){if(!n.options.mutationKey)return!1;if(r){if(Ea(n.options.mutationKey)!==Ea(c))return!1}else if(!Ui(n.options.mutationKey,c))return!1}return!(i&&n.state.status!==i||o&&!o(n))}function Lf(e,n){return((n==null?void 0:n.queryKeyHashFn)||Ea)(e)}function Ea(e){return JSON.stringify(e,(n,r)=>Gh(r)?Object.keys(r).sort().reduce((i,o)=>(i[o]=r[o],i),{}):r)}function Ui(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(Array.isArray(e)&&Array.isArray(n)){for(let i=0;i<n.length;i++)if(!Ui(e[i],n[i]))return!1;return!0}const r=Object.keys(n);for(const i of r)if(!Ui(e[i],n[i]))return!1;return!0}return!1}const Cw=Object.prototype.hasOwnProperty;function Ff(e,n,r=0){if(e===n)return e;if(r>500)return n;const i=_g(e)&&_g(n);if(!i&&!(Gh(e)&&Gh(n)))return n;const o=(i?e:Object.keys(e)).length,c=i?n:Object.keys(n),d=c.length,h=i?new Array(d):{};let m=0;for(let g=0;g<d;g++){const p=i?g:c[g],v=e[p],j=n[p];if(v===j){h[p]=v,(i?g<o:Cw.call(e,p))&&m++;continue}if(v===null||j===null||typeof v!="object"||typeof j!="object"){h[p]=j;continue}const C=Ff(v,j,r+1);h[p]=C,C===v&&m++}return o===d&&m===o?e:h}function to(e,n){if(!n||Object.keys(e).length!==Object.keys(n).length)return!1;for(const r in e)if(e[r]!==n[r])return!1;return!0}function _g(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Gh(e){if(!Pg(e))return!1;const n=e.constructor;if(n===void 0)return!0;const r=n.prototype;return!(!Pg(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Pg(e){return Object.prototype.toString.call(e)==="[object Object]"}function _w(e){return new Promise(n=>{pa.setTimeout(n,e)})}function Jh(e,n,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,n):r.structuralSharing!==!1?Ff(e,n):n}function Pn(e){return e}function Pw(e,n,r=0){const i=[...e,n];return r&&i.length>r?i.slice(1):i}function Ew(e,n,r=0){const i=[n,...e];return r&&i.length>r?i.slice(0,-1):i}const Df=Symbol();function oy(e,n){return!e.queryFn&&(n!=null&&n.initialPromise)?()=>n.initialPromise:!e.queryFn||e.queryFn===Df?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Uf(e,n){return typeof e=="function"?e(...n):!!e}function Rw(e,n,r){let i=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??(o=n()),i||(i=!0,o.aborted?r():o.addEventListener("abort",r,{once:!0})),o)}),e}let Mw=()=>kw;const Qf=()=>Mw();var Oa=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(){}},xa,qr,Ci,qv,Tw=(qv=class extends Oa{constructor(){super();xe(this,xa);xe(this,qr);xe(this,Ci);te(this,Ci,n=>{if(typeof window<"u"&&window.addEventListener){const r=()=>n();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){_(this,qr)||this.setEventListener(_(this,Ci))}onUnsubscribe(){var n;this.hasListeners()||((n=_(this,qr))==null||n.call(this),te(this,qr,void 0))}setEventListener(n){var r;te(this,Ci,n),(r=_(this,qr))==null||r.call(this),te(this,qr,n(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(n){_(this,xa)!==n&&(te(this,xa,n),this.onFocus())}onFocus(){const n=this.isFocused();this.listeners.forEach(r=>{r(n)})}isFocused(){var n;return typeof _(this,xa)=="boolean"?_(this,xa):((n=globalThis.document)==null?void 0:n.visibilityState)!=="hidden"}},xa=new WeakMap,qr=new WeakMap,Ci=new WeakMap,qv);const Bf=new Tw,qw=Nw;function Iw(){let e=[],n=0,r=h=>{h()},i=h=>{h()},o=qw;const c=h=>{n?e.push(h):o(()=>{r(h)})},d=()=>{const h=e;e=[],h.length&&o(()=>{i(()=>{h.forEach(m=>{r(m)})})})};return{batch:h=>{let m;n++;try{m=h()}finally{n--,n||d()}return m},batchCalls:h=>(...m)=>{c(()=>{h(...m)})},schedule:c,setNotifyFunction:h=>{r=h},setBatchNotifyFunction:h=>{i=h},setScheduler:h=>{o=h}}}const _t=Iw();var _i,Ir,Pi,Iv,$w=(Iv=class extends Oa{constructor(){super();xe(this,_i,!0);xe(this,Ir);xe(this,Pi);te(this,Pi,n=>{if(typeof window<"u"&&window.addEventListener){const r=()=>n(!0),i=()=>n(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",i)}}})}onSubscribe(){_(this,Ir)||this.setEventListener(_(this,Pi))}onUnsubscribe(){var n;this.hasListeners()||((n=_(this,Ir))==null||n.call(this),te(this,Ir,void 0))}setEventListener(n){var r;te(this,Pi,n),(r=_(this,Ir))==null||r.call(this),te(this,Ir,n(this.setOnline.bind(this)))}setOnline(n){_(this,_i)!==n&&(te(this,_i,n),this.listeners.forEach(r=>{r(n)}))}isOnline(){return _(this,_i)}},_i=new WeakMap,Ir=new WeakMap,Pi=new WeakMap,Iv);const cu=new $w;function zw(e){return Math.min(1e3*2**e,3e4)}function cy(e){return(e??"online")==="online"?cu.isOnline():!0}var Xh=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function uy(e){let n=!1,r=0,i,o="pending",c,d;const h=new Promise(($,z)=>{c=$,d=z});h.catch(nn);const m=()=>o!=="pending",g=$=>{var z;if(!m()){const E=new Xh($);b(E),(z=e.onCancel)==null||z.call(e,E)}},p=()=>{n=!0},v=()=>{n=!1},j=()=>Bf.isFocused()&&(e.networkMode==="always"||cu.isOnline())&&e.canRun(),C=()=>cy(e.networkMode)&&e.canRun(),y=$=>{m()||(i==null||i(),o="resolved",c($))},b=$=>{m()||(i==null||i(),o="rejected",d($))},k=()=>new Promise($=>{var z;i=E=>{(m()||j())&&$(E)},(z=e.onPause)==null||z.call(e)}).then(()=>{var $;i=void 0,m()||($=e.onContinue)==null||$.call(e)}),S=()=>{if(m())return;let $;const z=r===0?e.initialPromise:void 0;try{$=z??e.fn()}catch(E){$=Promise.reject(E)}Promise.resolve($).then(y).catch(E=>{var V;if(m())return;const T=e.retry??(Qf()?0:3),M=e.retryDelay??zw,O=typeof M=="function"?M(r,E):M,Q=T===!0||typeof T=="number"&&r<T||typeof T=="function"&&T(r,E);if(n||!Q){b(E);return}r++,(V=e.onFail)==null||V.call(e,r,E),_w(O).then(()=>j()?void 0:k()).then(()=>{n?b(E):S()})})};return{promise:h,status:()=>o,cancel:g,continue:()=>(i==null||i(),h),cancelRetry:p,continueRetry:v,canStart:C,start:()=>(C()?S():k().then(S),h)}}var ga,$v,dy=($v=class{constructor(){xe(this,ga)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),iy(this.gcTime)&&te(this,ga,pa.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Qf()?1/0:3e5))}clearGcTimeout(){_(this,ga)!==void 0&&(pa.clearTimeout(_(this,ga)),te(this,ga,void 0))}},ga=new WeakMap,$v);function Ow(e){return{onFetch:(n,r)=>{var p,v,j,C,y;const i=n.options,o=(j=(v=(p=n.fetchOptions)==null?void 0:p.meta)==null?void 0:v.fetchMore)==null?void 0:j.direction,c=((C=n.state.data)==null?void 0:C.pages)||[],d=((y=n.state.data)==null?void 0:y.pageParams)||[];let h={pages:[],pageParams:[]},m=0;const g=async()=>{let b=!1;const k=z=>{Rw(z,()=>n.signal,()=>b=!0)},S=oy(n.options,n.fetchOptions),$=async(z,E,T)=>{if(b)return Promise.reject(n.signal.reason);if(E==null&&z.pages.length)return Promise.resolve(z);const O=(()=>{const B={client:n.client,queryKey:n.queryKey,pageParam:E,direction:T?"backward":"forward",meta:n.options.meta};return k(B),B})(),Q=await S(O),{maxPages:V}=n.options,q=T?Ew:Pw;return{pages:q(z.pages,Q,V),pageParams:q(z.pageParams,E,V)}};if(o&&c.length){const z=o==="backward",E=z?hy:Yh,T={pages:c,pageParams:d};h=await $(T,E(i,T),z)}else{const z=e??c.length;do{const E=m===0?d[0]??i.initialPageParam:Yh(i,h);if(m>0&&E==null)break;h=await $(h,E),m++}while(m<z)}return h};n.options.persister?n.fetchFn=()=>{var b,k;return(k=(b=n.options).persister)==null?void 0:k.call(b,g,{client:n.client,queryKey:n.queryKey,meta:n.options.meta,signal:n.signal},r)}:n.fetchFn=g}}}function Yh(e,{pages:n,pageParams:r}){const i=n.length-1;return n.length>0?e.getNextPageParam(n[i],n,r[i],r):void 0}function hy(e,{pages:n,pageParams:r}){var i;return n.length>0?(i=e.getPreviousPageParam)==null?void 0:i.call(e,n[0],n,r[0],r):void 0}function Aw(e,n){return n?Yh(e,n)!=null:!1}function Lw(e,n){return!n||!e.getPreviousPageParam?!1:hy(e,n)!=null}var Ei,va,Ri,Wn,ya,$t,vo,ja,ds,Vs,zv,Fw=(zv=class extends dy{constructor(n){super();xe(this,ds);xe(this,Ei);xe(this,va);xe(this,Ri);xe(this,Wn);xe(this,ya);xe(this,$t);xe(this,vo);xe(this,ja);te(this,ja,!1),te(this,vo,n.defaultOptions),this.setOptions(n.options),this.observers=[],te(this,ya,n.client),te(this,Wn,_(this,ya).getQueryCache()),this.queryKey=n.queryKey,this.queryHash=n.queryHash,te(this,va,Rg(this.options)),this.state=n.state??_(this,va),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return _(this,Ei)}get promise(){var n;return(n=_(this,$t))==null?void 0:n.promise}setOptions(n){if(this.options={..._(this,vo),...n},n!=null&&n._type&&te(this,Ei,n._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Rg(this.options);r.data!==void 0&&(this.setState(Eg(r.data,r.dataUpdatedAt)),te(this,va,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_(this,Wn).remove(this)}setData(n,r){const i=Jh(this.state.data,n,this.options);return Pe(this,ds,Vs).call(this,{data:i,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),i}setState(n){Pe(this,ds,Vs).call(this,{type:"setState",state:n})}cancel(n){var i,o;const r=(i=_(this,$t))==null?void 0:i.promise;return(o=_(this,$t))==null||o.cancel(n),r?r.then(nn).catch(nn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return _(this,va)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(n=>Ct(n.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Df||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(n=>Ct(n.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(n=>n.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(n=0){return this.state.data===void 0?!0:n==="static"?!1:this.state.isInvalidated?!0:!ly(this.state.dataUpdatedAt,n)}onFocus(){var n,r;(n=this.observers.find(i=>i.shouldFetchOnWindowFocus()))==null||n.refetch({cancelRefetch:!1}),(r=_(this,$t))==null||r.continue()}onOnline(){var n,r;(n=this.observers.find(i=>i.shouldFetchOnReconnect()))==null||n.refetch({cancelRefetch:!1}),(r=_(this,$t))==null||r.continue()}addObserver(n){this.observers.includes(n)||(this.observers.push(n),this.clearGcTimeout(),_(this,Wn).notify({type:"observerAdded",query:this,observer:n}))}removeObserver(n){const r=this.observers.indexOf(n);r!==-1&&(this.observers.splice(r,1),this.observers.length||(_(this,$t)&&(_(this,ja)||this.state.fetchStatus==="paused"&&this.state.status==="pending"?_(this,$t).cancel({revert:!0}):_(this,$t).cancelRetry()),this.scheduleGc()),_(this,Wn).notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Pe(this,ds,Vs).call(this,{type:"invalidate"})}async fetch(n,r){var g,p,v,j,C,y,b,k,S,$,z,E;if(this.state.fetchStatus!=="idle"&&((g=_(this,$t))==null?void 0:g.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(_(this,$t))return _(this,$t).continueRetry(),_(this,$t).promise}if(n&&this.setOptions(n),!this.options.queryFn){const T=this.observers.find(M=>M.options.queryFn);T&&this.setOptions(T.options)}const i=new AbortController,o=T=>{Object.defineProperty(T,"signal",{enumerable:!0,get:()=>(te(this,ja,!0),i.signal)})},c=()=>{const T=oy(this.options,r),O=(()=>{const Q={client:_(this,ya),queryKey:this.queryKey,meta:this.meta};return o(Q),Q})();return te(this,ja,!1),this.options.persister?this.options.persister(T,O,this):T(O)},h=(()=>{const T={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:_(this,ya),state:this.state,fetchFn:c};return o(T),T})();(p=_(this,Ei)==="infinite"?Ow(this.options.pages):this.options.behavior)==null||p.onFetch(h,this),te(this,Ri,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((v=h.fetchOptions)==null?void 0:v.meta))&&Pe(this,ds,Vs).call(this,{type:"fetch",meta:(j=h.fetchOptions)==null?void 0:j.meta});const m=te(this,$t,uy({initialPromise:r==null?void 0:r.initialPromise,fn:h.fetchFn,onCancel:T=>{T instanceof Xh&&T.revert&&this.setState({..._(this,Ri),fetchStatus:"idle"}),i.abort()},onFail:(T,M)=>{Pe(this,ds,Vs).call(this,{type:"failed",failureCount:T,error:M})},onPause:()=>{Pe(this,ds,Vs).call(this,{type:"pause"})},onContinue:()=>{Pe(this,ds,Vs).call(this,{type:"continue"})},retry:h.options.retry,retryDelay:h.options.retryDelay,networkMode:h.options.networkMode,canRun:()=>!0}));try{const T=await m.start();if(T===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(T),(y=(C=_(this,Wn).config).onSuccess)==null||y.call(C,T,this),(k=(b=_(this,Wn).config).onSettled)==null||k.call(b,T,this.state.error,this),T}catch(T){if(T instanceof Xh){if(T.silent)return _(this,$t).promise;if(T.revert){if(this.state.data===void 0)throw T;return this.state.data}}throw Pe(this,ds,Vs).call(this,{type:"error",error:T}),($=(S=_(this,Wn).config).onError)==null||$.call(S,T,this),(E=(z=_(this,Wn).config).onSettled)==null||E.call(z,this.state.data,T,this),T}finally{_(this,$t)===m&&te(this,$t,void 0),this.scheduleGc()}}},Ei=new WeakMap,va=new WeakMap,Ri=new WeakMap,Wn=new WeakMap,ya=new WeakMap,$t=new WeakMap,vo=new WeakMap,ja=new WeakMap,ds=new WeakSet,Vs=function(n){const r=i=>{switch(n.type){case"failed":return{...i,fetchFailureCount:n.failureCount,fetchFailureReason:n.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...fy(i.data,this.options),fetchMeta:n.meta??null};case"success":const o={...i,...Eg(n.data,n.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return te(this,Ri,n.manual?o:void 0),o;case"error":const c=n.error;return{...i,error:c,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:c,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...n.state}}};this.state=r(this.state),_t.batch(()=>{this.observers.slice().forEach(i=>{i.onQueryUpdate()}),_(this,Wn).notify({query:this,type:"updated",action:n})})},zv);function fy(e,n){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:cy(n.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Eg(e,n){return{data:e,dataUpdatedAt:n??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Rg(e){const n=typeof e.initialData=="function"?e.initialData():e.initialData,r=n!==void 0,i=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:n,dataUpdateCount:0,dataUpdatedAt:r?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var hn,We,yo,fn,ba,Mi,Ks,jo,Ti,qi,wa,Na,$r,Ii,tt,Xl,ef,tf,nf,sf,rf,af,lf,of,Ov,qu=(Ov=class extends Oa{constructor(n,r){super();xe(this,tt);xe(this,hn);xe(this,We);xe(this,yo);xe(this,fn);xe(this,ba);xe(this,Mi);xe(this,Ks);xe(this,jo);xe(this,Ti);xe(this,qi);xe(this,wa);xe(this,Na);xe(this,$r);xe(this,Ii,new Set);this.options=r,te(this,hn,n),te(this,Ks,null),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(_(this,We).addObserver(this),Mg(_(this,We),this.options)?Pe(this,tt,Xl).call(this):this.updateResult(),Pe(this,tt,rf).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return cf(_(this,We),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return cf(_(this,We),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Pe(this,tt,af).call(this),Pe(this,tt,lf).call(this),_(this,We).removeObserver(this)}setOptions(n){const r=this.options,i=_(this,We);if(this.options=_(this,hn).defaultQueryOptions(n),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ct(this.options.enabled,_(this,We))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Pe(this,tt,of).call(this),_(this,We).setOptions(this.options),r._defaulted&&!to(this.options,r)&&_(this,hn).getQueryCache().notify({type:"observerOptionsUpdated",query:_(this,We),observer:this});const o=this.hasListeners();o&&Tg(_(this,We),i,this.options,r)&&Pe(this,tt,Xl).call(this),this.updateResult(),o&&(_(this,We)!==i||Ct(this.options.enabled,_(this,We))!==Ct(r.enabled,_(this,We))||Ct(this.options.staleTime,_(this,We))!==Ct(r.staleTime,_(this,We)))&&Pe(this,tt,tf).call(this);const c=Pe(this,tt,nf).call(this);o&&(_(this,We)!==i||Ct(this.options.enabled,_(this,We))!==Ct(r.enabled,_(this,We))||c!==_(this,$r))&&Pe(this,tt,sf).call(this,c)}getOptimisticResult(n){const r=_(this,hn).getQueryCache().build(_(this,hn),n),i=this.createResult(r,n);return to(this.getCurrentResult(),i)||(te(this,fn,i),te(this,Mi,this.options),te(this,ba,_(this,We).state)),i}getCurrentResult(){return _(this,fn)}trackResult(n,r){return new Proxy(n,{get:(i,o)=>(this.trackProp(o),r==null||r(o),Reflect.get(i,o))})}trackProp(n){_(this,Ii).add(n)}getCurrentQuery(){return _(this,We)}refetch({...n}={}){return this.fetch({...n})}fetchOptimistic(n){const r=_(this,hn).defaultQueryOptions(n),i=_(this,hn).getQueryCache().build(_(this,hn),r);let o=()=>{},c;const d=new Promise(h=>{c=h,o=_(this,hn).getQueryCache().subscribe(m=>{m.type==="updated"&&m.query.queryHash===i.queryHash&&i.state.data!==void 0&&(o(),h(this.createResult(i,r)))})});return Promise.race([i.fetch().then(()=>{const h=this.createResult(i,r);return c==null||c(h),h}).finally(()=>{o()}),d])}fetch(n){return Pe(this,tt,Xl).call(this,{...n,cancelRefetch:n.cancelRefetch??!0}).then(()=>(this.updateResult(),_(this,fn)))}createResult(n,r){var M;const i=_(this,We),o=this.options,c=_(this,fn),d=_(this,ba),h=_(this,Mi),m=n!==i?n.state:_(this,yo),{state:g}=n;let p={...g},v=!1,j;if(r._optimisticResults){const O=this.hasListeners(),Q=!O&&Mg(n,r),V=O&&Tg(n,i,r,o);(Q||V)&&(p={...p,...fy(g.data,n.options)}),r._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:C,errorUpdatedAt:y,status:b}=p;j=p.data;let k=!1;if(r.placeholderData!==void 0&&j===void 0&&b==="pending"){let O;c!=null&&c.isPlaceholderData&&r.placeholderData===(h==null?void 0:h.placeholderData)?(O=c.data,k=!0):O=typeof r.placeholderData=="function"?r.placeholderData((M=_(this,qi))==null?void 0:M.state.data,_(this,qi)):r.placeholderData,O!==void 0&&(b="success",j=Jh(c==null?void 0:c.data,O,r),v=!0)}if(r.select&&j!==void 0&&!k)if(c&&j===(d==null?void 0:d.data)&&r.select===_(this,jo))j=_(this,Ti);else try{te(this,jo,r.select),j=r.select(j),j=Jh(c==null?void 0:c.data,j,r),te(this,Ti,j),te(this,Ks,null)}catch(O){te(this,Ks,O)}else j===void 0&&te(this,Ks,null);_(this,Ks)&&(C=_(this,Ks),j=_(this,Ti),y=Date.now(),b="error",v=!1);const S=p.fetchStatus==="fetching",$=b==="pending",z=b==="error",E=$&&S,T=j!==void 0;return{status:b,fetchStatus:p.fetchStatus,isPending:$,isSuccess:b==="success",isError:z,isInitialLoading:E,isLoading:E,data:j,dataUpdatedAt:p.dataUpdatedAt,error:C,errorUpdatedAt:y,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:n.isFetched(),isFetchedAfterMount:p.dataUpdateCount>m.dataUpdateCount||p.errorUpdateCount>m.errorUpdateCount,isFetching:S,isRefetching:S&&!$,isLoadingError:z&&!T,isPaused:p.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:z&&T,isStale:Vf(n,r),refetch:this.refetch,isEnabled:Ct(r.enabled,n)!==!1}}updateResult(){const n=_(this,fn),r=this.createResult(_(this,We),this.options);if(te(this,ba,_(this,We).state),te(this,Mi,this.options),_(this,ba).data!==void 0&&te(this,qi,_(this,We)),to(r,n))return;te(this,fn,r);const o=(()=>{if(!n)return!0;const{notifyOnChangeProps:c}=this.options,d=typeof c=="function"?c():c;if(d==="all"||!d&&!_(this,Ii).size)return!0;const h=new Set(d??_(this,Ii));return this.options.throwOnError&&h.add("error"),Object.keys(_(this,fn)).some(m=>{const g=m;return _(this,fn)[g]!==n[g]&&h.has(g)})})();_t.batch(()=>{o&&this.listeners.forEach(c=>{c(_(this,fn))}),_(this,hn).getQueryCache().notify({query:_(this,We),type:"observerResultsUpdated"})})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Pe(this,tt,rf).call(this)}},hn=new WeakMap,We=new WeakMap,yo=new WeakMap,fn=new WeakMap,ba=new WeakMap,Mi=new WeakMap,Ks=new WeakMap,jo=new WeakMap,Ti=new WeakMap,qi=new WeakMap,wa=new WeakMap,Na=new WeakMap,$r=new WeakMap,Ii=new WeakMap,tt=new WeakSet,Xl=function(n){Pe(this,tt,of).call(this);let r=_(this,We).fetch(this.options,n);return n!=null&&n.throwOnError||(r=r.catch(nn)),r},ef=function(n){return!Qf()&&Ct(this.options.enabled,_(this,We))!==!1&&iy(n)},tf=function(){Pe(this,tt,af).call(this);const n=Ct(this.options.staleTime,_(this,We));if(_(this,fn).isStale||!Pe(this,tt,ef).call(this,n))return;const r=ly(_(this,fn).dataUpdatedAt,n)+1;te(this,wa,pa.setTimeout(()=>{_(this,fn).isStale||this.updateResult()},r))},nf=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(_(this,We)):this.options.refetchInterval)??!1},sf=function(n){Pe(this,tt,lf).call(this),te(this,$r,n),!(_(this,$r)===0||!Pe(this,tt,ef).call(this,_(this,$r)))&&te(this,Na,pa.setInterval(()=>{(this.options.refetchIntervalInBackground||Bf.isFocused())&&Pe(this,tt,Xl).call(this)},_(this,$r)))},rf=function(){Pe(this,tt,tf).call(this),Pe(this,tt,sf).call(this,Pe(this,tt,nf).call(this))},af=function(){_(this,wa)!==void 0&&(pa.clearTimeout(_(this,wa)),te(this,wa,void 0))},lf=function(){_(this,Na)!==void 0&&(pa.clearInterval(_(this,Na)),te(this,Na,void 0))},of=function(){const n=_(this,hn).getQueryCache().build(_(this,hn),this.options);if(n===_(this,We))return;const r=_(this,We);te(this,We,n),te(this,yo,n.state),this.hasListeners()&&(r==null||r.removeObserver(this),n.addObserver(this))},Ov);function Dw(e,n){return Ct(n.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Ct(n.retryOnMount,e)===!1)}function Mg(e,n){return Dw(e,n)||e.state.data!==void 0&&cf(e,n,n.refetchOnMount)}function cf(e,n,r){if(Ct(n.enabled,e)!==!1&&Ct(n.staleTime,e)!=="static"){const i=typeof r=="function"?r(e):r;return i==="always"||i!==!1&&Vf(e,n)}return!1}function Tg(e,n,r,i){return(e!==n||Ct(i.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Vf(e,r)}function Vf(e,n){return Ct(n.enabled,e)!==!1&&e.isStaleByTime(Ct(n.staleTime,e))}var Uw=class extends qu{constructor(e,n){super(e,n)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,n){var C,y;const{state:r}=e,i=super.createResult(e,n),{isFetching:o,isRefetching:c,isError:d,isRefetchError:h}=i,m=(y=(C=r.fetchMeta)==null?void 0:C.fetchMore)==null?void 0:y.direction,g=d&&m==="forward",p=o&&m==="forward",v=d&&m==="backward",j=o&&m==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Aw(n,r.data),hasPreviousPage:Lw(n,r.data),isFetchNextPageError:g,isFetchingNextPage:p,isFetchPreviousPageError:v,isFetchingPreviousPage:j,isRefetchError:h&&!g&&!v,isRefetching:c&&!p&&!j}}},bo,ks,Yt,ka,Ss,Rr,Av,Qw=(Av=class extends dy{constructor(n){super();xe(this,Ss);xe(this,bo);xe(this,ks);xe(this,Yt);xe(this,ka);te(this,bo,n.client),this.mutationId=n.mutationId,te(this,Yt,n.mutationCache),te(this,ks,[]),this.state=n.state||my(),this.setOptions(n.options),this.scheduleGc()}setOptions(n){this.options=n,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(n){_(this,ks).includes(n)||(_(this,ks).push(n),this.clearGcTimeout(),_(this,Yt).notify({type:"observerAdded",mutation:this,observer:n}))}removeObserver(n){te(this,ks,_(this,ks).filter(r=>r!==n)),this.scheduleGc(),_(this,Yt).notify({type:"observerRemoved",mutation:this,observer:n})}optionalRemove(){_(this,ks).length||(this.state.status==="pending"?this.scheduleGc():_(this,Yt).remove(this))}continue(){var n;return((n=_(this,ka))==null?void 0:n.continue())??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(n){var h,m,g,p,v,j,C,y,b,k,S,$,z,E,T,M,O,Q;const r=()=>{Pe(this,Ss,Rr).call(this,{type:"continue"})},i={client:_(this,bo),meta:this.options.meta,mutationKey:this.options.mutationKey},o=te(this,ka,uy({fn:()=>this.options.mutationFn?this.options.mutationFn(n,i):Promise.reject(new Error("No mutationFn found")),onFail:(V,q)=>{Pe(this,Ss,Rr).call(this,{type:"failed",failureCount:V,error:q})},onPause:()=>{Pe(this,Ss,Rr).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_(this,Yt).canRun(this)})),c=this.state.status==="pending",d=!o.canStart();try{if(c)r();else{Pe(this,Ss,Rr).call(this,{type:"pending",variables:n,isPaused:d}),_(this,Yt).config.onMutate&&await _(this,Yt).config.onMutate(n,this,i);const q=await((m=(h=this.options).onMutate)==null?void 0:m.call(h,n,i));q!==this.state.context&&Pe(this,Ss,Rr).call(this,{type:"pending",context:q,variables:n,isPaused:d})}const V=await o.start();return await((p=(g=_(this,Yt).config).onSuccess)==null?void 0:p.call(g,V,n,this.state.context,this,i)),await((j=(v=this.options).onSuccess)==null?void 0:j.call(v,V,n,this.state.context,i)),await((y=(C=_(this,Yt).config).onSettled)==null?void 0:y.call(C,V,null,this.state.variables,this.state.context,this,i)),await((k=(b=this.options).onSettled)==null?void 0:k.call(b,V,null,n,this.state.context,i)),Pe(this,Ss,Rr).call(this,{type:"success",data:V}),V}catch(V){try{await(($=(S=_(this,Yt).config).onError)==null?void 0:$.call(S,V,n,this.state.context,this,i))}catch(q){Promise.reject(q)}try{await((E=(z=this.options).onError)==null?void 0:E.call(z,V,n,this.state.context,i))}catch(q){Promise.reject(q)}try{await((M=(T=_(this,Yt).config).onSettled)==null?void 0:M.call(T,void 0,V,this.state.variables,this.state.context,this,i))}catch(q){Promise.reject(q)}try{await((Q=(O=this.options).onSettled)==null?void 0:Q.call(O,void 0,V,n,this.state.context,i))}catch(q){Promise.reject(q)}throw Pe(this,Ss,Rr).call(this,{type:"error",error:V}),V}finally{_(this,ka)===o&&te(this,ka,void 0),_(this,Yt).runNext(this)}}},bo=new WeakMap,ks=new WeakMap,Yt=new WeakMap,ka=new WeakMap,Ss=new WeakSet,Rr=function(n){const r=i=>{switch(n.type){case"failed":return{...i,failureCount:n.failureCount,failureReason:n.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:n.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:n.isPaused,status:"pending",variables:n.variables,submittedAt:Date.now()};case"success":return{...i,data:n.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:n.error,failureCount:i.failureCount+1,failureReason:n.error,isPaused:!1,status:"error"}}};this.state=r(this.state),_t.batch(()=>{_(this,ks).forEach(i=>{i.onMutationUpdate(n)}),_(this,Yt).notify({mutation:this,type:"updated",action:n})})},Av);function my(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ws,hs,wo,Lv,Bw=(Lv=class extends Oa{constructor(n={}){super();xe(this,Ws);xe(this,hs);xe(this,wo);this.config=n,te(this,Ws,new Set),te(this,hs,new Map),te(this,wo,0)}build(n,r,i){const o=new Qw({client:n,mutationCache:this,mutationId:++Kc(this,wo)._,options:n.defaultMutationOptions(r),state:i});return this.add(o),o}add(n){_(this,Ws).add(n);const r=Zc(n);if(typeof r=="string"){const i=_(this,hs).get(r);i?i.push(n):_(this,hs).set(r,[n])}this.notify({type:"added",mutation:n})}remove(n){if(_(this,Ws).delete(n)){const r=Zc(n);if(typeof r=="string"){const i=_(this,hs).get(r);if(i)if(i.length>1){const o=i.indexOf(n);o!==-1&&i.splice(o,1)}else i[0]===n&&_(this,hs).delete(r)}}this.notify({type:"removed",mutation:n})}canRun(n){var i;const r=Zc(n);if(typeof r=="string"){const o=(i=_(this,hs).get(r))==null?void 0:i.find(c=>c.state.status==="pending");return!o||o===n}else return!0}runNext(n){var i,o;const r=Zc(n);return typeof r=="string"?((o=(i=_(this,hs).get(r))==null?void 0:i.find(c=>c!==n&&c.state.isPaused))==null?void 0:o.continue())??Promise.resolve():Promise.resolve()}clear(){_t.batch(()=>{_(this,Ws).forEach(n=>{this.notify({type:"removed",mutation:n})}),_(this,Ws).clear(),_(this,hs).clear()})}getAll(){return Array.from(_(this,Ws))}find(n){const r={exact:!0,...n};return this.getAll().find(i=>Cg(r,i))}findAll(n={}){return this.getAll().filter(r=>Cg(n,r))}notify(n){_t.batch(()=>{this.listeners.forEach(r=>{r(n)})})}resumePausedMutations(){const n=this.getAll().filter(r=>r.state.isPaused);return _t.batch(()=>Promise.all(n.map(r=>r.continue().catch(nn))))}},Ws=new WeakMap,hs=new WeakMap,wo=new WeakMap,Lv);function Zc(e){var n;return(n=e.options.scope)==null?void 0:n.id}var Zs,zr,en,Gs,Ps,Yl,uf,Fv,Vw=(Fv=class extends Oa{constructor(r,i){super();xe(this,Ps);xe(this,Zs);xe(this,zr);xe(this,en);xe(this,Gs);te(this,Zs,r),this.setOptions(i),this.bindMethods(),Pe(this,Ps,Yl).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var o;const i=this.options;this.options=_(this,Zs).defaultMutationOptions(r),to(this.options,i)||_(this,Zs).getMutationCache().notify({type:"observerOptionsUpdated",mutation:_(this,en),observer:this}),i!=null&&i.mutationKey&&this.options.mutationKey&&Ea(i.mutationKey)!==Ea(this.options.mutationKey)?this.reset():((o=_(this,en))==null?void 0:o.state.status)==="pending"&&_(this,en).setOptions(this.options)}onSubscribe(){this.listeners.size===1&&_(this,en)&&(_(this,en).addObserver(this),Pe(this,Ps,Yl).call(this))}onUnsubscribe(){var r;this.hasListeners()||(r=_(this,en))==null||r.removeObserver(this)}onMutationUpdate(r){Pe(this,Ps,Yl).call(this),Pe(this,Ps,uf).call(this,r)}getCurrentResult(){return _(this,zr)}reset(){var r;(r=_(this,en))==null||r.removeObserver(this),te(this,en,void 0),Pe(this,Ps,Yl).call(this),Pe(this,Ps,uf).call(this)}mutate(r,i){var o;return te(this,Gs,i),(o=_(this,en))==null||o.removeObserver(this),te(this,en,_(this,Zs).getMutationCache().build(_(this,Zs),this.options)),_(this,en).addObserver(this),_(this,en).execute(r)}},Zs=new WeakMap,zr=new WeakMap,en=new WeakMap,Gs=new WeakMap,Ps=new WeakSet,Yl=function(){var i;const r=((i=_(this,en))==null?void 0:i.state)??my();te(this,zr,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},uf=function(r){_t.batch(()=>{var i,o,c,d,h,m,g,p;if(_(this,Gs)&&this.hasListeners()){const v=_(this,zr).variables,j=_(this,zr).context,C={client:_(this,Zs),meta:this.options.meta,mutationKey:this.options.mutationKey};if((r==null?void 0:r.type)==="success"){try{(o=(i=_(this,Gs)).onSuccess)==null||o.call(i,r.data,v,j,C)}catch(y){Promise.reject(y)}try{(d=(c=_(this,Gs)).onSettled)==null||d.call(c,r.data,null,v,j,C)}catch(y){Promise.reject(y)}}else if((r==null?void 0:r.type)==="error"){try{(m=(h=_(this,Gs)).onError)==null||m.call(h,r.error,v,j,C)}catch(y){Promise.reject(y)}try{(p=(g=_(this,Gs)).onSettled)==null||p.call(g,void 0,r.error,v,j,C)}catch(y){Promise.reject(y)}}}this.listeners.forEach(v=>{v(_(this,zr))})})},Fv);function qg(e,n){const r=new Set(n);return e.filter(i=>!r.has(i))}var $i,mn,zi,Sa,zn,Ca,No,ko,So,Co,zt,df,hf,py,ff,mf,pf,Dv,Hw=(Dv=class extends Oa{constructor(n,r,i){super();xe(this,zt);xe(this,$i);xe(this,mn);xe(this,zi);xe(this,Sa);xe(this,zn);xe(this,Ca);xe(this,No);xe(this,ko);xe(this,So);xe(this,Co,[]);te(this,$i,n),te(this,Sa,i),te(this,zi,[]),te(this,zn,[]),te(this,mn,[]),this.setQueries(r)}onSubscribe(){this.listeners.size===1&&_(this,zn).forEach(n=>{n.subscribe(r=>{Pe(this,zt,mf).call(this,n,r)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,_(this,zn).forEach(n=>{n.destroy()})}setQueries(n,r){te(this,zi,n),te(this,Sa,r),_t.batch(()=>{const i=_(this,zn),o=Pe(this,zt,ff).call(this,_(this,zi));o.forEach(v=>v.observer.setOptions(v.defaultedQueryOptions));const c=o.map(v=>v.observer),d=c.map(v=>v.getCurrentResult()),h=i.length!==c.length,m=c.some((v,j)=>v!==i[j]),g=h||m,p=g?!0:d.some((v,j)=>{const C=_(this,mn)[j];return!C||!to(v,C)});!g&&!p||(g&&(te(this,Co,o),te(this,zn,c)),te(this,mn,d),this.hasListeners()&&(g&&(qg(i,c).forEach(v=>{v.destroy()}),qg(c,i).forEach(v=>{v.subscribe(j=>{Pe(this,zt,mf).call(this,v,j)})})),Pe(this,zt,pf).call(this)))})}getCurrentResult(){return _(this,mn)}getQueries(){return _(this,zn).map(n=>n.getCurrentQuery())}getObservers(){return _(this,zn)}getOptimisticResult(n,r){const i=Pe(this,zt,ff).call(this,n),o=i.map(d=>d.observer.getOptimisticResult(d.defaultedQueryOptions)),c=i.map(d=>d.defaultedQueryOptions.queryHash);return[o,d=>Pe(this,zt,hf).call(this,d??o,r,c),()=>Pe(this,zt,df).call(this,o,i)]}},$i=new WeakMap,mn=new WeakMap,zi=new WeakMap,Sa=new WeakMap,zn=new WeakMap,Ca=new WeakMap,No=new WeakMap,ko=new WeakMap,So=new WeakMap,Co=new WeakMap,zt=new WeakSet,df=function(n,r){const i=new Set;return r.map((o,c)=>{const d=n[c];return o.defaultedQueryOptions.notifyOnChangeProps?d:o.observer.trackResult(d,h=>{i.has(h)||(i.add(h),r.forEach(m=>{m.observer.trackProp(h)}))})})},hf=function(n,r,i){if(r){const o=_(this,So),c=i!==void 0&&o!==void 0&&(o.length!==i.length||i.some((d,h)=>d!==o[h]));return(_(this,mn)!==_(this,ko)||c||r!==_(this,No))&&(te(this,No,r),te(this,ko,_(this,mn)),i!==void 0&&te(this,So,i),te(this,Ca,Ff(_(this,Ca),r(n)))),_(this,Ca)}return n},py=function(){var n;return!((n=_(this,Sa))!=null&&n.combine)||_(this,zn).some((r,i)=>{var o;return r.options.suspense&&((o=_(this,mn)[i])==null?void 0:o.data)===void 0})},ff=function(n){const r=new Map;_(this,zn).forEach(o=>{const c=o.options.queryHash;if(!c)return;const d=r.get(c);d?d.push(o):r.set(c,[o])});const i=[];return n.forEach(o=>{var h;const c=_(this,$i).defaultQueryOptions(o),d=((h=r.get(c.queryHash))==null?void 0:h.shift())??new qu(_(this,$i),c);i.push({defaultedQueryOptions:c,observer:d})}),i},mf=function(n,r){const i=_(this,zn).indexOf(n);i!==-1&&(te(this,mn,_(this,mn).slice()),_(this,mn)[i]=r,Pe(this,zt,pf).call(this))},pf=function(){var n;if(this.hasListeners()){const r=Pe(this,zt,py).call(this),i=_(this,Ca),o=r?i:Pe(this,zt,hf).call(this,Pe(this,zt,df).call(this,_(this,mn),_(this,Co)),(n=_(this,Sa))==null?void 0:n.combine);(r||i!==o)&&_t.batch(()=>{this.listeners.forEach(c=>{c(_(this,mn))})})}},Dv),Cs,Uv,Kw=(Uv=class extends Oa{constructor(n={}){super();xe(this,Cs);this.config=n,te(this,Cs,new Map)}build(n,r,i){const o=r.queryKey,c=r.queryHash??Lf(o,r);let d=this.get(c);return d||(d=new Fw({client:n,queryKey:o,queryHash:c,options:n.defaultQueryOptions(r),state:i,defaultOptions:n.getQueryDefaults(o)}),this.add(d)),d}add(n){_(this,Cs).has(n.queryHash)||(_(this,Cs).set(n.queryHash,n),this.notify({type:"added",query:n}))}remove(n){const r=_(this,Cs).get(n.queryHash);r&&(n.destroy(),r===n&&_(this,Cs).delete(n.queryHash),this.notify({type:"removed",query:n}))}clear(){_t.batch(()=>{this.getAll().forEach(n=>{this.remove(n)})})}get(n){return _(this,Cs).get(n)}getAll(){return[..._(this,Cs).values()]}find(n){const r={exact:!0,...n};return this.getAll().find(i=>Sg(r,i))}findAll(n={}){const r=this.getAll();return Object.keys(n).length>0?r.filter(i=>Sg(n,i)):r}notify(n){_t.batch(()=>{this.listeners.forEach(r=>{r(n)})})}onFocus(){_t.batch(()=>{this.getAll().forEach(n=>{n.onFocus()})})}onOnline(){_t.batch(()=>{this.getAll().forEach(n=>{n.onOnline()})})}},Cs=new WeakMap,Uv),kt,Or,Ar,Oi,Ai,Lr,Li,Fi,Qv,Ww=(Qv=class{constructor(e={}){xe(this,kt);xe(this,Or);xe(this,Ar);xe(this,Oi);xe(this,Ai);xe(this,Lr);xe(this,Li);xe(this,Fi);te(this,kt,e.queryCache||new Kw),te(this,Or,e.mutationCache||new Bw),te(this,Ar,e.defaultOptions||{}),te(this,Oi,new Map),te(this,Ai,new Map),te(this,Lr,0)}mount(){Kc(this,Lr)._++,_(this,Lr)===1&&(te(this,Li,Bf.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,kt).onFocus())})),te(this,Fi,cu.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,kt).onOnline())})))}unmount(){var e,n;Kc(this,Lr)._--,_(this,Lr)===0&&((e=_(this,Li))==null||e.call(this),te(this,Li,void 0),(n=_(this,Fi))==null||n.call(this),te(this,Fi,void 0))}isFetching(e){return _(this,kt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return _(this,Or).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const n=this.defaultQueryOptions({queryKey:e});return(r=_(this,kt).get(n.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const n=this.defaultQueryOptions(e),r=_(this,kt).build(this,n),i=r.state.data;return i===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Ct(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(i))}getQueriesData(e){return _(this,kt).findAll(e).map(({queryKey:n,state:r})=>[n,r.data])}setQueryData(e,n,r){var d;const i=this.defaultQueryOptions({queryKey:e}),o=(d=_(this,kt).get(i.queryHash))==null?void 0:d.state.data,c=Sw(n,o);if(c!==void 0)return _(this,kt).build(this,i).setData(c,{...r,manual:!0})}setQueriesData(e,n,r){return _t.batch(()=>_(this,kt).findAll(e).map(({queryKey:i})=>[i,this.setQueryData(i,n,r)]))}getQueryState(e){var r;const n=this.defaultQueryOptions({queryKey:e});return(r=_(this,kt).get(n.queryHash))==null?void 0:r.state}removeQueries(e){const n=_(this,kt);_t.batch(()=>{n.findAll(e).forEach(r=>{n.remove(r)})})}resetQueries(e,n){const r=_(this,kt);return _t.batch(()=>{const i=r.findAll(e),o=new Set(i);return i.forEach(c=>{c.reset()}),this.refetchQueries({type:"active",predicate:c=>o.has(c)},n)})}cancelQueries(e,n={}){const r={revert:!0,...n},i=_t.batch(()=>_(this,kt).findAll(e).map(o=>o.cancel(r)));return Promise.all(i).then(nn).catch(nn)}invalidateQueries(e,n={}){return _t.batch(()=>(_(this,kt).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},n)))}refetchQueries(e,n={}){const r={...n,cancelRefetch:n.cancelRefetch??!0},i=_t.batch(()=>_(this,kt).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let c=o.fetch(void 0,r);return r.throwOnError||(c=c.catch(nn)),o.state.fetchStatus==="paused"?Promise.resolve():c}));return Promise.all(i).then(nn)}async query(e){const n=this.defaultQueryOptions(e);n.retry===void 0&&(n.retry=!1);const r=_(this,kt).build(this,n),i=r.isStaleByTime(Ct(n.staleTime,r))?await r.fetch(n):r.state.data,o=n.select;return o?o(i):i}fetchQuery(e){const n=this.defaultQueryOptions(e);n.retry===void 0&&(n.retry=!1);const r=_(this,kt).build(this,n);return r.isStaleByTime(Ct(n.staleTime,r))?r.fetch(n):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(nn).catch(nn)}infiniteQuery(e){return e._type="infinite",this.query(e)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(nn).catch(nn)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return cu.isOnline()?_(this,Or).resumePausedMutations():Promise.resolve()}getQueryCache(){return _(this,kt)}getMutationCache(){return _(this,Or)}getDefaultOptions(){return _(this,Ar)}setDefaultOptions(e){te(this,Ar,e)}setQueryDefaults(e,n){_(this,Oi).set(Ea(e),{queryKey:e,defaultOptions:n})}getQueryDefaults(e){const n=[..._(this,Oi).values()],r={};return n.forEach(i=>{Ui(e,i.queryKey)&&Object.assign(r,i.defaultOptions)}),r}setMutationDefaults(e,n){_(this,Ai).set(Ea(e),{mutationKey:e,defaultOptions:n})}getMutationDefaults(e){const n=[..._(this,Ai).values()],r={};return n.forEach(i=>{Ui(e,i.mutationKey)&&Object.assign(r,i.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const n={..._(this,Ar).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return n.queryHash||(n.queryHash=Lf(n.queryKey,n)),n.refetchOnReconnect===void 0&&(n.refetchOnReconnect=n.networkMode!=="always"),n.throwOnError===void 0&&(n.throwOnError=!!n.suspense),!n.networkMode&&n.persister&&(n.networkMode="offlineFirst"),n.queryFn===Df&&(n.enabled=!1),n}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{..._(this,Ar).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){_(this,kt).clear(),_(this,Or).clear()}},kt=new WeakMap,Or=new WeakMap,Ar=new WeakMap,Oi=new WeakMap,Ai=new WeakMap,Lr=new WeakMap,Li=new WeakMap,Fi=new WeakMap,Qv);const xy=N.createContext(!1),gy=()=>N.useContext(xy);xy.Provider;function Zw(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}const Gw=N.createContext(Zw()),vy=()=>N.useContext(Gw),yy=(e,n,r)=>{const i=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Uf(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||i)&&(n.isReset()||(e.retryOnMount=!1))},jy=e=>{N.useEffect(()=>{e.clearReset()},[e])},by=({result:e,errorResetBoundary:n,throwOnError:r,query:i,suspense:o})=>e.isError&&!n.isReset()&&!e.isFetching&&i&&(o&&e.data===void 0||Uf(r,[e.error,i])),wy=e=>{if(e.suspense){const r=o=>o==="static"?o:Math.max(o??1e3,1e3),i=e.staleTime;e.staleTime=typeof i=="function"?(...o)=>r(i(...o)):r(i),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},xf=(e,n)=>(e==null?void 0:e.suspense)&&n.isPending,Ny=(e,n,r)=>n.fetchOptimistic(e).catch(()=>{r.clearReset()});function ky({queries:e,...n},r){const i=Ze(),o=gy(),c=vy(),d=n.subscribed!==!1,h=N.useMemo(()=>e.map(b=>{const k=i.defaultQueryOptions(b);return k._optimisticResults=o?"isRestoring":d?"optimistic":void 0,k}),[e,i,o,d]);h.forEach(b=>{wy(b);const k=i.getQueryCache().get(b.queryHash);yy(b,c,k)}),jy(c);const[m]=N.useState(()=>new Hw(i,h,n)),[g,p,v]=m.getOptimisticResult(h,n.combine),j=!o&&d;N.useSyncExternalStore(N.useCallback(b=>j?m.subscribe(_t.batchCalls(b)):nn,[m,j]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),N.useEffect(()=>{m.setQueries(h,n)},[h,n,m]);const C=g.some((b,k)=>xf(h[k],b))?g.flatMap((b,k)=>{const S=h[k];if(S&&xf(S,b)){const $=new qu(i,S);return Ny(S,$,c)}return[]}):[];if(C.length>0)throw Promise.all(C);const y=g.find((b,k)=>{const S=h[k];return S&&by({result:b,errorResetBoundary:c,throwOnError:S.throwOnError,query:i.getQueryCache().get(S.queryHash),suspense:S.suspense})});if(y)throw y.error;return p(v())}function Sy(e,n,r){const i=gy(),o=vy(),c=Ze(),d=c.defaultQueryOptions(e),h=c.getQueryCache().get(d.queryHash),m=e.subscribed!==!1;d._optimisticResults=i?"isRestoring":m?"optimistic":void 0,wy(d),yy(d,o,h),jy(o);const[g]=N.useState(()=>new n(c,d)),p=g.getOptimisticResult(d),v=!i&&m;if(N.useSyncExternalStore(N.useCallback(j=>{const C=v?g.subscribe(_t.batchCalls(j)):nn;return g.updateResult(),C},[g,v]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),N.useEffect(()=>{g.setOptions(d)},[d,g]),xf(d,p))throw Ny(d,g,o);if(by({result:p,errorResetBoundary:o,throwOnError:d.throwOnError,query:h,suspense:d.suspense}))throw p.error;return d.notifyOnChangeProps?p:g.trackResult(p)}function nt(e,n){return Sy(e,qu)}function Ke(e,n){const r=Ze(),[i]=N.useState(()=>new Vw(r,e));N.useEffect(()=>{i.setOptions(e)},[i,e]);const o=N.useSyncExternalStore(N.useCallback(d=>i.subscribe(_t.batchCalls(d)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),c=N.useCallback((...d)=>{i.mutate(d[0],d[1]).catch(nn)},[i]);if(o.error&&Uf(i.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:c,mutateAsync:o.mutate}}function Cy(e,n){return Sy(e,Uw)}/**
69
+ * @license lucide-react v0.469.0 - ISC
70
+ *
71
+ * This source code is licensed under the ISC license.
72
+ * See the LICENSE file in the root directory of this source tree.
73
+ */const Jw=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_y=(...e)=>e.filter((n,r,i)=>!!n&&n.trim()!==""&&i.indexOf(n)===r).join(" ").trim();/**
74
+ * @license lucide-react v0.469.0 - ISC
75
+ *
76
+ * This source code is licensed under the ISC license.
77
+ * See the LICENSE file in the root directory of this source tree.
78
+ */var Xw={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"};/**
79
+ * @license lucide-react v0.469.0 - ISC
80
+ *
81
+ * This source code is licensed under the ISC license.
82
+ * See the LICENSE file in the root directory of this source tree.
83
+ */const Yw=N.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:o="",children:c,iconNode:d,...h},m)=>N.createElement("svg",{ref:m,...Xw,width:n,height:n,stroke:e,strokeWidth:i?Number(r)*24/Number(n):r,className:_y("lucide",o),...h},[...d.map(([g,p])=>N.createElement(g,p)),...Array.isArray(c)?c:[c]]));/**
84
+ * @license lucide-react v0.469.0 - ISC
85
+ *
86
+ * This source code is licensed under the ISC license.
87
+ * See the LICENSE file in the root directory of this source tree.
88
+ */const re=(e,n)=>{const r=N.forwardRef(({className:i,...o},c)=>N.createElement(Yw,{ref:c,iconNode:n,className:_y(`lucide-${Jw(e)}`,i),...o}));return r.displayName=`${e}`,r};/**
89
+ * @license lucide-react v0.469.0 - ISC
90
+ *
91
+ * This source code is licensed under the ISC license.
92
+ * See the LICENSE file in the root directory of this source tree.
93
+ */const Eo=re("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
94
+ * @license lucide-react v0.469.0 - ISC
95
+ *
96
+ * This source code is licensed under the ISC license.
97
+ * See the LICENSE file in the root directory of this source tree.
98
+ */const eN=re("ArrowDownUp",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]);/**
99
+ * @license lucide-react v0.469.0 - ISC
100
+ *
101
+ * This source code is licensed under the ISC license.
102
+ * See the LICENSE file in the root directory of this source tree.
103
+ */const tN=re("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
104
+ * @license lucide-react v0.469.0 - ISC
105
+ *
106
+ * This source code is licensed under the ISC license.
107
+ * See the LICENSE file in the root directory of this source tree.
108
+ */const nN=re("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/**
109
+ * @license lucide-react v0.469.0 - ISC
110
+ *
111
+ * This source code is licensed under the ISC license.
112
+ * See the LICENSE file in the root directory of this source tree.
113
+ */const sN=re("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
114
+ * @license lucide-react v0.469.0 - ISC
115
+ *
116
+ * This source code is licensed under the ISC license.
117
+ * See the LICENSE file in the root directory of this source tree.
118
+ */const Hf=re("ArrowUpToLine",[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]]);/**
119
+ * @license lucide-react v0.469.0 - ISC
120
+ *
121
+ * This source code is licensed under the ISC license.
122
+ * See the LICENSE file in the root directory of this source tree.
123
+ */const rN=re("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
124
+ * @license lucide-react v0.469.0 - ISC
125
+ *
126
+ * This source code is licensed under the ISC license.
127
+ * See the LICENSE file in the root directory of this source tree.
128
+ */const aN=re("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
129
+ * @license lucide-react v0.469.0 - ISC
130
+ *
131
+ * This source code is licensed under the ISC license.
132
+ * See the LICENSE file in the root directory of this source tree.
133
+ */const iN=re("BellOff",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]);/**
134
+ * @license lucide-react v0.469.0 - ISC
135
+ *
136
+ * This source code is licensed under the ISC license.
137
+ * See the LICENSE file in the root directory of this source tree.
138
+ */const Kf=re("BellRing",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]]);/**
139
+ * @license lucide-react v0.469.0 - ISC
140
+ *
141
+ * This source code is licensed under the ISC license.
142
+ * See the LICENSE file in the root directory of this source tree.
143
+ */const Xi=re("Bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);/**
144
+ * @license lucide-react v0.469.0 - ISC
145
+ *
146
+ * This source code is licensed under the ISC license.
147
+ * See the LICENSE file in the root directory of this source tree.
148
+ */const Py=re("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
149
+ * @license lucide-react v0.469.0 - ISC
150
+ *
151
+ * This source code is licensed under the ISC license.
152
+ * See the LICENSE file in the root directory of this source tree.
153
+ */const lN=re("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
154
+ * @license lucide-react v0.469.0 - ISC
155
+ *
156
+ * This source code is licensed under the ISC license.
157
+ * See the LICENSE file in the root directory of this source tree.
158
+ */const Ey=re("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);/**
159
+ * @license lucide-react v0.469.0 - ISC
160
+ *
161
+ * This source code is licensed under the ISC license.
162
+ * See the LICENSE file in the root directory of this source tree.
163
+ */const Ro=re("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/**
164
+ * @license lucide-react v0.469.0 - ISC
165
+ *
166
+ * This source code is licensed under the ISC license.
167
+ * See the LICENSE file in the root directory of this source tree.
168
+ */const Wf=re("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
169
+ * @license lucide-react v0.469.0 - ISC
170
+ *
171
+ * This source code is licensed under the ISC license.
172
+ * See the LICENSE file in the root directory of this source tree.
173
+ */const Kr=re("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
174
+ * @license lucide-react v0.469.0 - ISC
175
+ *
176
+ * This source code is licensed under the ISC license.
177
+ * See the LICENSE file in the root directory of this source tree.
178
+ */const ms=re("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
179
+ * @license lucide-react v0.469.0 - ISC
180
+ *
181
+ * This source code is licensed under the ISC license.
182
+ * See the LICENSE file in the root directory of this source tree.
183
+ */const uu=re("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
184
+ * @license lucide-react v0.469.0 - ISC
185
+ *
186
+ * This source code is licensed under the ISC license.
187
+ * See the LICENSE file in the root directory of this source tree.
188
+ */const Dn=re("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
189
+ * @license lucide-react v0.469.0 - ISC
190
+ *
191
+ * This source code is licensed under the ISC license.
192
+ * See the LICENSE file in the root directory of this source tree.
193
+ */const oN=re("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/**
194
+ * @license lucide-react v0.469.0 - ISC
195
+ *
196
+ * This source code is licensed under the ISC license.
197
+ * See the LICENSE file in the root directory of this source tree.
198
+ */const cN=re("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/**
199
+ * @license lucide-react v0.469.0 - ISC
200
+ *
201
+ * This source code is licensed under the ISC license.
202
+ * See the LICENSE file in the root directory of this source tree.
203
+ */const Zf=re("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
204
+ * @license lucide-react v0.469.0 - ISC
205
+ *
206
+ * This source code is licensed under the ISC license.
207
+ * See the LICENSE file in the root directory of this source tree.
208
+ */const Ry=re("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
209
+ * @license lucide-react v0.469.0 - ISC
210
+ *
211
+ * This source code is licensed under the ISC license.
212
+ * See the LICENSE file in the root directory of this source tree.
213
+ */const My=re("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
214
+ * @license lucide-react v0.469.0 - ISC
215
+ *
216
+ * This source code is licensed under the ISC license.
217
+ * See the LICENSE file in the root directory of this source tree.
218
+ */const uN=re("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
219
+ * @license lucide-react v0.469.0 - ISC
220
+ *
221
+ * This source code is licensed under the ISC license.
222
+ * See the LICENSE file in the root directory of this source tree.
223
+ */const Ty=re("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
224
+ * @license lucide-react v0.469.0 - ISC
225
+ *
226
+ * This source code is licensed under the ISC license.
227
+ * See the LICENSE file in the root directory of this source tree.
228
+ */const dN=re("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
229
+ * @license lucide-react v0.469.0 - ISC
230
+ *
231
+ * This source code is licensed under the ISC license.
232
+ * See the LICENSE file in the root directory of this source tree.
233
+ */const hN=re("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
234
+ * @license lucide-react v0.469.0 - ISC
235
+ *
236
+ * This source code is licensed under the ISC license.
237
+ * See the LICENSE file in the root directory of this source tree.
238
+ */const Aa=re("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
239
+ * @license lucide-react v0.469.0 - ISC
240
+ *
241
+ * This source code is licensed under the ISC license.
242
+ * See the LICENSE file in the root directory of this source tree.
243
+ */const fN=re("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
244
+ * @license lucide-react v0.469.0 - ISC
245
+ *
246
+ * This source code is licensed under the ISC license.
247
+ * See the LICENSE file in the root directory of this source tree.
248
+ */const mN=re("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/**
249
+ * @license lucide-react v0.469.0 - ISC
250
+ *
251
+ * This source code is licensed under the ISC license.
252
+ * See the LICENSE file in the root directory of this source tree.
253
+ */const Ur=re("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
254
+ * @license lucide-react v0.469.0 - ISC
255
+ *
256
+ * This source code is licensed under the ISC license.
257
+ * See the LICENSE file in the root directory of this source tree.
258
+ */const Mo=re("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
259
+ * @license lucide-react v0.469.0 - ISC
260
+ *
261
+ * This source code is licensed under the ISC license.
262
+ * See the LICENSE file in the root directory of this source tree.
263
+ */const qy=re("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
264
+ * @license lucide-react v0.469.0 - ISC
265
+ *
266
+ * This source code is licensed under the ISC license.
267
+ * See the LICENSE file in the root directory of this source tree.
268
+ */const pN=re("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/**
269
+ * @license lucide-react v0.469.0 - ISC
270
+ *
271
+ * This source code is licensed under the ISC license.
272
+ * See the LICENSE file in the root directory of this source tree.
273
+ */const xN=re("FolderLock",[["rect",{width:"8",height:"5",x:"14",y:"17",rx:"1",key:"19aais"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2.5",key:"1w6v7t"}],["path",{d:"M20 17v-2a2 2 0 1 0-4 0v2",key:"pwaxnr"}]]);/**
274
+ * @license lucide-react v0.469.0 - ISC
275
+ *
276
+ * This source code is licensed under the ISC license.
277
+ * See the LICENSE file in the root directory of this source tree.
278
+ */const Iy=re("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
279
+ * @license lucide-react v0.469.0 - ISC
280
+ *
281
+ * This source code is licensed under the ISC license.
282
+ * See the LICENSE file in the root directory of this source tree.
283
+ */const Ig=re("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
284
+ * @license lucide-react v0.469.0 - ISC
285
+ *
286
+ * This source code is licensed under the ISC license.
287
+ * See the LICENSE file in the root directory of this source tree.
288
+ */const Ys=re("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
289
+ * @license lucide-react v0.469.0 - ISC
290
+ *
291
+ * This source code is licensed under the ISC license.
292
+ * See the LICENSE file in the root directory of this source tree.
293
+ */const ao=re("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
294
+ * @license lucide-react v0.469.0 - ISC
295
+ *
296
+ * This source code is licensed under the ISC license.
297
+ * See the LICENSE file in the root directory of this source tree.
298
+ */const gN=re("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
299
+ * @license lucide-react v0.469.0 - ISC
300
+ *
301
+ * This source code is licensed under the ISC license.
302
+ * See the LICENSE file in the root directory of this source tree.
303
+ */const vN=re("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/**
304
+ * @license lucide-react v0.469.0 - ISC
305
+ *
306
+ * This source code is licensed under the ISC license.
307
+ * See the LICENSE file in the root directory of this source tree.
308
+ */const yN=re("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
309
+ * @license lucide-react v0.469.0 - ISC
310
+ *
311
+ * This source code is licensed under the ISC license.
312
+ * See the LICENSE file in the root directory of this source tree.
313
+ */const jN=re("Hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);/**
314
+ * @license lucide-react v0.469.0 - ISC
315
+ *
316
+ * This source code is licensed under the ISC license.
317
+ * See the LICENSE file in the root directory of this source tree.
318
+ */const Yi=re("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
319
+ * @license lucide-react v0.469.0 - ISC
320
+ *
321
+ * This source code is licensed under the ISC license.
322
+ * See the LICENSE file in the root directory of this source tree.
323
+ */const el=re("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
324
+ * @license lucide-react v0.469.0 - ISC
325
+ *
326
+ * This source code is licensed under the ISC license.
327
+ * See the LICENSE file in the root directory of this source tree.
328
+ */const bN=re("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
329
+ * @license lucide-react v0.469.0 - ISC
330
+ *
331
+ * This source code is licensed under the ISC license.
332
+ * See the LICENSE file in the root directory of this source tree.
333
+ */const Iu=re("Layers",[["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"}]]);/**
334
+ * @license lucide-react v0.469.0 - ISC
335
+ *
336
+ * This source code is licensed under the ISC license.
337
+ * See the LICENSE file in the root directory of this source tree.
338
+ */const wN=re("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
339
+ * @license lucide-react v0.469.0 - ISC
340
+ *
341
+ * This source code is licensed under the ISC license.
342
+ * See the LICENSE file in the root directory of this source tree.
343
+ */const $y=re("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
344
+ * @license lucide-react v0.469.0 - ISC
345
+ *
346
+ * This source code is licensed under the ISC license.
347
+ * See the LICENSE file in the root directory of this source tree.
348
+ */const io=re("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
349
+ * @license lucide-react v0.469.0 - ISC
350
+ *
351
+ * This source code is licensed under the ISC license.
352
+ * See the LICENSE file in the root directory of this source tree.
353
+ */const NN=re("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
354
+ * @license lucide-react v0.469.0 - ISC
355
+ *
356
+ * This source code is licensed under the ISC license.
357
+ * See the LICENSE file in the root directory of this source tree.
358
+ */const kN=re("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
359
+ * @license lucide-react v0.469.0 - ISC
360
+ *
361
+ * This source code is licensed under the ISC license.
362
+ * See the LICENSE file in the root directory of this source tree.
363
+ */const SN=re("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/**
364
+ * @license lucide-react v0.469.0 - ISC
365
+ *
366
+ * This source code is licensed under the ISC license.
367
+ * See the LICENSE file in the root directory of this source tree.
368
+ */const zy=re("OctagonAlert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]);/**
369
+ * @license lucide-react v0.469.0 - ISC
370
+ *
371
+ * This source code is licensed under the ISC license.
372
+ * See the LICENSE file in the root directory of this source tree.
373
+ */const CN=re("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
374
+ * @license lucide-react v0.469.0 - ISC
375
+ *
376
+ * This source code is licensed under the ISC license.
377
+ * See the LICENSE file in the root directory of this source tree.
378
+ */const tl=re("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
379
+ * @license lucide-react v0.469.0 - ISC
380
+ *
381
+ * This source code is licensed under the ISC license.
382
+ * See the LICENSE file in the root directory of this source tree.
383
+ */const To=re("Pencil",[["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"}]]);/**
384
+ * @license lucide-react v0.469.0 - ISC
385
+ *
386
+ * This source code is licensed under the ISC license.
387
+ * See the LICENSE file in the root directory of this source tree.
388
+ */const Gf=re("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
389
+ * @license lucide-react v0.469.0 - ISC
390
+ *
391
+ * This source code is licensed under the ISC license.
392
+ * See the LICENSE file in the root directory of this source tree.
393
+ */const Oy=re("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
394
+ * @license lucide-react v0.469.0 - ISC
395
+ *
396
+ * This source code is licensed under the ISC license.
397
+ * See the LICENSE file in the root directory of this source tree.
398
+ */const Jn=re("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
399
+ * @license lucide-react v0.469.0 - ISC
400
+ *
401
+ * This source code is licensed under the ISC license.
402
+ * See the LICENSE file in the root directory of this source tree.
403
+ */const Jf=re("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
404
+ * @license lucide-react v0.469.0 - ISC
405
+ *
406
+ * This source code is licensed under the ISC license.
407
+ * See the LICENSE file in the root directory of this source tree.
408
+ */const Ay=re("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/**
409
+ * @license lucide-react v0.469.0 - ISC
410
+ *
411
+ * This source code is licensed under the ISC license.
412
+ * See the LICENSE file in the root directory of this source tree.
413
+ */const $u=re("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
414
+ * @license lucide-react v0.469.0 - ISC
415
+ *
416
+ * This source code is licensed under the ISC license.
417
+ * See the LICENSE file in the root directory of this source tree.
418
+ */const qo=re("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/**
419
+ * @license lucide-react v0.469.0 - ISC
420
+ *
421
+ * This source code is licensed under the ISC license.
422
+ * See the LICENSE file in the root directory of this source tree.
423
+ */const Gn=re("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
424
+ * @license lucide-react v0.469.0 - ISC
425
+ *
426
+ * This source code is licensed under the ISC license.
427
+ * See the LICENSE file in the root directory of this source tree.
428
+ */const _N=re("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
429
+ * @license lucide-react v0.469.0 - ISC
430
+ *
431
+ * This source code is licensed under the ISC license.
432
+ * See the LICENSE file in the root directory of this source tree.
433
+ */const PN=re("ServerCrash",[["path",{d:"M6 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2",key:"4b9dqc"}],["path",{d:"M6 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-2",key:"22nnkd"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m13 6-4 6h6l-4 6",key:"14hqih"}]]);/**
434
+ * @license lucide-react v0.469.0 - ISC
435
+ *
436
+ * This source code is licensed under the ISC license.
437
+ * See the LICENSE file in the root directory of this source tree.
438
+ */const Ly=re("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
439
+ * @license lucide-react v0.469.0 - ISC
440
+ *
441
+ * This source code is licensed under the ISC license.
442
+ * See the LICENSE file in the root directory of this source tree.
443
+ */const Fy=re("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
444
+ * @license lucide-react v0.469.0 - ISC
445
+ *
446
+ * This source code is licensed under the ISC license.
447
+ * See the LICENSE file in the root directory of this source tree.
448
+ */const Xf=re("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
449
+ * @license lucide-react v0.469.0 - ISC
450
+ *
451
+ * This source code is licensed under the ISC license.
452
+ * See the LICENSE file in the root directory of this source tree.
453
+ */const zu=re("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
454
+ * @license lucide-react v0.469.0 - ISC
455
+ *
456
+ * This source code is licensed under the ISC license.
457
+ * See the LICENSE file in the root directory of this source tree.
458
+ */const EN=re("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
459
+ * @license lucide-react v0.469.0 - ISC
460
+ *
461
+ * This source code is licensed under the ISC license.
462
+ * See the LICENSE file in the root directory of this source tree.
463
+ */const RN=re("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
464
+ * @license lucide-react v0.469.0 - ISC
465
+ *
466
+ * This source code is licensed under the ISC license.
467
+ * See the LICENSE file in the root directory of this source tree.
468
+ */const $g=re("Table2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]);/**
469
+ * @license lucide-react v0.469.0 - ISC
470
+ *
471
+ * This source code is licensed under the ISC license.
472
+ * See the LICENSE file in the root directory of this source tree.
473
+ */const Dy=re("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
474
+ * @license lucide-react v0.469.0 - ISC
475
+ *
476
+ * This source code is licensed under the ISC license.
477
+ * See the LICENSE file in the root directory of this source tree.
478
+ */const ps=re("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
479
+ * @license lucide-react v0.469.0 - ISC
480
+ *
481
+ * This source code is licensed under the ISC license.
482
+ * See the LICENSE file in the root directory of this source tree.
483
+ */const Xn=re("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
484
+ * @license lucide-react v0.469.0 - ISC
485
+ *
486
+ * This source code is licensed under the ISC license.
487
+ * See the LICENSE file in the root directory of this source tree.
488
+ */const Yf=re("Unplug",[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]]);/**
489
+ * @license lucide-react v0.469.0 - ISC
490
+ *
491
+ * This source code is licensed under the ISC license.
492
+ * See the LICENSE file in the root directory of this source tree.
493
+ */const MN=re("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/**
494
+ * @license lucide-react v0.469.0 - ISC
495
+ *
496
+ * This source code is licensed under the ISC license.
497
+ * See the LICENSE file in the root directory of this source tree.
498
+ */const TN=re("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
499
+ * @license lucide-react v0.469.0 - ISC
500
+ *
501
+ * This source code is licensed under the ISC license.
502
+ * See the LICENSE file in the root directory of this source tree.
503
+ */const qN=re("UserX",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/**
504
+ * @license lucide-react v0.469.0 - ISC
505
+ *
506
+ * This source code is licensed under the ISC license.
507
+ * See the LICENSE file in the root directory of this source tree.
508
+ */const Ou=re("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
509
+ * @license lucide-react v0.469.0 - ISC
510
+ *
511
+ * This source code is licensed under the ISC license.
512
+ * See the LICENSE file in the root directory of this source tree.
513
+ */const gf=re("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
514
+ * @license lucide-react v0.469.0 - ISC
515
+ *
516
+ * This source code is licensed under the ISC license.
517
+ * See the LICENSE file in the root directory of this source tree.
518
+ */const IN=re("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/**
519
+ * @license lucide-react v0.469.0 - ISC
520
+ *
521
+ * This source code is licensed under the ISC license.
522
+ * See the LICENSE file in the root directory of this source tree.
523
+ */const gn=re("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
524
+ * @license lucide-react v0.469.0 - ISC
525
+ *
526
+ * This source code is licensed under the ISC license.
527
+ * See the LICENSE file in the root directory of this source tree.
528
+ */const Uy=re("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function Qy(e){var n,r,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(n=0;n<o;n++)e[n]&&(r=Qy(e[n]))&&(i&&(i+=" "),i+=r)}else for(r in e)e[r]&&(i&&(i+=" "),i+=r);return i}function $N(){for(var e,n,r=0,i="",o=arguments.length;r<o;r++)(e=arguments[r])&&(n=Qy(e))&&(i&&(i+=" "),i+=n);return i}function F(...e){return $N(e)}function Dt({className:e,size:n=16,label:r}){return t.jsxs("span",{role:"status","aria-label":r??"Loading",className:F("inline-flex items-center gap-2 text-fg-subtle",e),children:[t.jsx($y,{className:"animate-spin",style:{width:n,height:n},"aria-hidden":!0}),r&&t.jsx("span",{className:"text-xs",children:r})]})}function nl({label:e="Loading…"}){return t.jsx("div",{className:"flex h-48 w-full items-center justify-center",children:t.jsx(Dt,{size:18,label:e})})}function du({className:e}){return t.jsx("span",{className:F("skeleton inline-block h-3 w-16 align-middle",e),"aria-hidden":!0})}class vf extends Error{constructor(r,i){super(i.message||i.error||`Request failed (${r})`);Eh(this,"status");Eh(this,"body");this.name="ApiRequestError",this.status=r,this.body=i}get code(){return this.body.error}}function er(e){return e instanceof vf}function be(e,n="Something went wrong"){return er(e)?e.status===0?"Could not reach the server":e.body.message||e.body.error||n:e instanceof Error&&e.message||n}const Ns={};function zN(e){Object.assign(Ns,e)}const zg="/api";function By(e,n){const r=e.startsWith("/")?`${zg}${e}`:`${zg}/${e}`;if(!n)return r;const i=new URLSearchParams;for(const[c,d]of Object.entries(n))d==null||d===""||i.set(c,String(d));const o=i.toString();return o?`${r}?${o}`:r}function ON(e){return typeof e=="object"&&e!==null&&typeof e.error=="string"}async function Zl(e,n,r,i={}){const o={accept:"application/json"};r!==void 0&&(o["content-type"]="application/json");let c;try{c=await fetch(By(n,i.query),{method:e,credentials:"same-origin",headers:o,body:r!==void 0?JSON.stringify(r):void 0,signal:i.signal})}catch(v){throw v instanceof DOMException&&v.name==="AbortError"?v:new vf(0,{error:"network",message:"Could not reach the server"})}const d=await c.text();let h=null;if(d)try{h=JSON.parse(d)}catch{h=d}if(c.ok)return h;const m=ON(h)?h:{error:`http_${c.status}`,message:typeof h=="string"&&h.slice(0,200)||c.statusText||`Request failed (${c.status})`},g=new vf(c.status,m);throw i.silent===!0||Array.isArray(i.silent)&&i.silent.includes(c.status)||AN(g),g}function AN(e){var n,r,i;switch(e.status){case 401:(n=Ns.onUnauthenticated)==null||n.call(Ns);break;case 402:(r=Ns.onProRequired)==null||r.call(Ns,e.body.feature);break;case 423:(i=Ns.onDemoLocked)==null||i.call(Ns,e.body.message);break}}const ae={get:(e,n)=>Zl("GET",e,void 0,n),post:(e,n,r)=>Zl("POST",e,n??{},r),patch:(e,n,r)=>Zl("PATCH",e,n??{},r),put:(e,n,r)=>Zl("PUT",e,n??{},r),del:(e,n)=>Zl("DELETE",e,void 0,n)},Ve=e=>encodeURIComponent(e);var Ye;(function(e){e.assertEqual=o=>{};function n(o){}e.assertIs=n;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{const c={};for(const d of o)c[d]=d;return c},e.getValidEnumValues=o=>{const c=e.objectKeys(o).filter(h=>typeof o[o[h]]!="number"),d={};for(const h of c)d[h]=o[h];return e.objectValues(d)},e.objectValues=o=>e.objectKeys(o).map(function(c){return o[c]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const c=[];for(const d in o)Object.prototype.hasOwnProperty.call(o,d)&&c.push(d);return c},e.find=(o,c)=>{for(const d of o)if(c(d))return d},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function i(o,c=" | "){return o.map(d=>typeof d=="string"?`'${d}'`:d).join(c)}e.joinValues=i,e.jsonStringifyReplacer=(o,c)=>typeof c=="bigint"?c.toString():c})(Ye||(Ye={}));var Og;(function(e){e.mergeShapes=(n,r)=>({...n,...r})})(Og||(Og={}));const ve=Ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Mr=e=>{switch(typeof e){case"undefined":return ve.undefined;case"string":return ve.string;case"number":return Number.isNaN(e)?ve.nan:ve.number;case"boolean":return ve.boolean;case"function":return ve.function;case"bigint":return ve.bigint;case"symbol":return ve.symbol;case"object":return Array.isArray(e)?ve.array:e===null?ve.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ve.promise:typeof Map<"u"&&e instanceof Map?ve.map:typeof Set<"u"&&e instanceof Set?ve.set:typeof Date<"u"&&e instanceof Date?ve.date:ve.object;default:return ve.unknown}},Y=Ye.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class tr extends Error{get errors(){return this.issues}constructor(n){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=n}format(n){const r=n||function(c){return c.message},i={_errors:[]},o=c=>{for(const d of c.issues)if(d.code==="invalid_union")d.unionErrors.map(o);else if(d.code==="invalid_return_type")o(d.returnTypeError);else if(d.code==="invalid_arguments")o(d.argumentsError);else if(d.path.length===0)i._errors.push(r(d));else{let h=i,m=0;for(;m<d.path.length;){const g=d.path[m];m===d.path.length-1?(h[g]=h[g]||{_errors:[]},h[g]._errors.push(r(d))):h[g]=h[g]||{_errors:[]},h=h[g],m++}}};return o(this),i}static assert(n){if(!(n instanceof tr))throw new Error(`Not a ZodError: ${n}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ye.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(n=r=>r.message){const r={},i=[];for(const o of this.issues)if(o.path.length>0){const c=o.path[0];r[c]=r[c]||[],r[c].push(n(o))}else i.push(n(o));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}}tr.create=e=>new tr(e);const yf=(e,n)=>{let r;switch(e.code){case Y.invalid_type:e.received===ve.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Y.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ye.jsonStringifyReplacer)}`;break;case Y.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ye.joinValues(e.keys,", ")}`;break;case Y.invalid_union:r="Invalid input";break;case Y.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ye.joinValues(e.options)}`;break;case Y.invalid_enum_value:r=`Invalid enum value. Expected ${Ye.joinValues(e.options)}, received '${e.received}'`;break;case Y.invalid_arguments:r="Invalid function arguments";break;case Y.invalid_return_type:r="Invalid function return type";break;case Y.invalid_date:r="Invalid date";break;case Y.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Ye.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case Y.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case Y.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case Y.custom:r="Invalid input";break;case Y.invalid_intersection_types:r="Intersection results could not be merged";break;case Y.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Y.not_finite:r="Number must be finite";break;default:r=n.defaultError,Ye.assertNever(e)}return{message:r}};let LN=yf;function FN(){return LN}const DN=e=>{const{data:n,path:r,errorMaps:i,issueData:o}=e,c=[...r,...o.path||[]],d={...o,path:c};if(o.message!==void 0)return{...o,path:c,message:o.message};let h="";const m=i.filter(g=>!!g).slice().reverse();for(const g of m)h=g(d,{data:n,defaultError:h}).message;return{...o,path:c,message:h}};function ue(e,n){const r=FN(),i=DN({issueData:n,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===yf?void 0:yf].filter(o=>!!o)});e.common.issues.push(i)}class vn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(n,r){const i=[];for(const o of r){if(o.status==="aborted")return $e;o.status==="dirty"&&n.dirty(),i.push(o.value)}return{status:n.value,value:i}}static async mergeObjectAsync(n,r){const i=[];for(const o of r){const c=await o.key,d=await o.value;i.push({key:c,value:d})}return vn.mergeObjectSync(n,i)}static mergeObjectSync(n,r){const i={};for(const o of r){const{key:c,value:d}=o;if(c.status==="aborted"||d.status==="aborted")return $e;c.status==="dirty"&&n.dirty(),d.status==="dirty"&&n.dirty(),c.value!=="__proto__"&&(typeof d.value<"u"||o.alwaysSet)&&(i[c.value]=d.value)}return{status:n.value,value:i}}}const $e=Object.freeze({status:"aborted"}),eo=e=>({status:"dirty",value:e}),Yn=e=>({status:"valid",value:e}),Ag=e=>e.status==="aborted",Lg=e=>e.status==="dirty",Qi=e=>e.status==="valid",hu=e=>typeof Promise<"u"&&e instanceof Promise;var Se;(function(e){e.errToObj=n=>typeof n=="string"?{message:n}:n||{},e.toString=n=>typeof n=="string"?n:n==null?void 0:n.message})(Se||(Se={}));class Rs{constructor(n,r,i,o){this._cachedPath=[],this.parent=n,this.data=r,this._path=i,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Fg=(e,n)=>{if(Qi(n))return{success:!0,data:n.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new tr(e.common.issues);return this._error=r,this._error}}};function Fe(e){if(!e)return{};const{errorMap:n,invalid_type_error:r,required_error:i,description:o}=e;if(n&&(r||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return n?{errorMap:n,description:o}:{errorMap:(d,h)=>{const{message:m}=e;return d.code==="invalid_enum_value"?{message:m??h.defaultError}:typeof h.data>"u"?{message:m??i??h.defaultError}:d.code!=="invalid_type"?{message:h.defaultError}:{message:m??r??h.defaultError}},description:o}}class He{get description(){return this._def.description}_getType(n){return Mr(n.data)}_getOrReturnCtx(n,r){return r||{common:n.parent.common,data:n.data,parsedType:Mr(n.data),schemaErrorMap:this._def.errorMap,path:n.path,parent:n.parent}}_processInputParams(n){return{status:new vn,ctx:{common:n.parent.common,data:n.data,parsedType:Mr(n.data),schemaErrorMap:this._def.errorMap,path:n.path,parent:n.parent}}}_parseSync(n){const r=this._parse(n);if(hu(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(n){const r=this._parse(n);return Promise.resolve(r)}parse(n,r){const i=this.safeParse(n,r);if(i.success)return i.data;throw i.error}safeParse(n,r){const i={common:{issues:[],async:(r==null?void 0:r.async)??!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:Mr(n)},o=this._parseSync({data:n,path:i.path,parent:i});return Fg(i,o)}"~validate"(n){var i,o;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:Mr(n)};if(!this["~standard"].async)try{const c=this._parseSync({data:n,path:[],parent:r});return Qi(c)?{value:c.value}:{issues:r.common.issues}}catch(c){(o=(i=c==null?void 0:c.message)==null?void 0:i.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:n,path:[],parent:r}).then(c=>Qi(c)?{value:c.value}:{issues:r.common.issues})}async parseAsync(n,r){const i=await this.safeParseAsync(n,r);if(i.success)return i.data;throw i.error}async safeParseAsync(n,r){const i={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:n,parsedType:Mr(n)},o=this._parse({data:n,path:i.path,parent:i}),c=await(hu(o)?o:Promise.resolve(o));return Fg(i,c)}refine(n,r){const i=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,c)=>{const d=n(o),h=()=>c.addIssue({code:Y.custom,...i(o)});return typeof Promise<"u"&&d instanceof Promise?d.then(m=>m?!0:(h(),!1)):d?!0:(h(),!1)})}refinement(n,r){return this._refinement((i,o)=>n(i)?!0:(o.addIssue(typeof r=="function"?r(i,o):r),!1))}_refinement(n){return new Ia({schema:this,typeName:ze.ZodEffects,effect:{type:"refinement",refinement:n}})}superRefine(n){return this._refinement(n)}constructor(n){this.spa=this.safeParseAsync,this._def=n,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Xs.create(this,this._def)}nullable(){return $a.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Es.create(this)}promise(){return vu.create(this,this._def)}or(n){return mu.create([this,n],this._def)}and(n){return pu.create(this,n,this._def)}transform(n){return new Ia({...Fe(this._def),schema:this,typeName:ze.ZodEffects,effect:{type:"transform",transform:n}})}default(n){const r=typeof n=="function"?n:()=>n;return new yu({...Fe(this._def),innerType:this,defaultValue:r,typeName:ze.ZodDefault})}brand(){return new Wy({typeName:ze.ZodBranded,type:this,...Fe(this._def)})}catch(n){const r=typeof n=="function"?n:()=>n;return new ju({...Fe(this._def),innerType:this,catchValue:r,typeName:ze.ZodCatch})}describe(n){const r=this.constructor;return new r({...this._def,description:n})}pipe(n){return tm.create(this,n)}readonly(){return bu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const UN=/^c[^\s-]{8,}$/i,QN=/^[0-9a-z]+$/,BN=/^[0-9A-HJKMNP-TV-Z]{26}$/i,VN=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,HN=/^[a-z0-9_-]{21}$/i,KN=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,WN=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ZN=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,GN="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Oh;const JN=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,XN=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,YN=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ek=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tk=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,nk=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Vy="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",sk=new RegExp(`^${Vy}$`);function Hy(e){let n="[0-5]\\d";e.precision?n=`${n}\\.\\d{${e.precision}}`:e.precision==null&&(n=`${n}(\\.\\d+)?`);const r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${n})${r}`}function rk(e){return new RegExp(`^${Hy(e)}$`)}function ak(e){let n=`${Vy}T${Hy(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),n=`${n}(${r.join("|")})`,new RegExp(`^${n}$`)}function ik(e,n){return!!((n==="v4"||!n)&&JN.test(e)||(n==="v6"||!n)&&YN.test(e))}function lk(e,n){if(!KN.test(e))return!1;try{const[r]=e.split(".");if(!r)return!1;const i=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(i));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||n&&o.alg!==n)}catch{return!1}}function ok(e,n){return!!((n==="v4"||!n)&&XN.test(e)||(n==="v6"||!n)&&ek.test(e))}class _s extends He{_parse(n){if(this._def.coerce&&(n.data=String(n.data)),this._getType(n)!==ve.string){const c=this._getOrReturnCtx(n);return ue(c,{code:Y.invalid_type,expected:ve.string,received:c.parsedType}),$e}const i=new vn;let o;for(const c of this._def.checks)if(c.kind==="min")n.data.length<c.value&&(o=this._getOrReturnCtx(n,o),ue(o,{code:Y.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),i.dirty());else if(c.kind==="max")n.data.length>c.value&&(o=this._getOrReturnCtx(n,o),ue(o,{code:Y.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),i.dirty());else if(c.kind==="length"){const d=n.data.length>c.value,h=n.data.length<c.value;(d||h)&&(o=this._getOrReturnCtx(n,o),d?ue(o,{code:Y.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):h&&ue(o,{code:Y.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),i.dirty())}else if(c.kind==="email")ZN.test(n.data)||(o=this._getOrReturnCtx(n,o),ue(o,{validation:"email",code:Y.invalid_string,message:c.message}),i.dirty());else if(c.kind==="emoji")Oh||(Oh=new RegExp(GN,"u")),Oh.test(n.data)||(o=this._getOrReturnCtx(n,o),ue(o,{validation:"emoji",code:Y.invalid_string,message:c.message}),i.dirty());else if(c.kind==="uuid")VN.test(n.data)||(o=this._getOrReturnCtx(n,o),ue(o,{validation:"uuid",code:Y.invalid_string,message:c.message}),i.dirty());else if(c.kind==="nanoid")HN.test(n.data)||(o=this._getOrReturnCtx(n,o),ue(o,{validation:"nanoid",code:Y.invalid_string,message:c.message}),i.dirty());else if(c.kind==="cuid")UN.test(n.data)||(o=this._getOrReturnCtx(n,o),ue(o,{validation:"cuid",code:Y.invalid_string,message:c.message}),i.dirty());else if(c.kind==="cuid2")QN.test(n.data)||(o=this._getOrReturnCtx(n,o),ue(o,{validation:"cuid2",code:Y.invalid_string,message:c.message}),i.dirty());else if(c.kind==="ulid")BN.test(n.data)||(o=this._getOrReturnCtx(n,o),ue(o,{validation:"ulid",code:Y.invalid_string,message:c.message}),i.dirty());else if(c.kind==="url")try{new URL(n.data)}catch{o=this._getOrReturnCtx(n,o),ue(o,{validation:"url",code:Y.invalid_string,message:c.message}),i.dirty()}else c.kind==="regex"?(c.regex.lastIndex=0,c.regex.test(n.data)||(o=this._getOrReturnCtx(n,o),ue(o,{validation:"regex",code:Y.invalid_string,message:c.message}),i.dirty())):c.kind==="trim"?n.data=n.data.trim():c.kind==="includes"?n.data.includes(c.value,c.position)||(o=this._getOrReturnCtx(n,o),ue(o,{code:Y.invalid_string,validation:{includes:c.value,position:c.position},message:c.message}),i.dirty()):c.kind==="toLowerCase"?n.data=n.data.toLowerCase():c.kind==="toUpperCase"?n.data=n.data.toUpperCase():c.kind==="startsWith"?n.data.startsWith(c.value)||(o=this._getOrReturnCtx(n,o),ue(o,{code:Y.invalid_string,validation:{startsWith:c.value},message:c.message}),i.dirty()):c.kind==="endsWith"?n.data.endsWith(c.value)||(o=this._getOrReturnCtx(n,o),ue(o,{code:Y.invalid_string,validation:{endsWith:c.value},message:c.message}),i.dirty()):c.kind==="datetime"?ak(c).test(n.data)||(o=this._getOrReturnCtx(n,o),ue(o,{code:Y.invalid_string,validation:"datetime",message:c.message}),i.dirty()):c.kind==="date"?sk.test(n.data)||(o=this._getOrReturnCtx(n,o),ue(o,{code:Y.invalid_string,validation:"date",message:c.message}),i.dirty()):c.kind==="time"?rk(c).test(n.data)||(o=this._getOrReturnCtx(n,o),ue(o,{code:Y.invalid_string,validation:"time",message:c.message}),i.dirty()):c.kind==="duration"?WN.test(n.data)||(o=this._getOrReturnCtx(n,o),ue(o,{validation:"duration",code:Y.invalid_string,message:c.message}),i.dirty()):c.kind==="ip"?ik(n.data,c.version)||(o=this._getOrReturnCtx(n,o),ue(o,{validation:"ip",code:Y.invalid_string,message:c.message}),i.dirty()):c.kind==="jwt"?lk(n.data,c.alg)||(o=this._getOrReturnCtx(n,o),ue(o,{validation:"jwt",code:Y.invalid_string,message:c.message}),i.dirty()):c.kind==="cidr"?ok(n.data,c.version)||(o=this._getOrReturnCtx(n,o),ue(o,{validation:"cidr",code:Y.invalid_string,message:c.message}),i.dirty()):c.kind==="base64"?tk.test(n.data)||(o=this._getOrReturnCtx(n,o),ue(o,{validation:"base64",code:Y.invalid_string,message:c.message}),i.dirty()):c.kind==="base64url"?nk.test(n.data)||(o=this._getOrReturnCtx(n,o),ue(o,{validation:"base64url",code:Y.invalid_string,message:c.message}),i.dirty()):Ye.assertNever(c);return{status:i.value,value:n.data}}_regex(n,r,i){return this.refinement(o=>n.test(o),{validation:r,code:Y.invalid_string,...Se.errToObj(i)})}_addCheck(n){return new _s({...this._def,checks:[...this._def.checks,n]})}email(n){return this._addCheck({kind:"email",...Se.errToObj(n)})}url(n){return this._addCheck({kind:"url",...Se.errToObj(n)})}emoji(n){return this._addCheck({kind:"emoji",...Se.errToObj(n)})}uuid(n){return this._addCheck({kind:"uuid",...Se.errToObj(n)})}nanoid(n){return this._addCheck({kind:"nanoid",...Se.errToObj(n)})}cuid(n){return this._addCheck({kind:"cuid",...Se.errToObj(n)})}cuid2(n){return this._addCheck({kind:"cuid2",...Se.errToObj(n)})}ulid(n){return this._addCheck({kind:"ulid",...Se.errToObj(n)})}base64(n){return this._addCheck({kind:"base64",...Se.errToObj(n)})}base64url(n){return this._addCheck({kind:"base64url",...Se.errToObj(n)})}jwt(n){return this._addCheck({kind:"jwt",...Se.errToObj(n)})}ip(n){return this._addCheck({kind:"ip",...Se.errToObj(n)})}cidr(n){return this._addCheck({kind:"cidr",...Se.errToObj(n)})}datetime(n){return typeof n=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:n}):this._addCheck({kind:"datetime",precision:typeof(n==null?void 0:n.precision)>"u"?null:n==null?void 0:n.precision,offset:(n==null?void 0:n.offset)??!1,local:(n==null?void 0:n.local)??!1,...Se.errToObj(n==null?void 0:n.message)})}date(n){return this._addCheck({kind:"date",message:n})}time(n){return typeof n=="string"?this._addCheck({kind:"time",precision:null,message:n}):this._addCheck({kind:"time",precision:typeof(n==null?void 0:n.precision)>"u"?null:n==null?void 0:n.precision,...Se.errToObj(n==null?void 0:n.message)})}duration(n){return this._addCheck({kind:"duration",...Se.errToObj(n)})}regex(n,r){return this._addCheck({kind:"regex",regex:n,...Se.errToObj(r)})}includes(n,r){return this._addCheck({kind:"includes",value:n,position:r==null?void 0:r.position,...Se.errToObj(r==null?void 0:r.message)})}startsWith(n,r){return this._addCheck({kind:"startsWith",value:n,...Se.errToObj(r)})}endsWith(n,r){return this._addCheck({kind:"endsWith",value:n,...Se.errToObj(r)})}min(n,r){return this._addCheck({kind:"min",value:n,...Se.errToObj(r)})}max(n,r){return this._addCheck({kind:"max",value:n,...Se.errToObj(r)})}length(n,r){return this._addCheck({kind:"length",value:n,...Se.errToObj(r)})}nonempty(n){return this.min(1,Se.errToObj(n))}trim(){return new _s({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new _s({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new _s({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(n=>n.kind==="datetime")}get isDate(){return!!this._def.checks.find(n=>n.kind==="date")}get isTime(){return!!this._def.checks.find(n=>n.kind==="time")}get isDuration(){return!!this._def.checks.find(n=>n.kind==="duration")}get isEmail(){return!!this._def.checks.find(n=>n.kind==="email")}get isURL(){return!!this._def.checks.find(n=>n.kind==="url")}get isEmoji(){return!!this._def.checks.find(n=>n.kind==="emoji")}get isUUID(){return!!this._def.checks.find(n=>n.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(n=>n.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(n=>n.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(n=>n.kind==="cuid2")}get isULID(){return!!this._def.checks.find(n=>n.kind==="ulid")}get isIP(){return!!this._def.checks.find(n=>n.kind==="ip")}get isCIDR(){return!!this._def.checks.find(n=>n.kind==="cidr")}get isBase64(){return!!this._def.checks.find(n=>n.kind==="base64")}get isBase64url(){return!!this._def.checks.find(n=>n.kind==="base64url")}get minLength(){let n=null;for(const r of this._def.checks)r.kind==="min"&&(n===null||r.value>n)&&(n=r.value);return n}get maxLength(){let n=null;for(const r of this._def.checks)r.kind==="max"&&(n===null||r.value<n)&&(n=r.value);return n}}_s.create=e=>new _s({checks:[],typeName:ze.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Fe(e)});function ck(e,n){const r=(e.toString().split(".")[1]||"").length,i=(n.toString().split(".")[1]||"").length,o=r>i?r:i,c=Number.parseInt(e.toFixed(o).replace(".","")),d=Number.parseInt(n.toFixed(o).replace(".",""));return c%d/10**o}class Ra extends He{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(n){if(this._def.coerce&&(n.data=Number(n.data)),this._getType(n)!==ve.number){const c=this._getOrReturnCtx(n);return ue(c,{code:Y.invalid_type,expected:ve.number,received:c.parsedType}),$e}let i;const o=new vn;for(const c of this._def.checks)c.kind==="int"?Ye.isInteger(n.data)||(i=this._getOrReturnCtx(n,i),ue(i,{code:Y.invalid_type,expected:"integer",received:"float",message:c.message}),o.dirty()):c.kind==="min"?(c.inclusive?n.data<c.value:n.data<=c.value)&&(i=this._getOrReturnCtx(n,i),ue(i,{code:Y.too_small,minimum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),o.dirty()):c.kind==="max"?(c.inclusive?n.data>c.value:n.data>=c.value)&&(i=this._getOrReturnCtx(n,i),ue(i,{code:Y.too_big,maximum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),o.dirty()):c.kind==="multipleOf"?ck(n.data,c.value)!==0&&(i=this._getOrReturnCtx(n,i),ue(i,{code:Y.not_multiple_of,multipleOf:c.value,message:c.message}),o.dirty()):c.kind==="finite"?Number.isFinite(n.data)||(i=this._getOrReturnCtx(n,i),ue(i,{code:Y.not_finite,message:c.message}),o.dirty()):Ye.assertNever(c);return{status:o.value,value:n.data}}gte(n,r){return this.setLimit("min",n,!0,Se.toString(r))}gt(n,r){return this.setLimit("min",n,!1,Se.toString(r))}lte(n,r){return this.setLimit("max",n,!0,Se.toString(r))}lt(n,r){return this.setLimit("max",n,!1,Se.toString(r))}setLimit(n,r,i,o){return new Ra({...this._def,checks:[...this._def.checks,{kind:n,value:r,inclusive:i,message:Se.toString(o)}]})}_addCheck(n){return new Ra({...this._def,checks:[...this._def.checks,n]})}int(n){return this._addCheck({kind:"int",message:Se.toString(n)})}positive(n){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Se.toString(n)})}negative(n){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Se.toString(n)})}nonpositive(n){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Se.toString(n)})}nonnegative(n){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Se.toString(n)})}multipleOf(n,r){return this._addCheck({kind:"multipleOf",value:n,message:Se.toString(r)})}finite(n){return this._addCheck({kind:"finite",message:Se.toString(n)})}safe(n){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Se.toString(n)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Se.toString(n)})}get minValue(){let n=null;for(const r of this._def.checks)r.kind==="min"&&(n===null||r.value>n)&&(n=r.value);return n}get maxValue(){let n=null;for(const r of this._def.checks)r.kind==="max"&&(n===null||r.value<n)&&(n=r.value);return n}get isInt(){return!!this._def.checks.find(n=>n.kind==="int"||n.kind==="multipleOf"&&Ye.isInteger(n.value))}get isFinite(){let n=null,r=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(r===null||i.value>r)&&(r=i.value):i.kind==="max"&&(n===null||i.value<n)&&(n=i.value)}return Number.isFinite(r)&&Number.isFinite(n)}}Ra.create=e=>new Ra({checks:[],typeName:ze.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Fe(e)});class Ma extends He{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(n){if(this._def.coerce)try{n.data=BigInt(n.data)}catch{return this._getInvalidInput(n)}if(this._getType(n)!==ve.bigint)return this._getInvalidInput(n);let i;const o=new vn;for(const c of this._def.checks)c.kind==="min"?(c.inclusive?n.data<c.value:n.data<=c.value)&&(i=this._getOrReturnCtx(n,i),ue(i,{code:Y.too_small,type:"bigint",minimum:c.value,inclusive:c.inclusive,message:c.message}),o.dirty()):c.kind==="max"?(c.inclusive?n.data>c.value:n.data>=c.value)&&(i=this._getOrReturnCtx(n,i),ue(i,{code:Y.too_big,type:"bigint",maximum:c.value,inclusive:c.inclusive,message:c.message}),o.dirty()):c.kind==="multipleOf"?n.data%c.value!==BigInt(0)&&(i=this._getOrReturnCtx(n,i),ue(i,{code:Y.not_multiple_of,multipleOf:c.value,message:c.message}),o.dirty()):Ye.assertNever(c);return{status:o.value,value:n.data}}_getInvalidInput(n){const r=this._getOrReturnCtx(n);return ue(r,{code:Y.invalid_type,expected:ve.bigint,received:r.parsedType}),$e}gte(n,r){return this.setLimit("min",n,!0,Se.toString(r))}gt(n,r){return this.setLimit("min",n,!1,Se.toString(r))}lte(n,r){return this.setLimit("max",n,!0,Se.toString(r))}lt(n,r){return this.setLimit("max",n,!1,Se.toString(r))}setLimit(n,r,i,o){return new Ma({...this._def,checks:[...this._def.checks,{kind:n,value:r,inclusive:i,message:Se.toString(o)}]})}_addCheck(n){return new Ma({...this._def,checks:[...this._def.checks,n]})}positive(n){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Se.toString(n)})}negative(n){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Se.toString(n)})}nonpositive(n){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Se.toString(n)})}nonnegative(n){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Se.toString(n)})}multipleOf(n,r){return this._addCheck({kind:"multipleOf",value:n,message:Se.toString(r)})}get minValue(){let n=null;for(const r of this._def.checks)r.kind==="min"&&(n===null||r.value>n)&&(n=r.value);return n}get maxValue(){let n=null;for(const r of this._def.checks)r.kind==="max"&&(n===null||r.value<n)&&(n=r.value);return n}}Ma.create=e=>new Ma({checks:[],typeName:ze.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Fe(e)});class fu extends He{_parse(n){if(this._def.coerce&&(n.data=!!n.data),this._getType(n)!==ve.boolean){const i=this._getOrReturnCtx(n);return ue(i,{code:Y.invalid_type,expected:ve.boolean,received:i.parsedType}),$e}return Yn(n.data)}}fu.create=e=>new fu({typeName:ze.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Fe(e)});class Bi extends He{_parse(n){if(this._def.coerce&&(n.data=new Date(n.data)),this._getType(n)!==ve.date){const c=this._getOrReturnCtx(n);return ue(c,{code:Y.invalid_type,expected:ve.date,received:c.parsedType}),$e}if(Number.isNaN(n.data.getTime())){const c=this._getOrReturnCtx(n);return ue(c,{code:Y.invalid_date}),$e}const i=new vn;let o;for(const c of this._def.checks)c.kind==="min"?n.data.getTime()<c.value&&(o=this._getOrReturnCtx(n,o),ue(o,{code:Y.too_small,message:c.message,inclusive:!0,exact:!1,minimum:c.value,type:"date"}),i.dirty()):c.kind==="max"?n.data.getTime()>c.value&&(o=this._getOrReturnCtx(n,o),ue(o,{code:Y.too_big,message:c.message,inclusive:!0,exact:!1,maximum:c.value,type:"date"}),i.dirty()):Ye.assertNever(c);return{status:i.value,value:new Date(n.data.getTime())}}_addCheck(n){return new Bi({...this._def,checks:[...this._def.checks,n]})}min(n,r){return this._addCheck({kind:"min",value:n.getTime(),message:Se.toString(r)})}max(n,r){return this._addCheck({kind:"max",value:n.getTime(),message:Se.toString(r)})}get minDate(){let n=null;for(const r of this._def.checks)r.kind==="min"&&(n===null||r.value>n)&&(n=r.value);return n!=null?new Date(n):null}get maxDate(){let n=null;for(const r of this._def.checks)r.kind==="max"&&(n===null||r.value<n)&&(n=r.value);return n!=null?new Date(n):null}}Bi.create=e=>new Bi({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ze.ZodDate,...Fe(e)});class Dg extends He{_parse(n){if(this._getType(n)!==ve.symbol){const i=this._getOrReturnCtx(n);return ue(i,{code:Y.invalid_type,expected:ve.symbol,received:i.parsedType}),$e}return Yn(n.data)}}Dg.create=e=>new Dg({typeName:ze.ZodSymbol,...Fe(e)});class jf extends He{_parse(n){if(this._getType(n)!==ve.undefined){const i=this._getOrReturnCtx(n);return ue(i,{code:Y.invalid_type,expected:ve.undefined,received:i.parsedType}),$e}return Yn(n.data)}}jf.create=e=>new jf({typeName:ze.ZodUndefined,...Fe(e)});class bf extends He{_parse(n){if(this._getType(n)!==ve.null){const i=this._getOrReturnCtx(n);return ue(i,{code:Y.invalid_type,expected:ve.null,received:i.parsedType}),$e}return Yn(n.data)}}bf.create=e=>new bf({typeName:ze.ZodNull,...Fe(e)});class Ug extends He{constructor(){super(...arguments),this._any=!0}_parse(n){return Yn(n.data)}}Ug.create=e=>new Ug({typeName:ze.ZodAny,...Fe(e)});class wf extends He{constructor(){super(...arguments),this._unknown=!0}_parse(n){return Yn(n.data)}}wf.create=e=>new wf({typeName:ze.ZodUnknown,...Fe(e)});class Br extends He{_parse(n){const r=this._getOrReturnCtx(n);return ue(r,{code:Y.invalid_type,expected:ve.never,received:r.parsedType}),$e}}Br.create=e=>new Br({typeName:ze.ZodNever,...Fe(e)});class Qg extends He{_parse(n){if(this._getType(n)!==ve.undefined){const i=this._getOrReturnCtx(n);return ue(i,{code:Y.invalid_type,expected:ve.void,received:i.parsedType}),$e}return Yn(n.data)}}Qg.create=e=>new Qg({typeName:ze.ZodVoid,...Fe(e)});class Es extends He{_parse(n){const{ctx:r,status:i}=this._processInputParams(n),o=this._def;if(r.parsedType!==ve.array)return ue(r,{code:Y.invalid_type,expected:ve.array,received:r.parsedType}),$e;if(o.exactLength!==null){const d=r.data.length>o.exactLength.value,h=r.data.length<o.exactLength.value;(d||h)&&(ue(r,{code:d?Y.too_big:Y.too_small,minimum:h?o.exactLength.value:void 0,maximum:d?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),i.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(ue(r,{code:Y.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),i.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(ue(r,{code:Y.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),i.dirty()),r.common.async)return Promise.all([...r.data].map((d,h)=>o.type._parseAsync(new Rs(r,d,r.path,h)))).then(d=>vn.mergeArray(i,d));const c=[...r.data].map((d,h)=>o.type._parseSync(new Rs(r,d,r.path,h)));return vn.mergeArray(i,c)}get element(){return this._def.type}min(n,r){return new Es({...this._def,minLength:{value:n,message:Se.toString(r)}})}max(n,r){return new Es({...this._def,maxLength:{value:n,message:Se.toString(r)}})}length(n,r){return new Es({...this._def,exactLength:{value:n,message:Se.toString(r)}})}nonempty(n){return this.min(1,n)}}Es.create=(e,n)=>new Es({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ze.ZodArray,...Fe(n)});function Si(e){if(e instanceof Mt){const n={};for(const r in e.shape){const i=e.shape[r];n[r]=Xs.create(Si(i))}return new Mt({...e._def,shape:()=>n})}else return e instanceof Es?new Es({...e._def,type:Si(e.element)}):e instanceof Xs?Xs.create(Si(e.unwrap())):e instanceof $a?$a.create(Si(e.unwrap())):e instanceof Ta?Ta.create(e.items.map(n=>Si(n))):e}class Mt extends He{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const n=this._def.shape(),r=Ye.objectKeys(n);return this._cached={shape:n,keys:r},this._cached}_parse(n){if(this._getType(n)!==ve.object){const g=this._getOrReturnCtx(n);return ue(g,{code:Y.invalid_type,expected:ve.object,received:g.parsedType}),$e}const{status:i,ctx:o}=this._processInputParams(n),{shape:c,keys:d}=this._getCached(),h=[];if(!(this._def.catchall instanceof Br&&this._def.unknownKeys==="strip"))for(const g in o.data)d.includes(g)||h.push(g);const m=[];for(const g of d){const p=c[g],v=o.data[g];m.push({key:{status:"valid",value:g},value:p._parse(new Rs(o,v,o.path,g)),alwaysSet:g in o.data})}if(this._def.catchall instanceof Br){const g=this._def.unknownKeys;if(g==="passthrough")for(const p of h)m.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(g==="strict")h.length>0&&(ue(o,{code:Y.unrecognized_keys,keys:h}),i.dirty());else if(g!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const g=this._def.catchall;for(const p of h){const v=o.data[p];m.push({key:{status:"valid",value:p},value:g._parse(new Rs(o,v,o.path,p)),alwaysSet:p in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const g=[];for(const p of m){const v=await p.key,j=await p.value;g.push({key:v,value:j,alwaysSet:p.alwaysSet})}return g}).then(g=>vn.mergeObjectSync(i,g)):vn.mergeObjectSync(i,m)}get shape(){return this._def.shape()}strict(n){return Se.errToObj,new Mt({...this._def,unknownKeys:"strict",...n!==void 0?{errorMap:(r,i)=>{var c,d;const o=((d=(c=this._def).errorMap)==null?void 0:d.call(c,r,i).message)??i.defaultError;return r.code==="unrecognized_keys"?{message:Se.errToObj(n).message??o}:{message:o}}}:{}})}strip(){return new Mt({...this._def,unknownKeys:"strip"})}passthrough(){return new Mt({...this._def,unknownKeys:"passthrough"})}extend(n){return new Mt({...this._def,shape:()=>({...this._def.shape(),...n})})}merge(n){return new Mt({unknownKeys:n._def.unknownKeys,catchall:n._def.catchall,shape:()=>({...this._def.shape(),...n._def.shape()}),typeName:ze.ZodObject})}setKey(n,r){return this.augment({[n]:r})}catchall(n){return new Mt({...this._def,catchall:n})}pick(n){const r={};for(const i of Ye.objectKeys(n))n[i]&&this.shape[i]&&(r[i]=this.shape[i]);return new Mt({...this._def,shape:()=>r})}omit(n){const r={};for(const i of Ye.objectKeys(this.shape))n[i]||(r[i]=this.shape[i]);return new Mt({...this._def,shape:()=>r})}deepPartial(){return Si(this)}partial(n){const r={};for(const i of Ye.objectKeys(this.shape)){const o=this.shape[i];n&&!n[i]?r[i]=o:r[i]=o.optional()}return new Mt({...this._def,shape:()=>r})}required(n){const r={};for(const i of Ye.objectKeys(this.shape))if(n&&!n[i])r[i]=this.shape[i];else{let c=this.shape[i];for(;c instanceof Xs;)c=c._def.innerType;r[i]=c}return new Mt({...this._def,shape:()=>r})}keyof(){return Ky(Ye.objectKeys(this.shape))}}Mt.create=(e,n)=>new Mt({shape:()=>e,unknownKeys:"strip",catchall:Br.create(),typeName:ze.ZodObject,...Fe(n)});Mt.strictCreate=(e,n)=>new Mt({shape:()=>e,unknownKeys:"strict",catchall:Br.create(),typeName:ze.ZodObject,...Fe(n)});Mt.lazycreate=(e,n)=>new Mt({shape:e,unknownKeys:"strip",catchall:Br.create(),typeName:ze.ZodObject,...Fe(n)});class mu extends He{_parse(n){const{ctx:r}=this._processInputParams(n),i=this._def.options;function o(c){for(const h of c)if(h.result.status==="valid")return h.result;for(const h of c)if(h.result.status==="dirty")return r.common.issues.push(...h.ctx.common.issues),h.result;const d=c.map(h=>new tr(h.ctx.common.issues));return ue(r,{code:Y.invalid_union,unionErrors:d}),$e}if(r.common.async)return Promise.all(i.map(async c=>{const d={...r,common:{...r.common,issues:[]},parent:null};return{result:await c._parseAsync({data:r.data,path:r.path,parent:d}),ctx:d}})).then(o);{let c;const d=[];for(const m of i){const g={...r,common:{...r.common,issues:[]},parent:null},p=m._parseSync({data:r.data,path:r.path,parent:g});if(p.status==="valid")return p;p.status==="dirty"&&!c&&(c={result:p,ctx:g}),g.common.issues.length&&d.push(g.common.issues)}if(c)return r.common.issues.push(...c.ctx.common.issues),c.result;const h=d.map(m=>new tr(m));return ue(r,{code:Y.invalid_union,unionErrors:h}),$e}}get options(){return this._def.options}}mu.create=(e,n)=>new mu({options:e,typeName:ze.ZodUnion,...Fe(n)});const Hs=e=>e instanceof kf?Hs(e.schema):e instanceof Ia?Hs(e.innerType()):e instanceof gu?[e.value]:e instanceof qa?e.options:e instanceof Sf?Ye.objectValues(e.enum):e instanceof yu?Hs(e._def.innerType):e instanceof jf?[void 0]:e instanceof bf?[null]:e instanceof Xs?[void 0,...Hs(e.unwrap())]:e instanceof $a?[null,...Hs(e.unwrap())]:e instanceof Wy||e instanceof bu?Hs(e.unwrap()):e instanceof ju?Hs(e._def.innerType):[];class em extends He{_parse(n){const{ctx:r}=this._processInputParams(n);if(r.parsedType!==ve.object)return ue(r,{code:Y.invalid_type,expected:ve.object,received:r.parsedType}),$e;const i=this.discriminator,o=r.data[i],c=this.optionsMap.get(o);return c?r.common.async?c._parseAsync({data:r.data,path:r.path,parent:r}):c._parseSync({data:r.data,path:r.path,parent:r}):(ue(r,{code:Y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),$e)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(n,r,i){const o=new Map;for(const c of r){const d=Hs(c.shape[n]);if(!d.length)throw new Error(`A discriminator value for key \`${n}\` could not be extracted from all schema options`);for(const h of d){if(o.has(h))throw new Error(`Discriminator property ${String(n)} has duplicate value ${String(h)}`);o.set(h,c)}}return new em({typeName:ze.ZodDiscriminatedUnion,discriminator:n,options:r,optionsMap:o,...Fe(i)})}}function Nf(e,n){const r=Mr(e),i=Mr(n);if(e===n)return{valid:!0,data:e};if(r===ve.object&&i===ve.object){const o=Ye.objectKeys(n),c=Ye.objectKeys(e).filter(h=>o.indexOf(h)!==-1),d={...e,...n};for(const h of c){const m=Nf(e[h],n[h]);if(!m.valid)return{valid:!1};d[h]=m.data}return{valid:!0,data:d}}else if(r===ve.array&&i===ve.array){if(e.length!==n.length)return{valid:!1};const o=[];for(let c=0;c<e.length;c++){const d=e[c],h=n[c],m=Nf(d,h);if(!m.valid)return{valid:!1};o.push(m.data)}return{valid:!0,data:o}}else return r===ve.date&&i===ve.date&&+e==+n?{valid:!0,data:e}:{valid:!1}}class pu extends He{_parse(n){const{status:r,ctx:i}=this._processInputParams(n),o=(c,d)=>{if(Ag(c)||Ag(d))return $e;const h=Nf(c.value,d.value);return h.valid?((Lg(c)||Lg(d))&&r.dirty(),{status:r.value,value:h.data}):(ue(i,{code:Y.invalid_intersection_types}),$e)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([c,d])=>o(c,d)):o(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}pu.create=(e,n,r)=>new pu({left:e,right:n,typeName:ze.ZodIntersection,...Fe(r)});class Ta extends He{_parse(n){const{status:r,ctx:i}=this._processInputParams(n);if(i.parsedType!==ve.array)return ue(i,{code:Y.invalid_type,expected:ve.array,received:i.parsedType}),$e;if(i.data.length<this._def.items.length)return ue(i,{code:Y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$e;!this._def.rest&&i.data.length>this._def.items.length&&(ue(i,{code:Y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const c=[...i.data].map((d,h)=>{const m=this._def.items[h]||this._def.rest;return m?m._parse(new Rs(i,d,i.path,h)):null}).filter(d=>!!d);return i.common.async?Promise.all(c).then(d=>vn.mergeArray(r,d)):vn.mergeArray(r,c)}get items(){return this._def.items}rest(n){return new Ta({...this._def,rest:n})}}Ta.create=(e,n)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ta({items:e,typeName:ze.ZodTuple,rest:null,...Fe(n)})};class xu extends He{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(n){const{status:r,ctx:i}=this._processInputParams(n);if(i.parsedType!==ve.object)return ue(i,{code:Y.invalid_type,expected:ve.object,received:i.parsedType}),$e;const o=[],c=this._def.keyType,d=this._def.valueType;for(const h in i.data)o.push({key:c._parse(new Rs(i,h,i.path,h)),value:d._parse(new Rs(i,i.data[h],i.path,h)),alwaysSet:h in i.data});return i.common.async?vn.mergeObjectAsync(r,o):vn.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(n,r,i){return r instanceof He?new xu({keyType:n,valueType:r,typeName:ze.ZodRecord,...Fe(i)}):new xu({keyType:_s.create(),valueType:n,typeName:ze.ZodRecord,...Fe(r)})}}class Bg extends He{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(n){const{status:r,ctx:i}=this._processInputParams(n);if(i.parsedType!==ve.map)return ue(i,{code:Y.invalid_type,expected:ve.map,received:i.parsedType}),$e;const o=this._def.keyType,c=this._def.valueType,d=[...i.data.entries()].map(([h,m],g)=>({key:o._parse(new Rs(i,h,i.path,[g,"key"])),value:c._parse(new Rs(i,m,i.path,[g,"value"]))}));if(i.common.async){const h=new Map;return Promise.resolve().then(async()=>{for(const m of d){const g=await m.key,p=await m.value;if(g.status==="aborted"||p.status==="aborted")return $e;(g.status==="dirty"||p.status==="dirty")&&r.dirty(),h.set(g.value,p.value)}return{status:r.value,value:h}})}else{const h=new Map;for(const m of d){const g=m.key,p=m.value;if(g.status==="aborted"||p.status==="aborted")return $e;(g.status==="dirty"||p.status==="dirty")&&r.dirty(),h.set(g.value,p.value)}return{status:r.value,value:h}}}}Bg.create=(e,n,r)=>new Bg({valueType:n,keyType:e,typeName:ze.ZodMap,...Fe(r)});class lo extends He{_parse(n){const{status:r,ctx:i}=this._processInputParams(n);if(i.parsedType!==ve.set)return ue(i,{code:Y.invalid_type,expected:ve.set,received:i.parsedType}),$e;const o=this._def;o.minSize!==null&&i.data.size<o.minSize.value&&(ue(i,{code:Y.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&i.data.size>o.maxSize.value&&(ue(i,{code:Y.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());const c=this._def.valueType;function d(m){const g=new Set;for(const p of m){if(p.status==="aborted")return $e;p.status==="dirty"&&r.dirty(),g.add(p.value)}return{status:r.value,value:g}}const h=[...i.data.values()].map((m,g)=>c._parse(new Rs(i,m,i.path,g)));return i.common.async?Promise.all(h).then(m=>d(m)):d(h)}min(n,r){return new lo({...this._def,minSize:{value:n,message:Se.toString(r)}})}max(n,r){return new lo({...this._def,maxSize:{value:n,message:Se.toString(r)}})}size(n,r){return this.min(n,r).max(n,r)}nonempty(n){return this.min(1,n)}}lo.create=(e,n)=>new lo({valueType:e,minSize:null,maxSize:null,typeName:ze.ZodSet,...Fe(n)});class kf extends He{get schema(){return this._def.getter()}_parse(n){const{ctx:r}=this._processInputParams(n);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}kf.create=(e,n)=>new kf({getter:e,typeName:ze.ZodLazy,...Fe(n)});class gu extends He{_parse(n){if(n.data!==this._def.value){const r=this._getOrReturnCtx(n);return ue(r,{received:r.data,code:Y.invalid_literal,expected:this._def.value}),$e}return{status:"valid",value:n.data}}get value(){return this._def.value}}gu.create=(e,n)=>new gu({value:e,typeName:ze.ZodLiteral,...Fe(n)});function Ky(e,n){return new qa({values:e,typeName:ze.ZodEnum,...Fe(n)})}class qa extends He{_parse(n){if(typeof n.data!="string"){const r=this._getOrReturnCtx(n),i=this._def.values;return ue(r,{expected:Ye.joinValues(i),received:r.parsedType,code:Y.invalid_type}),$e}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(n.data)){const r=this._getOrReturnCtx(n),i=this._def.values;return ue(r,{received:r.data,code:Y.invalid_enum_value,options:i}),$e}return Yn(n.data)}get options(){return this._def.values}get enum(){const n={};for(const r of this._def.values)n[r]=r;return n}get Values(){const n={};for(const r of this._def.values)n[r]=r;return n}get Enum(){const n={};for(const r of this._def.values)n[r]=r;return n}extract(n,r=this._def){return qa.create(n,{...this._def,...r})}exclude(n,r=this._def){return qa.create(this.options.filter(i=>!n.includes(i)),{...this._def,...r})}}qa.create=Ky;class Sf extends He{_parse(n){const r=Ye.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(n);if(i.parsedType!==ve.string&&i.parsedType!==ve.number){const o=Ye.objectValues(r);return ue(i,{expected:Ye.joinValues(o),received:i.parsedType,code:Y.invalid_type}),$e}if(this._cache||(this._cache=new Set(Ye.getValidEnumValues(this._def.values))),!this._cache.has(n.data)){const o=Ye.objectValues(r);return ue(i,{received:i.data,code:Y.invalid_enum_value,options:o}),$e}return Yn(n.data)}get enum(){return this._def.values}}Sf.create=(e,n)=>new Sf({values:e,typeName:ze.ZodNativeEnum,...Fe(n)});class vu extends He{unwrap(){return this._def.type}_parse(n){const{ctx:r}=this._processInputParams(n);if(r.parsedType!==ve.promise&&r.common.async===!1)return ue(r,{code:Y.invalid_type,expected:ve.promise,received:r.parsedType}),$e;const i=r.parsedType===ve.promise?r.data:Promise.resolve(r.data);return Yn(i.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}}vu.create=(e,n)=>new vu({type:e,typeName:ze.ZodPromise,...Fe(n)});class Ia extends He{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ze.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(n){const{status:r,ctx:i}=this._processInputParams(n),o=this._def.effect||null,c={addIssue:d=>{ue(i,d),d.fatal?r.abort():r.dirty()},get path(){return i.path}};if(c.addIssue=c.addIssue.bind(c),o.type==="preprocess"){const d=o.transform(i.data,c);if(i.common.async)return Promise.resolve(d).then(async h=>{if(r.value==="aborted")return $e;const m=await this._def.schema._parseAsync({data:h,path:i.path,parent:i});return m.status==="aborted"?$e:m.status==="dirty"||r.value==="dirty"?eo(m.value):m});{if(r.value==="aborted")return $e;const h=this._def.schema._parseSync({data:d,path:i.path,parent:i});return h.status==="aborted"?$e:h.status==="dirty"||r.value==="dirty"?eo(h.value):h}}if(o.type==="refinement"){const d=h=>{const m=o.refinement(h,c);if(i.common.async)return Promise.resolve(m);if(m instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return h};if(i.common.async===!1){const h=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return h.status==="aborted"?$e:(h.status==="dirty"&&r.dirty(),d(h.value),{status:r.value,value:h.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(h=>h.status==="aborted"?$e:(h.status==="dirty"&&r.dirty(),d(h.value).then(()=>({status:r.value,value:h.value}))))}if(o.type==="transform")if(i.common.async===!1){const d=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!Qi(d))return $e;const h=o.transform(d.value,c);if(h instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:h}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(d=>Qi(d)?Promise.resolve(o.transform(d.value,c)).then(h=>({status:r.value,value:h})):$e);Ye.assertNever(o)}}Ia.create=(e,n,r)=>new Ia({schema:e,typeName:ze.ZodEffects,effect:n,...Fe(r)});Ia.createWithPreprocess=(e,n,r)=>new Ia({schema:n,effect:{type:"preprocess",transform:e},typeName:ze.ZodEffects,...Fe(r)});class Xs extends He{_parse(n){return this._getType(n)===ve.undefined?Yn(void 0):this._def.innerType._parse(n)}unwrap(){return this._def.innerType}}Xs.create=(e,n)=>new Xs({innerType:e,typeName:ze.ZodOptional,...Fe(n)});class $a extends He{_parse(n){return this._getType(n)===ve.null?Yn(null):this._def.innerType._parse(n)}unwrap(){return this._def.innerType}}$a.create=(e,n)=>new $a({innerType:e,typeName:ze.ZodNullable,...Fe(n)});class yu extends He{_parse(n){const{ctx:r}=this._processInputParams(n);let i=r.data;return r.parsedType===ve.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}yu.create=(e,n)=>new yu({innerType:e,typeName:ze.ZodDefault,defaultValue:typeof n.default=="function"?n.default:()=>n.default,...Fe(n)});class ju extends He{_parse(n){const{ctx:r}=this._processInputParams(n),i={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return hu(o)?o.then(c=>({status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new tr(i.common.issues)},input:i.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new tr(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}ju.create=(e,n)=>new ju({innerType:e,typeName:ze.ZodCatch,catchValue:typeof n.catch=="function"?n.catch:()=>n.catch,...Fe(n)});class Vg extends He{_parse(n){if(this._getType(n)!==ve.nan){const i=this._getOrReturnCtx(n);return ue(i,{code:Y.invalid_type,expected:ve.nan,received:i.parsedType}),$e}return{status:"valid",value:n.data}}}Vg.create=e=>new Vg({typeName:ze.ZodNaN,...Fe(e)});class Wy extends He{_parse(n){const{ctx:r}=this._processInputParams(n),i=r.data;return this._def.type._parse({data:i,path:r.path,parent:r})}unwrap(){return this._def.type}}class tm extends He{_parse(n){const{status:r,ctx:i}=this._processInputParams(n);if(i.common.async)return(async()=>{const c=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return c.status==="aborted"?$e:c.status==="dirty"?(r.dirty(),eo(c.value)):this._def.out._parseAsync({data:c.value,path:i.path,parent:i})})();{const o=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?$e:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:i.path,parent:i})}}static create(n,r){return new tm({in:n,out:r,typeName:ze.ZodPipeline})}}class bu extends He{_parse(n){const r=this._def.innerType._parse(n),i=o=>(Qi(o)&&(o.value=Object.freeze(o.value)),o);return hu(r)?r.then(o=>i(o)):i(r)}unwrap(){return this._def.innerType}}bu.create=(e,n)=>new bu({innerType:e,typeName:ze.ZodReadonly,...Fe(n)});var ze;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ze||(ze={}));const fe=_s.create,pn=Ra.create;Ma.create;const Ms=fu.create;Bi.create;const Hg=wf.create;Br.create;const sl=Es.create,Oe=Mt.create,Zy=mu.create,Au=em.create;pu.create;Ta.create;const Gy=xu.create,Cn=gu.create,es=qa.create;vu.create;Xs.create;$a.create;const nr={string:(e=>_s.create({...e,coerce:!0})),number:(e=>Ra.create({...e,coerce:!0})),boolean:(e=>fu.create({...e,coerce:!0})),bigint:(e=>Ma.create({...e,coerce:!0})),date:(e=>Bi.create({...e,coerce:!0}))},nm=["alerts","users","folders","flows","audit","sso","mcp"],Jy={monthlyUsd:39,yearlyUsd:390},Xy=fe().trim().min(8).max(512);Oe({key:Xy,instance:Oe({label:fe().trim().min(1).max(120),version:fe().max(40).optional()})});Oe({key:Xy,activationId:fe().trim().min(1).max(120)});const wu=["admin","operator","viewer"],uk="anonymous";function dk(e){return(e==null?void 0:e.id)===uk}const Yy=es(wu),hk=Oe({email:fe().email(),name:fe().min(1).max(80),password:fe().min(8).max(200)}),fk=Oe({email:fe().email(),password:fe().min(1)}),mk=Oe({email:fe().email(),name:fe().min(1).max(80),role:Yy,password:fe().min(8).max(200).optional()});Oe({name:fe().min(1).max(80).optional(),role:Yy.optional(),password:fe().min(8).max(200).optional(),disabled:Ms().optional()});const e0=Oe({issuer:fe().url(),clientId:fe().min(1).max(255),clientSecret:fe().min(1).max(500).optional(),scopes:sl(fe().min(1).max(60)).max(20).optional(),emailClaim:fe().min(1).max(60).optional()}),t0=Oe({entryPoint:fe().url(),issuer:fe().min(1).max(255),idpCert:fe().min(1).max(1e4),emailAttribute:fe().min(1).max(200).optional()}),pk=Au("kind",[Oe({kind:Cn("oidc"),name:fe().min(1).max(60),enabled:Ms().optional(),config:e0.extend({clientSecret:fe().min(1).max(500)})}),Oe({kind:Cn("saml"),name:fe().min(1).max(60),enabled:Ms().optional(),config:t0})]);Oe({name:fe().min(1).max(60).optional(),enabled:Ms().optional(),config:Zy([e0.partial(),t0.partial()]).optional()});const n0=fe().trim().toLowerCase().transform(e=>e.replace(/^@/,"")).pipe(fe().regex(/^(?=.{3,253}$)([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/,"Enter a domain like example.com"));Oe({requireSso:Ms().optional(),autoProvision:Ms().optional(),autoProvisionDomains:sl(n0).max(50).optional()});const s0=["redis","postgres"],tu={redis:"bull",postgres:"bullmq"},Kg={redis:{test:/^rediss?:\/\//,message:"Must start with redis:// or rediss://"},postgres:{test:/^postgres(ql)?:\/\//,message:"Must start with postgres:// or postgresql://"}},xk=/^[A-Za-z_][A-Za-z0-9_]{0,62}$/;function r0(e){const n=[],r=e.kind??"redis";return e.url!==void 0&&!Kg[r].test.test(e.url)&&n.push({path:"url",message:Kg[r].message}),r==="postgres"&&(e.prefix!==void 0&&!xk.test(e.prefix)&&n.push({path:"prefix",message:"A Postgres schema: letters, digits and _, not starting with a digit"}),e.cluster===!0&&n.push({path:"cluster",message:"Cluster mode is Redis only"})),n}const a0=Oe({name:fe().min(1).max(80),kind:es(s0).default("redis"),url:fe().min(1),prefix:fe().min(1).max(64).optional(),cluster:Ms().default(!1),queueFilter:fe().max(200).nullable().optional()}),gk=a0.superRefine((e,n)=>{for(const r of r0(e))n.addIssue({code:Y.custom,path:[r.path],message:r.message})}).transform(e=>({...e,prefix:e.prefix??tu[e.kind]}));a0.omit({kind:!0}).partial();Oe({ids:sl(fe().min(1)).min(1)});Oe({kind:es(s0).default("redis"),url:fe().min(1),prefix:fe().optional(),cluster:Ms().optional()}).superRefine((e,n)=>{for(const r of r0(e))n.addIssue({code:Y.custom,path:[r.path],message:r.message})});const oo=["waiting","active","completed","failed","delayed","prioritized","paused","waiting-children"],i0=es(oo),vk=["waiting","limited","maxed","paused"];Oe({page:nr.number().int().min(1).default(1),pageSize:nr.number().int().min(1).max(200).default(25)});Oe({q:fe().max(200).optional(),withinMs:nr.number().int().min(0).optional(),limit:nr.number().int().min(1).max(1e3).default(500)});const yk=Oe({name:fe().min(1).max(200).default("__default__"),data:Hg().default({}),opts:Gy(Hg()).default({})}),l0=Oe({state:es(["completed","failed","delayed","wait","active","paused","prioritized"]),grace:pn().int().min(0).default(0),limit:pn().int().min(1).max(1e5).default(1e3)});Oe({reason:fe().trim().max(500).optional()});const Nu=500,jk=["run_copy","skip_next"];Oe({scheduler:es(jk).default("run_copy")});Oe({jobIds:sl(fe().min(1).max(200)).min(1,"jobIds must not be empty").max(Nu,`at most ${Nu} job ids per call`)});Oe({state:i0.default("waiting"),groupId:fe().min(1).max(200).optional(),page:nr.number().int().min(1).default(1),pageSize:nr.number().int().min(1).max(200).default(25),order:es(["asc","desc"]).default("desc")});Oe({state:i0.default("failed"),q:fe().min(1).max(500),cursor:fe().optional(),limit:nr.number().int().min(1).max(200).default(50)});Oe({queueName:fe().min(1).max(255)});const o0=Oe({name:fe().min(1).max(80),color:fe().max(20).nullable().optional(),parentId:fe().nullable().optional()}),bk=o0.partial().extend({position:pn().int().min(0).optional()});Oe({queues:sl(Oe({connectionId:fe(),queueName:fe()}))});const wk=Oe({waitingAbove:pn().int().min(0).max(1e7).default(0),failedAbove:pn().int().min(0).max(1e7).default(0)}),ku={waitingAbove:0,failedAbove:0},Nk=100,kk=["waiting_above","failed_above","failed_rate_above","duration_above"],Sk=["failed_above","failed_rate_above"];function Ck(e){return Sk.includes(e)}const _k=Au("kind",[Oe({kind:Cn("waiting_above"),threshold:pn().int().min(1)}),Oe({kind:Cn("failed_above"),threshold:pn().int().min(1),windowMinutes:pn().int().min(1).max(1440).default(5)}),Oe({kind:Cn("failed_rate_above"),percent:pn().min(.1).max(100),windowMinutes:pn().int().min(1).max(1440).default(5),minSample:pn().int().min(1).default(20)}),Oe({kind:Cn("duration_above"),seconds:pn().min(.001).max(86400),percentile:Zy([Cn(50),Cn(95)]).default(95),windowMinutes:pn().int().min(1).max(1440).default(15),minSample:pn().int().min(1).max(Nk).default(5)})]),Pk=Au("type",[Oe({type:Cn("queue"),connectionId:fe().min(1),queueName:fe().min(1)}),Oe({type:Cn("folder"),folderId:fe().min(1)}),Oe({type:Cn("connection"),connectionId:fe().min(1)}),Oe({type:Cn("global")})]),Ek=Au("type",[Oe({type:Cn("slack"),webhookUrl:fe().url()}),Oe({type:Cn("webhook"),url:fe().url(),headers:Gy(fe()).optional()})]),c0=Oe({name:fe().min(1).max(120),enabled:Ms().default(!0),scope:Pk,condition:_k,channels:sl(Ek).default([]),cooldownMinutes:pn().int().min(1).max(1440).default(30)});c0.partial();const sm=["job.add","job.retry","job.remove","job.promote","job.discard","job.bulk_retry","job.bulk_remove","job.bulk_promote","queue.pause","queue.resume","queue.clean","queue.retry_all","queue.drain","queue.obliterate","scheduler.remove","queue.hide","queue.unhide","connection.create","connection.update","connection.delete","user.create","user.update","user.delete","user.disable","user.enable","alert.create","alert.update","alert.delete","license.set","license.remove","sso.provider_create","sso.provider_update","sso.provider_delete","attention.thresholds_update","auth.login","auth.login_failed","auth.logout","auth.sso_login","auth.sso_denied","auth.sso_provisioned","mcp.settings_update","mcp.authorize","mcp.revoke"],rm={"job.add":"added a job","job.retry":"retried a job","job.remove":"removed a job","job.promote":"promoted a job","job.discard":"discarded a job","job.bulk_retry":"retried jobs in bulk","job.bulk_remove":"removed jobs in bulk","job.bulk_promote":"promoted jobs in bulk","queue.pause":"paused the queue","queue.resume":"resumed the queue","queue.clean":"cleaned the queue","queue.retry_all":"retried every job in a state","queue.drain":"drained the queue","queue.obliterate":"obliterated the queue","scheduler.remove":"removed a job scheduler","queue.hide":"hid the queue","queue.unhide":"unhid the queue","connection.create":"added a connection","connection.update":"edited a connection","connection.delete":"deleted a connection","user.create":"invited a user","user.update":"edited a user","user.delete":"deleted a user","user.disable":"disabled a user","user.enable":"re-enabled a user","alert.create":"created an alert","alert.update":"edited an alert","alert.delete":"deleted an alert","license.set":"applied a license key","license.remove":"removed the license key","sso.provider_create":"added an SSO provider","sso.provider_update":"edited an SSO provider","sso.provider_delete":"deleted an SSO provider","attention.thresholds_update":"changed the attention thresholds","auth.login":"signed in","auth.login_failed":"failed to sign in","auth.logout":"signed out","auth.sso_login":"signed in with SSO","auth.sso_denied":"was refused by SSO (no account)","auth.sso_provisioned":"joined through SSO (auto-provisioned)","mcp.settings_update":"changed the MCP access level","mcp.authorize":"connected an MCP client","mcp.revoke":"disconnected an MCP client"},Rk=["queue.obliterate","queue.drain","queue.clean","job.remove","job.bulk_remove","connection.delete","user.create","user.update","user.delete","license.set","license.remove","auth.login_failed","sso.provider_create","sso.provider_update","sso.provider_delete","auth.sso_provisioned","mcp.settings_update","mcp.authorize"],Mk=es(sm);Oe({limit:nr.number().int().min(1).max(200).default(50),cursor:fe().max(200).optional(),actorId:fe().max(36).optional(),action:Mk.optional(),connectionId:fe().max(36).optional(),queueName:fe().max(255).optional(),jobId:fe().max(255).optional(),result:es(["ok","error"]).optional(),from:fe().datetime({offset:!0}).optional(),to:fe().datetime({offset:!0}).optional()});Oe({connectionId:fe(),from:fe().min(1),to:fe().min(1),label:fe().max(120).nullable().optional()});Oe({maxNodes:nr.number().int().min(1).max(500).default(200),fromRoot:es(["true","false"]).default("true").transform(e=>e==="true")});const Wg={admin:3,operator:2,viewer:1};function Zg(e,n){return Wg[e]>=Wg[n]}const Tk=["off","read","write"];Oe({maxAccess:es(Tk)});Oe({request:fe().min(1).max(4096),approve:Ms(),access:es(["read","write"]).default("read")});let Vi={open:!1,feature:"alerts"};const Cf=new Set;function u0(e){Vi=e,Cf.forEach(n=>n())}function co(e){u0({open:!0,feature:e??Vi.feature})}function Ah(){Vi.open&&u0({...Vi,open:!1})}function qk(){return N.useSyncExternalStore(e=>(Cf.add(e),()=>Cf.delete(e)),()=>Vi,()=>Vi)}let _a=[],Ik=0;const _f=new Set;function d0(){_f.forEach(e=>e())}function $k(e){return _f.add(e),()=>_f.delete(e)}function Ni(e,n,r={}){const i=_a.find(c=>c.message===n&&c.kind===e);if(i)return i.id;const o=++Ik;return _a=[..._a,{id:o,kind:e,message:n,description:r.description,durationMs:r.durationMs??(r.action?8e3:e==="error"?6e3:3500),action:r.action}],d0(),o}function Lh(e){_a=_a.filter(n=>n.id!==e),d0()}const ee=Object.assign((e,n)=>Ni((n==null?void 0:n.kind)??"info",e,n),{info:(e,n)=>Ni("info",e,{description:n}),success:(e,n)=>Ni("success",e,{description:n}),error:(e,n)=>Ni("error",e,{description:n}),warning:(e,n)=>Ni("warning",e,{description:n}),undoable:(e,n,r)=>Ni("success",e,{description:r,action:n})}),zk={info:Yi,success:Zf,error:Ry,warning:Xn},Ok={info:"text-info",success:"text-success",error:"text-danger",warning:"text-warning"};function Ak({item:e}){N.useEffect(()=>{const r=setTimeout(()=>Lh(e.id),e.durationMs);return()=>clearTimeout(r)},[e.id,e.durationMs]);const n=zk[e.kind];return t.jsxs("div",{role:e.kind==="error"?"alert":"status",className:"toast-in pointer-events-auto flex w-80 items-start gap-2.5 rounded-lg border border-border bg-surface px-3 py-2.5 text-[13px] shadow-[var(--shadow)]",children:[t.jsx(n,{className:F("mt-px size-4 shrink-0",Ok[e.kind]),"aria-hidden":!0}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-fg",children:e.message}),e.description&&t.jsx("p",{className:"mt-0.5 text-xs break-words text-fg-muted",children:e.description}),e.action&&t.jsx("button",{type:"button",className:"mt-1.5 rounded text-xs font-medium text-accent hover:underline",onClick:()=>{var r;(r=e.action)==null||r.onClick(),Lh(e.id)},children:e.action.label})]}),t.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>Lh(e.id),className:"-mr-1 rounded p-0.5 text-fg-subtle hover:text-fg",children:t.jsx(gn,{className:"size-3.5"})})]})}function Lk(){const e=N.useSyncExternalStore($k,()=>_a,()=>_a);return e.length===0?null:t.jsx("div",{className:"pointer-events-none fixed right-4 bottom-4 z-[100] flex flex-col items-end gap-2","aria-live":"polite",children:e.map(n=>t.jsx(Ak,{item:n},n.id))})}const h0=N.createContext(null);function Fk({children:e}){const[n,r]=N.useState(null),[i,o]=N.useState(null),[c,d]=N.useState(!1),[h,m]=N.useState(!0),[g,p]=N.useState(!0),v=an(),j=Ln(),C=Ze(),y=N.useRef(j);y.current=j;const b=N.useRef(h);b.current=h;const k=N.useCallback(async()=>{const[O,Q]=await Promise.allSettled([ae.get("/setup/status",{silent:!0}),ae.get("/edition",{silent:!0})]);O.status==="fulfilled"&&(d(!!O.value.needsSetup),m(O.value.authRequired!==!1)),Q.status==="fulfilled"&&o(Q.value)},[]),S=N.useCallback(async()=>{try{const O=await ae.get("/auth/me",{silent:!0});r(O.user),o(O.edition),d(!1),m(O.edition.features.users)}catch(O){r(null),er(O)&&O.status===401?await k():er(O)&&O.status===0&&ee.error("Could not reach the server")}finally{p(!1)}},[k]),$=N.useRef(S);$.current=S,N.useEffect(()=>{S()},[S]),N.useEffect(()=>{zN({onUnauthenticated:()=>{if(!b.current){$.current();return}r(null),C.clear();const O=y.current.pathname;!O.startsWith("/login")&&!O.startsWith("/setup")&&v("/login",{replace:!0,state:{from:y.current}})},onProRequired:O=>co(O),onDemoLocked:()=>ee.warning("This action is locked in the demo")})},[v,C]);const z=N.useCallback(async O=>{const Q=await ae.post("/auth/login",O,{silent:[401]});return r(Q.user),o(Q.edition),d(!1),C.clear(),Q},[C]),E=N.useCallback(async O=>{const Q=await ae.post("/setup",O);return r(Q.user),o(Q.edition),d(!1),Q},[]),T=N.useCallback(async()=>{try{await ae.post("/auth/logout",{},{silent:!0})}finally{r(null),C.clear(),v("/login",{replace:!0})}},[v,C]),M=N.useMemo(()=>({user:n,edition:i,loading:g,needsSetup:c,authRequired:h,isAnonymous:dk(n),refresh:S,login:z,setup:E,logout:T,setEdition:o,can:O=>n?Zg(n.role,O):!1,isAdmin:(n==null?void 0:n.role)==="admin",isOperator:n?Zg(n.role,"operator"):!1}),[n,i,g,c,h,S,z,E,T]);return t.jsx(h0.Provider,{value:M,children:e})}function yt(){const e=N.useContext(h0);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}function rn({icon:e,title:n,description:r,action:i,className:o,compact:c}){return t.jsxs("div",{className:F("flex flex-col items-center justify-center text-center",c?"gap-2 px-4 py-8":"gap-3 px-6 py-16",o),children:[e&&t.jsx("div",{className:"flex size-10 items-center justify-center rounded-lg border border-border bg-surface-2 text-fg-subtle [&_svg]:size-5",children:e}),t.jsxs("div",{className:"max-w-sm",children:[t.jsx("h3",{className:"text-sm font-semibold text-fg",children:n}),r&&t.jsx("p",{className:"mt-1 text-xs leading-relaxed text-fg-muted",children:r})]}),i&&t.jsx("div",{className:"mt-1 flex items-center gap-2",children:i})]})}function Dk(){const{user:e,loading:n,needsSetup:r}=yt(),i=Ln();return n?t.jsx(m0,{}):e?t.jsx(sy,{}):r?t.jsx(Qr,{to:"/setup",replace:!0}):t.jsx(Qr,{to:"/login",replace:!0,state:{from:i}})}function Gg({children:e}){const{user:n,loading:r,authRequired:i}=yt();return r?t.jsx(m0,{}):n||!i?t.jsx(Qr,{to:"/",replace:!0}):t.jsx(t.Fragment,{children:e})}function f0({role:e,children:n}){const{can:r}=yt();return r(e)?t.jsx(t.Fragment,{children:n}):t.jsx(rn,{icon:t.jsx(Xf,{}),title:`${e==="admin"?"Admins":"Operators"} only`,description:"Your role does not allow this page. Ask an admin to change your role if you need access."})}function m0(){return t.jsx("div",{className:"flex h-full min-h-screen w-full items-center justify-center bg-bg",children:t.jsx(nl,{})})}const Uk={primary:"bg-accent text-accent-fg hover:bg-accent-hover border border-transparent",secondary:"bg-surface-2 text-fg border border-border hover:bg-surface-3 hover:border-border-strong",outline:"bg-transparent text-fg border border-border-strong hover:bg-surface-2",ghost:"bg-transparent text-fg-muted border border-transparent hover:text-fg hover:bg-surface-2",danger:"bg-danger/90 text-white border border-transparent hover:bg-danger",link:"bg-transparent text-accent border border-transparent hover:underline px-0 h-auto"},Qk={xs:"h-6 px-2 text-[11px] gap-1 [&_svg]:size-3",sm:"h-7 px-2.5 text-xs gap-1.5 [&_svg]:size-3.5",md:"h-8 px-3 text-[13px] gap-1.5 [&_svg]:size-4",icon:"h-8 w-8 [&_svg]:size-4","icon-sm":"h-7 w-7 [&_svg]:size-3.5","icon-xs":"h-6 w-6 [&_svg]:size-3"},H=N.forwardRef(function({variant:n="secondary",size:r="md",loading:i,leftIcon:o,rightIcon:c,className:d,children:h,disabled:m,type:g="button",...p},v){return t.jsxs("button",{ref:v,type:g,disabled:m||i,className:F("inline-flex shrink-0 select-none items-center justify-center rounded-md font-medium whitespace-nowrap transition-colors outline-none","focus-visible:ring-2 focus-visible:ring-accent/60 disabled:pointer-events-none disabled:opacity-50",Uk[n],Qk[r],d),...p,children:[i?t.jsx($y,{className:"animate-spin","aria-hidden":!0}):o,h,!i&&c]})}),Bk={sm:"26rem",md:"32rem",lg:"44rem",xl:"60rem"};function En({open:e,onClose:n,title:r,description:i,children:o,footer:c,size:d="md",hideClose:h,className:m,bodyClassName:g}){const p=N.useRef(null),v=N.useId(),j=N.useId();N.useEffect(()=>{const y=p.current;y&&(e&&!y.open?y.showModal():!e&&y.open&&y.close())},[e]);const C=y=>{y.target===p.current&&n()};return t.jsx("dialog",{ref:p,className:F("dialog",m),style:{"--dialog-w":Bk[d]},"aria-labelledby":r?v:void 0,"aria-describedby":i?j:void 0,onClose:()=>{e&&n()},onCancel:y=>{y.preventDefault(),n()},onClick:C,children:e&&t.jsxs("div",{className:"flex max-h-[90vh] flex-col",onClick:y=>y.stopPropagation(),children:[(r||!h)&&t.jsxs("header",{className:"flex items-start gap-3 border-b border-border px-5 py-3.5",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[r&&t.jsx("h2",{id:v,className:"text-sm font-semibold text-fg",children:r}),i&&t.jsx("p",{id:j,className:"mt-0.5 text-xs text-fg-muted",children:i})]}),!h&&t.jsx(H,{variant:"ghost",size:"icon-sm","aria-label":"Close",onClick:n,className:"-mr-1.5 -mt-0.5",children:t.jsx(gn,{})})]}),t.jsx("div",{className:F("min-h-0 flex-1 overflow-y-auto px-5 py-4",g),children:o}),c&&t.jsx("footer",{className:"flex items-center justify-end gap-2 border-t border-border bg-surface-2/50 px-5 py-3",children:c})]})})}const uo={alerts:{title:"Alerts",tagline:"Know before your users do. Slack or webhook, evaluated server-side every few seconds.",bullets:["Waiting above N, failures in a window, failure-rate %, connection down","Scope to one queue, a whole connection, or everything","Cooldown per alert and an events feed with delivery status"]},users:{title:"Users & roles",tagline:"Give the whole team a login without giving everyone the obliterate button.",bullets:["Admin, operator and viewer roles enforced on every endpoint","Invite by email with a temporary password","Last-login audit and safe deletion guards"]},folders:{title:"Folders",tagline:"Organise hundreds of queues across connections the way your teams think about them.",bullets:["Nested folders with colours, shown in the sidebar","Assign queues from any connection with a picker","The default stays one folder per connection, so nothing breaks"]},audit:{title:"Audit log",tagline:"Who paused the payments queue, when, from which IP — persisted, filterable, exportable.",bullets:["Every mutating action recorded: jobs, queues, connections, users, license, logins","Failed attempts included, so a refused obliterate is a finding and not silence","CSV export for compliance, one-year retention, and never the job payload"]},flows:{title:"Flows",tagline:"See how queues feed each other, detected from BullMQ flow parents plus your own edges.",bullets:["Edges detected from job parent references with evidence counts","Manual edges for producer → consumer relationships Redis cannot see","Auto-layout graph with live counts and paused state per queue"]},sso:{title:"SSO",tagline:"Your identity provider decides who is who. Configured in this UI, not in a YAML file.",bullets:["OIDC (Google Workspace, Entra ID, Okta, Keycloak, Authentik) and SAML 2.0","Accounts stay pre-provisioned: the IdP proves identity, you still assign the role","Require SSO for the team while admins keep a password way in"]},mcp:{title:"MCP",tagline:"Ask your AI why the payments queue is failing, and let it retry the jobs — as you, with your role.",bullets:["Claude or any MCP client with OAuth; sign in with your Bullpane login or SSO","Read or read & write: the admin sets the ceiling, a viewer can never write","Every action lands in the audit log; drain and obliterate stay in the dashboard"]}},Vk={tier:"free",demo:!1,features:Object.fromEntries(nm.map(e=>[e,!1])),license:null,pricing:Jy,checkoutUrl:""};function jt(){const{edition:e}=yt(),n=e??Vk,r=N.useCallback(o=>{var c;return!!((c=n.features)!=null&&c[o])},[n]),i=N.useCallback((o,c)=>r(o)?(c==null||c(),!0):(co(o),!1),[r]);return N.useMemo(()=>({edition:n,tier:n.tier,isPro:n.tier==="pro",demo:!!n.demo,pricing:n.pricing??Jy,checkoutUrl:n.checkoutUrl??"",has:r,gate:i}),[n,r,i])}function Hk(){const{open:e,feature:n}=qk(),{pricing:r,checkoutUrl:i,demo:o}=jt(),c=uo[n];return t.jsxs(En,{open:e,onClose:Ah,size:"md",title:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(RN,{className:"size-4 text-pro","aria-hidden":!0}),c.title," is a Pro feature"]}),description:c.tagline,footer:t.jsxs(t.Fragment,{children:[t.jsx(H,{variant:"ghost",size:"sm",onClick:Ah,children:"Not now"}),t.jsxs(Te,{to:"/settings/license",onClick:Ah,className:"inline-flex h-7 items-center gap-1.5 rounded-md border border-border-strong px-2.5 text-xs font-medium text-fg hover:bg-surface-2",children:[t.jsx(el,{className:"size-3.5","aria-hidden":!0}),"I have a key"]}),t.jsxs("a",{href:i||"#",target:"_blank",rel:"noreferrer noopener","aria-disabled":!i,className:"inline-flex h-7 items-center gap-1.5 rounded-md bg-accent px-3 text-xs font-medium text-accent-fg hover:bg-accent-hover aria-disabled:pointer-events-none aria-disabled:opacity-50",children:["Unlock Pro · $",r.monthlyUsd,"/mo or $",r.yearlyUsd,"/yr",t.jsx(Ur,{className:"size-3.5","aria-hidden":!0})]})]}),children:[t.jsx("ul",{className:"space-y-2",children:c.bullets.map(d=>t.jsxs("li",{className:"flex items-start gap-2 text-[13px] text-fg",children:[t.jsx(Kr,{className:"mt-0.5 size-4 shrink-0 text-success","aria-hidden":!0}),t.jsx("span",{children:d})]},d))}),t.jsxs("div",{className:"mt-4 rounded-md border border-border bg-surface-2/60 p-3 text-xs text-fg-muted",children:[t.jsxs("p",{children:["One subscription unlocks every Pro feature — ",nm.map(d=>uo[d].title).join(", ")," — for this installation. $",r.monthlyUsd,"/month or $",r.yearlyUsd,"/year, unlimited users. Your data stays on your servers; only the key is verified with bullpane.com."]}),o&&t.jsx("p",{className:"mt-2 text-warning",children:"You are in demo mode: Pro is already unlocked here."})]})]})}function Kk(e){if(!e)return!1;const n=e.tagName;return n==="INPUT"||n==="TEXTAREA"||n==="SELECT"?!0:e.isContentEditable}function p0(e,n,r={}){const{mod:i=!1,allowInInputs:o=!1,enabled:c=!0}=r;N.useEffect(()=>{if(!c)return;const d=h=>{if(h.key.toLowerCase()!==e.toLowerCase())return;const m=h.metaKey||h.ctrlKey;i===m&&(!i&&h.altKey||!o&&Kk(document.activeElement)||!i&&document.querySelector("dialog[open]")||n(h))};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,n,i,o,c])}const Wk=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform),x0=Wk?"⌘":"Ctrl",Nt=encodeURIComponent,oe={home:"/",login:"/login",setup:"/setup",connection:e=>`/c/${Nt(e)}`,queue:(e,n,r)=>`/c/${Nt(e)}/q/${Nt(n)}${r?`?state=${r}`:""}`,queueSearch:(e,n,r)=>`/c/${Nt(e)}/q/${Nt(n)}?search=1${r?`&state=${r}`:""}`,job:(e,n,r)=>`/c/${Nt(e)}/q/${Nt(n)}/j/${Nt(r)}`,jobTree:(e,n,r)=>`/c/${Nt(e)}/q/${Nt(n)}/j/${Nt(r)}/tree`,groups:(e,n)=>`/c/${Nt(e)}/q/${Nt(n)}/groups`,group:(e,n,r)=>`/c/${Nt(e)}/q/${Nt(n)}/groups/${Nt(r)}`,queueMetrics:(e,n)=>`/c/${Nt(e)}/q/${Nt(n)}/metrics`,queueSchedulers:(e,n)=>`/c/${Nt(e)}/q/${Nt(n)}/schedulers`,schedulers:e=>e?`/schedulers/${Nt(e)}`:"/schedulers",health:"/health",folders:"/folders",folder:e=>`/folders/${Nt(e)}`,alerts:"/alerts",users:"/users",audit:e=>{if(!e)return"/audit";const n=new URLSearchParams;for(const[i,o]of Object.entries(e))o&&n.set(i,o);const r=n.toString();return r?`/audit?${r}`:"/audit"},flows:e=>e?`/flows/${Nt(e)}`:"/flows",settings:(e="connections")=>`/settings/${e}`};function Jg(e,n){const r=e.indexOf(":");return r>=0?e.slice(r+1):e}function ho(e){return((e==null?void 0:e.failed)??0)>0?"failed":((e==null?void 0:e.waiting)??0)>0?"waiting":((e==null?void 0:e.prioritized)??0)>0?"prioritized":"completed"}const g0=new Intl.NumberFormat("en-US"),v0=new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1});function W(e){return e==null||Number.isNaN(e)?"–":g0.format(e)}function ht(e){return e==null||Number.isNaN(e)?"–":Math.abs(e)<1e4?g0.format(e):v0.format(e)}function _n(e,n=1){return e==null||Number.isNaN(e)?"–":`${e.toFixed(n)}%`}function Kt(e){if(e==null||Number.isNaN(e))return"–";if(e<1024)return`${e} B`;const n=["KB","MB","GB","TB","PB"];let r=e/1024,i=0;for(;r>=1024&&i<n.length-1;)r/=1024,i++;return`${r.toFixed(r>=100?0:r>=10?1:2)} ${n[i]}`}function An(e){if(e==null||!Number.isFinite(e))return"–";if(e<0&&(e=0),e<1e3)return`${Math.round(e)}ms`;const n=e/1e3;if(n<60)return`${n.toFixed(n<10?2:1)}s`;const r=Math.floor(n/60),i=Math.round(n%60);if(r<60)return`${r}m ${i}s`;const o=Math.floor(r/60),c=r%60;return o<24?`${o}h ${c}m`:`${Math.floor(o/24)}d ${o%24}h`}function fo(e){return e==null?"–":An(e*1e3)}function Io(e){if(e==null||e==="")return null;if(e instanceof Date)return e.getTime();if(typeof e=="number")return Number.isFinite(e)&&e>0?e:null;const n=Number(e);if(!Number.isNaN(n)&&n>0)return n;const r=Date.parse(e);return Number.isNaN(r)?null:r}function Vr(e,n=Date.now()){const r=Io(e);if(r==null)return"–";const i=n-r,o=i<0,c=Math.abs(i),d=Math.round(c/1e3);let h;if(d<5)return"just now";if(d<60)h=`${d}s`;else if(d<3600)h=`${Math.floor(d/60)}m`;else if(d<86400)h=`${Math.floor(d/3600)}h`;else if(d<86400*30)h=`${Math.floor(d/86400)}d`;else return Su(r);return o?`in ${h}`:`${h} ago`}function no(e){return e<10?`0${e}`:String(e)}function Su(e){const n=Io(e);if(n==null)return"–";const r=new Date(n);return`${r.getFullYear()}-${no(r.getMonth()+1)}-${no(r.getDate())}`}function xn(e){const n=Io(e);if(n==null)return"–";const r=new Date(n);return`${Su(r)} ${no(r.getHours())}:${no(r.getMinutes())}:${no(r.getSeconds())}`}function Pf(e){const n=Io(e);if(n==null)return"–";const r=new Date(n);return`${xn(r)}.${String(r.getMilliseconds()).padStart(3,"0")}`}function Cu(e,n=2){try{return typeof e=="string"?e:JSON.stringify(e,null,n)??String(e)}catch{return String(e)}}function Zk(e){try{const n=JSON.parse(e);return JSON.stringify(n,null,2)}catch{return null}}function y0(e){return e==null||!Number.isFinite(e)?"–":e>=10?`${e.toFixed(1)} cores`:`${e.toFixed(2)} ${e===1?"core":"cores"}`}function Hi(e){if(e==null||!Number.isFinite(e))return"–";const n=e*100;return n>=10?`${Math.round(n)}%`:n>=1?`${n.toFixed(0)}%`:`${n.toFixed(n>=.1?1:2)}%`}function Hr(e,n="/s"){return e==null||!Number.isFinite(e)?"–":e>=1e4?`${v0.format(e)}${n}`:e>=100?`${Math.round(e)}${n}`:`${e.toFixed(e<10?2:1)}${n}`}function mo(e){return e==null||!Number.isFinite(e)?"–":e>=1e3?`${(e/1e3).toFixed(2)} s`:e>=10?`${Math.round(e)} ms`:`${e.toFixed(1)} ms`}function Gk(e){return e==null||!Number.isFinite(e)?"–":`${e.toFixed(2)}×`}const Ef="bullpane.";function Lu(e,n,r=Jk){try{const i=localStorage.getItem(Ef+e);if(i==null)return n;const o=r(i);return o===void 0?n:o}catch{return n}}function po(e,n){try{n==null?localStorage.removeItem(Ef+e):localStorage.setItem(Ef+e,typeof n=="string"?n:JSON.stringify(n))}catch{}}function Jk(e){try{return JSON.parse(e)}catch{return e}}function Fu(e,n){const[r,i]=N.useState(()=>Lu(e,n,Xk)),o=N.useCallback(d=>{i(d),po(e,d?"1":"0")},[e]),c=N.useCallback(()=>{i(d=>(po(e,d?"0":"1"),!d))},[e]);return[r,c,o]}function Xk(e){if(e==="1"||e==="true"||e==='"true"')return!0;if(e==="0"||e==="false"||e==='"false"')return!1}const Ut=e=>()=>typeof document<"u"&&document.hidden?!1:e,Tt={queues:5e3,queue:3e3,job:5e3,connections:1e4,health:3e3,setup:1e4},ie={health:["health"],edition:["edition"],setupStatus:["setup-status"],me:["me"],connections:["connections"],connectionsHealth:["health","connections"],connectionHealth:e=>["health","connections",e],connection:e=>["connections",e],overview:e=>["connections",e,"overview"],queues:e=>["connections",e,"queues"],queue:(e,n)=>["connections",e,"queue",n],queueSetup:(e,n)=>["connections",e,"queue",n,"setup"],jobs:(e,n,r)=>["connections",e,"queue",n,"jobs",r],jobSearch:(e,n,r)=>["connections",e,"queue",n,"search",r],job:(e,n,r)=>["connections",e,"queue",n,"job",r],jobLogs:(e,n,r,i)=>["connections",e,"queue",n,"job",r,"logs",i],groups:(e,n,r)=>["connections",e,"queue",n,"groups",r],schedulers:(e,n,r)=>["connections",e,"queue",n,"schedulers",r],allSchedulers:(e,n)=>["connections",e,"schedulers",n],jobTree:(e,n,r,i)=>["connections",e,"queue",n,"job",r,"tree",i],groupJobs:(e,n,r,i)=>["connections",e,"queue",n,"groups",r,"jobs",i],flows:(e,n)=>["flows",e,n],hiddenQueues:e=>["connections",e,"hidden-queues"],folders:["folders"],alerts:["alerts"],attention:["attention"],alertEvents:e=>["alerts","events",e],users:["users"],ssoProviders:["sso","providers"],ssoSettings:["sso","settings"],mcpSettings:["mcp","settings"],mcpGrants:e=>["mcp","grants",e],mcpConsent:e=>["mcp","consent",e],attentionThresholds:["settings","attention"],ssoLoginOptions:["sso","login-options"],audit:e=>["audit",e],auditActors:["audit","actors"]},ln=(e,n)=>`/connections/${Ve(e)}/queues/${Ve(n)}`;function Yk(){return nt({queryKey:ie.health,queryFn:()=>ae.get("/health"),staleTime:6e4})}function xs(){return nt({queryKey:ie.connections,queryFn:()=>ae.get("/connections"),refetchInterval:Ut(Tt.connections)})}function e2(e){return nt({queryKey:ie.overview(e??""),queryFn:()=>ae.get(`/connections/${Ve(e)}/overview`),enabled:!!e,refetchInterval:Ut(Tt.queues),placeholderData:Pn})}function t2(){const e=xs(),n=e.data??[],r=ky({queries:n.map(o=>({queryKey:ie.overview(o.id),queryFn:()=>ae.get(`/connections/${Ve(o.id)}/overview`),refetchInterval:Ut(Tt.queues),placeholderData:Pn}))}),i=n.map((o,c)=>({connection:o,result:r[c]}));return{connections:e,entries:i,isLoading:e.isLoading}}function n2(e,n={}){return nt({queryKey:ie.queues(e??""),queryFn:()=>ae.get(`/connections/${Ve(e)}/queues`),enabled:!!e&&(n.enabled??!0),refetchInterval:Ut(Tt.queues),placeholderData:Pn})}function rl(){const e=xs(),n=e.data??[],r=ky({queries:n.map(o=>({queryKey:ie.queues(o.id),queryFn:()=>ae.get(`/connections/${Ve(o.id)}/queues`),refetchInterval:Ut(Tt.queues),placeholderData:Pn}))}),i=n.map((o,c)=>{var d,h,m;return{connection:o,queues:((d=r[c])==null?void 0:d.data)??[],isLoading:!!((h=r[c])!=null&&h.isLoading),error:(m=r[c])==null?void 0:m.error}});return{connections:n,byConnection:i,isLoading:e.isLoading,error:e.error}}function s2(e){const n=Ze();return Ke({mutationFn:()=>ae.get(`/connections/${Ve(e)}/queues`,{query:{refresh:1}}),onSuccess:r=>{e&&n.setQueryData(ie.queues(e),r),n.invalidateQueries({queryKey:ie.connection(e)})}})}function j0(e,n){return nt({queryKey:ie.queue(e??"",n??""),queryFn:()=>ae.get(ln(e,n)),enabled:!!e&&!!n,refetchInterval:Ut(Tt.queue),placeholderData:Pn})}function am(e,n,r={}){return nt({queryKey:ie.queueSetup(e??"",n??""),queryFn:()=>ae.get(`${ln(e,n)}/setup`),enabled:!!e&&!!n&&(r.enabled??!0),refetchInterval:Ut(Tt.setup),placeholderData:Pn})}function b0(e,n,r,i={}){return nt({queryKey:ie.jobs(e??"",n??"",r),queryFn:()=>ae.get(`${ln(e,n)}/jobs`,{query:{...r}}),enabled:!!e&&!!n&&(i.enabled??!0),refetchInterval:Ut(Tt.queue),placeholderData:Pn})}function r2(e,n,r,i={}){return Cy({queryKey:ie.jobSearch(e??"",n??"",r),queryFn:({pageParam:o})=>ae.get(`${ln(e,n)}/jobs/search`,{query:{state:r.state,q:r.q,limit:r.limit,cursor:o}}),initialPageParam:void 0,getNextPageParam:o=>o.nextCursor??void 0,enabled:!!e&&!!n&&r.q.trim().length>0&&(i.enabled??!0),staleTime:3e4})}function a2(e,n,r){return nt({queryKey:ie.job(e??"",n??"",r??""),queryFn:()=>ae.get(`${ln(e,n)}/jobs/${Ve(r)}`),enabled:!!e&&!!n&&!!r,refetchInterval:i=>{if(typeof document<"u"&&document.hidden)return!1;const o=i.state.data;return o&&o.finishedOn?!1:Tt.job}})}function i2(e,n,r,i={},o=!0){return nt({queryKey:ie.jobLogs(e??"",n??"",r??"",i),queryFn:()=>ae.get(`${ln(e,n)}/jobs/${Ve(r)}/logs`,{query:{start:i.start,end:i.end}}),enabled:o&&!!e&&!!n&&!!r,refetchInterval:Ut(Tt.job)})}function im(e,n){const r=Ze();return Ke({mutationFn:({jobId:i,action:o,scheduler:c})=>{const d=`${ln(e,n)}/jobs/${Ve(i)}`;return o==="remove"?ae.del(d):ae.post(`${d}/${o}`,o==="promote"&&c?{scheduler:c}:void 0)},onSuccess:()=>{r.invalidateQueries({queryKey:ie.queue(e,n)}),r.invalidateQueries({queryKey:ie.queues(e)}),r.invalidateQueries({queryKey:ie.overview(e)})}})}function l2(e,n){const r=Ze();return Ke({mutationFn:({action:i,jobIds:o})=>ae.post(`${ln(e,n)}/jobs/bulk/${i}`,{jobIds:o}),onSuccess:()=>{r.invalidateQueries({queryKey:ie.queue(e,n)}),r.invalidateQueries({queryKey:ie.queues(e)}),r.invalidateQueries({queryKey:ie.overview(e)})}})}function o2(e,n){const r=Ze();return Ke({mutationFn:i=>ae.post(`${ln(e,n)}/jobs`,i),onSuccess:()=>{r.invalidateQueries({queryKey:ie.queue(e,n)}),r.invalidateQueries({queryKey:ie.queues(e)})}})}function w0(e,n){const r=Ze();return Ke({mutationFn:i=>{const o=`${ln(e,n)}/${i.action}`;return"body"in i?ae.post(o,i.body):ae.post(o)},onSuccess:()=>{r.invalidateQueries({queryKey:ie.queue(e,n)}),r.invalidateQueries({queryKey:ie.queues(e)}),r.invalidateQueries({queryKey:ie.overview(e)})}})}function c2(e){const n=Ze();return Ke({mutationFn:({queue:r,action:i,reason:o})=>ae.post(`${ln(e,r)}/${i}`,i==="pause"?{...o?{reason:o}:{}}:void 0),onSuccess:()=>{n.invalidateQueries({queryKey:ie.connection(e)})}})}function N0(e,n,r){return nt({queryKey:ie.groups(e??"",n??"",r),queryFn:()=>ae.get(`${ln(e,n)}/groups`,{query:{...r}}),enabled:!!e&&!!n,refetchInterval:Ut(Tt.queues),placeholderData:Pn})}function u2(e,n,r,i){return nt({queryKey:ie.groupJobs(e??"",n??"",r??"",i),queryFn:()=>ae.get(`${ln(e,n)}/groups/${Ve(r)}/jobs`,{query:{...i}}),enabled:!!e&&!!n&&!!r,refetchInterval:Ut(Tt.queue),placeholderData:Pn})}function d2(e,n,r,i={}){return nt({queryKey:ie.schedulers(e??"",n??"",r),queryFn:()=>ae.get(`${ln(e,n)}/schedulers`,{query:{...r}}),enabled:!!e&&!!n&&i.enabled!==!1,refetchInterval:Ut(Tt.queues),placeholderData:Pn})}function h2(e,n={}){return nt({queryKey:ie.allSchedulers(e??"",n),queryFn:()=>ae.get(`/connections/${Ve(e)}/schedulers`,{query:{...n}}),enabled:!!e,refetchInterval:Ut(Tt.queues),placeholderData:Pn})}function f2(e,n){const r=Ze();return Ke({mutationFn:i=>ae.del(`${ln(e,n)}/schedulers/${Ve(i)}`),onSuccess:()=>{r.invalidateQueries({queryKey:["connections",e,"queue",n,"schedulers"]}),r.invalidateQueries({queryKey:ie.queue(e,n)}),r.invalidateQueries({queryKey:ie.queues(e)})}})}function U3(e,n,r,i=200){return nt({queryKey:ie.jobTree(e??"",n??"",r??"",i),queryFn:()=>ae.get(`${ln(e,n)}/jobs/${Ve(r)}/tree`,{query:{maxNodes:i}}),enabled:!!e&&!!n&&!!r,refetchInterval:o=>{if(typeof document<"u"&&document.hidden)return!1;const c=o.state.data;return c&&c.nodes.every(d=>d.finishedOn!==null||d.missing)?!1:Tt.job},placeholderData:Pn})}function m2(){const e=Ze();return Ke({mutationFn:n=>ae.post("/connections",n),onSuccess:()=>e.invalidateQueries({queryKey:ie.connections})})}function p2(){const e=Ze();return Ke({mutationFn:({id:n,input:r})=>ae.patch(`/connections/${Ve(n)}`,r),onSuccess:()=>e.invalidateQueries({queryKey:ie.connections})})}function x2(){const e=Ze();return Ke({mutationFn:n=>ae.del(`/connections/${Ve(n)}`),onSuccess:()=>e.invalidateQueries({queryKey:ie.connections})})}function g2(){return Ke({mutationFn:e=>ae.post("/connections/test",e)})}function v2(e={}){const n=e.enabled??!0;return nt({queryKey:ie.connectionsHealth,queryFn:()=>ae.get("/health/connections"),enabled:n,refetchInterval:n?Ut(Tt.health):!1,placeholderData:Pn})}function k0(e,n={}){return nt({queryKey:ie.hiddenQueues(e??""),queryFn:()=>ae.get(`/connections/${Ve(e)}/hidden-queues`),enabled:!!e&&(n.enabled??!0),staleTime:3e4})}function y2(e){const n=Ze();return Ke({mutationFn:({queue:r,hidden:i})=>i?ae.post(`/connections/${Ve(e)}/hidden-queues`,{queueName:r}):ae.del(`/connections/${Ve(e)}/hidden-queues/${Ve(r)}`),onSuccess:r=>{n.setQueryData(ie.hiddenQueues(e),r),n.invalidateQueries({queryKey:ie.queues(e)}),n.invalidateQueries({queryKey:ie.overview(e)}),n.invalidateQueries({queryKey:ie.connections})}})}function S0(){return nt({queryKey:ie.attentionThresholds,queryFn:()=>ae.get("/settings/attention"),staleTime:5*6e4})}function j2(){const e=Ze();return Ke({mutationFn:n=>ae.put("/settings/attention",n),onSuccess:n=>e.setQueryData(ie.attentionThresholds,n)})}function Wr(e=!0){return nt({queryKey:ie.folders,queryFn:()=>ae.get("/folders",{silent:[402]}),enabled:e,staleTime:3e4})}function b2(){const e=Ze();return Ke({mutationFn:n=>ae.post("/folders",n),onSuccess:()=>e.invalidateQueries({queryKey:ie.folders})})}function C0(){const e=Ze();return Ke({mutationFn:({id:n,input:r})=>ae.patch(`/folders/${Ve(n)}`,r),onSuccess:()=>e.invalidateQueries({queryKey:ie.folders})})}function w2(){const e=Ze();return Ke({mutationFn:n=>ae.del(`/folders/${Ve(n)}`),onSuccess:()=>e.invalidateQueries({queryKey:ie.folders})})}function _0(){const e=Ze();return Ke({mutationFn:({id:n,input:r})=>ae.put(`/folders/${Ve(n)}/queues`,r),onSuccess:()=>e.invalidateQueries({queryKey:ie.folders})})}function lm(e=!0){return nt({queryKey:ie.alerts,queryFn:()=>ae.get("/alerts",{silent:[402]}),enabled:e,refetchInterval:Ut(Tt.connections)})}function N2(e=!0){return nt({queryKey:ie.attention,queryFn:()=>ae.get("/attention",{silent:[402]}),enabled:e,refetchInterval:Ut(Tt.queues)})}function om(e){setTimeout(()=>void e.invalidateQueries({queryKey:ie.attention}),1500)}function k2(e={},n=!0){return nt({queryKey:ie.alertEvents(e),queryFn:()=>ae.get("/alerts/events",{query:{...e},silent:[402]}),enabled:n,refetchInterval:Ut(Tt.connections)})}function S2(){const e=Ze();return Ke({mutationFn:n=>ae.post("/alerts",n),onSuccess:()=>{e.invalidateQueries({queryKey:ie.alerts}),om(e)}})}function P0(){const e=Ze();return Ke({mutationFn:({id:n,input:r})=>ae.patch(`/alerts/${Ve(n)}`,r),onSuccess:()=>{e.invalidateQueries({queryKey:ie.alerts}),om(e)}})}function C2(){const e=Ze();return Ke({mutationFn:n=>ae.del(`/alerts/${Ve(n)}`),onSuccess:()=>{e.invalidateQueries({queryKey:ie.alerts}),om(e)}})}function _2(){const e=Ze();return Ke({mutationFn:n=>ae.post(`/alerts/${Ve(n)}/test`),onSuccess:()=>e.invalidateQueries({queryKey:["alerts","events"]})})}function P2(e=!0){return nt({queryKey:ie.users,queryFn:()=>ae.get("/users",{silent:[402]}),enabled:e})}function E2(){const e=Ze();return Ke({mutationFn:n=>ae.post("/users",n),onSuccess:()=>e.invalidateQueries({queryKey:ie.users})})}function R2(){const e=Ze();return Ke({mutationFn:({id:n,input:r})=>ae.patch(`/users/${Ve(n)}`,r),onSuccess:()=>e.invalidateQueries({queryKey:ie.users})})}function M2(e={},n=50,r=!0){return Cy({queryKey:ie.audit({...e,limit:n}),queryFn:({pageParam:i})=>ae.get("/audit",{query:{...e,limit:n,cursor:i??void 0},silent:[402,403]}),initialPageParam:void 0,getNextPageParam:i=>i.nextCursor??void 0,enabled:r})}function T2(e=!0){return nt({queryKey:ie.auditActors,queryFn:()=>ae.get("/audit/actors",{silent:[402,403]}),enabled:e,staleTime:6e4})}function q2(e={}){return By("/audit/export",{...e})}function I2(e,n,r,i=!0){const o={connectionId:e,queueName:n,jobId:r};return nt({queryKey:ie.audit({...o,limit:20}),queryFn:()=>ae.get("/audit",{query:{...o,limit:20},silent:[402,403]}),enabled:i&&!!e&&!!n&&!!r,staleTime:15e3})}function Q3(e,n=200,r=!0){return nt({queryKey:ie.flows(e??"",n),queryFn:()=>ae.get(`/connections/${Ve(e)}/flows`,{query:{sample:n},silent:[402]}),enabled:r&&!!e,refetchInterval:Ut(Tt.connections),placeholderData:Pn})}function B3(){const e=Ze();return Ke({mutationFn:n=>ae.post("/flow-edges",n),onSuccess:()=>e.invalidateQueries({queryKey:["flows"]})})}function V3(){const e=Ze();return Ke({mutationFn:n=>ae.del(`/flow-edges/${Ve(n)}`),onSuccess:()=>e.invalidateQueries({queryKey:["flows"]})})}function $2(){return Ke({mutationFn:e=>ae.put("/license",{key:e})})}function z2(){return Ke({mutationFn:()=>ae.post("/license/refresh")})}function O2(){return Ke({mutationFn:()=>ae.del("/license")})}function A2(){return nt({queryKey:ie.ssoLoginOptions,queryFn:()=>ae.get("/auth/sso/options",{silent:!0}),staleTime:6e4,retry:!1})}function L2(e=!0){return nt({queryKey:ie.ssoProviders,queryFn:()=>ae.get("/sso/providers",{silent:[402]}),enabled:e})}function E0(e=!0){return nt({queryKey:ie.ssoSettings,queryFn:()=>ae.get("/sso/settings",{silent:[402]}),enabled:e})}function F2(){const e=Ze();return Ke({mutationFn:n=>ae.post("/sso/providers",n),onSuccess:()=>{e.invalidateQueries({queryKey:ie.ssoProviders}),e.invalidateQueries({queryKey:ie.ssoLoginOptions})}})}function D2(){const e=Ze();return Ke({mutationFn:({id:n,input:r})=>ae.patch(`/sso/providers/${Ve(n)}`,r),onSuccess:()=>{e.invalidateQueries({queryKey:ie.ssoProviders}),e.invalidateQueries({queryKey:ie.ssoLoginOptions})}})}function U2(){const e=Ze();return Ke({mutationFn:n=>ae.del(`/sso/providers/${Ve(n)}`),onSuccess:()=>{e.invalidateQueries({queryKey:ie.ssoProviders}),e.invalidateQueries({queryKey:ie.ssoLoginOptions}),e.invalidateQueries({queryKey:ie.ssoSettings})}})}function Q2(){return Ke({mutationFn:e=>ae.post(`/sso/providers/${Ve(e)}/test`)})}function R0(){const e=Ze();return Ke({mutationFn:n=>ae.put("/sso/settings",n),onSuccess:()=>{e.invalidateQueries({queryKey:ie.ssoSettings}),e.invalidateQueries({queryKey:ie.ssoLoginOptions})}})}function B2(e=!0){return nt({queryKey:ie.mcpSettings,queryFn:()=>ae.get("/mcp/settings",{silent:[402]}),enabled:e})}function V2(){const e=Ze();return Ke({mutationFn:n=>ae.put("/mcp/settings",n),onSuccess:()=>void e.invalidateQueries({queryKey:ie.mcpSettings})})}function H2(e,n=!0){return nt({queryKey:ie.mcpGrants(e),queryFn:()=>ae.get(`/mcp/grants${e?"?all=1":""}`,{silent:[402]}),enabled:n})}function K2(){const e=Ze();return Ke({mutationFn:n=>ae.del(`/mcp/grants/${Ve(n)}`),onSuccess:()=>void e.invalidateQueries({queryKey:["mcp","grants"]})})}function H3(e){return nt({queryKey:ie.mcpConsent(e??""),queryFn:()=>ae.get(`/mcp/consent?request=${encodeURIComponent(e??"")}`),enabled:!!e,refetchOnWindowFocus:!1,staleTime:1/0})}function K3(){return Ke({mutationFn:e=>ae.post("/mcp/consent",e)})}const W2={neutral:"bg-surface-3 text-fg-muted",outline:"border border-border-strong text-fg-muted",success:"bg-success/15 text-success",warning:"bg-warning/15 text-warning",danger:"bg-danger/15 text-danger",info:"bg-info/15 text-info",accent:"bg-accent/15 text-accent",violet:"bg-violet/15 text-violet",teal:"bg-teal/15 text-teal",pro:"bg-pro/15 text-pro",custom:""};function ye({variant:e="neutral",dot:n,size:r="sm",mono:i,className:o,children:c,...d}){return t.jsxs("span",{className:F("inline-flex shrink-0 items-center gap-1 rounded font-medium whitespace-nowrap",r==="xs"?"h-4 px-1 text-[10px] leading-none":"h-5 px-1.5 text-[11px] leading-none",i&&"font-mono",W2[e],o),...d,children:[n&&t.jsx("span",{className:"status-dot size-1.5 bg-current","aria-hidden":!0}),c]})}function cm({className:e}){const{isPro:n,demo:r}=jt();return r?t.jsx(ye,{variant:"warning",size:"xs",className:F("tracking-wider",e),title:"Demo mode: Pro unlocked, settings locked",children:"DEMO"}):n?t.jsx(ye,{variant:"pro",size:"xs",className:F("tracking-wider",e),children:"PRO"}):t.jsx(ye,{variant:"outline",size:"xs",className:F("tracking-wider",e),children:"FREE"})}function Xg({className:e}){return t.jsx(io,{className:F("size-3 shrink-0 text-pro",e),"aria-label":"Pro feature"})}function Ki({children:e,className:n}){return t.jsx("kbd",{className:F("inline-flex h-5 min-w-5 items-center justify-center rounded border border-border-strong bg-surface-2 px-1 font-mono text-[10px] leading-none text-fg-muted shadow-[inset_0_-1px_0_var(--border-strong)]",n),children:e})}function Ce({content:e,children:n,side:r="top",className:i,block:o}){if(e==null||e==="")return t.jsx(t.Fragment,{children:n});const c={top:"bottom-full left-1/2 mb-1.5 -translate-x-1/2",bottom:"top-full left-1/2 mt-1.5 -translate-x-1/2",left:"right-full top-1/2 mr-1.5 -translate-y-1/2",right:"left-full top-1/2 ml-1.5 -translate-y-1/2"}[r];return t.jsxs("span",{className:F("has-tooltip relative",o?"block":"inline-flex",i),children:[n,t.jsx("span",{role:"tooltip",className:F("tooltip",c),children:e})]})}function Z2(e){return e?e.ok?"ok":"down":"unknown"}function Du({status:e,className:n,pulse:r,withLabel:i}){const o=Z2(e),c=o==="ok"?"bg-success text-success":o==="down"?"bg-danger text-danger":"bg-fg-subtle text-fg-subtle",d=o==="ok"?`Connected · ${(e==null?void 0:e.latencyMs)??"?"} ms · Redis ${(e==null?void 0:e.redisVersion)??"?"}`:o==="down"?`Down: ${(e==null?void 0:e.error)??"unreachable"}`:"Status unknown",h=e!=null&&e.checkedAt?` · checked ${Vr(e.checkedAt)}`:"";return t.jsx(Ce,{content:d+h,children:t.jsxs("span",{className:F("inline-flex items-center gap-1.5",n),children:[t.jsx("span",{className:F("status-dot",c,r&&o==="down"&&"pulse"),"aria-label":d,role:"img"}),i&&t.jsx("span",{className:F("text-xs",o==="down"?"text-danger":"text-fg-muted"),children:o==="ok"?"Connected":o==="down"?"Down":"Unknown"})]})})}function um({className:e}){return t.jsx("span",{className:F("inline-flex size-6 items-center justify-center rounded-md bg-[#0b0d10] ring-1 ring-border-strong",e),"aria-hidden":!0,children:t.jsxs("svg",{viewBox:"0 0 32 32",className:"size-5",children:[t.jsx("rect",{x:"7",y:"8",width:"18",height:"4",rx:"2",fill:"#5b8def"}),t.jsx("rect",{x:"7",y:"14",width:"13",height:"4",rx:"2",fill:"#5b8def",opacity:".75"}),t.jsx("rect",{x:"7",y:"20",width:"8",height:"4",rx:"2",fill:"#5b8def",opacity:".5"}),t.jsx("circle",{cx:"24",cy:"22",r:"3",fill:"#f85149"})]})})}function Yg({onOpenSwitcher:e,onNavigate:n,className:r}){const{isAdmin:i}=yt(),{has:o}=jt(),{byConnection:c,isLoading:d}=rl(),h=o("folders"),m=Wr(h),g=[{to:oe.alerts,label:"Alerts",icon:Xi,feature:"alerts"},{to:oe.flows(),label:"Flows",icon:IN,feature:"flows"},{to:oe.users,label:"Users",icon:Ou,feature:"users",adminOnly:!0},{to:oe.audit(),label:"Audit log",icon:qo,feature:"audit",adminOnly:!0}];return t.jsxs("aside",{className:F("flex h-full w-64 shrink-0 flex-col border-r border-border bg-surface",r),"aria-label":"Sidebar",children:[t.jsxs("div",{className:"flex h-12 items-center gap-2 border-b border-border px-3",children:[t.jsx(um,{}),t.jsx("span",{className:"truncate text-[13px] font-semibold tracking-tight",children:"Bullpane"}),t.jsx(cm,{className:"ml-auto"})]}),t.jsx("div",{className:"px-2 pt-2",children:t.jsxs("button",{type:"button",onClick:e,className:"flex h-8 w-full items-center gap-2 rounded-md border border-border bg-bg px-2.5 text-xs text-fg-subtle hover:border-border-strong hover:text-fg-muted",children:[t.jsx(Gn,{className:"size-3.5","aria-hidden":!0}),t.jsx("span",{className:"flex-1 text-left",children:"Jump to queue…"}),t.jsx(Ki,{children:x0}),t.jsx(Ki,{children:"K"})]})}),t.jsxs("nav",{className:"px-2 pt-2","aria-label":"Primary",children:[t.jsx(Gl,{to:oe.home,end:!0,icon:wN,label:"Overview",onNavigate:n}),t.jsx(Gl,{to:oe.schedulers(),icon:Ro,label:"Schedulers",onNavigate:n})]}),t.jsxs("div",{className:"mt-2 min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-2 pb-2",children:[t.jsx(G2,{children:"Queues"}),h&&m.data&&m.data.length>0&&t.jsx(Y2,{folders:m.data,byConnection:c,onNavigate:n}),c.map(({connection:p,queues:v,error:j})=>t.jsx(X2,{connection:p,queues:v,error:j,onNavigate:n,defaultOpen:c.length<=J2},p.id)),!d&&c.length===0&&t.jsxs("p",{className:"px-2 py-3 text-xs text-fg-subtle",children:["No connections yet."," ",i?t.jsx(_o,{to:oe.settings("connections"),className:"text-accent hover:underline",onClick:n,children:"Add one"}):"Ask an admin to add one."]}),d&&t.jsxs("div",{className:"space-y-2 px-2 py-2",children:[t.jsx("span",{className:"skeleton block h-3 w-3/4"}),t.jsx("span",{className:"skeleton block h-3 w-1/2"}),t.jsx("span",{className:"skeleton block h-3 w-2/3"})]}),h?t.jsx(Gl,{to:oe.folders,icon:Ys,label:"Manage folders",className:"mt-1 text-xs",onNavigate:n}):t.jsxs("button",{type:"button",onClick:()=>co("folders"),className:"nav-item mt-1 w-full text-left",title:"Custom folders are a Pro feature",children:[t.jsx(xN,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}),t.jsx("span",{className:"flex-1 truncate text-xs",children:"Custom folders"}),t.jsx(Xg,{})]})]}),t.jsxs("nav",{className:"border-t border-border px-2 py-2","aria-label":"Secondary",children:[g.filter(p=>!p.adminOnly||i).map(p=>o(p.feature)?t.jsx(Gl,{to:p.to,icon:p.icon,label:p.label,onNavigate:n},p.to):t.jsxs("button",{type:"button",onClick:()=>co(p.feature),className:"nav-item w-full text-left",children:[t.jsx(p.icon,{className:"size-3.5 shrink-0","aria-hidden":!0}),t.jsx("span",{className:"flex-1 truncate",children:p.label}),t.jsx(Xg,{})]},p.to)),t.jsx(Gl,{to:oe.settings(),icon:Fy,label:"Settings",onNavigate:n})]})]})}function G2({children:e}){return t.jsx("div",{className:"px-2 pt-2 pb-1 text-[10px] font-semibold tracking-wider text-fg-subtle uppercase",children:e})}function Gl({to:e,icon:n,label:r,end:i,className:o,onNavigate:c}){return t.jsxs(_o,{to:e,end:i,className:({isActive:d})=>F("nav-item",d&&"active",o),onClick:c,children:[t.jsx(n,{className:"size-3.5 shrink-0","aria-hidden":!0}),t.jsx("span",{className:"flex-1 truncate",children:r})]})}function M0(e,n=!0){const[r,i,o]=Fu(`sidebar.${e}`,n);return[r,i,o]}const J2=3;function X2({connection:e,queues:n,error:r,onNavigate:i,defaultOpen:o}){const c=Fn(),d=c.connectionId===e.id,[h,m,g]=M0(`conn.${e.id}`,o),p=N.useMemo(()=>[...n].sort((C,y)=>C.name.localeCompare(y.name)),[n]),v=n.reduce((C,y)=>C+y.counts.failed,0),j=n.reduce((C,y)=>C+y.counts.waiting+y.counts.prioritized,0);return N.useEffect(()=>{d&&!h&&g(!0)},[d,e.id]),t.jsxs("div",{className:"mt-0.5",children:[t.jsxs("div",{className:F("group flex h-7 items-center gap-1 rounded-md pr-1 pl-1 hover:bg-surface-2",d&&!c.queue&&"bg-surface-3"),children:[t.jsx("button",{type:"button",onClick:m,"aria-expanded":h,"aria-label":h?"Collapse":"Expand",className:"rounded p-0.5 text-fg-subtle hover:text-fg",children:h?t.jsx(ms,{className:"size-3.5"}):t.jsx(Dn,{className:"size-3.5"})}),t.jsxs(_o,{to:oe.connection(e.id),onClick:i,className:"flex min-w-0 flex-1 items-center gap-1.5 text-[13px] font-medium text-fg",children:[t.jsx(Aa,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}),t.jsx("span",{className:"truncate",children:e.name})]}),!h&&t.jsx(Ce,{content:`${n.length} ${n.length===1?"queue":"queues"} · ${ht(j)} waiting · ${ht(v)} failed`,children:t.jsxs("span",{className:"flex shrink-0 cursor-help items-center gap-1",children:[t.jsx("span",{className:"num text-[10px] text-fg-subtle",children:n.length}),v>0&&t.jsx("span",{className:"num text-[10px] text-danger",children:ht(v)})]})}),t.jsx(Du,{status:e.status,pulse:!0})]}),h&&t.jsxs("ul",{className:"ml-3 border-l border-border pl-1",children:[!!r&&t.jsx("li",{className:"px-2 py-1 text-xs text-danger",children:"Could not load queues"}),!r&&p.length===0&&t.jsx("li",{className:"px-2 py-1 text-xs text-fg-subtle",children:"No queues discovered"}),p.map(C=>t.jsx(T0,{connectionId:e.id,queue:C,onNavigate:i},C.name))]})]})}function T0({connectionId:e,queue:n,onNavigate:r,hint:i}){const o=Fn(),c=o.connectionId===e&&o.queue===n.name;return t.jsx("li",{children:t.jsxs(_o,{to:oe.queue(e,n.name,ho(n.counts)),onClick:r,className:F("nav-item h-6.5 pr-1.5 pl-2 text-xs",c&&"active"),title:i?`${i} / ${n.name}`:n.name,children:[t.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[n.name,i&&t.jsxs("span",{className:"ml-1 text-fg-subtle",children:["· ",i]})]}),n.isPaused&&t.jsx("span",{className:"rounded bg-surface-3 px-1 text-[9px] text-fg-subtle uppercase",children:"paused"}),t.jsx("span",{className:"num text-[10px] text-fg-subtle",title:"waiting",children:ht(n.counts.waiting+n.counts.prioritized)}),n.counts.failed>0&&t.jsx(Ce,{content:`${ht(n.counts.failed)} failed · click to open them`,children:t.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-danger",children:[t.jsx("span",{className:"status-dot size-1.5 bg-danger"}),t.jsx("span",{className:"num",children:ht(n.counts.failed)})]})})]})})}function Y2({folders:e,byConnection:n,onNavigate:r}){const i=e.filter(d=>!d.parentId).sort((d,h)=>d.position-h.position||d.name.localeCompare(h.name)),o=d=>e.filter(h=>h.parentId===d).sort((h,m)=>h.position-m.position||h.name.localeCompare(m.name)),c=(d,h)=>{const m=n.find(p=>p.connection.id===d),g=m==null?void 0:m.queues.find(p=>p.name===h);return m&&g?{connection:m.connection,queue:g}:null};return t.jsx("div",{className:"mb-2",children:i.map(d=>t.jsx(q0,{folder:d,children:o(d.id),lookup:c,onNavigate:r,depth:0},d.id))})}function q0({folder:e,children:n,lookup:r,onNavigate:i,depth:o}){const[c,d]=M0(`folder.${e.id}`),m=Fn().folderId===e.id,g=e.queues.map(p=>({ref:p,hit:r(p.connectionId,p.queueName)}));return t.jsxs("div",{className:"mt-0.5",style:{marginLeft:o*12},children:[t.jsxs("div",{className:F("group flex h-7 items-center gap-1 rounded-md pr-1 pl-1 hover:bg-surface-2",m&&"bg-surface-3"),children:[t.jsx("button",{type:"button",onClick:d,"aria-expanded":c,"aria-label":c?"Collapse":"Expand",className:"rounded p-0.5 text-fg-subtle hover:text-fg",children:c?t.jsx(ms,{className:"size-3.5"}):t.jsx(Dn,{className:"size-3.5"})}),t.jsxs(_o,{to:oe.folder(e.id),onClick:i,className:({isActive:p})=>F("flex min-w-0 flex-1 items-center gap-1.5 text-[13px] font-medium",p?"text-fg":"text-fg hover:underline"),title:`Open ${e.name}`,children:[t.jsx(Ys,{className:"size-3.5 shrink-0",style:{color:e.color??"var(--fg-subtle)"},"aria-hidden":!0}),t.jsx("span",{className:"truncate",children:e.name})]}),t.jsx("span",{className:"num text-[10px] text-fg-subtle",children:e.queues.length})]}),c&&t.jsxs(t.Fragment,{children:[n.map(p=>t.jsx(q0,{folder:p,children:[],lookup:r,onNavigate:i,depth:o+1},p.id)),t.jsxs("ul",{className:"ml-3 border-l border-border pl-1",children:[g.length===0&&n.length===0&&t.jsx("li",{className:"px-2 py-1 text-xs text-fg-subtle",children:"Empty folder"}),g.map(({ref:p,hit:v})=>v?t.jsx(T0,{connectionId:v.connection.id,queue:v.queue,hint:v.connection.name,onNavigate:i},`${p.connectionId}/${p.queueName}`):t.jsx("li",{className:"nav-item h-6.5 pl-2 text-xs text-fg-subtle line-through",title:"Queue not found on its connection",children:p.queueName},`${p.connectionId}/${p.queueName}`))]})]})]})}const eS=.9,tS=.7;function dm(e){if(!(e==null||!Number.isFinite(e))){if(e>=eS)return"danger";if(e>=tS)return"warn"}}function nS(e){return dm(e)??"ok"}function $o(e){if(e==null||!Number.isFinite(e))return"No CPU rate yet — needs two INFO samples. Also resets when Redis restarts. This is not zero.";const n=`${y0(e)} — used_cpu_sys + used_cpu_user per second, as a share of one core.`;return e>1?`${n} Above 100%: Redis is using more than one core, which its background threads (persistence, lazy free) can legitimately do — the command loop itself is still single threaded.`:`${n} Redis runs its command loop on a single thread, so 100% is the practical ceiling.`}const I0="health.paused";let Rf=Lu(I0,!1,e=>e==="true"||e==='"true"'||e==="1");const Mf=new Set;function sS(e){return Mf.add(e),()=>Mf.delete(e)}function ev(){return Rf}function rS(e){Rf!==e&&(Rf=e,po(I0,e),Mf.forEach(n=>n()))}function aS(){const e=N.useSyncExternalStore(sS,ev,ev),n=N.useCallback(r=>rS(r),[]);return[e,n]}function Uu(){const[e,n]=aS(),r=v2({enabled:!e}),i=r.data??[];let o=null;for(const c of i){const d=c.info?Date.parse(c.info.sampledAt):NaN;Number.isFinite(d)&&(o===null||d>o)&&(o=d)}return{health:i,paused:e,setPaused:n,isLoading:r.isLoading&&!e,error:r.error,lastSampleAt:o,refetch:()=>void r.refetch()}}function hm(e){let n=null,r=null,i=null,o=0,c=0,d=0;for(const h of e){h.ok||o++,h.commandsPerSec!=null&&h.kind!=="postgres"&&(n=(n??0)+h.commandsPerSec),h.memoryUsedPct!=null&&(r=Math.max(r??0,h.memoryUsedPct)),h.cpuCores!=null&&(i=Math.max(i??0,h.cpuCores));for(const m of h.warnings)m.level==="critical"?c++:d++}return{total:e.length,down:o,commandsPerSec:n,memoryPct:r,cpuCores:i,critical:c,warn:d}}function iS({className:e}){const{health:n,paused:r}=Uu();if(n.length===0)return null;const i=hm(n),o=i.down>0||i.critical>0,c=!o&&i.warn>0,d=r?"Health monitoring is paused. Open the monitor to resume.":[`${i.total} connection${i.total===1?"":"s"}`,i.down>0?`${i.down} unreachable`:null,i.commandsPerSec==null?"commands/sec: measuring…":`${Hr(i.commandsPerSec)} across all connections`,i.memoryPct==null?"no maxmemory set":`peak memory use ${_n(i.memoryPct)} of maxmemory`,i.cpuCores==null?null:`busiest CPU ${Hi(i.cpuCores)} of one core — ${$o(i.cpuCores)}`,i.critical>0?`${i.critical} critical warning${i.critical===1?"":"s"}`:null,i.warn>0?`${i.warn} warning${i.warn===1?"":"s"}`:null].filter(Boolean).join(" · ");return t.jsx(Ce,{content:d,side:"bottom",children:t.jsxs(Te,{to:oe.health,"aria-label":"Health monitor",className:F("hidden items-center gap-1.5 rounded-md border border-border bg-bg px-2 py-1 text-xs text-fg-muted transition-colors hover:border-border-strong hover:text-fg md:flex",o&&"border-danger/50 text-danger",c&&"border-warning/50 text-warning",r&&"opacity-60",e),children:[t.jsx(Eo,{className:F("size-3.5 shrink-0",r&&"opacity-50"),"aria-hidden":!0}),t.jsxs("span",{className:"num whitespace-nowrap",children:[i.total," conn",t.jsx("span",{className:"mx-1 text-fg-subtle",children:"·"}),r?"paused":i.commandsPerSec==null?"—":`${Hr(i.commandsPerSec,"")} cmd/s`,i.cpuCores!=null&&!r&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mx-1 text-fg-subtle",children:"·"}),Hi(i.cpuCores)," cpu"]}),i.memoryPct!=null&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mx-1 text-fg-subtle",children:"·"}),_n(i.memoryPct,0)," mem"]})]})]})})}const lS={sso:"SSO",mcp:"MCP"};function oS(){var c;const e=Fn(),{pathname:n}=Ln(),i=(c=xs().data)==null?void 0:c.find(d=>d.id===e.connectionId),o=[{label:"Overview",to:oe.home}];return n.startsWith("/settings")?(o.push({label:"Settings",to:oe.settings()}),e.tab&&o.push({label:lS[e.tab]??e.tab[0].toUpperCase()+e.tab.slice(1)}),o):n.startsWith("/health")?[...o,{label:"Health"}]:n.startsWith("/alerts")?[...o,{label:"Alerts"}]:n.startsWith("/users")?[...o,{label:"Users"}]:n.startsWith("/audit")?[...o,{label:"Audit log"}]:n.startsWith("/folders")?[...o,{label:"Folders"}]:n.startsWith("/flows")?(o.push({label:"Flows",to:oe.flows()}),i&&o.push({label:i.name}),o):(e.connectionId&&(o.push({label:(i==null?void 0:i.name)??e.connectionId,to:oe.connection(e.connectionId)}),e.queue&&(o.push({label:e.queue,to:oe.queue(e.connectionId,e.queue)}),n.includes("/groups")&&(o.push({label:"Groups",to:e.groupId?oe.groups(e.connectionId,e.queue):void 0}),e.groupId&&o.push({label:e.groupId,mono:!0})),e.jobId&&o.push({label:e.jobId,mono:!0}))),o)}function cS({onOpenSwitcher:e,onToggleSidebar:n}){var d,h;const r=oS(),i=Fn(),c=(d=xs().data)==null?void 0:d.find(m=>m.id===i.connectionId);return t.jsxs("header",{className:"flex h-12 shrink-0 items-center gap-2 border-b border-border bg-surface px-3",children:[t.jsx(H,{variant:"ghost",size:"icon-sm",className:"lg:hidden","aria-label":"Toggle sidebar",onClick:n,children:t.jsx(kN,{})}),t.jsx("nav",{"aria-label":"Breadcrumb",className:"min-w-0 flex-1",children:t.jsx("ol",{className:"flex min-w-0 items-center gap-1 text-[13px]",children:r.map((m,g)=>{const p=g===r.length-1;return t.jsxs("li",{className:F("flex min-w-0 items-center gap-1",p&&"min-w-0 flex-1"),children:[g>0&&t.jsx(Dn,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}),m.to&&!p?t.jsx(Te,{to:m.to,className:"truncate text-fg-muted hover:text-fg",children:m.label}):t.jsx("span",{"aria-current":p?"page":void 0,className:F("truncate",p?"font-medium text-fg":"text-fg-muted",m.mono&&"font-mono text-xs"),children:m.label})]},g)})})}),c&&t.jsxs("div",{className:"hidden items-center gap-1.5 rounded-md border border-border bg-bg px-2 py-1 text-xs text-fg-muted sm:flex",children:[t.jsx(Du,{status:c.status,pulse:!0}),t.jsx("span",{className:"truncate",children:c.name}),((h=c.status)==null?void 0:h.latencyMs)!=null&&t.jsxs("span",{className:"num text-fg-subtle",children:[c.status.latencyMs," ms"]})]}),t.jsx(iS,{}),t.jsx(H,{variant:"ghost",size:"icon-sm","aria-label":"Search queues",onClick:e,className:"sm:hidden",children:t.jsx(Gn,{})}),t.jsxs("button",{type:"button",onClick:e,className:"hidden h-7 items-center gap-1.5 rounded-md border border-border px-2 text-xs text-fg-subtle hover:border-border-strong hover:text-fg-muted sm:inline-flex",children:[t.jsx(Gn,{className:"size-3.5","aria-hidden":!0}),t.jsx(Ki,{children:x0}),t.jsx(Ki,{children:"K"})]}),t.jsx(dS,{})]})}function uS(){return t.jsxs("button",{type:"button",onClick:()=>co("users"),className:"flex h-7 items-center gap-1.5 rounded-md border border-warning/40 bg-warning/10 px-2 text-xs text-warning hover:bg-warning/20",title:"Anyone who can reach this URL can retry, promote and delete jobs. Pro adds login, roles and the audit log.",children:[t.jsx(Xf,{className:"size-3.5","aria-hidden":!0}),t.jsx("span",{className:"hidden md:inline",children:"No login"})]})}function dS(){const{user:e,logout:n,isAdmin:r,authRequired:i}=yt(),{demo:o,has:c}=jt(),[d,h]=N.useState(!1),m=N.useRef(null);if(N.useEffect(()=>{if(!d)return;const p=j=>{var C;(C=m.current)!=null&&C.contains(j.target)||h(!1)},v=j=>j.key==="Escape"&&h(!1);return document.addEventListener("mousedown",p),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",v)}},[d]),!i)return t.jsx(uS,{});if(!e)return null;const g=e.name.split(/\s+/).map(p=>p[0]).slice(0,2).join("").toUpperCase();return t.jsxs("div",{ref:m,className:"relative",children:[t.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":d,onClick:()=>h(p=>!p),className:"flex h-7 items-center gap-2 rounded-md px-1.5 hover:bg-surface-2",children:[t.jsx("span",{className:"flex size-6 items-center justify-center rounded-full bg-accent/20 text-[10px] font-semibold text-accent",children:g||"?"}),t.jsx("span",{className:"hidden max-w-32 truncate text-xs text-fg md:inline",children:e.name}),t.jsx(ye,{variant:e.role==="admin"?"pro":e.role==="operator"?"info":"neutral",size:"xs",className:"hidden md:inline-flex",children:e.role})]}),d&&t.jsxs("div",{role:"menu",className:"absolute right-0 z-40 mt-1 w-60 rounded-lg border border-border bg-surface p-1 shadow-[var(--shadow)]",children:[t.jsxs("div",{className:"px-2.5 py-2",children:[t.jsx("p",{className:"truncate text-[13px] font-medium text-fg",children:e.name}),t.jsx("p",{className:"truncate text-xs text-fg-muted",children:e.email}),t.jsxs("p",{className:"mt-1 flex items-center gap-1 text-[11px] text-fg-subtle",children:[t.jsx(EN,{className:"size-3","aria-hidden":!0})," ",e.role,o&&t.jsx("span",{className:"ml-1 text-warning",children:"· demo"})]})]}),t.jsx("div",{className:"my-1 border-t border-border"}),r&&c("audit")&&t.jsxs(Te,{role:"menuitem",to:oe.audit(),onClick:()=>h(!1),className:"nav-item",children:[t.jsx(qo,{className:"size-3.5","aria-hidden":!0})," Audit log"]}),t.jsxs(Te,{role:"menuitem",to:oe.settings("license"),onClick:()=>h(!1),className:"nav-item",children:[t.jsx(el,{className:"size-3.5","aria-hidden":!0})," License"]}),t.jsxs("button",{role:"menuitem",type:"button",onClick:()=>void n(),className:"nav-item w-full text-left",children:[t.jsx(NN,{className:"size-3.5","aria-hidden":!0})," Log out"]})]})]})}function hS({open:e,onClose:n}){const{byConnection:r}=rl(),i=an(),[o,c]=N.useState(""),[d,h]=N.useState(0),m=N.useRef(null),g=N.useRef(null),p=N.useRef(null),v=N.useMemo(()=>r.flatMap(({connection:y,queues:b})=>b.map(k=>({key:`${y.id}/${k.name}`,connectionId:y.id,connectionName:y.name,queue:k.name,waiting:k.counts.waiting+k.counts.prioritized,failed:k.counts.failed,paused:k.isPaused,landing:ho(k.counts)}))),[r]),j=N.useMemo(()=>{const y=o.trim().toLowerCase();return v.map(k=>({it:k,score:fS(y,k)})).filter(k=>k.score>0).sort((k,S)=>S.score-k.score||k.it.queue.localeCompare(S.it.queue)).slice(0,50).map(k=>k.it)},[v,o]);N.useEffect(()=>{const y=g.current;y&&(e&&!y.open?(y.showModal(),c(""),h(0),setTimeout(()=>{var b;return(b=m.current)==null?void 0:b.focus()},0)):!e&&y.open&&y.close())},[e]),N.useEffect(()=>{h(0)},[o]),N.useEffect(()=>{var b;const y=(b=p.current)==null?void 0:b.children[d];y==null||y.scrollIntoView({block:"nearest"})},[d]);const C=y=>{y&&(n(),i(oe.queue(y.connectionId,y.queue,y.landing)))};return t.jsx("dialog",{ref:g,className:"dialog !mt-[12vh]",style:{"--dialog-w":"36rem"},"aria-label":"Jump to queue",onClose:n,onCancel:y=>{y.preventDefault(),n()},onClick:y=>y.target===g.current&&n(),children:e&&t.jsxs("div",{onClick:y=>y.stopPropagation(),children:[t.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[t.jsx(Gn,{className:"size-4 text-fg-subtle","aria-hidden":!0}),t.jsx("input",{ref:m,value:o,onChange:y=>c(y.target.value),placeholder:"Type a queue name…","aria-label":"Queue name","aria-activedescendant":j[d]?`qs-${j[d].key}`:void 0,role:"combobox","aria-expanded":!0,"aria-controls":"qs-list",className:"h-11 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-subtle",onKeyDown:y=>{y.key==="ArrowDown"?(y.preventDefault(),h(b=>Math.min(j.length-1,b+1))):y.key==="ArrowUp"?(y.preventDefault(),h(b=>Math.max(0,b-1))):y.key==="Enter"&&(y.preventDefault(),C(j[d]))}}),t.jsx(Ki,{children:"esc"})]}),t.jsxs("ul",{id:"qs-list",ref:p,role:"listbox",className:"max-h-[50vh] overflow-y-auto p-1",children:[j.length===0&&t.jsx("li",{className:"px-3 py-8 text-center text-xs text-fg-subtle",children:v.length===0?"No queues loaded yet":"No queue matches"}),j.map((y,b)=>t.jsxs("li",{id:`qs-${y.key}`,role:"option","aria-selected":b===d,onMouseEnter:()=>h(b),onClick:()=>C(y),className:F("flex cursor-pointer items-center gap-2 rounded-md px-2.5 py-1.5 text-[13px]",b===d?"bg-surface-3 text-fg":"text-fg-muted"),children:[t.jsx(Aa,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}),t.jsx("span",{className:"truncate font-medium text-fg",children:t.jsx(mS,{text:y.queue,needle:o})}),t.jsx("span",{className:"truncate text-xs text-fg-subtle",children:y.connectionName}),y.paused&&t.jsx("span",{className:"rounded bg-surface-3 px-1 text-[9px] uppercase",children:"paused"}),t.jsxs("span",{className:"num ml-auto text-xs text-fg-subtle",children:[ht(y.waiting)," waiting"]}),y.failed>0&&t.jsxs("span",{className:"num text-xs text-danger",children:[ht(y.failed)," failed"]}),b===d&&t.jsx(dN,{className:"size-3.5 text-fg-subtle","aria-hidden":!0})]},y.key))]})]})})}function fS(e,n){if(!e)return 1;const r=n.queue.toLowerCase();if(r===e)return 100;if(r.startsWith(e))return 80;if(r.includes(e))return 60;if(n.connectionName.toLowerCase().includes(e))return 20;let i=0;for(let o=0;o<r.length&&i<e.length;o++)r[o]===e[i]&&i++;return i===e.length?10:0}function mS({text:e,needle:n}){const r=n.trim().toLowerCase();if(!r)return t.jsx(t.Fragment,{children:e});const i=e.toLowerCase().indexOf(r);return i<0?t.jsx(t.Fragment,{children:e}):t.jsxs(t.Fragment,{children:[e.slice(0,i),t.jsx("mark",{className:"rounded-sm bg-accent/25 text-fg",children:e.slice(i,i+r.length)}),e.slice(i+r.length)]})}const xo=new Map;let Gc=null,tv=Number.POSITIVE_INFINITY,$0=Date.now();function pS(){document.hidden||($0=Date.now(),xo.forEach((e,n)=>n()))}function nv(){const e=xo.size?Math.min(...xo.values()):Number.POSITIVE_INFINITY;e!==tv&&(Gc&&clearInterval(Gc),Gc=null,tv=e,Number.isFinite(e)&&(Gc=setInterval(pS,e)))}function al(e=15e3){const[,n]=N.useState(0);return N.useEffect(()=>{const r=()=>n(i=>i+1);return xo.set(r,e),nv(),()=>{xo.delete(r),nv()}},[e]),$0}function Wt({value:e,className:n,withAbsolute:r,emptyText:i="–"}){const o=al(),c=Io(e);if(c==null)return t.jsx("span",{className:F("text-fg-subtle",n),children:i});const d=xn(c);return t.jsxs("time",{dateTime:new Date(c).toISOString(),title:d,className:F("num whitespace-nowrap",n),children:[Vr(c,o),r&&t.jsx("span",{className:"ml-1.5 text-fg-subtle",children:d})]})}const xS="only leaves the list · jobs untouched · reversible",z0="Hide this queue from the lists. Nothing is deleted: the jobs, the workers and the alerts stay exactly as they are, and you can bring it back at any time. (Not to be confused with Obliterate, which deletes the queue and all its jobs for good.)",O0="Removed from the lists only. No job was deleted.";function fm(e){var o;const n=y2(e),r=(c,d={})=>n.mutate({queue:c,hidden:!1},{onSuccess:()=>{d.silent||ee.success(`${c} is visible again`)},onError:h=>ee.error(be(h))});return{hide:c=>n.mutate({queue:c,hidden:!0},{onSuccess:()=>ee.undoable(`${c} hidden`,{label:"Undo",onClick:()=>r(c,{silent:!0})},O0),onError:d=>ee.error(be(d))}),unhide:r,isPending:n.isPending,pendingQueue:n.isPending?((o=n.variables)==null?void 0:o.queue)??null:null}}function gS(){const e=Ze(),n=async(o,c,d)=>{const h=d?await ae.post(`/connections/${Ve(o)}/hidden-queues`,{queueName:c}):await ae.del(`/connections/${Ve(o)}/hidden-queues/${Ve(c)}`);e.setQueryData(ie.hiddenQueues(o),h),e.invalidateQueries({queryKey:ie.queues(o)}),e.invalidateQueries({queryKey:ie.overview(o)})},r=(o,c,d={})=>n(o,c,!1).then(()=>{d.silent||ee.success(`${c} is visible again`)},h=>ee.error(be(h)));return{hide:(o,c)=>n(o,c,!0).then(()=>ee.undoable(`${c} hidden`,{label:"Undo",onClick:()=>void r(o,c,{silent:!0})},O0),d=>ee.error(be(d))),unhide:r}}function vS({connectionId:e,queueName:n}){var d;const{isOperator:r}=yt(),i=k0(e),o=fm(e),c=(d=i.data)==null?void 0:d.find(h=>h.queueName===n);return c?t.jsxs("div",{role:"status",className:"mx-auto flex w-full max-w-none flex-wrap items-center gap-x-3 gap-y-1.5 border-b border-warning/40 bg-warning/10 px-5 py-2 text-xs text-fg",children:[t.jsx(Mo,{className:"size-3.5 shrink-0 text-warning","aria-hidden":!0}),t.jsxs("span",{children:[t.jsx("span",{className:"font-medium",children:"This queue is hidden."})," It does not appear in the sidebar, the cards or the tables. Nothing was deleted — the jobs, the workers and the alerts are untouched."]}),t.jsxs("span",{className:"text-fg-subtle",children:["hidden ",t.jsx(Wt,{value:c.hiddenAt,className:"text-xs"}),c.hiddenByName&&` by ${c.hiddenByName}`]}),r&&t.jsx(H,{size:"xs",variant:"secondary",className:"ml-auto",leftIcon:t.jsx(qy,{}),loading:o.pendingQueue===n,onClick:()=>o.unhide(n),children:"Show again"})]}):null}function yS(){const[e,n]=N.useState(!1),[r,i]=N.useState(!1),o=Ln(),c=bg("/c/:connectionId/q/:queue/*"),d=bg("/c/:connectionId/q/:queue"),h=c??d,m=N.useCallback(()=>n(!0),[]);return p0("k",g=>{g.preventDefault(),n(p=>!p)},{mod:!0,allowInInputs:!0}),N.useEffect(()=>{i(!1)},[o.pathname]),t.jsxs("div",{className:"flex h-screen w-full overflow-hidden bg-bg",children:[t.jsx(Yg,{onOpenSwitcher:m,className:"hidden lg:flex"}),r&&t.jsxs("div",{className:"fixed inset-0 z-40 flex lg:hidden",children:[t.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>i(!1),"aria-hidden":!0}),t.jsx(Yg,{onOpenSwitcher:m,onNavigate:()=>i(!1),className:"relative z-10 shadow-[var(--shadow)]"})]}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[t.jsx(cS,{onOpenSwitcher:m,onToggleSidebar:()=>i(g=>!g)}),t.jsxs("main",{className:F("min-h-0 flex-1 overflow-y-auto"),children:[(h==null?void 0:h.params.connectionId)&&h.params.queue&&t.jsx(vS,{connectionId:h.params.connectionId,queueName:h.params.queue}),t.jsx(sy,{})]})]}),t.jsx(hS,{open:e,onClose:()=>n(!1)})]})}function vt({children:e,className:n,wide:r}){return t.jsx("div",{className:F("mx-auto w-full px-5 py-5",r?"max-w-none":"max-w-[1400px]",n),children:e})}function gs({title:e,description:n,actions:r,className:i}){return t.jsxs("div",{className:F("mb-4 flex flex-wrap items-start justify-between gap-3",i),children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h1",{className:"truncate text-lg font-semibold tracking-tight text-fg",children:e}),n&&t.jsx("p",{className:"mt-0.5 text-xs text-fg-muted",children:n})]}),r&&t.jsx("div",{className:"flex flex-wrap items-center gap-2",children:r})]})}function Qu({label:e,hint:n,error:r,htmlFor:i,className:o,children:c,inline:d}){return t.jsxs("div",{className:F(d?"flex items-center gap-3":"flex flex-col gap-1",o),children:[e&&t.jsx("label",{htmlFor:i,className:"text-xs font-medium text-fg-muted",children:e}),c,r?t.jsx("p",{className:"text-xs text-danger",role:"alert",children:r}):n?t.jsx("p",{className:"text-xs text-fg-subtle",children:n}):null]})}const Ee=N.forwardRef(function({label:n,hint:r,error:i,mono:o,className:c,wrapperClassName:d,id:h,leftIcon:m,...g},p){const v=N.useId(),j=h??v,C=t.jsxs("div",{className:F("relative",m&&"[&_svg]:pointer-events-none"),children:[m&&t.jsx("span",{className:"pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-fg-subtle [&_svg]:size-3.5",children:m}),t.jsx("input",{ref:p,id:j,"aria-invalid":i?!0:void 0,className:F("control",o&&"font-mono",m&&"pl-8",c),...g})]});return!n&&!r&&!i?C:t.jsx(Qu,{label:n,hint:r,error:i,htmlFor:j,className:d,children:C})}),Wi=N.forwardRef(function({label:n,hint:r,error:i,mono:o,className:c,wrapperClassName:d,id:h,...m},g){const p=N.useId(),v=h??p,j=t.jsx("textarea",{ref:g,id:v,"aria-invalid":i?!0:void 0,className:F("control",o&&"font-mono text-xs",c),...m});return!n&&!r&&!i?j:t.jsx(Qu,{label:n,hint:r,error:i,htmlFor:v,className:d,children:j})}),ut=N.forwardRef(function({label:n,hint:r,error:i,className:o,wrapperClassName:c,id:d,options:h,children:m,...g},p){const v=N.useId(),j=d??v,C=t.jsx("select",{ref:p,id:j,"aria-invalid":i?!0:void 0,className:F("control",o),...g,children:h?h.map(y=>t.jsx("option",{value:y.value,disabled:y.disabled,children:y.label},y.value)):m});return!n&&!r&&!i?C:t.jsx(Qu,{label:n,hint:r,error:i,htmlFor:j,className:c,children:C})}),mm=N.forwardRef(function({label:n,description:r,className:i,id:o,...c},d){const h=N.useId(),m=o??h;return t.jsxs("label",{htmlFor:m,className:F("flex cursor-pointer items-start gap-2 text-[13px] select-none",i),children:[t.jsx("input",{ref:d,id:m,type:"checkbox",className:"mt-0.5 size-3.5 shrink-0 cursor-pointer accent-[var(--accent)]",...c}),(n||r)&&t.jsxs("span",{className:"flex flex-col",children:[n&&t.jsx("span",{className:"text-fg",children:n}),r&&t.jsx("span",{className:"text-xs text-fg-subtle",children:r})]})]})});function Zi({checked:e,onChange:n,disabled:r,label:i,className:o,size:c="md"}){const d=c==="sm"?"h-4 w-7":"h-5 w-9",h=c==="sm"?"size-3":"size-4",m=c==="sm"?"translate-x-3":"translate-x-4";return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":i,disabled:r,onClick:()=>n(!e),className:F("relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-colors outline-none focus-visible:ring-2 focus-visible:ring-accent/60 disabled:opacity-50",d,e?"bg-accent":"bg-surface-3",o),children:t.jsx("span",{className:F("inline-block rounded-full bg-white shadow transition-transform",h,e?m:"translate-x-0.5")})})}function A0({title:e,description:n,children:r,footer:i}){return t.jsx("div",{className:"flex min-h-screen items-center justify-center bg-bg px-4 py-10",children:t.jsxs("div",{className:"w-full max-w-sm",children:[t.jsxs("div",{className:"mb-6 flex items-center justify-center gap-2",children:[t.jsx(um,{className:"size-8"}),t.jsx("span",{className:"text-base font-semibold tracking-tight",children:"Bullpane"}),t.jsx(cm,{})]}),t.jsxs("div",{className:"card p-6 shadow-[var(--shadow)]",children:[t.jsx("h1",{className:"text-base font-semibold text-fg",children:e}),n&&t.jsx("p",{className:"mt-1 text-xs text-fg-muted",children:n}),t.jsx("div",{className:"mt-5",children:r})]}),i&&t.jsx("div",{className:"mt-4 text-center text-xs text-fg-subtle",children:i})]})})}function jS(){var ce;const{login:e,needsSetup:n}=yt(),{demo:r}=jt(),i=an(),o=Ln(),[c,d]=Po(),[h,m]=N.useState(""),[g,p]=N.useState(""),[v,j]=N.useState(null),[C,y]=N.useState({}),[b,k]=N.useState(!1),S=c.get("sso_error");N.useEffect(()=>{if(!S)return;j(S);const _e=new URLSearchParams(c);_e.delete("sso_error"),d(_e,{replace:!0})},[S,c,d]);const{data:$}=A2(),z=($==null?void 0:$.providers)??[],E=z.length>0,T=($==null?void 0:$.requireSso)??!1,[M,O]=N.useState(!1),Q=!T||M;if(n)return t.jsx(Qr,{to:"/setup",replace:!0});const V=(ce=o.state)==null?void 0:ce.from,q=V!=null&&V.pathname?`${V.pathname}${V.search??""}`:void 0,B=async _e=>{_e.preventDefault(),j(null);const Ue=fk.safeParse({email:h.trim(),password:g});if(!Ue.success){const Ge={};for(const rt of Ue.error.issues)Ge[rt.path[0]]=rt.message;y(Ge);return}y({}),k(!0);try{await e(Ue.data),i(q??"/",{replace:!0})}catch(Ge){er(Ge)&&Ge.status===401?j(be(Ge,"Invalid email or password")):j(be(Ge))}finally{k(!1)}};return t.jsxs(A0,{title:"Sign in",description:r?"Demo playground: Pro features are unlocked, settings are read-only.":T?"This installation signs in through your identity provider.":"Use the account created during setup.",footer:t.jsxs(t.Fragment,{children:["Self-hosted dashboard for BullMQ ·"," ",t.jsx(Te,{to:"/setup",className:"hover:text-fg",children:"first run?"})]}),children:[v&&t.jsx("p",{role:"alert",className:"mb-3 rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-xs text-danger",children:v}),E&&t.jsx("div",{className:"space-y-2",children:z.map(_e=>t.jsxs(H,{variant:"secondary",className:"w-full",leftIcon:t.jsx(zu,{className:"size-4"}),onClick:()=>{const Ue=`/api/auth/sso/${encodeURIComponent(_e.id)}/start`;window.location.href=q?`${Ue}?next=${encodeURIComponent(q)}`:Ue},children:["Sign in with ",_e.name]},_e.id))}),E&&Q&&t.jsxs("div",{className:"my-4 flex items-center gap-3",children:[t.jsx("span",{className:"h-px flex-1 bg-border"}),t.jsx("span",{className:"text-[11px] uppercase tracking-wide text-fg-subtle",children:"or"}),t.jsx("span",{className:"h-px flex-1 bg-border"})]}),Q?t.jsxs("form",{onSubmit:B,className:"space-y-3",noValidate:!0,children:[t.jsx(Ee,{label:"Email",type:"email",autoComplete:"username",autoFocus:!E,value:h,onChange:_e=>m(_e.target.value),error:C.email,required:!0}),t.jsx(Ee,{label:"Password",type:"password",autoComplete:"current-password",value:g,onChange:_e=>p(_e.target.value),error:C.password,required:!0}),T&&t.jsx("p",{className:"text-[11px] text-fg-subtle",children:($==null?void 0:$.passwordEscapeHatch)==="all"?"Password sign-in is allowed for everyone on this installation (BULLPANE_ALLOW_PASSWORD_LOGIN).":"Password sign-in works for admin accounts only, so a misconfigured provider cannot lock you out."}),t.jsx(H,{type:"submit",variant:"primary",className:"w-full",loading:b,children:"Sign in"})]}):t.jsx("div",{className:"mt-4 text-center",children:t.jsx(H,{variant:"link",size:"sm",leftIcon:t.jsx(el,{className:"size-3.5"}),onClick:()=>O(!0),children:"Sign in with a password instead"})})]})}function bS(){const{setup:e,needsSetup:n,loading:r}=yt(),i=an(),[o,c]=N.useState({name:"",email:"",password:"",confirm:""}),[d,h]=N.useState({}),[m,g]=N.useState(null),[p,v]=N.useState(!1);if(!r&&!n)return t.jsx(Qr,{to:"/login",replace:!0});const j=y=>b=>c(k=>({...k,[y]:b.target.value})),C=async y=>{y.preventDefault(),g(null);const b=hk.safeParse({name:o.name.trim(),email:o.email.trim(),password:o.password}),k={};if(!b.success)for(const S of b.error.issues)k[String(S.path[0])]=S.message;if(o.password!==o.confirm&&(k.confirm="Passwords do not match"),h(k),!(Object.keys(k).length>0||!b.success)){v(!0);try{await e(b.data),i("/",{replace:!0})}catch(S){er(S)&&S.status===409?g("Setup was already completed. Sign in instead."):g(be(S))}finally{v(!1)}}};return t.jsx(A0,{title:"Create the admin account",description:"This is the first run. The account you create here is the administrator of this installation.",children:t.jsxs("form",{onSubmit:C,className:"space-y-3",noValidate:!0,children:[t.jsx(Ee,{label:"Name",autoFocus:!0,autoComplete:"name",value:o.name,onChange:j("name"),error:d.name,required:!0}),t.jsx(Ee,{label:"Email",type:"email",autoComplete:"username",value:o.email,onChange:j("email"),error:d.email,required:!0}),t.jsx(Ee,{label:"Password",type:"password",autoComplete:"new-password",value:o.password,onChange:j("password"),error:d.password,hint:"At least 8 characters",required:!0}),t.jsx(Ee,{label:"Confirm password",type:"password",autoComplete:"new-password",value:o.confirm,onChange:j("confirm"),error:d.confirm,required:!0}),m&&t.jsx("p",{role:"alert",className:"rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-xs text-danger",children:m}),t.jsx(H,{type:"submit",variant:"primary",className:"w-full",loading:p,children:"Create account"})]})})}const Pa=e=>`${e.connection.id}/${e.queue.name}`;function Tf(e,n){const r=[];if(n&&n.length>0){const o=new Map(e.map(p=>[Pa(p),p])),c=new Set,d=n.filter(p=>!p.parentId).sort(sv),h=p=>n.filter(v=>v.parentId===p).sort(sv),m=(p,v)=>{const j=[];for(const C of p.queues){const y=`${C.connectionId}/${C.queueName}`,b=o.get(y);b&&(j.push(b),c.add(y))}j.length>0&&r.push({id:`folder:${p.id}`,title:v,color:p.color,kind:"folder",items:Fh(j)})};for(const p of d){m(p,p.name);for(const v of h(p.id))m(v,`${p.name} / ${v.name}`)}const g=e.filter(p=>!c.has(Pa(p)));return g.length>0&&r.push({id:"leftover",title:"Queues without folder",kind:"leftover",items:Fh(g)}),r}const i=new Map;for(const o of e){let c=i.get(o.connection.id);c||(c={id:`conn:${o.connection.id}`,title:o.connection.name,kind:"connection",items:[]},i.set(o.connection.id,c)),c.items.push(o)}for(const o of i.values())o.items=Fh(o.items);return[...i.values()]}function sv(e,n){return e.position-n.position||e.name.localeCompare(n.name)}function Fh(e){return[...e].sort((n,r)=>r.queue.counts.failed-n.queue.counts.failed||r.queue.counts.waiting-n.queue.counts.waiting||n.queue.name.localeCompare(r.queue.name))}function pm(e){return e.reduce((n,{queue:r})=>(n.queues+=1,r.isPaused&&(n.paused+=1),n.waiting+=r.counts.waiting+r.counts.prioritized,n.active+=r.counts.active,n.failed+=r.counts.failed,n.delayed+=r.counts.delayed,n.completed+=r.counts.completed,n),{queues:0,paused:0,waiting:0,active:0,failed:0,delayed:0,completed:0})}function xm(e,n){const r=n.trim().toLowerCase();return r?e.queue.name.toLowerCase().includes(r)||e.connection.name.toLowerCase().includes(r):!0}const wS={failing:"failing now",paused:"paused",backlog:"backlog, no worker",waiting:"backlog over threshold",failed:"failed jobs"},NS=1;function kS(e,n=ku){var g,p;const r=e.queue,i=r.counts,o=[],c=((g=r.rates)==null?void 0:g.failed)??0,d=(((p=r.rates)==null?void 0:p.completed)??0)+c;c>0&&o.push("failing"),r.isPaused&&o.push("paused");const h=i.waiting+i.prioritized,m=h>=NS&&i.active===0&&d===0&&!r.isPaused;return m&&o.push("backlog"),!m&&n.waitingAbove>0&&h>n.waitingAbove&&o.push("waiting"),n.failedAbove>0?i.failed>n.failedAbove&&o.push("failed"):o.length===0&&i.failed>0&&o.push("failed"),o}function ki(e){return e>0?Math.min(Math.log10(e+1)*1e3,9999):0}const SS={failed_rate_above:1e6,failed_above:1e6,duration_above:7e5,waiting_above:7e5};function CS(e,n,r=[]){var h;const i=e.queue,o=i.counts;let c=0,d=0;for(const m of r){const g=m.threshold>0?m.value/m.threshold:m.value;d=Math.max(d,SS[m.kind]+ki(g*100))}return c+=d,n.includes("failing")&&(c+=1e6+ki(((h=i.rates)==null?void 0:h.failed)??0)),n.includes("paused")&&(c+=5e5+ki(o.waiting+o.active)),n.includes("backlog")&&(c+=1e5+ki(o.waiting+o.prioritized)),n.includes("waiting")&&(c+=5e4+ki(o.waiting+o.prioritized)),n.includes("failed")&&(c+=ki(o.failed)),c}const _S=["paused","backlog"];function rv(e,n){return`${e}\0${n}`}function PS(e,n=ku,r=8,i){const o=[],c=[],d=new Map;for(const h of i??[]){const m=rv(h.connectionId,h.queueName),g=d.get(m);g?g.push(h):d.set(m,[h])}for(const h of e){const m=kS(h,n),g=i?m.filter(v=>_S.includes(v)):m,p=d.get(rv(h.connection.id,h.queue.name))??[];g.length>0||p.length>0?o.push({entry:h,reasons:g,findings:p,score:CS(h,g,p)}):c.push(h)}return o.sort((h,m)=>m.score-h.score||h.entry.queue.name.localeCompare(m.entry.queue.name)),{attention:ES(o,r),hidden:Math.max(0,o.length-r),rest:c}}function ES(e,n){if(e.length<=n)return e;const r=new Map;for(const c of e){const d=c.entry.connection.id,h=r.get(d);h?h.push(c):r.set(d,[c])}const i=[...r.values()],o=[];for(let c=0;o.length<n;c++){let d=!1;for(const h of i)if(!(c>=h.length)&&(o.push(h[c]),d=!0,o.length===n))break;if(!d)break}return o}function gm(e,n,r){const[i,o]=Po(),c=N.useMemo(()=>{const g=av(i.get("sort"),i.get("dir"),r);if(g)return g;const p=Lu(`table.${e}.sort`,null);return p&&typeof p=="object"&&av(p.key,p.dir,r)?p:n},[i,e,n,r]),d=i.get("filter")??"",h=N.useCallback(g=>{po(`table.${e}.sort`,g),o(p=>{const v=new URLSearchParams(p);return v.set("sort",g.key),v.set("dir",g.dir),v},{replace:!0})},[o,e]),m=N.useCallback(g=>{o(p=>{const v=new URLSearchParams(p);return g.trim()?v.set("filter",g):v.delete("filter"),v},{replace:!0})},[o]);return{sort:c,setSort:h,filter:d,setFilter:m}}function av(e,n,r){return!e||r&&!r.includes(e)?null:{key:e,dir:n==="asc"?"asc":"desc"}}function Qs(e,n,r=!1){const i=`var(--state-${e})`;return{label:n,fg:i,bg:`color-mix(in srgb, ${i} 14%, transparent)`,border:`color-mix(in srgb, ${i} 38%, transparent)`,dotClass:RS[e],textClass:MS[e],muted:r}}const RS={completed:"bg-state-completed",active:"bg-state-active",waiting:"bg-state-waiting",delayed:"bg-state-delayed",failed:"bg-state-failed",prioritized:"bg-state-prioritized",paused:"bg-state-paused","waiting-children":"bg-state-waiting-children",unknown:"bg-state-unknown"},MS={completed:"text-state-completed",active:"text-state-active",waiting:"text-state-waiting",delayed:"text-state-delayed",failed:"text-state-failed",prioritized:"text-state-prioritized",paused:"text-state-paused","waiting-children":"text-state-waiting-children",unknown:"text-state-unknown"},ot={completed:Qs("completed","completed"),active:Qs("active","active"),waiting:Qs("waiting","waiting"),delayed:Qs("delayed","delayed"),failed:Qs("failed","failed"),prioritized:Qs("prioritized","prioritized",!0),paused:Qs("paused","paused",!0),"waiting-children":Qs("waiting-children","waiting-children",!0),unknown:Qs("unknown","unknown",!0)};function Bu(e){return e&&ot[e]||ot.unknown}function TS(e){const n=Bu(e);return{"--chip-fg":n.fg,"--chip-bg":n.bg,"--chip-border":n.border}}const qS=["completed","active","waiting","delayed","failed"],IS=["prioritized","paused","waiting-children"];function Gi({values:e,width:n=96,height:r=22,className:i,stroke:o="currentColor",fill:c=!0,title:d,zeroBased:h=!0,dimmed:m}){const g=N.useId(),p=(e??[]).map(Q=>typeof Q=="number"&&Number.isFinite(Q)?Q:null),v=p.filter(Q=>Q!==null);if(v.length<2)return t.jsx("span",{className:F("inline-block text-fg-subtle/40",i),style:{width:n,height:r},"aria-hidden":!0,children:t.jsx("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,children:t.jsx("line",{x1:0,y1:r-1,x2:n,y2:r-1,stroke:"currentColor",strokeDasharray:"2 3"})})});const j=Math.max(...v),C=h?Math.min(0,...v):Math.min(...v),y=j===C?j+1:j,b=j===C?C-(h?0:1):C,k=1.5,S=p.length>1?(n-k*2)/(p.length-1):0,$=Q=>r-k-(Q-b)/(y-b||1)*(r-k*2),z=[];let E=null;p.forEach((Q,V)=>{if(Q===null){E=null;return}const q=[k+V*S,$(Q)];E?E.pts.push(q):(E={pts:[q]},z.push(E))});const T=Q=>Q.map(([V,q],B)=>`${B===0?"M":"L"}${V.toFixed(1)},${q.toFixed(1)}`).join(" "),M=z[z.length-1],O=M==null?void 0:M.pts[M.pts.length-1];return t.jsxs("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,className:F("inline-block overflow-visible align-middle",m&&"opacity-40",i),role:"img","aria-label":d??`Sparkline, ${v.length} points`,children:[d&&t.jsx("title",{children:d}),c&&t.jsx("defs",{children:t.jsxs("linearGradient",{id:`g-${g}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:o,stopOpacity:.35}),t.jsx("stop",{offset:"100%",stopColor:o,stopOpacity:0})]})}),z.map((Q,V)=>{if(Q.pts.length<2){const[_e,Ue]=Q.pts[0];return t.jsx("circle",{cx:_e,cy:Ue,r:1.4,fill:o},V)}const q=T(Q.pts),B=Q.pts[0][0],ce=Q.pts[Q.pts.length-1][0];return t.jsxs("g",{children:[c&&t.jsx("path",{d:`${q} L${ce.toFixed(1)},${r} L${B.toFixed(1)},${r} Z`,fill:`url(#g-${g})`}),t.jsx("path",{d:q,fill:"none",stroke:o,strokeWidth:1.4,strokeLinejoin:"round",strokeLinecap:"round"})]},V)}),O&&t.jsx("circle",{cx:O[0],cy:O[1],r:1.8,fill:o})]})}const $S=Object.fromEntries(["waiting","active","completed","failed","delayed","prioritized","paused","waiting-children","unknown"].map(e=>{const n=Bu(e);return[e,{label:n.label,dot:n.dotClass,color:n.fg,text:n.textClass}]}));function L0({state:e,size:n,className:r}){const i=Bu(e);return t.jsx(ye,{variant:"custom",size:n,dot:!0,className:F("border",r),style:{color:i.fg,background:i.bg,borderColor:i.border},children:i.label})}function iv({state:e,count:n,hideZero:r,short:i,className:o,title:c,to:d}){if(r&&!n)return null;const h=Bu(e),m=i&&e==="waiting-children"?"children":h.label,g=t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"opacity-80",children:m}),t.jsx("span",{className:"num font-semibold",children:ht(n)})]}),p=h.muted?void 0:TS(e),v=c??`${ht(n)} ${h.label}`;return d?t.jsx(Te,{to:d,className:F("state-chip relative z-10 hover:brightness-125 hover:underline",h.muted&&"muted",o),style:p,title:`${v} — open the ${h.label} tab`,children:g}):t.jsx("span",{className:F("state-chip",h.muted&&"muted",o),style:p,title:v,children:g})}const vm="This queue deletes completed jobs (removeOnComplete), so the sorted sets keep far fewer successes than failures and this ratio is probably too low. To measure it for real, create the Worker with metrics: { maxDataPoints: MetricsTime.ONE_WEEK }.",zS="From BullMQ's own metrics counters, which are recorded when each job finishes — unaffected by removeOnComplete.",OS="Counted from the completed/failed sorted sets over the trailing window.";function ym(e){return(e==null?void 0:e.retentionSkewed)===!0}function jm(e){return e?e.retentionSkewed?vm:e.source==="metrics"?zS:OS:""}function F0({rates:e,className:n}){return ym(e)?t.jsx(Ce,{content:vm,className:n,children:t.jsx(Xn,{className:"size-3 shrink-0 text-warning","aria-label":"Success rate is unreliable: this queue prunes completed jobs"})}):null}function Vu({entry:e,showConnection:n,onHide:r,hidePending:i}){const{connection:o,queue:c}=e,d=c.counts,h=oe.queue(o.id,c.name,ho(d));return t.jsxs("article",{className:F("queue-card",c.isPaused&&"opacity-90",d.failed>0&&"border-state-failed/40"),"data-testid":"queue-card",children:[t.jsxs("header",{className:"flex min-w-0 items-start gap-1.5",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx(Te,{to:h,className:"block truncate font-mono text-[13px] font-semibold text-fg after:absolute after:inset-0 after:content-[''] hover:underline",title:c.name,children:c.name}),n&&t.jsx("div",{className:"truncate text-[11px] text-fg-subtle",title:o.name,children:o.name})]}),t.jsxs("div",{className:"relative z-10 flex shrink-0 items-center gap-1",children:[c.isPro&&t.jsx(ye,{variant:"pro",size:"xs",className:"tracking-wider",title:`BullMQ Pro · ${W(c.groupsCount)} groups`,children:"PRO"}),c.isPaused&&t.jsx(ye,{variant:"warning",size:"xs",className:"tracking-wider",children:"PAUSED"}),t.jsx(Te,{to:oe.queueSearch(o.id,c.name),className:"rounded p-0.5 text-fg-subtle hover:bg-surface-2 hover:text-fg",title:"Search jobs in this queue","aria-label":`Search jobs in ${c.name}`,children:t.jsx(Gn,{className:"size-3.5"})}),r&&t.jsx("button",{type:"button",disabled:i,onClick:()=>r(e),className:"rounded p-0.5 text-fg-subtle hover:bg-surface-2 hover:text-fg disabled:opacity-50",title:z0,"aria-label":`Hide ${c.name} from the lists`,children:t.jsx(Mo,{className:"size-3.5"})})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[qS.map(m=>t.jsx(iv,{state:m,count:d[m],to:oe.queue(o.id,c.name,m)},m)),IS.map(m=>t.jsx(iv,{state:m,count:d[m],hideZero:!0,short:!0,to:oe.queue(o.id,c.name,m)},m))]}),t.jsxs("footer",{className:"mt-auto flex items-center gap-2 border-t border-border pt-2",children:[t.jsx(bm,{rates:c.rates,className:"min-w-0 flex-1"}),c.metrics&&c.metrics.completed.length>1&&t.jsx("span",{className:"shrink-0",style:{color:ot.completed.fg},children:t.jsx(Gi,{values:c.metrics.completed,width:56,height:14,title:"Completed per minute"})})]})]})}function D0(e){return e?e%1440===0?`${e/1440}d`:e%60===0?`${e/60}h`:`${e}m`:"1h"}function bm({rates:e,className:n,compact:r}){const i=(e==null?void 0:e.successPct)??null,o=((e==null?void 0:e.completed)??0)+((e==null?void 0:e.failed)??0),c=D0(e==null?void 0:e.windowMinutes),d=ym(e),h=e?`${W(e.completed)} completed · ${W(e.failed)} failed in the last ${c}`:"no rate data",m=e?`${h}
529
+
530
+ ${jm(e)}`:h;return t.jsxs("div",{className:F("flex flex-col gap-1",n),title:m,children:[t.jsx("div",{className:F("flex h-1.5 w-full overflow-hidden rounded-full bg-surface-3",d&&"opacity-50"),role:"img","aria-label":i==null?`No finished jobs in the last ${c}`:`${_n(i)} success in the last ${c}${d?", unreliable: this queue prunes completed jobs":""}`,children:i!=null&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"h-full",style:{width:`${i}%`,background:ot.completed.fg}}),t.jsx("span",{className:"h-full flex-1",style:{background:ot.failed.fg,opacity:i>=100?0:1}})]})}),!r&&t.jsx("span",{className:"num flex min-w-0 items-center gap-1 text-[11px] text-fg-muted",children:i==null?t.jsxs("span",{className:"truncate text-fg-subtle",children:["no finished jobs · ",c]}):t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:F("truncate",d&&"opacity-60"),children:[t.jsxs("span",{className:F("font-medium",i<90?"text-state-failed":"text-fg"),children:[_n(i)," ok"]}),t.jsxs("span",{className:"text-fg-subtle",children:[" · ",c]}),o>0&&t.jsxs("span",{className:"text-fg-subtle",children:[" · ",W(o)," finished"]})]}),t.jsx(F0,{rates:e})]})})]})}function U0({sections:e,showConnection:n,hideSingleHeader:r,className:i,onHide:o,hidePendingKey:c}){const d=e.length===1&&r;return t.jsx("div",{className:F("space-y-4",i),children:e.map(h=>t.jsxs("section",{"aria-label":h.title,children:[!d&&t.jsxs("h3",{className:"mb-1.5 flex items-center gap-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle uppercase",children:[h.kind==="folder"?t.jsx(Ys,{className:"size-3.5",style:{color:h.color??"var(--fg-subtle)"},"aria-hidden":!0}):h.kind==="connection"?t.jsx(Ly,{className:"size-3.5","aria-hidden":!0}):t.jsx(Iy,{className:"size-3.5","aria-hidden":!0}),t.jsx("span",{className:"truncate normal-case tracking-normal text-fg-muted",children:h.title}),t.jsx("span",{className:"num font-normal",children:h.items.length})]}),t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:"repeat(auto-fill, minmax(230px, 1fr))"},children:h.items.map(m=>t.jsx(Vu,{entry:m,showConnection:n,onHide:o,hidePending:c===Pa(m)},`${m.connection.id}/${m.queue.name}`))})]},h.id))})}function wm({count:e=6}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:"repeat(auto-fill, minmax(230px, 1fr))"},children:Array.from({length:e},(n,r)=>t.jsx("div",{className:"card h-[118px] animate-pulse"},r))})}function AS({sections:e,showConnection:n,defaultOpen:r,storagePrefix:i="overview.group",className:o}){return e.length===0?null:t.jsx("div",{className:F("space-y-1.5",o),children:e.map(c=>t.jsx(LS,{section:c,showConnection:n,defaultOpen:r,storagePrefix:i},c.id))})}function LS({section:e,showConnection:n,defaultOpen:r,storagePrefix:i}){const[o,c]=Fu(`${i}.${e.id}`,r),d=pm(e.items),h=e.kind==="folder"?Ys:e.kind==="connection"?Ly:Iy;return t.jsxs("section",{className:"card overflow-hidden","aria-label":e.title,children:[t.jsxs("button",{type:"button",onClick:c,"aria-expanded":o,className:F("flex w-full flex-wrap items-center gap-x-4 gap-y-1 px-3 py-2 text-left transition-colors hover:bg-surface-2",o&&"border-b border-border"),children:[o?t.jsx(ms,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}):t.jsx(Dn,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}),t.jsx(h,{className:"size-3.5 shrink-0",style:{color:e.color??"var(--fg-subtle)"},"aria-hidden":!0}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium text-fg",title:e.title,children:e.title}),t.jsxs("span",{className:"num shrink-0 text-xs text-fg-subtle",children:[d.queues," ",d.queues===1?"queue":"queues",d.paused>0&&t.jsxs("span",{className:"text-state-paused",children:[" · ",d.paused," paused"]})]}),t.jsxs("span",{className:"flex shrink-0 flex-wrap items-center gap-x-3 gap-y-0.5",children:[t.jsx(Dh,{state:"waiting",value:d.waiting}),t.jsx(Dh,{state:"active",value:d.active}),t.jsx(Dh,{state:"failed",value:d.failed,dimZero:!0})]})]}),o&&t.jsx("div",{className:"grid gap-2 p-2",style:{gridTemplateColumns:"repeat(auto-fill, minmax(230px, 1fr))"},children:e.items.map(m=>t.jsx(Vu,{entry:m,showConnection:n},`${m.connection.id}/${m.queue.name}`))})]})}function Dh({state:e,value:n,dimZero:r}){const i=ot[e],o=r&&n===0;return t.jsxs("span",{className:"flex items-baseline gap-1",title:`${n} ${i.label}`,children:[t.jsx("span",{className:F("status-dot size-1.5 self-center",i.dotClass,o&&"opacity-40"),"aria-hidden":!0}),t.jsx("span",{className:F("num text-xs font-medium",o?"text-fg-subtle":i.textClass),children:ht(n)}),t.jsx("span",{className:"text-[10px] text-fg-subtle",children:i.label})]})}function FS({items:e,hidden:n,showConnection:r,filtered:i,rules:o,className:c}){const d=o&&o.unmeasured>0&&t.jsx(Ce,{content:"Their Workers keep no BullMQ metrics, so failure rules cannot judge them. Turn on metrics: { maxDataPoints } in the Worker options.",children:t.jsxs(Te,{to:oe.alerts,className:"inline-flex items-center gap-1 text-[11px] text-fg-subtle hover:text-fg",children:[t.jsx(Yi,{className:"size-3","aria-hidden":!0}),W(o.unmeasured)," ",o.unmeasured===1?"queue":"queues"," not measurable"]})});return e.length===0?t.jsxs("section",{"aria-label":"Needs attention",className:F("card flex flex-wrap items-center gap-2 px-4 py-2.5",c),children:[t.jsx(Zf,{className:"size-4 shrink-0 text-state-completed","aria-hidden":!0}),t.jsxs("p",{className:"text-xs text-fg-muted",children:[i?"Nothing matching the filter needs attention":"No queue needs attention",t.jsx("span",{className:"text-fg-subtle",children:o?o.rules>0?" — no rule broken, nothing paused or stuck. ":" — nothing paused or stuck, and no rule is set. ":" — nothing failing, paused or over the thresholds."}),o&&t.jsx(Te,{to:oe.alerts,className:"text-accent hover:underline",children:o.rules>0?`${o.rules} ${o.rules===1?"rule":"rules"} watching`:"Add a rule"})]}),d&&t.jsx("span",{className:"ml-auto",children:d})]}):t.jsxs("section",{"aria-label":"Needs attention",className:c,children:[t.jsxs("h2",{className:"mb-1.5 flex items-center gap-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle uppercase",children:[t.jsx(Xn,{className:"size-3.5 text-warning","aria-hidden":!0}),t.jsx("span",{className:"normal-case tracking-normal text-fg-muted",children:"Needs attention"}),t.jsx("span",{className:"num font-normal",children:W(e.length+n)}),n>0&&t.jsxs("span",{className:"font-normal normal-case tracking-normal text-fg-subtle",children:["· showing the ",e.length," worst, the rest are in the table below"]}),d&&t.jsx("span",{className:"ml-auto font-normal normal-case tracking-normal",children:d})]}),t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:"repeat(auto-fill, minmax(230px, 1fr))"},children:e.map(({entry:h,reasons:m,findings:g})=>t.jsxs("div",{className:"relative flex flex-col gap-1",children:[t.jsx(Vu,{entry:h,showConnection:r}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[g.map(p=>t.jsx(QS,{finding:p},p.alertId)),m.map(p=>t.jsx(BS,{reason:p},p))]})]},`${h.connection.id}/${h.queue.name}`))})]})}const nu={failing:"border-state-failed/40 bg-state-failed/10 text-state-failed",paused:"border-state-paused/40 bg-state-paused/10 text-state-paused",backlog:"border-warning/40 bg-warning/10 text-warning",waiting:"border-warning/40 bg-warning/10 text-warning",failed:"border-state-failed/30 bg-state-failed/5 text-state-failed"},DS={failed_rate_above:nu.failing,failed_above:nu.failing,duration_above:"border-state-delayed/40 bg-state-delayed/10 text-state-delayed",waiting_above:nu.waiting};function Uh(e,n){return e.unit==="%"?`${n}%`:e.unit==="s"?n>=10?`${Math.round(n)}s`:n>=1?`${n.toFixed(1)}s`:`${Math.round(n*1e3)}ms`:W(n)}function US(e){const n=e.windowMinutes?` · ${e.windowMinutes>=60&&e.windowMinutes%60===0?`${e.windowMinutes/60}h`:`${e.windowMinutes}m`}`:"",r=` > ${Uh(e,e.threshold)}`;switch(e.kind){case"failed_rate_above":return`${Uh(e,e.value)} failed${n}${r}`;case"failed_above":return`${W(e.value)} failed${n}${r}`;case"duration_above":return`p${e.percentile??95} ${Uh(e,e.value)}${n}${r}`;case"waiting_above":return`${W(e.value)} waiting${r}`}}function QS({finding:e}){return t.jsx(Ce,{content:`Rule "${e.alertName}"${e.notifies?"":" · dashboard only, notifies nobody"}`,children:t.jsxs(Te,{to:oe.alerts,className:F("inline-flex items-center gap-1 rounded border px-1.5 py-px text-[10px] font-medium hover:brightness-110",DS[e.kind]),children:[!e.notifies&&t.jsx(iN,{className:"size-2.5 opacity-70","aria-hidden":!0}),t.jsx("span",{className:"num",children:US(e)})]})})}function BS({reason:e}){return t.jsx("span",{className:F("rounded border px-1.5 py-px text-[10px] font-medium",nu[e]),children:wS[e]})}function Q0({totals:e,title:n="All queues",className:r,children:i,hiddenCount:o=0,onRevealHidden:c}){return t.jsxs("div",{className:F("card flex flex-wrap items-center gap-x-5 gap-y-2 px-4 py-2.5",r),children:[t.jsxs("div",{className:"flex items-baseline gap-2",children:[t.jsx("h2",{className:"text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:n}),t.jsxs("span",{className:"num text-xs text-fg-muted",children:[W(e.queues)," ",e.queues===1?"queue":"queues",e.paused>0&&t.jsxs("span",{className:"text-state-paused",children:[" · ",W(e.paused)," paused"]})]}),o>0&&(c?t.jsxs("button",{type:"button",onClick:c,className:"num text-xs text-fg-subtle underline decoration-dotted underline-offset-2 hover:text-fg-muted",title:"These queues are hidden and are NOT included in the totals. Click to see them.",children:[W(o)," hidden"]}):t.jsxs("span",{className:"num text-xs text-fg-subtle",title:"These queues are hidden and are NOT included in the totals.",children:[W(o)," hidden"]}))]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[t.jsx(Jl,{state:"waiting",value:e.waiting}),t.jsx(Jl,{state:"active",value:e.active}),t.jsx(Jl,{state:"delayed",value:e.delayed}),t.jsx(Jl,{state:"failed",value:e.failed,dimZero:!0}),t.jsx(Jl,{state:"completed",value:e.completed})]}),i&&t.jsx("div",{className:"ml-auto flex items-center gap-2",children:i})]})}function Jl({state:e,value:n,dimZero:r}){const i=ot[e],o=r&&n===0;return t.jsxs("span",{className:"flex items-baseline gap-1.5",title:`${W(n)} ${i.label}`,children:[t.jsx("span",{className:F("status-dot size-2 self-center",i.dotClass,o&&"opacity-40"),"aria-hidden":!0}),t.jsx("span",{className:F("num text-sm font-semibold",o?"text-fg-muted":i.textClass),children:ht(n)}),t.jsx("span",{className:"text-xs text-fg-subtle",children:i.label})]})}function Nm({value:e,onChange:n,className:r,placeholder:i="Filter queues…","aria-label":o="Filter queues by name or connection"}){return t.jsxs("div",{className:F("relative w-64",r),children:[t.jsx(Ee,{leftIcon:t.jsx(Gn,{}),placeholder:i,value:e,onChange:c=>n(c.target.value),onKeyDown:c=>c.key==="Escape"&&n(""),className:"!h-7 pr-7 text-xs","aria-label":o}),e&&t.jsx("button",{type:"button",className:"absolute top-1/2 right-1.5 -translate-y-1/2 rounded p-0.5 text-fg-subtle hover:text-fg","aria-label":"Clear filter",onClick:()=>n(""),children:t.jsx(gn,{className:"size-3.5"})})]})}function fs({dense:e,className:n,wrapperClassName:r,maxHeight:i,children:o,...c}){return t.jsx("div",{className:F("table-wrap",i!=null&&"overflow-y-auto",r),style:i!=null?{maxHeight:i}:void 0,children:t.jsx("table",{className:F("data-table",e&&"dense",n),...c,children:o})})}function me({align:e="left",className:n,...r}){return t.jsx("th",{scope:"col",className:F(e==="right"&&"!text-right",e==="center"&&"!text-center",n),...r})}function pe({align:e="left",num:n,mono:r,muted:i,className:o,...c}){return t.jsx("td",{className:F(e==="right"&&"text-right",e==="center"&&"text-center",n&&"num",r&&"font-mono text-xs",i&&"text-fg-muted",o),...c})}function il({onActivate:e,selected:n,className:r,onClick:i,onKeyDown:o,...c}){const d=!!e;return t.jsx("tr",{tabIndex:d?0:void 0,"aria-selected":n||void 0,className:F(d&&"row-click",n&&"bg-accent/10",r),onClick:h=>{i==null||i(h),!(!d||h.defaultPrevented||h.target.closest("button, a, input, select, textarea, [data-no-row-click]"))&&(e==null||e())},onKeyDown:h=>{o==null||o(h),!(!d||h.defaultPrevented)&&h.target===h.currentTarget&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),e==null||e())},...c})}function xt({colSpan:e,children:n,className:r}){return t.jsx("tr",{children:t.jsx("td",{colSpan:e,className:F("!py-10 text-center text-fg-subtle",r),children:n})})}function VS(e,n){const r=e==null||e==="",i=n==null||n==="";if(r&&i)return 0;if(r)return 1;if(i)return-1;if(typeof e=="number"&&typeof n=="number")return e-n;if(typeof e=="boolean"&&typeof n=="boolean")return Number(e)-Number(n);const o=String(e),c=String(n),d=Number(o),h=Number(c);return o.trim()!==""&&c.trim()!==""&&!Number.isNaN(d)&&!Number.isNaN(h)?d-h:o.localeCompare(c,void 0,{numeric:!0,sensitivity:"base"})}function HS(e,n,r){const i=n.find(d=>d.key===r.key&&d.sortValue);if(!i)return e;const o=i.sortValue,c=r.dir==="asc"?1:-1;return e.map((d,h)=>({row:d,i:h,v:o(d)})).sort((d,h)=>{const m=VS(d.v,h.v);return m!==0&&(d.v==null||h.v==null||d.v===""||h.v==="")?m:m!==0?m*c:d.i-h.i}).map(d=>d.row)}function KS({columns:e,rows:n,rowKey:r,sort:i,onSort:o,onRowActivate:c,rowClassName:d,message:h,messageClassName:m,presorted:g,className:p,...v}){const j=N.useMemo(()=>g?n:HS(n,e,i),[n,e,i,g]),C=y=>{y.sortValue&&(i.key===y.key?o({key:y.key,dir:i.dir==="asc"?"desc":"asc"}):o({key:y.key,dir:y.defaultDir??(y.num||y.align==="right"?"desc":"asc")}))};return t.jsxs(fs,{className:p,...v,children:[t.jsx("thead",{children:t.jsx("tr",{children:e.map(y=>{const b=i.key===y.key&&!!y.sortValue,k=b?i.dir==="asc"?"ascending":"descending":y.sortValue?"none":void 0;return t.jsx(me,{align:y.align,className:F(y.thClassName,b&&"!text-fg"),"aria-sort":k,children:y.sortValue?t.jsxs("button",{type:"button",className:F("sort-header",y.align==="right"&&"flex-row-reverse"),onClick:()=>C(y),title:`Sort by ${typeof y.header=="string"?y.header:y.key}`,children:[t.jsx("span",{children:y.header}),b?i.dir==="asc"?t.jsx(rN,{className:"size-3","aria-hidden":!0}):t.jsx(tN,{className:"size-3","aria-hidden":!0}):t.jsx(nN,{className:"size-3 opacity-40","aria-hidden":!0})]}):y.header},y.key)})})}),t.jsxs("tbody",{children:[h!=null&&j.length===0&&t.jsx(xt,{colSpan:e.length,className:m,children:h}),j.map(y=>t.jsx(il,{onActivate:c?()=>c(y):void 0,className:d==null?void 0:d(y),children:e.map(b=>t.jsx(pe,{align:b.align,num:b.num,mono:b.mono,muted:typeof b.muted=="function"?b.muted(y):b.muted,className:b.className,"data-no-row-click":b.noRowClick?!0:void 0,children:b.render(y)},b.key))},r(y)))]})]})}const km=["queue","connection","waiting","active","completed","failed","delayed","prioritized","waiting-children","success","paused","groups","trend","actions"],Sm={key:"failed",dir:"desc"};function Cm({rows:e,showConnection:n,sort:r,onSort:i,message:o,messageClassName:c,onToggle:d,pendingKey:h,onHide:m,hidePendingKey:g}){const p=an(),v=N.useMemo(()=>{var C,y;const j=[{key:"queue",header:"Queue",sortValue:b=>b.queue.name,render:b=>t.jsx(Te,{to:oe.queue(b.connection.id,b.queue.name,ho(b.queue.counts)),className:"font-mono text-xs font-medium hover:underline",title:`${b.queue.prefix}:${b.queue.name}`,children:b.queue.name}),className:"max-w-72 truncate"}];return n&&j.push({key:"connection",header:"Connection",sortValue:b=>b.connection.name,render:b=>b.connection.name,muted:!0,className:"max-w-48 truncate"}),j.push(ha("waiting","Waiting",b=>b.queue.counts.waiting),ha("active","Active",b=>b.queue.counts.active),ha("completed","Completed",b=>b.queue.counts.completed,!0),ha("failed","Failed",b=>b.queue.counts.failed),ha("delayed","Delayed",b=>b.queue.counts.delayed,!0),ha("prioritized","Prioritized",b=>b.queue.counts.prioritized,!0),ha("waiting-children","Waiting-children",b=>b.queue.counts["waiting-children"],!0),{key:"success",header:`Success % (${D0((y=(C=e[0])==null?void 0:C.queue.rates)==null?void 0:y.windowMinutes)})`,align:"right",num:!0,sortValue:b=>{var k;return((k=b.queue.rates)==null?void 0:k.successPct)??null},render:b=>{const k=b.queue.rates,S=(k==null?void 0:k.successPct)??null,$=ym(k);return t.jsxs("span",{className:"inline-flex items-center justify-end gap-1.5",title:jm(k),children:[t.jsx(bm,{rates:k,compact:!0,className:"w-14"}),t.jsx("span",{className:F("num w-14 text-right",$&&"opacity-50",S==null?"text-fg-subtle":S<90?"font-semibold text-state-failed":"text-fg"),children:S==null?"–":_n(S)}),t.jsx(F0,{rates:k,className:"w-3"})]})}},{key:"paused",header:"Paused",sortValue:b=>b.queue.isPaused,render:b=>b.queue.isPaused?t.jsx(ye,{variant:"warning",size:"xs",className:"tracking-wider",children:"PAUSED"}):t.jsx("span",{className:"text-fg-subtle",children:"–"})},{key:"groups",header:"Groups",align:"right",num:!0,sortValue:b=>b.queue.isPro?b.queue.groupsCount:null,render:b=>b.queue.isPro?t.jsxs(Te,{to:oe.groups(b.connection.id,b.queue.name),className:"inline-flex items-center gap-1.5 hover:underline",title:"BullMQ Pro groups",children:[t.jsx(ye,{variant:"pro",size:"xs",className:"tracking-wider",children:"PRO"}),W(b.queue.groupsCount)]}):t.jsx("span",{className:"text-fg-subtle",children:"–"})},{key:"trend",header:"Trend",sortValue:b=>{var S;const k=(S=b.queue.metrics)==null?void 0:S.completed;return k&&k.length?k.reduce(($,z)=>$+z,0):null},render:b=>{var k;return t.jsx("span",{style:{color:ot.completed.fg},children:t.jsx(Gi,{values:(k=b.queue.metrics)==null?void 0:k.completed,width:80,height:18,title:"Completed per minute"})})}},{key:"actions",header:t.jsx("span",{className:"sr-only",children:"Actions"}),align:"right",noRowClick:!0,render:b=>t.jsxs("span",{className:"inline-flex items-center justify-end gap-0.5",children:[t.jsx(H,{size:"icon-xs",variant:"ghost",title:"Search jobs","aria-label":`Search jobs in ${b.queue.name}`,onClick:()=>p(oe.queueSearch(b.connection.id,b.queue.name)),children:t.jsx(Gn,{})}),d&&t.jsx(H,{size:"icon-xs",variant:"ghost",loading:h===Pa(b),title:b.queue.isPaused?"Resume queue":"Pause queue","aria-label":b.queue.isPaused?"Resume queue":"Pause queue",onClick:()=>d(b),children:b.queue.isPaused?t.jsx(Gf,{}):t.jsx(tl,{})}),m&&t.jsx(H,{size:"icon-xs",variant:"ghost",loading:g===Pa(b),title:z0,"aria-label":`Hide ${b.queue.name} from the lists`,onClick:()=>m(b),children:t.jsx(Mo,{})})]})}),j},[n,d,h,m,g,p,e]);return t.jsx(KS,{columns:v,rows:e,rowKey:Pa,sort:r,onSort:i,onRowActivate:j=>p(oe.queue(j.connection.id,j.queue.name,ho(j.queue.counts))),message:o,messageClassName:c,className:"min-w-[1100px]"})}function ha(e,n,r,i=!1){var d;const o=(d=ot[e])==null?void 0:d.textClass,c=e;return{key:e,header:n,align:"right",num:!0,sortValue:r,noRowClick:!0,render:h=>{const m=r(h),g=F(m>0?o:"text-fg-subtle",e==="failed"&&m>0&&"font-semibold");return m===0?t.jsx("span",{className:g,children:W(m)}):t.jsx(Te,{to:oe.queue(h.connection.id,h.queue.name,c),className:F(g,"hover:underline"),title:`Open the ${n.toLowerCase()} jobs of ${h.queue.name}`,children:W(m)})},muted:i?h=>r(h)===0:void 0}}const WS=4;function ZS({className:e}){const{health:n,paused:r,isLoading:i,error:o}=Uu(),[c,d]=Fu("overview.health.expanded",!1),h=n.flatMap(p=>p.warnings.filter(v=>v.level==="critical").map(v=>({health:p,warning:v}))),m=n.filter(p=>!p.ok);if(!i&&n.length===0&&o==null)return null;const g=n.length>WS;return t.jsxs("section",{"aria-label":"Server health",className:F("space-y-2",e),children:[h.length>0&&t.jsx(JS,{items:h}),t.jsxs("div",{className:"card px-2 py-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Eo,{className:F("size-3.5 shrink-0 text-fg-subtle",r&&"opacity-50"),"aria-hidden":!0}),i&&n.length===0?t.jsx("span",{className:"min-w-0 flex-1 text-[11px] text-fg-subtle",children:"Reading server health…"}):o!=null&&n.length===0?t.jsxs("span",{className:"min-w-0 flex-1 truncate text-[11px] text-danger",children:["Could not load health: ",be(o)]}):g?t.jsx(GS,{health:n,paused:r,expanded:c,onToggle:d}):t.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:n.map(p=>t.jsx(lv,{health:p,paused:r},p.connectionId))}),r&&t.jsx(Ce,{content:"Monitoring is paused — the dashboard is sending no health reads. These are the last numbers received.",children:t.jsxs("span",{className:"flex shrink-0 cursor-help items-center gap-1 text-[11px] text-warning",children:[t.jsx(tl,{className:"size-3","aria-hidden":!0}),"paused"]})}),m.length>0&&!r&&!g&&t.jsxs("span",{className:"shrink-0 text-[11px] font-medium text-danger",children:[m.length," unreachable"]}),t.jsx(Te,{to:oe.health,className:"shrink-0 rounded-md border border-border px-1.5 py-0.5 text-[11px] text-fg-muted transition-colors hover:border-border-strong hover:text-fg",children:"Monitor"})]}),g&&c&&t.jsx("div",{className:"mt-2 flex flex-col gap-1 border-t border-border pt-2",children:n.map(p=>t.jsx(lv,{health:p,paused:r,className:"min-w-0"},p.connectionId))})]})]})}function GS({health:e,paused:n,expanded:r,onToggle:i}){const o=hm(e),c=e.filter(h=>!h.ok||h.warnings.some(m=>m.level==="critical")),d=o.total-c.length;return t.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsxs("button",{type:"button",onClick:i,"aria-expanded":r,className:"flex shrink-0 items-center gap-1 rounded text-xs font-medium text-fg hover:text-accent",children:[r?t.jsx(ms,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}):t.jsx(Dn,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}),t.jsxs("span",{className:"num",children:[o.total," connections"]})]}),t.jsxs("span",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-fg-muted",children:[d>0&&t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"status-dot bg-success text-success","aria-hidden":!0}),t.jsxs("span",{className:"num",children:[d," ok"]})]}),c.length>0?t.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5",children:[t.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 font-medium text-danger",children:[t.jsx("span",{className:"status-dot pulse bg-danger text-danger","aria-hidden":!0}),t.jsxs("span",{className:"num",children:[c.length," with problems"]})]}),c.slice(0,3).map(h=>t.jsx(Ce,{content:h.ok?h.warnings.map(m=>m.message).join(" · "):`Unreachable: ${h.error??"unknown error"}`,children:t.jsx(Te,{to:oe.health,className:"max-w-52 shrink-0 cursor-help truncate rounded border border-danger/40 bg-danger/10 px-1.5 py-px text-[11px] font-medium text-danger",children:h.connectionName})},h.connectionId)),c.length>3&&t.jsxs(Te,{to:oe.health,className:"shrink-0 text-[11px] text-danger underline underline-offset-2",children:["+",c.length-3," more"]})]}):o.warn>0&&t.jsxs("span",{className:"flex items-center gap-1.5 text-warning",children:[t.jsx("span",{className:"status-dot bg-warning text-warning","aria-hidden":!0}),t.jsxs("span",{className:"num",children:[o.warn," warning",o.warn===1?"":"s"]})]}),!n&&t.jsxs(t.Fragment,{children:[t.jsx(us,{label:"cmd/s",value:o.commandsPerSec==null?"–":Hr(o.commandsPerSec,""),tip:o.commandsPerSec==null?"No rate yet — needs two INFO samples. This is not zero.":"Redis commands, summed across every Redis connection"}),t.jsx(us,{label:"cpu",value:Hi(o.cpuCores),tip:`Busiest single Redis — ${$o(o.cpuCores)}`,tone:dm(o.cpuCores)}),o.memoryPct!=null&&t.jsx(us,{label:"mem",value:_n(o.memoryPct,0),tip:"Highest memory use against maxmemory across connections",tone:o.memoryPct>=90?"danger":o.memoryPct>=75?"warn":void 0})]})]}),t.jsx("button",{type:"button",onClick:i,className:"shrink-0 text-[11px] text-fg-subtle underline underline-offset-2 hover:text-fg",children:r?"hide all":"show all"})]})}function lv({health:e,paused:n,className:r}){var m;const i=e.info&&e.info.backend!=="postgres"?e.info:null,o=((m=e.info)==null?void 0:m.backend)==="postgres"?e.info:null,c=!e.ok,d=XS(e.warnings),h=c?`Unreachable: ${e.error??"unknown error"}`:e.warnings.length>0?e.warnings.map(g=>g.message).join(" · "):"Responding to INFO";return t.jsxs("div",{className:F("flex min-w-0 items-center gap-2",n&&"opacity-70",r),children:[t.jsx(Ce,{content:h,children:t.jsx("span",{className:F("status-dot shrink-0 cursor-help",c?"bg-danger pulse text-danger":d==="critical"?"bg-danger text-danger":d==="warn"?"bg-warning text-warning":"bg-success text-success"),role:"img","aria-label":c?"unreachable":d?`${d} warning`:"ok"})}),t.jsx(Te,{to:oe.health,className:"min-w-0 flex-1 truncate text-xs font-medium text-fg hover:underline",title:e.connectionName,children:e.connectionName}),c?t.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] text-danger",children:e.error??(e.kind==="postgres"?"Postgres is unreachable":"Redis is unreachable")}):e.kind==="postgres"?t.jsxs("span",{className:"flex shrink-0 items-center gap-x-3 text-[11px] text-fg-muted",children:[t.jsx(us,{label:"db",value:o?Kt(o.databaseSizeBytes):"–",tip:"pg_database_size of the database BullMQ lives in"}),t.jsx(us,{label:"tx/s",value:e.commandsPerSec==null?"–":Hr(e.commandsPerSec,""),tip:e.commandsPerSec==null?"No rate yet — needs two samples. This is not zero.":"Transactions per second, from pg_stat_database"}),t.jsx(us,{label:"conn",value:o?`${o.connectedClients}/${o.maxConnections}`:"–",tip:"Sessions on this database / max_connections",tone:o&&o.maxConnections>0&&o.connectedClients/o.maxConnections>=.9?"danger":void 0}),t.jsx(us,{label:"lat",value:o?mo(o.latencyMs):"–",tip:"Round trip of the health query itself"})]}):t.jsxs("span",{className:"flex shrink-0 items-center gap-x-3 text-[11px] text-fg-muted",children:[t.jsx(us,{label:"mem",value:i?`${i.usedMemoryHuman||Kt(i.usedMemoryBytes)}${e.memoryUsedPct!=null?` · ${_n(e.memoryUsedPct)}`:""}`:"–",tip:e.memoryUsedPct!=null&&(i!=null&&i.maxMemoryBytes)?`${_n(e.memoryUsedPct)} of ${Kt(i.maxMemoryBytes)} maxmemory`:"used_memory — no maxmemory set on this Redis",tone:e.memoryUsedPct==null?void 0:e.memoryUsedPct>=90?"danger":e.memoryUsedPct>=75?"warn":void 0}),t.jsx(us,{label:"cpu",value:Hi(e.cpuCores),tip:$o(e.cpuCores),tone:dm(e.cpuCores)}),t.jsx(us,{label:"cmd/s",value:e.commandsPerSec==null?"–":Hr(e.commandsPerSec,""),tip:e.commandsPerSec==null?"No rate yet — needs two INFO samples. This is not zero.":"Derived from total_commands_processed between samples"}),t.jsx(us,{label:"lat",value:i?mo(i.latencyMs):"–",tip:"Round trip of the INFO command itself"})]})]})}function us({label:e,value:n,tip:r,tone:i}){return t.jsx(Ce,{content:r,children:t.jsxs("span",{className:"cursor-help items-baseline gap-1 whitespace-nowrap",children:[t.jsx("span",{className:F("num font-medium",i==="danger"?"text-danger":i==="warn"?"text-warning":"text-fg"),children:n}),t.jsx("span",{className:"ml-1 text-fg-subtle",children:e})]})})}function JS({items:e}){return t.jsxs("div",{role:"status",className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger/10 px-2.5 py-1.5 text-xs text-danger",children:[t.jsx(zy,{className:"mt-px size-3.5 shrink-0","aria-hidden":!0}),t.jsx("div",{className:"min-w-0 flex-1 space-y-0.5 leading-snug",children:e.map(({health:n,warning:r},i)=>t.jsxs("p",{className:"truncate",children:[t.jsx("span",{className:"font-semibold",children:n.connectionName}),t.jsx("span",{className:"mx-1.5 opacity-50",children:"·"}),r.message]},`${n.connectionId}-${r.code}-${i}`))}),t.jsx(Te,{to:oe.health,className:"shrink-0 underline underline-offset-2 hover:no-underline",children:"Monitor"})]})}function XS(e){let n=null;for(const r of e){if(r.level==="critical")return"critical";n="warn"}return n}const YS=2;function eC(){var rt,Be;const{isAdmin:e,isOperator:n}=yt(),{has:r}=jt(),{connections:i,entries:o,isLoading:c}=t2(),d=S0(),h=r("alerts"),m=N2(h),g=r("folders"),p=Wr(g),v=an(),{sort:j,setSort:C,filter:y,setFilter:b}=gm("overview",Sm,km),k=N.useMemo(()=>o.flatMap(Z=>{var de;return(((de=Z.result.data)==null?void 0:de.queues)??[]).map(se=>({connection:Z.connection,queue:se}))}),[o]),S=N.useMemo(()=>k.filter(Z=>xm(Z,y)),[k,y]),$=N.useMemo(()=>pm(k),[k]),z=c||o.some(Z=>Z.result.isLoading),E=N.useMemo(()=>o.reduce((Z,de)=>{var se;return Z+(((se=de.result.data)==null?void 0:se.hiddenCount)??0)},0),[o]),T=N.useMemo(()=>o.filter(Z=>{var de;return((de=Z.result.data)==null?void 0:de.discovery)&&!Z.result.data.discovery.complete}).map(Z=>{var de,se;return{name:Z.connection.name,keys:((se=(de=Z.result.data)==null?void 0:de.discovery)==null?void 0:se.totalKeys)??null}}),[o]),M=N.useMemo(()=>{const Z=o.filter(de=>{var se;return(((se=de.result.data)==null?void 0:se.hiddenCount)??0)>0});return Z.length===1?Z[0].connection.id:null},[o]),O=gS(),Q=n?Z=>void O.hide(Z.connection.id,Z.queue.name):void 0,V=((rt=i.data)==null?void 0:rt.length)??0,q=V>YS,B=h?((Be=m.data)==null?void 0:Be.findings)??[]:void 0,ce=N.useMemo(()=>PS(S,d.data,8,B),[S,d.data,B]),_e=N.useMemo(()=>{if(!h||!m.data)return;const Z=new Set(S.map(se=>`${se.connection.id}\0${se.queue.name}`)),de=m.data.unmeasured.filter(se=>Z.has(`${se.connectionId}\0${se.queueName}`)).length;return{rules:m.data.rules,unmeasured:de}},[h,m.data,S]),Ue=N.useMemo(()=>Tf(ce.rest,g?p.data:void 0),[ce.rest,g,p.data]),Ge=N.useMemo(()=>Tf(S,g?p.data:void 0),[S,g,p.data]);return!c&&V===0?t.jsx(vt,{children:t.jsx(rn,{icon:t.jsx(Aa,{}),title:"No Redis connections yet",description:e?"Point the dashboard at a Redis that runs BullMQ. Queues are discovered automatically from the key prefix.":"An administrator needs to add a Redis connection before queues show up here.",action:e&&t.jsx(H,{variant:"primary",leftIcon:t.jsx(Jn,{}),onClick:()=>v(`${oe.settings("connections")}?new=1`),children:"Add connection"})})}):t.jsxs(vt,{wide:!0,children:[t.jsx(gs,{title:"Overview",description:"Every connection and queue at a glance. Refreshes every 5 seconds."}),t.jsx(ZS,{className:"mb-3"}),T.length>0&&t.jsxs("p",{className:"mb-3 rounded-md border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-fg-muted",role:"status",children:["Still discovering queues on ",T.map(Z=>`${Z.name}${Z.keys?` (${W(Z.keys)} keys)`:""}`).join(", "),": the keyspace is large and the SCAN runs in bounded passes. Queues with a connected worker are listed already; the others appear as the scan completes."]}),t.jsxs("section",{className:"space-y-3","aria-label":"All queues",children:[t.jsxs(Q0,{totals:$,hiddenCount:E,onRevealHidden:M?()=>v(`${oe.connection(M)}#hidden-queues`):void 0,children:[t.jsx(Nm,{value:y,onChange:b,"aria-label":"Filter queues by name or connection"}),t.jsxs("span",{className:"num whitespace-nowrap text-xs text-fg-subtle",children:[S.length," of ",k.length]})]}),z&&k.length===0?t.jsx(wm,{}):S.length===0?t.jsx("p",{className:"py-6 text-center text-xs text-fg-subtle",children:y?"No queue matches the filter":"No queues discovered yet"}):t.jsxs(t.Fragment,{children:[t.jsx(FS,{items:ce.attention,hidden:ce.hidden,showConnection:q,filtered:!!y,rules:_e}),q?t.jsx(AS,{sections:Ue,showConnection:!0,defaultOpen:!1}):t.jsx(U0,{sections:Ge,showConnection:!0,onHide:Q})]}),t.jsx("div",{className:"card overflow-hidden",children:t.jsx(Cm,{rows:S,showConnection:!0,sort:j,onSort:C,onHide:Q,message:z&&k.length===0?"Loading queues…":y?"No queue matches the filter":"No queues discovered yet"})})]})]})}function tC({connectionId:e,hidden:n,canUnhide:r,onUnhide:i,pendingQueue:o,className:c,forceOpen:d}){const[h,m]=Fu(`hiddenQueues.${e}`,!1),g=h||!!d;return n.length===0?null:t.jsxs("section",{className:F("card overflow-hidden",c),"aria-label":"Hidden queues",id:"hidden-queues",children:[t.jsxs("button",{type:"button",onClick:m,"aria-expanded":g,className:"flex w-full items-center gap-2 px-4 py-2.5 text-left hover:bg-surface-2",children:[g?t.jsx(ms,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}):t.jsx(Dn,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}),t.jsx(Mo,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}),t.jsxs("h2",{className:"text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:["Hidden queues ",t.jsxs("span",{className:"num",children:["(",n.length,")"]})]}),t.jsx("span",{className:"ml-auto text-[11px] text-fg-subtle",children:"Not counted in the totals above · jobs untouched"})]}),g&&t.jsx("ul",{className:"divide-y divide-border border-t border-border",children:n.map(p=>t.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 px-4 py-2",children:[t.jsx(Te,{to:oe.queue(e,p.queueName),className:"font-mono text-xs font-medium hover:underline",children:p.queueName}),t.jsxs("span",{className:"text-[11px] text-fg-subtle",children:["hidden ",t.jsx(Wt,{value:p.hiddenAt,className:"text-[11px]"}),p.hiddenByName&&` by ${p.hiddenByName}`]}),r&&t.jsx(H,{size:"xs",variant:"ghost",className:"ml-auto",leftIcon:t.jsx(qy,{}),loading:o===p.queueName,onClick:()=>i(p.queueName),title:"Put this queue back in the lists",children:"Show again"})]},p.queueName))})]})}function B0({queue:e,onClose:n,onConfirm:r,loading:i}){const[o,c]=N.useState(""),d=()=>{const h=o.trim();r(h||void 0)};return t.jsx(En,{open:e!==null,onClose:n,size:"sm",title:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(tl,{className:"size-4 text-warning","aria-hidden":!0}),"Pause ",e]}),description:"Workers stop taking new jobs from this queue; jobs already running finish. Jobs keep arriving and wait until you resume.",footer:t.jsxs(t.Fragment,{children:[t.jsx(H,{variant:"ghost",size:"sm",onClick:n,disabled:i,children:"Cancel"}),t.jsx(H,{variant:"primary",size:"sm",loading:i,onClick:d,children:"Pause queue"})]}),children:t.jsx(Wi,{autoFocus:!0,label:"Reason (optional)",hint:"Recorded in the audit log next to who paused it and when.",placeholder:"e.g. payment provider degraded, holding refunds until they recover",rows:3,maxLength:500,value:o,onChange:h=>c(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(h.metaKey||h.ctrlKey)&&!i&&d()}})})}function nC(){var de,se,A,K,qe,Ae;const{connectionId:e=""}=Fn(),{isOperator:n,isAdmin:r}=yt(),{has:i}=jt(),o=xs(),c=(de=o.data)==null?void 0:de.find(Ne=>Ne.id===e),d=e2(e),h=s2(e),m=c2(e),g=k0(e),p=fm(e),v=N.useRef(null),[j,C]=N.useState(!1),[y,b]=N.useState(null),k=i("folders"),S=Wr(k),$=an(),{sort:z,setSort:E,filter:T,setFilter:M}=gm(`connection.${e}`,Sm,km),O=N.useMemo(()=>{var Ne;return c?(((Ne=d.data)==null?void 0:Ne.queues)??[]).map(Le=>({connection:c,queue:Le})):[]},[c,d.data]),Q=N.useMemo(()=>O.filter(Ne=>xm(Ne,T)),[O,T]),V=N.useMemo(()=>Tf(Q,k?S.data:void 0),[Q,k,S.data]),q=N.useMemo(()=>pm(O),[O]);if(o.isSuccess&&!c)return t.jsx(vt,{children:t.jsx(rn,{icon:t.jsx(Aa,{}),title:"Connection not found",description:"It may have been removed.",action:t.jsx(Te,{to:"/",className:"text-accent hover:underline",children:"Back to overview"})})});const B=(se=d.data)==null?void 0:se.info,ce=((A=d.data)==null?void 0:A.status)??(c==null?void 0:c.status),_e=n?Ne=>{if(!Ne.queue.isPaused){b(Ne);return}m.mutate({queue:Ne.queue.name,action:"resume"},{onSuccess:()=>ee.success(`${Ne.queue.name} resumed`),onError:Le=>ee.error(be(Le))})}:void 0,Ue=Ne=>{if(!y)return;const Le=y.queue.name;m.mutate({queue:Le,action:"pause",...Ne?{reason:Ne}:{}},{onSuccess:()=>{b(null),ee.success(`${Le} paused`)},onError:st=>ee.error(be(st))})},Ge=m.isPending&&m.variables?`${e}/${m.variables.queue}`:null,rt=n?Ne=>p.hide(Ne.queue.name):void 0,Be=p.pendingQueue?`${e}/${p.pendingQueue}`:null,Z=()=>{C(!0),requestAnimationFrame(()=>{var Ne;return(Ne=v.current)==null?void 0:Ne.scrollIntoView({behavior:"smooth",block:"center"})})};return t.jsxs(vt,{wide:!0,children:[t.jsx(gs,{title:t.jsxs("span",{className:"flex items-center gap-2",children:[(c==null?void 0:c.name)??e,t.jsx(Du,{status:ce,pulse:!0,withLabel:!0})]}),description:c&&t.jsxs("span",{className:"font-mono",children:[c.url," · ",c.kind==="postgres"?"schema":"prefix"," ",t.jsx("span",{className:"text-fg",children:c.prefix}),c.cluster&&" · cluster",c.queueFilter&&` · filter ${c.queueFilter}`]}),actions:t.jsxs(t.Fragment,{children:[t.jsx(H,{size:"sm",variant:"secondary",leftIcon:t.jsx(Jf,{}),loading:h.isPending,onClick:()=>h.mutate(void 0,{onSuccess:()=>ee.success("Queue list refreshed"),onError:Ne=>ee.error(be(Ne))}),title:"Force queue rediscovery (bypasses the 30 s cache)",children:"Rediscover"}),r&&t.jsx(H,{size:"sm",variant:"ghost",leftIcon:t.jsx(Fy,{}),onClick:()=>$(`${oe.settings("connections")}?edit=${encodeURIComponent(e)}`),children:"Edit"})]})}),ce&&!ce.ok&&t.jsxs("div",{className:"mb-4 rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-xs text-danger",role:"alert",children:[(c==null?void 0:c.kind)==="postgres"?"Postgres":"Redis"," unreachable: ",ce.error??"unknown error"]}),t.jsxs("div",{className:"card mb-4 grid grid-cols-2 gap-px overflow-hidden bg-border sm:grid-cols-4 lg:grid-cols-8",children:[(B==null?void 0:B.backend)==="postgres"?t.jsxs(t.Fragment,{children:[t.jsx(dn,{label:"Postgres",value:B.serverVersion}),t.jsx(dn,{label:"Schema",value:B.schema}),t.jsx(dn,{label:"Uptime",value:fo(B.uptimeSeconds)}),t.jsx(dn,{label:"Connections",value:`${W(B.connectedClients)} / ${W(B.maxConnections)}`}),t.jsx(dn,{label:"Database",value:Kt(B.databaseSizeBytes)}),t.jsx(dn,{label:"Jobs table",value:Kt(B.jobTableBytes)}),t.jsx(dn,{label:"Events table",value:Kt(B.eventTableBytes)})]}):t.jsxs(t.Fragment,{children:[t.jsx(dn,{label:"Redis",value:B==null?void 0:B.redisVersion}),t.jsx(dn,{label:"Mode",value:B==null?void 0:B.mode}),t.jsx(dn,{label:"Uptime",value:B?fo(B.uptimeSeconds):void 0}),t.jsx(dn,{label:"Clients",value:B?W(B.connectedClients):void 0}),t.jsx(dn,{label:"Memory",value:B?`${Kt(B.usedMemoryBytes)}${B.maxMemoryBytes?` / ${Kt(B.maxMemoryBytes)}`:""}`:void 0}),t.jsx(dn,{label:"Keys",value:B?B.totalKeys!=null?W(B.totalKeys):"–":void 0}),t.jsx(dn,{label:"Ops / s",value:B?B.opsPerSec!=null?W(B.opsPerSec):"–":void 0})]}),t.jsx(dn,{label:"Latency",value:ce?ce.latencyMs!=null?`${ce.latencyMs} ms`:"–":void 0})]}),t.jsxs("section",{className:"space-y-3","aria-label":"Queues",children:[t.jsxs(Q0,{totals:q,title:"Queues",hiddenCount:((K=d.data)==null?void 0:K.hiddenCount)??((qe=g.data)==null?void 0:qe.length)??0,onRevealHidden:Z,children:[t.jsx(Nm,{value:T,onChange:M,"aria-label":"Filter queues"}),t.jsxs("span",{className:"num whitespace-nowrap text-xs text-fg-subtle",children:[Q.length," of ",O.length]})]}),d.isLoading?t.jsx(wm,{}):Q.length>0?t.jsx(U0,{sections:V,hideSingleHeader:!0,onHide:rt,hidePendingKey:Be}):null,t.jsx("div",{className:"card overflow-hidden",children:t.jsx(Cm,{rows:Q,sort:z,onSort:E,onToggle:_e,pendingKey:Ge,onHide:rt,hidePendingKey:Be,message:d.isLoading?t.jsx(Dt,{label:"Loading queues…"}):d.isError&&!d.data?be(d.error):T?"No queue matches the filter":"No queues discovered. Check the prefix and queue filter, then rediscover.",messageClassName:d.isError&&!d.data?"text-danger":void 0})}),t.jsx("div",{ref:v,children:t.jsx(tC,{connectionId:e,hidden:g.data??[],canUnhide:n,onUnhide:Ne=>p.unhide(Ne),pendingQueue:p.pendingQueue,forceOpen:j})})]}),t.jsx(B0,{queue:(y==null?void 0:y.queue.name)??null,onClose:()=>b(null),onConfirm:Ue,loading:m.isPending&&((Ae=m.variables)==null?void 0:Ae.action)==="pause"})]})}function dn({label:e,value:n}){return t.jsxs("div",{className:"bg-surface px-3 py-2",children:[t.jsx("div",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:e}),t.jsx("div",{className:"num truncate text-[13px] font-medium text-fg",children:n===void 0?t.jsx("span",{className:"skeleton inline-block h-3 w-12"}):n})]})}function _m({reason:e="Not available yet"}){return t.jsx(Ce,{content:e,children:t.jsx("span",{className:"cursor-help text-fg-subtle","aria-label":e,children:"—"})})}function Zn({label:e,value:n,unknownReason:r,isUnknown:i,hint:o,secondary:c,spark:d,sparkColor:h="var(--accent)",sparkTitle:m,meterPct:g,meterLabel:p,meterTone:v="ok",dimmed:j,big:C,className:y}){const b=t.jsx("span",{className:"text-[10px] font-medium tracking-wide text-fg-subtle uppercase",children:e});return t.jsxs("div",{className:F("min-w-0 rounded-md border border-border bg-bg/60 px-2.5 py-2",j&&"opacity-50",y),children:[t.jsx("div",{className:"flex items-center gap-1",children:o?t.jsx(Ce,{content:o,children:t.jsx("span",{className:"cursor-help border-b border-dotted border-border-strong",children:b})}):b}),t.jsx("div",{className:F("num mt-0.5 truncate font-semibold text-fg",C?"text-xl":"text-[15px]"),children:i?t.jsx(_m,{reason:r??"Not available yet"}):n}),c&&t.jsx("div",{className:"mt-0.5 truncate text-[11px] text-fg-muted",children:c}),g!==void 0&&t.jsx(sC,{pct:g,label:p,tone:v}),d&&t.jsx(Gi,{values:d,width:C?260:112,height:C?44:22,className:"mt-1.5 w-full",stroke:h,title:m??e,dimmed:j})]})}function sC({pct:e,label:n,tone:r="ok"}){const i=r==="danger"?"bg-danger":r==="warn"?"bg-warning":"bg-accent";return t.jsxs("div",{className:"mt-1",children:[t.jsx("div",{className:"h-1 w-full overflow-hidden rounded-full bg-surface-3",children:e!=null&&t.jsx("div",{className:F("h-full rounded-full transition-[width] duration-500",i),style:{width:`${Math.max(0,Math.min(100,e))}%`}})}),n&&t.jsx("div",{className:"mt-0.5 truncate text-[10px] text-fg-subtle",children:n})]})}function V0({warning:e}){const n=e.level==="critical",r=n?zy:Xn;return t.jsxs("div",{role:"status",className:F("flex items-start gap-2 rounded-md border px-2.5 py-1.5 text-xs",n?"border-danger/40 bg-danger/10 text-danger":"border-warning/40 bg-warning/10 text-warning"),children:[t.jsx(r,{className:"mt-px size-3.5 shrink-0","aria-hidden":!0}),t.jsx("span",{className:"min-w-0 flex-1 leading-snug",children:e.message}),t.jsx("span",{className:"shrink-0 font-mono text-[10px] opacity-60",children:e.code})]})}function tn({label:e,value:n,tone:r,hint:i}){const o=t.jsxs("div",{className:"flex items-baseline justify-between gap-3 border-b border-border/60 py-1 last:border-b-0",children:[t.jsx("dt",{className:"shrink-0 text-[11px] text-fg-subtle",children:e}),t.jsx("dd",{className:F("num min-w-0 truncate text-right text-[12px]",r==="danger"?"text-danger":r==="warn"?"text-warning":r==="muted"?"text-fg-muted":"text-fg"),children:n})]});return i?t.jsx(Ce,{content:i,block:!0,children:o}):o}const rC="No rate yet — needs two samples. Also resets when Postgres restarts. This is not zero.";function aC({health:e,big:n,paused:r}){var v;const[i,o]=N.useState(!1),c=al(1e3),d=((v=e.info)==null?void 0:v.backend)==="postgres"?e.info:null,h=!e.ok,m=H0(e,c),g=e.history??[],p=d&&d.maxConnections>0?d.connectedClients/d.maxConnections*100:null;return t.jsxs("section",{"aria-label":`Postgres health for ${e.connectionName}`,className:F("card flex min-w-0 flex-col gap-3 p-3",h&&"border-danger/50 bg-danger/[0.04]",r&&"opacity-70"),children:[t.jsxs("header",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[t.jsx(Ce,{content:h?`Unreachable: ${e.error??"unknown error"}`:"Responding",children:t.jsx("span",{className:F("status-dot",h?"bg-danger pulse text-danger":"bg-success text-success"),role:"img","aria-label":h?"unreachable":"ok"})}),t.jsx("h3",{className:"min-w-0 truncate text-sm font-semibold text-fg",children:e.connectionName}),d&&t.jsxs(t.Fragment,{children:[t.jsxs(ye,{variant:"outline",size:"xs",mono:!0,children:["Postgres ",d.serverVersion]}),t.jsx(ye,{variant:"neutral",size:"xs",mono:!0,children:d.schema}),t.jsx(Ce,{content:"Postgres server uptime",children:t.jsxs("span",{className:"num cursor-help text-[11px] text-fg-subtle",children:["up ",fo(d.uptimeSeconds)]})})]}),t.jsx("span",{className:"ml-auto shrink-0 text-[11px] text-fg-subtle",children:r?t.jsx("span",{className:"text-warning",children:"paused"}):m==null?t.jsx(_m,{reason:"No successful sample yet"}):t.jsxs("span",{className:"num",children:["sampled ",m,"s ago"]})})]}),h&&t.jsx("p",{className:"rounded-md border border-danger/40 bg-danger/10 px-2.5 py-1.5 font-mono text-[11px] break-words text-danger",children:e.error??"Postgres is unreachable"}),e.warnings.length>0&&t.jsx("div",{className:"flex flex-col gap-1.5",children:e.warnings.filter(j=>!(h&&j.code==="unreachable")).map((j,C)=>t.jsx(V0,{warning:j},`${j.code}-${C}`))}),t.jsxs("div",{className:F("grid gap-2",n?"sm:grid-cols-2 lg:grid-cols-3":"grid-cols-2 sm:grid-cols-3"),children:[t.jsx(Zn,{label:"Connections",big:n,dimmed:h,isUnknown:!d,unknownReason:"No sample",value:d?W(d.connectedClients):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Ou,{className:"size-3","aria-hidden":!0})," sessions on this database (pg_stat_activity)"]}),meterPct:p,meterLabel:d?`of ${W(d.maxConnections)} max_connections`:"",meterTone:p==null?"ok":p>=90?"danger":p>=75?"warn":"ok",spark:Js(g,"connectedClients"),sparkColor:"var(--info)",sparkTitle:"Connections"}),t.jsx(Zn,{label:"Transactions/sec",big:n,dimmed:h,isUnknown:e.commandsPerSec==null,unknownReason:rC,value:Hr(e.commandsPerSec),secondary:e.commandsPerSec==null?"measuring…":void 0,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Uy,{className:"size-3","aria-hidden":!0})," xact_commit + xact_rollback between samples"]}),spark:Js(g,"commandsPerSec"),sparkColor:"var(--accent)",sparkTitle:"Transactions per second"}),t.jsx(Zn,{label:"Latency",big:n,dimmed:h,isUnknown:!d,unknownReason:"No sample",value:d?mo(d.latencyMs):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(ao,{className:"size-3","aria-hidden":!0})," round trip of the health query itself"]}),spark:Js(g,"latencyMs"),sparkColor:"var(--warning)",sparkTitle:"Latency"}),t.jsx(Zn,{label:"Database",big:n,dimmed:h,isUnknown:!d,unknownReason:"No sample",value:d?Kt(d.databaseSizeBytes):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Aa,{className:"size-3","aria-hidden":!0})," pg_database_size, the whole database"]}),spark:Js(g,"memoryBytes"),sparkColor:"var(--violet)",sparkTitle:"Database size"}),t.jsx(Zn,{label:"Jobs table",big:n,dimmed:h,isUnknown:!d,unknownReason:"No sample",value:d?Kt(d.jobTableBytes):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx($g,{className:"size-3","aria-hidden":!0})," BullMQ's job table, with its indexes"]})}),t.jsx(Zn,{label:"Events table",big:n,dimmed:h,isUnknown:!d,unknownReason:"No sample",value:d?Kt(d.eventTableBytes):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx($g,{className:"size-3","aria-hidden":!0})," never trimmed by BullMQ 6: clean it on a schedule"]})})]}),t.jsxs("details",{open:i,onToggle:j=>o(j.currentTarget.open),className:"rounded-md border border-border bg-bg/40",children:[t.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 px-2.5 py-1.5 text-[11px] text-fg-muted select-none hover:text-fg",children:[t.jsx(Dn,{className:F("size-3.5 transition-transform",i&&"rotate-90"),"aria-hidden":!0}),"Details"]}),t.jsxs("dl",{className:"grid gap-x-6 px-2.5 pb-2 sm:grid-cols-2 lg:grid-cols-3",children:[t.jsx(tn,{label:"Cache hit rate",value:(d==null?void 0:d.cacheHitRatePct)!=null?_n(d.cacheHitRatePct):"—",hint:"blks_hit / (blks_hit + blks_read), cumulative"}),t.jsx(tn,{label:"Deadlocks",value:d?W(d.deadlocks):"—",tone:(d==null?void 0:d.deadlocks)!=null&&d.deadlocks>0?"warn":"muted",hint:"pg_stat_database.deadlocks, cumulative since the stats reset"}),t.jsx(tn,{label:"Transactions",value:d?ht(d.totalTransactions):"—",hint:"xact_commit + xact_rollback, cumulative"}),t.jsx(tn,{label:"History points",value:W(g.length),tone:"muted",hint:"Kept in the server's memory, not persisted"})]})]})]})}const ov="No rate yet — needs two INFO samples. Also resets when Redis restarts. This is not zero.";function H0(e,n){if(!e.info)return null;const r=Date.parse(e.info.sampledAt);return Number.isFinite(r)?Math.max(0,Math.round((n-r)/1e3)):null}function Js(e,n){return e.map(r=>{const i=r[n];return typeof i=="number"&&Number.isFinite(i)?i:null})}function iC(e){return e.health.kind==="postgres"?t.jsx(aC,{...e}):t.jsx(lC,{...e})}function lC({health:e,big:n,paused:r}){const[i,o]=N.useState(!1),c=al(1e3),d=e.info&&e.info.backend!=="postgres"?e.info:null,h=!e.ok,m=H0(e,c),g=e.history??[],p=h;return t.jsxs("section",{"aria-label":`Redis health for ${e.connectionName}`,className:F("card flex min-w-0 flex-col gap-3 p-3",h&&"border-danger/50 bg-danger/[0.04]",r&&"opacity-70"),children:[t.jsxs("header",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[t.jsx(Ce,{content:h?`Unreachable: ${e.error??"unknown error"}`:"Responding to INFO",children:t.jsx("span",{className:F("status-dot",h?"bg-danger pulse text-danger":"bg-success text-success"),role:"img","aria-label":h?"unreachable":"ok"})}),t.jsx("h3",{className:"min-w-0 truncate text-sm font-semibold text-fg",children:e.connectionName}),d&&t.jsxs(t.Fragment,{children:[t.jsx(ye,{variant:"outline",size:"xs",mono:!0,children:d.redisVersion}),t.jsx(ye,{variant:"neutral",size:"xs",children:d.mode}),t.jsx(Ce,{content:"Redis process uptime",children:t.jsxs("span",{className:"num cursor-help text-[11px] text-fg-subtle",children:["up ",fo(d.uptimeSeconds)]})})]}),t.jsx("span",{className:"ml-auto shrink-0 text-[11px] text-fg-subtle",children:r?t.jsx("span",{className:"text-warning",children:"paused"}):m==null?t.jsx(_m,{reason:"No successful sample yet"}):t.jsx(Ce,{content:d?`Sampled at ${new Date(d.sampledAt).toLocaleTimeString()}`:"",children:t.jsxs("span",{className:"num cursor-help",children:["sampled ",m,"s ago"]})})})]}),h&&t.jsx("p",{className:"rounded-md border border-danger/40 bg-danger/10 px-2.5 py-1.5 font-mono text-[11px] break-words text-danger",children:e.error??"Redis is unreachable"}),e.warnings.length>0&&t.jsx("div",{className:"flex flex-col gap-1.5",children:e.warnings.filter(v=>!(h&&v.code==="unreachable")).map((v,j)=>t.jsx(V0,{warning:v},`${v.code}-${j}`))}),t.jsxs("div",{className:F("grid gap-2",n?"sm:grid-cols-2 lg:grid-cols-3":"grid-cols-2 sm:grid-cols-3"),children:[t.jsx(Zn,{label:"Memory",big:n,dimmed:p,isUnknown:!d,unknownReason:"No sample",value:d?d.usedMemoryHuman||Kt(d.usedMemoryBytes):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(vN,{className:"size-3","aria-hidden":!0})," used_memory"]}),meterPct:e.memoryUsedPct,meterLabel:e.memoryUsedPct!=null&&(d!=null&&d.maxMemoryBytes)?`${_n(e.memoryUsedPct)} of ${Kt(d.maxMemoryBytes)}`:"no maxmemory set",meterTone:e.memoryUsedPct==null?"ok":e.memoryUsedPct>=90?"danger":e.memoryUsedPct>=75?"warn":"ok",spark:Js(g,"memoryBytes"),sparkColor:"var(--violet)",sparkTitle:"Used memory"}),t.jsx(Zn,{label:"CPU",big:n,dimmed:p,isUnknown:e.cpuCores==null,unknownReason:ov,value:Hi(e.cpuCores),secondary:e.cpuCores==null?"measuring…":t.jsx(Ce,{content:$o(e.cpuCores),children:t.jsx("span",{className:"num cursor-help border-b border-dotted border-border-strong",children:y0(e.cpuCores)})}),hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(hN,{className:"size-3","aria-hidden":!0})," used_cpu_sys + used_cpu_user, per second, as a share of one core. 100% = one saturated core."]}),meterPct:e.cpuCores==null?null:e.cpuCores*100,meterLabel:e.cpuCores==null?"measuring…":e.cpuCores>1?"over 1 core":"of 1 core",meterTone:e.cpuCores==null?"ok":nS(e.cpuCores),spark:Js(g,"cpuCores"),sparkColor:"var(--teal)",sparkTitle:"CPU (share of one core)"}),t.jsx(Zn,{label:"Commands/sec",big:n,dimmed:p,isUnknown:e.commandsPerSec==null,unknownReason:ov,value:Hr(e.commandsPerSec),secondary:e.commandsPerSec==null?"measuring…":void 0,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Uy,{className:"size-3","aria-hidden":!0})," derived from total_commands_processed between samples"]}),spark:Js(g,"commandsPerSec"),sparkColor:"var(--accent)",sparkTitle:"Commands per second"}),t.jsx(Zn,{label:"Latency",big:n,dimmed:p,isUnknown:!d,unknownReason:"No sample",value:d?mo(d.latencyMs):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(ao,{className:"size-3","aria-hidden":!0})," round trip of the INFO command itself"]}),spark:Js(g,"latencyMs"),sparkColor:"var(--warning)",sparkTitle:"INFO latency"}),t.jsx(Zn,{label:"Clients",big:n,dimmed:p,isUnknown:!d,unknownReason:"No sample",value:d?W(d.connectedClients):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Ou,{className:"size-3","aria-hidden":!0})," connected_clients"]}),secondary:(d==null?void 0:d.blockedClients)!=null?t.jsx(Ce,{content:"Blocked clients are normal for BullMQ: workers sit in BRPOPLPUSH waiting for the next job. A number close to your worker count is healthy, not a stall.",children:t.jsxs("span",{className:"cursor-help border-b border-dotted border-border-strong",children:[W(d.blockedClients)," blocked"]})}):void 0,spark:Js(g,"connectedClients"),sparkColor:"var(--info)",sparkTitle:"Connected clients"}),t.jsx(Zn,{label:"Keys",big:n,dimmed:p,isUnknown:!d||d.totalKeys==null,unknownReason:"Redis did not report a keyspace (empty db, or cluster)",value:d?ht(d.totalKeys):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(bN,{className:"size-3","aria-hidden":!0})," total keys across the keyspace"]})})]}),t.jsxs("details",{open:i,onToggle:v=>o(v.currentTarget.open),className:"rounded-md border border-border bg-bg/40",children:[t.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 px-2.5 py-1.5 text-[11px] text-fg-muted select-none hover:text-fg",children:[t.jsx(Dn,{className:F("size-3.5 transition-transform",i&&"rotate-90"),"aria-hidden":!0}),"Details"]}),t.jsxs("dl",{className:"grid gap-x-6 px-2.5 pb-2 sm:grid-cols-2 lg:grid-cols-3",children:[t.jsx(tn,{label:"RSS",value:d?Kt(d.usedMemoryRssBytes):"—",hint:"used_memory_rss — what the OS actually holds for the Redis process"}),t.jsx(tn,{label:"Peak memory",value:d?Kt(d.usedMemoryPeakBytes):"—",hint:"used_memory_peak"}),t.jsx(tn,{label:"Fragmentation",value:d?Gk(d.memFragmentationRatio):"—",tone:(d==null?void 0:d.memFragmentationRatio)!=null&&d.memFragmentationRatio>1.5?"warn":void 0,hint:"mem_fragmentation_ratio — above 1.5 the allocator is wasting memory"}),t.jsx(tn,{label:"Maxmemory policy",value:(d==null?void 0:d.maxMemoryPolicy)??"—",tone:d!=null&&d.maxMemoryPolicy&&d.maxMemoryPolicy!=="noeviction"?"warn":void 0,hint:"Anything other than noeviction can silently delete queue keys under memory pressure"}),t.jsx(tn,{label:"Hit rate",value:(d==null?void 0:d.keyspaceHitRatePct)!=null?_n(d.keyspaceHitRatePct):"—",hint:"keyspace_hits / (hits + misses), cumulative since start"}),t.jsx(tn,{label:"Evicted keys",value:d?W(d.evictedKeys):"—",tone:(d==null?void 0:d.evictedKeys)!=null&&d.evictedKeys>0?"danger":"muted",hint:"Non-zero on a queue Redis means jobs were deleted to free memory"}),t.jsx(tn,{label:"Expired keys",value:d?W(d.expiredKeys):"—",tone:"muted",hint:"expired_keys, cumulative"}),t.jsx(tn,{label:"Rejected connections",value:d?W(d.rejectedConnections):"—",tone:(d==null?void 0:d.rejectedConnections)!=null&&d.rejectedConnections>0?"warn":"muted",hint:"Non-zero means maxclients was hit at some point since start"}),t.jsx(tn,{label:"Replicas",value:(d==null?void 0:d.connectedReplicas)!=null?W(d.connectedReplicas):"—",hint:"connected_slaves"}),t.jsx(tn,{label:"Persistence",value:(d==null?void 0:d.persistenceOk)==null?"—":d.persistenceOk?"ok":"failing",tone:(d==null?void 0:d.persistenceOk)===!1?"danger":void 0,hint:"rdb_last_bgsave_status / aof_last_write_status"}),t.jsx(tn,{label:"Commands processed",value:d?ht(d.totalCommandsProcessed):"—",hint:"total_commands_processed, cumulative since start"}),t.jsx(tn,{label:"History points",value:W(g.length),tone:"muted",hint:"Kept in the server's memory, not persisted"})]})]})]})}const oC="redis-health";function cC({big:e,className:n,headless:r}){const{health:i,paused:o,setPaused:c,isLoading:d,error:h}=Uu(),m=hm(i);return t.jsxs("section",{id:oC,"aria-label":"Server health",className:F("scroll-mt-16",n),children:[!r&&t.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[t.jsxs("h2",{className:"flex items-center gap-1.5 text-sm font-semibold text-fg",children:[t.jsx(Eo,{className:"size-4 text-fg-subtle","aria-hidden":!0}),"Server health"]}),m.critical>0&&t.jsxs(ye,{variant:"danger",size:"xs",children:[m.critical," critical"]}),m.warn>0&&t.jsxs(ye,{variant:"warning",size:"xs",children:[m.warn," warning",m.warn===1?"":"s"]}),m.critical===0&&m.warn===0&&i.length>0&&!o&&t.jsx(ye,{variant:"success",size:"xs",dot:!0,children:"all clear"}),t.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[!e&&t.jsxs(Te,{to:oe.health,className:"inline-flex items-center gap-1 text-[11px] text-accent hover:underline",children:["Open monitor",t.jsx(Ur,{className:"size-3","aria-hidden":!0})]}),t.jsx(cv,{paused:o,onChange:c})]})]}),r&&t.jsx("div",{className:"mb-2 flex items-center justify-end",children:t.jsx(cv,{paused:o,onChange:c})}),o&&t.jsxs("p",{className:"mb-2 flex items-center gap-2 rounded-md border border-warning/40 bg-warning/10 px-2.5 py-1.5 text-xs text-warning",children:[t.jsx(tl,{className:"size-3.5 shrink-0","aria-hidden":!0}),"Monitoring paused. The dashboard is sending no health reads to your servers. Numbers below are the last frame received."]}),h!=null&&!o&&t.jsxs("p",{className:"mb-2 rounded-md border border-danger/40 bg-danger/10 px-2.5 py-1.5 text-xs text-danger",children:["Could not load health: ",be(h)]}),d&&i.length===0?t.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"repeat(auto-fit, minmax(360px, 1fr))"},children:[0,1].map(g=>t.jsx("div",{className:"card h-64 animate-pulse"},g))}):i.length===0?t.jsx("div",{className:"card",children:t.jsx(rn,{compact:!0,icon:t.jsx(PN,{}),title:"Nothing to monitor",description:"Health shows up once a connection is configured."})}):t.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:`repeat(auto-fit, minmax(${e?480:360}px, 1fr))`},children:i.map(g=>t.jsx(iC,{health:g,big:e,paused:o},g.connectionId))}),t.jsx(uC,{})]})}function cv({paused:e,onChange:n}){return t.jsx(Ce,{content:e?"Resume polling. One health read per connection every 3s.":"Stop the dashboard's own health traffic immediately.",children:t.jsx(H,{size:"xs",variant:e?"primary":"ghost",leftIcon:e?t.jsx(Gf,{}):t.jsx(tl,{}),"aria-pressed":e,onClick:()=>n(!e),children:e?"Resume monitoring":"Pause monitoring"})})}function uC(){return t.jsxs("p",{className:"mt-2 text-[11px] leading-relaxed text-fg-subtle",children:["One read per connection every 3s: INFO on Redis (O(1)), one pg_stat_* query on Postgres. The server shares and rate-limits the sample, so extra browser tabs add no extra load. See"," ",t.jsx("code",{className:"font-mono text-fg-muted",children:"docs/PRODUCTION-TRIAL.md"})," before pointing this at a production server."]})}function dC(){const{health:e,paused:n,lastSampleAt:r}=Uu();return t.jsxs(vt,{wide:!0,children:[t.jsx(gs,{title:"Health monitor",description:n?"Paused — the dashboard is sending nothing to your servers.":"One health read per connection every 3 seconds (INFO on Redis, pg_stat_* on Postgres), sampled on the server and shared across tabs.",actions:r!=null&&!n?t.jsxs("span",{className:"num text-[11px] text-fg-subtle",children:["last sample ",xn(r)]}):void 0}),t.jsx(cC,{big:!0,headless:!0}),t.jsxs("section",{className:"mt-6 space-y-3","aria-label":"Sample history",children:[t.jsx("h2",{className:"text-sm font-semibold text-fg",children:"History"}),e.length===0?t.jsx("p",{className:"text-xs text-fg-subtle",children:"No connections to show."}):e.map(i=>t.jsx(hC,{health:i},i.connectionId))]})]})}const Qh=40;function hC({health:e}){const[n,r]=N.useState(!1),i=N.useMemo(()=>[...e.history??[]].reverse(),[e.history]),o=n?i:i.slice(0,Qh);return t.jsxs("div",{className:"card overflow-hidden",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2",children:[t.jsx("span",{className:F("status-dot",e.ok?"bg-success text-success":"bg-danger text-danger"),role:"img","aria-label":e.ok?"ok":"unreachable"}),t.jsx("h3",{className:"truncate text-[13px] font-medium text-fg",children:e.connectionName}),t.jsxs(ye,{variant:"neutral",size:"xs",children:[W(i.length)," samples"]}),i.length>Qh&&t.jsx("button",{type:"button",className:"ml-auto text-[11px] text-accent hover:underline",onClick:()=>r(c=>!c),children:n?`Show latest ${Qh}`:`Show all ${i.length}`})]}),t.jsxs(fs,{dense:!0,maxHeight:n?420:void 0,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(me,{children:"Time"}),t.jsx(me,{align:"right",children:"Latency"}),t.jsx(me,{align:"right",children:"Memory / DB size"}),t.jsx(me,{align:"right",children:"Cmd or tx /s"}),t.jsx(me,{align:"right",children:"CPU"}),t.jsx(me,{align:"right",children:"Clients"})]})}),t.jsx("tbody",{children:o.length===0?t.jsxs(xt,{colSpan:6,children:["No samples yet",e.ok?"":" — the server is unreachable"]}):o.map(c=>t.jsxs("tr",{children:[t.jsx(pe,{num:!0,mono:!0,children:xn(c.t)}),t.jsx(pe,{align:"right",num:!0,children:mo(c.latencyMs)}),t.jsx(pe,{align:"right",num:!0,children:Kt(c.memoryBytes)}),t.jsx(pe,{align:"right",num:!0,muted:c.commandsPerSec==null,children:c.commandsPerSec==null?t.jsx(uv,{}):Hr(c.commandsPerSec,"")}),t.jsx(pe,{align:"right",num:!0,muted:c.cpuCores==null,children:c.cpuCores==null?t.jsx(uv,{}):t.jsx(Ce,{content:$o(c.cpuCores),children:t.jsx("span",{className:"cursor-help",children:Hi(c.cpuCores)})})}),t.jsx(pe,{align:"right",num:!0,children:W(c.connectedClients)})]},c.t))})]})]})}function uv(){return t.jsx(Ce,{content:"No rate for this sample — it was the first one, or the server had just restarted. Not zero.",children:t.jsx("span",{className:"cursor-help text-fg-subtle",children:"—"})})}function K0(e,n){const r=new Set(e);return r.has(n)?r.delete(n):r.add(n),r}function fC(e,n,r,i){const o=r?n.indexOf(r):-1,c=n.indexOf(i);if(o<0||c<0)return K0(e,i);const[d,h]=o<=c?[o,c]:[c,o],m=!e.has(i),g=new Set(e);for(const p of n.slice(d,h+1))m?g.add(p):g.delete(p);return g}function mC(e,n){const r=n.length>0&&n.every(o=>e.has(o)),i=new Set(e);for(const o of n)r?i.delete(o):i.add(o);return i}function pC(e,n){return n.reduce((r,i)=>e.has(i)?r+1:r,0)}function xC(e){const[n,r]=N.useState(()=>new Set),i=N.useRef(null),o=N.useCallback(C=>n.has(C),[n]),c=N.useCallback(C=>{i.current=C,r(y=>K0(y,C))},[]),d=N.useCallback(C=>{const y=i.current;i.current=C,r(b=>fC(b,e,y,C))},[e]),h=N.useMemo(()=>pC(n,e),[e,n]),m=e.length>0&&h===e.length,g=N.useCallback(()=>{r(C=>mC(C,e)),i.current=null},[e]),p=N.useCallback(()=>{r(new Set),i.current=null},[]),v=N.useCallback(C=>{r(y=>{const b=new Set(y);for(const k of C)b.delete(k);return b})},[]),j=N.useMemo(()=>[...n],[n]);return{selectedIds:j,visibleSelectedCount:h,offPageCount:j.length-h,allVisibleSelected:m,has:o,toggle:c,toggleRange:d,toggleAllVisible:g,clear:p,deselect:v}}function W0(e){if(e==="mixed")return["retry","promote","remove"];const n=[];return(e==="failed"||e==="completed")&&n.push("retry"),e==="delayed"&&n.push("promote"),n.push("remove"),n}const gC={retry:"Retry",promote:"Promote",remove:"Remove"};function dv({selection:e,state:n,queue:r,actions:i,onRun:o,pending:c,searching:d,className:h}){const m=e.selectedIds.length;if(m===0)return null;const g=i??W0(n);return t.jsxs("div",{role:"toolbar","aria-label":"Bulk actions",className:F("flex flex-wrap items-center gap-2 border-b border-border bg-accent/10 px-3 py-2 text-xs",h),children:[t.jsxs("span",{className:"font-medium text-fg",children:[t.jsx("span",{className:"num",children:W(m)})," selected"]}),e.offPageCount>0&&t.jsxs("span",{className:"text-fg-muted",title:"Selection is kept by job id, so it survives the 3 s refresh and paging. These jobs are still selected and the action will include them.",children:["(",t.jsx("span",{className:"num",children:W(e.offPageCount)})," not on this page)"]}),d&&t.jsx("span",{className:"text-fg-subtle",children:"· from the loaded search results, not the whole state"}),t.jsx("span",{className:"flex-1"}),g.map(p=>t.jsx(H,{size:"sm",variant:p==="remove"?"danger":p==="retry"?"primary":"secondary",leftIcon:p==="retry"?t.jsx($u,{}):p==="promote"?t.jsx(Hf,{}):t.jsx(ps,{}),loading:c===p,disabled:!!c,onClick:()=>o(p),children:gC[p]},p)),t.jsx(H,{size:"sm",variant:"ghost",leftIcon:t.jsx(gn,{}),onClick:e.clear,disabled:!!c,children:"Clear"})]})}function hv({result:e,onDismiss:n}){const[r,i]=N.useState(!1),o=e.action==="retry"?"retried":e.action==="promote"?"promoted":"removed",c=e.failed.length;return t.jsxs("div",{className:F("border-b border-border px-3 py-2 text-xs",c>0?"bg-warning/10":"bg-state-completed/10"),role:"status",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs("span",{className:"text-fg",children:[t.jsx("span",{className:"num font-semibold",children:W(e.ok.length)})," ",o,c>0&&t.jsxs(t.Fragment,{children:[" · ",t.jsx("span",{className:"num font-semibold text-warning",children:W(c)})," failed"]})]}),c>0&&t.jsxs("button",{type:"button",className:"inline-flex items-center gap-0.5 text-fg-muted hover:text-fg",onClick:()=>i(d=>!d),"aria-expanded":r,children:[r?t.jsx(ms,{className:"size-3"}):t.jsx(Dn,{className:"size-3"}),r?"hide reasons":"why?"]}),t.jsx("span",{className:"flex-1"}),t.jsx("button",{type:"button",className:"rounded p-0.5 text-fg-subtle hover:text-fg","aria-label":"Dismiss",onClick:n,children:t.jsx(gn,{className:"size-3.5"})})]}),r&&c>0&&t.jsx("ul",{className:"mt-1.5 max-h-40 space-y-0.5 overflow-auto font-mono text-[11px] text-fg-muted",children:e.failed.map(d=>t.jsxs("li",{children:[t.jsx("span",{className:"text-fg",children:d.jobId})," — ",d.reason]},d.jobId))})]})}function Pm({items:e,value:n,onChange:r,className:i,size:o="md",variant:c="underline",...d}){const h=N.useRef(null),m=g=>{var y;if(!["ArrowLeft","ArrowRight","Home","End"].includes(g.key))return;g.preventDefault();const p=e.filter(b=>!b.disabled),v=p.findIndex(b=>b.value===n);let j=v;g.key==="ArrowRight"&&(j=(v+1)%p.length),g.key==="ArrowLeft"&&(j=(v-1+p.length)%p.length),g.key==="Home"&&(j=0),g.key==="End"&&(j=p.length-1);const C=p[j];if(C){r(C.value,C);const b=(y=h.current)==null?void 0:y.querySelector(`[data-value="${C.value}"]`);b==null||b.focus()}};return t.jsx("div",{ref:h,role:"tablist","aria-label":d["aria-label"],onKeyDown:m,className:F("flex min-w-0 items-end gap-0.5 overflow-x-auto",c==="underline"&&"border-b border-border",c==="pills"&&"rounded-md bg-surface-2 p-0.5",i),children:e.map(g=>{const p=g.value===n;return t.jsxs("button",{role:"tab",type:"button","data-value":g.value,"aria-selected":p,tabIndex:p?0:-1,disabled:g.disabled,onClick:()=>r(g.value,g),className:F("relative inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-accent/60 disabled:opacity-40",o==="sm"?"h-7 px-2 text-xs":"h-8 px-2.5 text-[13px]",c==="underline"&&F("-mb-px rounded-t border-b-2",p?"border-accent text-fg":"border-transparent text-fg-muted hover:border-border-strong hover:text-fg"),c==="pills"&&F("rounded",p?"bg-surface text-fg shadow-sm":"text-fg-muted hover:text-fg")),children:[g.tone&&t.jsx("span",{className:F("status-dot",g.tone),"aria-hidden":!0}),g.icon,g.label,g.count!=null&&t.jsx("span",{className:F("num rounded px-1 py-px text-[11px] leading-none",p?"bg-surface-3 text-fg":"bg-surface-2 text-fg-subtle"),children:ht(g.count)}),g.locked&&t.jsx(io,{className:"size-3 text-pro","aria-label":"Pro feature"})]},g.value)})})}function qf({connectionId:e,queue:n,jobs:r,loading:i,error:o,emptyText:c="No jobs in this state",canOperate:d,onAction:h,pendingId:m,showState:g=!0,showGroup:p,onGroupClick:v,highlight:j,compact:C,selection:y}){const b=an(),k=8+(g?1:0)+(p?1:0)+(y?1:0),S=(r==null?void 0:r.length)??0,$=S>0&&r.every(z=>z.state==="delayed");return t.jsxs(fs,{dense:C,className:"min-w-[960px]",children:[t.jsx("thead",{children:t.jsxs("tr",{children:[y&&t.jsx(me,{className:"w-8",children:t.jsx("input",{type:"checkbox",className:"size-3.5 cursor-pointer align-middle accent-[var(--accent)]","aria-label":y.allVisibleSelected?"Clear selection on this page":"Select every job on this page",title:y.allVisibleSelected?"Clear this page":"Select this page",checked:y.allVisibleSelected,ref:z=>{z&&(z.indeterminate=!y.allVisibleSelected&&y.visibleSelectedCount>0)},disabled:S===0,onChange:y.toggleAllVisible})}),t.jsx(me,{className:"w-28",children:"ID"}),t.jsx(me,{children:t.jsx("span",{className:"cursor-help border-b border-dotted border-border-strong",title:'The job name — the first argument of queue.add("name", data). It is the job type / handler, not the queue name.',children:"Name"})}),g&&t.jsx(me,{children:"State"}),p&&t.jsx(me,{children:"Group"}),t.jsx(me,{className:"w-24",children:"Attempts"}),t.jsx(me,{className:"w-28",children:"Created"}),t.jsx(me,{className:"w-28",children:$?"Runs at":"Finished"}),t.jsx(me,{className:"w-24",align:"right",children:"Duration"}),t.jsx(me,{children:"Data"}),t.jsx(me,{className:"w-28",align:"right",children:t.jsx("span",{className:"sr-only",children:"Actions"})})]})}),t.jsxs("tbody",{children:[!!o&&!r&&t.jsx(xt,{colSpan:k,className:"text-danger",children:"Could not load jobs"}),i&&!r&&t.jsx(xt,{colSpan:k,children:t.jsx(Dt,{label:"Loading jobs…"})}),r&&r.length===0&&t.jsx(xt,{colSpan:k,children:c}),r==null?void 0:r.map(z=>t.jsx(vC,{job:z,connectionId:e,queue:n,canOperate:d,onAction:h,pending:m===z.id,showState:g,showGroup:!!p,onGroupClick:v,highlight:j,selection:y,onOpen:()=>b(oe.job(e,n,z.id))},z.id))]})]})}function vC({job:e,connectionId:n,queue:r,canOperate:i,onAction:o,pending:c,showState:d,showGroup:h,onGroupClick:m,highlight:g,selection:p,onOpen:v}){const j=e.processedOn&&e.finishedOn?e.finishedOn-e.processedOn:null,C=e.processedOn?e.processedOn-e.timestamp:null,y=e.state==="failed"||e.state==="completed",b=e.state==="delayed",k=(p==null?void 0:p.has(e.id))??!1;return t.jsxs(il,{onActivate:v,selected:k,className:F(c&&"opacity-50"),children:[p&&t.jsx(pe,{"data-no-row-click":!0,children:t.jsx("input",{type:"checkbox",className:"size-3.5 cursor-pointer align-middle accent-[var(--accent)]","aria-label":`Select job ${e.id}`,checked:k,onChange:()=>{},onClick:S=>{S.stopPropagation(),S.shiftKey?p.toggleRange(e.id):p.toggle(e.id)}})}),t.jsx(pe,{mono:!0,children:t.jsx(Te,{to:oe.job(n,r,e.id),className:"text-accent hover:underline",title:e.id,children:e.id.length>14?`${e.id.slice(0,12)}…`:e.id})}),t.jsx(pe,{children:t.jsx("span",{className:"block max-w-56 truncate font-medium",title:e.name,children:t.jsx(ma,{text:e.name,needle:g})})}),d&&t.jsx(pe,{children:t.jsx(L0,{state:e.state,size:"xs"})}),h&&t.jsx(pe,{mono:!0,muted:!0,"data-no-row-click":!0,children:e.groupId?m?t.jsx("button",{type:"button",className:"max-w-40 truncate rounded px-1 text-left text-pro hover:bg-pro/10 hover:underline",title:`Show only group ${e.groupId}`,onClick:()=>m(e.groupId),children:e.groupId}):t.jsx(Te,{to:oe.group(n,r,e.groupId),className:"text-pro hover:underline",title:"Open group",children:e.groupId}):"–"}),t.jsxs(pe,{num:!0,children:[t.jsxs("span",{className:F(e.attemptsMade>1&&"text-warning"),children:[e.attemptsMade,e.attempts!=null&&t.jsxs("span",{className:"text-fg-subtle",children:[" / ",e.attempts]})]}),e.stalledCounter>0&&t.jsxs(ye,{variant:"warning",size:"xs",className:"ml-1.5 gap-0.5",title:`Stalled ${e.stalledCounter} time${e.stalledCounter===1?"":"s"}: the worker lost the lock (it died or blocked) and BullMQ recovered the job. Not a state — the job went back to waiting.`,children:[t.jsx(Yf,{className:"size-2.5","aria-hidden":!0}),e.stalledCounter]}),e.priority>0&&t.jsxs(ye,{variant:"violet",size:"xs",className:"ml-1.5",title:"priority",children:["p",e.priority]})]}),t.jsx(pe,{muted:!0,children:t.jsx(Wt,{value:e.timestamp})}),t.jsx(pe,{muted:!0,children:e.state==="delayed"&&e.delayedUntil?t.jsx(Ce,{content:t.jsxs(t.Fragment,{children:["runs at ",xn(e.delayedUntil)]}),side:"left",children:t.jsx("span",{className:"text-state-delayed",children:t.jsx(Wt,{value:e.delayedUntil})})}):t.jsx(Wt,{value:e.finishedOn,emptyText:e.processedOn?"running…":"–"})}),t.jsx(pe,{num:!0,align:"right",muted:!0,children:t.jsx(Ce,{content:t.jsxs(t.Fragment,{children:[C!=null&&t.jsxs(t.Fragment,{children:["wait ",An(C)," · "]}),e.processedOn&&t.jsxs(t.Fragment,{children:["started ",xn(e.processedOn)]})]}),side:"left",children:t.jsx("span",{children:j!=null?An(j):e.processedOn?An(Date.now()-e.processedOn):"–"})})}),t.jsx(pe,{className:"max-w-md",children:t.jsx(yC,{job:e,highlight:g})}),t.jsx(pe,{align:"right","data-no-row-click":!0,children:t.jsxs("div",{className:"flex items-center justify-end gap-0.5",children:[i&&o&&y&&t.jsx(H,{size:"icon-xs",variant:"ghost",title:"Retry","aria-label":"Retry job",onClick:()=>o(e.id,"retry",e),children:t.jsx($u,{})}),i&&o&&b&&t.jsx(H,{size:"icon-xs",variant:"ghost",title:"Promote","aria-label":"Promote job",onClick:()=>o(e.id,"promote",e),children:t.jsx(Hf,{})}),i&&o&&t.jsx(H,{size:"icon-xs",variant:"ghost",title:"Remove","aria-label":"Remove job",className:"hover:text-danger",onClick:()=>o(e.id,"remove",e),children:t.jsx(ps,{})}),t.jsx(H,{size:"icon-xs",variant:"ghost",title:"Open","aria-label":"Open job",onClick:v,children:t.jsx(Ur,{})})]})})]})}function ma({text:e,needle:n}){const r=n==null?void 0:n.trim();if(!r||!e)return e;const i=e.toLowerCase(),o=r.toLowerCase(),c=[];let d=0,h=i.indexOf(o,d),m=0;for(;h>=0&&m++<200;)h>d&&c.push(e.slice(d,h)),c.push(t.jsx("mark",{children:e.slice(h,h+r.length)},h)),d=h+r.length,h=i.indexOf(o,d);return d<e.length&&c.push(e.slice(d)),t.jsx(t.Fragment,{children:c})}function yC({job:e,highlight:n}){const[r,i]=N.useState(!1),o=e.dataPreview??"";if(!o&&e.dataTruncated&&e.dataBytes)return t.jsxs("span",{className:"font-mono text-xs text-fg-subtle",title:"Payloads this large are not previewed in lists so a page never moves megabytes through Redis. Open the job to see it.",children:["payload ",Kt(e.dataBytes)," · open the job",e.failedReason&&t.jsx("span",{className:"block truncate font-sans text-danger",title:e.failedReason,children:t.jsx(ma,{text:e.failedReason,needle:n})})]});if(e.failedReason&&!r)return t.jsxs("div",{className:"flex flex-col gap-0.5","data-no-row-click":!0,children:[t.jsx("button",{type:"button",className:"truncate text-left font-mono text-xs text-fg-muted hover:text-fg",onClick:()=>i(!0),title:"Expand",children:o?t.jsx(ma,{text:o,needle:n}):t.jsx("span",{className:"text-fg-subtle",children:"{}"})}),t.jsx("span",{className:"truncate text-xs text-danger",title:e.failedReason,children:t.jsx(ma,{text:e.failedReason,needle:n})})]});if(!r)return t.jsx("button",{type:"button","data-no-row-click":!0,className:"block w-full truncate text-left font-mono text-xs text-fg-muted hover:text-fg",onClick:()=>i(!0),title:"Expand",children:o?t.jsx(ma,{text:o,needle:n}):t.jsx("span",{className:"text-fg-subtle",children:"{}"})});const c=e.dataTruncated?null:Zk(o);return t.jsxs("div",{"data-no-row-click":!0,className:"py-1",children:[t.jsxs("pre",{className:"max-h-64 overflow-auto rounded border border-border bg-bg p-2 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-all text-fg",children:[t.jsx(ma,{text:c??o,needle:n}),e.dataTruncated&&t.jsx("span",{className:"text-fg-subtle",children:" … (truncated, open the job for the full payload)"})]}),e.failedReason&&t.jsx("p",{className:"mt-1 text-xs break-words text-danger",children:t.jsx(ma,{text:e.failedReason,needle:n})}),t.jsx("button",{type:"button",className:"mt-1 text-[11px] text-fg-subtle hover:text-fg",onClick:()=>i(!1),children:"collapse"})]})}const jC=[25,50,100,200];function Hu({page:e,pageSize:n,total:r,onPage:i,onPageSize:o,count:c,className:d}){const h=Math.max(1,Math.ceil(r/n)),m=r===0?0:(e-1)*n+1,g=c!=null?m+Math.max(0,c-1):Math.min(r,e*n);return t.jsxs("div",{className:`flex flex-wrap items-center justify-between gap-3 text-xs text-fg-muted ${d??""}`,children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"num",children:r===0?"0 items":`${W(m)}–${W(g)} of ${W(r)}`}),o&&t.jsxs("label",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"sr-only",children:"Page size"}),t.jsx(ut,{"aria-label":"Page size",className:"!h-7 !w-auto !py-0 text-xs",value:String(n),onChange:p=>o(Number(p.target.value)),options:jC.map(p=>({value:String(p),label:`${p} / page`}))})]})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(H,{size:"icon-sm",variant:"ghost","aria-label":"First page",disabled:e<=1,onClick:()=>i(1),children:t.jsx(oN,{})}),t.jsx(H,{size:"icon-sm",variant:"ghost","aria-label":"Previous page",disabled:e<=1,onClick:()=>i(e-1),children:t.jsx(uu,{})}),t.jsxs("span",{className:"num min-w-16 text-center",children:[e," / ",h]}),t.jsx(H,{size:"icon-sm",variant:"ghost","aria-label":"Next page",disabled:e>=h,onClick:()=>i(e+1),children:t.jsx(Dn,{})}),t.jsx(H,{size:"icon-sm",variant:"ghost","aria-label":"Last page",disabled:e>=h,onClick:()=>i(h),children:t.jsx(cN,{})})]})]})}function sn({open:e,onClose:n,onConfirm:r,title:i,description:o,confirmText:c="Confirm",danger:d,typeToConfirm:h,loading:m,children:g}){const[p,v]=N.useState(""),j=!h||p===h;return t.jsxs(En,{open:e,onClose:n,size:"sm",title:t.jsxs("span",{className:"flex items-center gap-2",children:[d&&t.jsx(Xn,{className:"size-4 text-danger","aria-hidden":!0}),i]}),description:o,footer:t.jsxs(t.Fragment,{children:[t.jsx(H,{variant:"ghost",size:"sm",onClick:n,disabled:m,children:"Cancel"}),t.jsx(H,{variant:d?"danger":"primary",size:"sm",disabled:!j,loading:m,onClick:async()=>{await r(),v("")},children:c})]}),children:[g,h&&t.jsx(Ee,{autoFocus:!0,mono:!0,label:t.jsxs(t.Fragment,{children:["Type ",t.jsx("span",{className:"font-mono text-fg",children:h})," to confirm"]}),value:p,onChange:C=>v(C.target.value),onKeyDown:C=>{C.key==="Enter"&&j&&!m&&r()},autoComplete:"off",spellCheck:!1})]})}async function bC(e){try{return await navigator.clipboard.writeText(e),!0}catch{try{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select();const r=document.execCommand("copy");return document.body.removeChild(n),r}catch{return!1}}}function go({value:e,label:n="Copy",copiedLabel:r="Copied",showLabel:i,icon:o,variant:c="ghost",size:d,...h}){const[m,g]=N.useState(!1);return N.useEffect(()=>{if(!m)return;const p=setTimeout(()=>g(!1),1500);return()=>clearTimeout(p)},[m]),t.jsxs(H,{variant:c,size:d??(i?"sm":"icon-sm"),"aria-label":m?r:n,title:m?r:n,onClick:async()=>{await bC(typeof e=="function"?e():e)&&g(!0)},...h,children:[m?t.jsx(Kr,{className:"text-success"}):o??t.jsx(Ty,{}),i&&(m?r:n)]})}function Em({code:e,language:n,className:r,maxHeight:i=480,copy:o=!0,wrap:c,header:d,tone:h="default"}){return t.jsxs("div",{className:F("card relative overflow-hidden",h==="danger"&&"border-danger/40",r),children:[(d||n||o)&&t.jsxs("div",{className:"flex h-8 items-center justify-between border-b border-border bg-surface-2/60 pr-1 pl-3",children:[t.jsx("span",{className:"text-[11px] tracking-wide text-fg-subtle uppercase",children:d??n}),o&&t.jsx(go,{value:e,size:"icon-xs"})]}),t.jsx("pre",{className:F("overflow-auto p-3 font-mono text-xs leading-relaxed text-fg",c?"break-words whitespace-pre-wrap":"whitespace-pre",h==="danger"&&"text-danger"),style:{maxHeight:i},children:t.jsx("code",{children:e})})]})}const Z0="new Worker(name, fn, { metrics: { maxDataPoints: MetricsTime.ONE_WEEK } })";function G0(e){return e.isLoading?"loading":e.isError||!e.data?"unknown":e.data.metricsEnabled?"on":"off"}function wC({connectionId:e,queueName:n}){const r=am(e||void 0,n||void 0,{enabled:!!e&&!!n}),i=G0(r);return i==="loading"||i==="on"?null:t.jsx(J0,{title:i==="off"?`Queue "${n}" does not collect BullMQ metrics — this alert will stay inert`:`Could not read the setup of "${n}", so it is unknown whether it collects metrics`})}function NC({folder:e}){const[n,r]=N.useState({}),i=(e==null?void 0:e.queues)??[],o=p=>`${p.connectionId}/${p.queueName}`;N.useEffect(()=>r({}),[e==null?void 0:e.id]);const c=N.useCallback((p,v)=>{r(j=>j[p]===v?j:{...j,[p]:v})},[]);if(!e||i.length===0)return null;const d=i.filter(p=>n[o(p)]==="off").map(p=>p.queueName),h=i.filter(p=>n[o(p)]==="unknown").map(p=>p.queueName),m=i.map(p=>t.jsx(kC,{id:o(p),queue:p,onState:c},o(p)));if(d.length===0&&h.length===0)return t.jsx(t.Fragment,{children:m});const g=[d.length>0?`${d.length} of ${i.length} queue(s) collect no metrics: ${d.join(", ")}`:null,h.length>0?`could not read: ${h.join(", ")}`:null].filter(Boolean);return t.jsxs(t.Fragment,{children:[m,t.jsx(J0,{title:`Folder "${e.name}" — ${g.join(" · ")}`})]})}function kC({id:e,queue:n,onState:r}){const i=am(n.connectionId,n.queueName),o=G0(i);return N.useEffect(()=>r(e,o),[e,o,r]),null}function J0({title:e}){return t.jsxs("div",{className:"space-y-2 rounded-md border border-warning/40 bg-warning/10 p-3",role:"status",children:[t.jsxs("p",{className:"flex items-start gap-2 text-xs text-fg",children:[t.jsx(Xn,{className:"mt-px size-4 shrink-0 text-warning"}),t.jsx("span",{children:e})]}),t.jsxs("p",{className:"text-xs text-fg-muted",children:["Failure alerts are measured only from BullMQ's own metrics counters — the completed/failed sorted sets lie as soon as"," ",t.jsx("code",{className:"font-mono",children:"removeOnComplete"})," prunes them. Turn metrics on in the worker and the alert starts measuring by itself:"]}),t.jsx(Em,{code:Z0,language:"ts",wrap:!0,maxHeight:80})]})}function SC({measurement:e}){var r;if(!e)return t.jsx(Ce,{content:"Not evaluated yet — the server evaluates alerts every few seconds.",children:t.jsx(ye,{variant:"neutral",children:"pending"})});if(e.state==="no_metrics")return t.jsx(Ce,{content:`This queue collects no BullMQ metrics, so the alert cannot measure and will not fire. Enable it with ${Z0}`,children:t.jsxs(ye,{variant:"warning",dot:!0,children:[t.jsx(Xn,{className:"size-3"})," can't measure"]})});if(e.state==="warming_up")return t.jsx(Ce,{content:"Redis could not be read on the last evaluation, so the rule kept its previous state. It measures again on the next tick.",children:t.jsxs(ye,{variant:"info",dot:!0,children:[t.jsx(My,{className:"size-3"})," waiting for data"]})});const n=((r=e.queuesWithoutMetrics)==null?void 0:r.length)??0;return n>0?t.jsx(Ce,{content:`Measuring, but ${n} queue(s) it covers collect no metrics and are invisible to this rule: ${(e.queuesWithoutMetrics??[]).slice(0,10).join(", ")}${n>10?` and ${n-10} more`:""}`,children:t.jsx(ye,{variant:"warning",dot:!0,children:"partial"})}):t.jsx(Ce,{content:e.source==="metrics"?"Measured from BullMQ metrics counters.":"Measured from live queue counts.",children:t.jsx(ye,{variant:"success",dot:!0,children:"ok"})})}const CC={waiting_above:"Waiting jobs above threshold (incl. prioritized, excl. paused)",failed_above:"Failures above threshold in a window (needs worker metrics)",failed_rate_above:"Failure rate above percent (needs worker metrics)",duration_above:"Processing time above (p50 / p95 of completed jobs)"};function _C(e,n){return{name:"",enabled:!0,scopeType:(n==null?void 0:n.type)??"queue",connectionId:(n==null?void 0:n.type)==="queue"||(n==null?void 0:n.type)==="connection"?n.connectionId:e,queueName:(n==null?void 0:n.type)==="queue"?n.queueName:"",folderId:(n==null?void 0:n.type)==="folder"?n.folderId:"",kind:"failed_above",threshold:"10",windowMinutes:"5",percent:"5",minSample:"20",seconds:"30",percentile:"95",cooldownMinutes:"30",channels:[]}}function PC(e){const n=e.condition;return{name:e.name,enabled:e.enabled,scopeType:e.scope.type,connectionId:e.scope.type==="queue"||e.scope.type==="connection"?e.scope.connectionId:"",queueName:e.scope.type==="queue"?e.scope.queueName:"",folderId:e.scope.type==="folder"?e.scope.folderId:"",kind:n.kind,threshold:"threshold"in n?String(n.threshold):"10",windowMinutes:"windowMinutes"in n?String(n.windowMinutes):"5",percent:"percent"in n?String(n.percent):"5",minSample:"minSample"in n?String(n.minSample):"20",seconds:n.kind==="duration_above"?String(n.seconds):"30",percentile:n.kind==="duration_above"?String(n.percentile):"95",cooldownMinutes:String(e.cooldownMinutes),channels:e.channels.map(r=>r.type==="slack"?{type:"slack",url:r.webhookUrl,headersText:""}:{type:"webhook",url:r.url,headersText:Object.entries(r.headers??{}).map(([i,o])=>`${i}: ${o}`).join(`
531
+ `)})}}function EC(e){const n={};for(const r of e.split(`
532
+ `)){const i=r.trim();if(!i)continue;const o=i.indexOf(":");if(o<=0)throw new Error(`Header line "${i}" must look like "Name: value"`);n[i.slice(0,o).trim()]=i.slice(o+1).trim()}return Object.keys(n).length?n:void 0}function RC(e){const n=c=>c.trim()===""?NaN:Number(c);let r;switch(e.kind){case"waiting_above":r={kind:"waiting_above",threshold:n(e.threshold)};break;case"failed_above":r={kind:"failed_above",threshold:n(e.threshold),windowMinutes:n(e.windowMinutes)};break;case"duration_above":r={kind:"duration_above",seconds:n(e.seconds),percentile:e.percentile==="50"?50:95,windowMinutes:n(e.windowMinutes),minSample:n(e.minSample)};break;default:r={kind:"failed_rate_above",percent:n(e.percent),windowMinutes:n(e.windowMinutes),minSample:n(e.minSample)};break}const i=e.scopeType==="folder"?{type:"folder",folderId:e.folderId}:e.scopeType==="global"?{type:"global"}:e.scopeType==="connection"?{type:"connection",connectionId:e.connectionId}:{type:"queue",connectionId:e.connectionId,queueName:e.queueName},o=e.channels.map(c=>c.type==="slack"?{type:"slack",webhookUrl:c.url.trim()}:{type:"webhook",url:c.url.trim(),headers:EC(c.headersText)});return{name:e.name.trim(),enabled:e.enabled,scope:i,condition:r,channels:o,cooldownMinutes:n(e.cooldownMinutes)}}function Ku({open:e,onClose:n,alert:r,initialScope:i}){var $,z,E,T;const o=xs(),c=S2(),d=P0(),h=((z=($=o.data)==null?void 0:$[0])==null?void 0:z.id)??"",[m,g]=N.useState(()=>r?PC(r):_C(h,i)),[p,v]=N.useState({}),j=n2(m.connectionId||void 0,{enabled:m.scopeType==="queue"}),C=Wr(),y=(M,O)=>g(Q=>({...Q,[M]:O})),b=(M,O)=>g(Q=>({...Q,channels:Q.channels.map((V,q)=>q===M?{...V,...O}:V)})),k=c.isPending||d.isPending,S=()=>{let M;try{M=RC(m)}catch(V){v({channels:V.message});return}const O=c0.safeParse(M);if(!O.success){const V={};for(const q of O.error.issues){const B=q.path[0]==="condition"||q.path[0]==="scope"?String(q.path[1]??q.path[0]):q.path[0]==="channels"?"channels":String(q.path[0]);V[B]=q.path[0]==="channels"?`Channel ${Number(q.path[1])+1}: ${q.message}`:q.message}v(V);return}v({});const Q=()=>{ee.success(r?"Alert updated":"Alert created"),n()};r?d.mutate({id:r.id,input:O.data},{onSuccess:Q,onError:V=>ee.error(be(V))}):c.mutate(O.data,{onSuccess:Q,onError:V=>ee.error(be(V))})};return t.jsx(En,{open:e,onClose:n,size:"lg",title:r?"Edit rule":"New rule",description:"Evaluated on the server every few seconds. Every queue that breaks it shows up in Needs attention; add channels to be notified too.",footer:t.jsxs(t.Fragment,{children:[t.jsx(H,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),t.jsx(H,{variant:"primary",size:"sm",onClick:S,loading:k,children:r?"Save changes":"Create rule"})]}),children:t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"grid gap-3 sm:grid-cols-[1fr_auto]",children:[t.jsx(Ee,{label:"Name",value:m.name,onChange:M=>y("name",M.target.value),error:p.name,autoFocus:!0,placeholder:"payments: failures spiking"}),t.jsx(Qu,{label:"Enabled",className:"justify-end",children:t.jsx(mm,{checked:m.enabled,onChange:M=>y("enabled",M.target.checked),label:m.enabled?"On":"Off",className:"h-8 items-center"})})]}),t.jsxs("fieldset",{className:"grid gap-3 rounded-md border border-border p-3 sm:grid-cols-3",children:[t.jsx("legend",{className:"px-1 text-[11px] font-semibold tracking-wider text-fg-subtle uppercase",children:"Scope"}),t.jsx(ut,{label:"Watch",value:m.scopeType,onChange:M=>y("scopeType",M.target.value),options:[{value:"global",label:"Every queue"},{value:"connection",label:"Every queue on a connection"},{value:"folder",label:"Every queue in a folder"},{value:"queue",label:"One queue"}]}),m.scopeType==="global"?t.jsx("p",{className:"self-end pb-2 text-xs text-fg-muted sm:col-span-2",children:"Every discovered queue on every connection, except hidden ones."}):m.scopeType==="connection"?t.jsx(ut,{label:"Connection",value:m.connectionId,onChange:M=>y("connectionId",M.target.value),error:p.connectionId,wrapperClassName:"sm:col-span-2",options:(o.data??[]).map(M=>({value:M.id,label:M.name}))}):m.scopeType==="queue"?t.jsxs(t.Fragment,{children:[t.jsx(ut,{label:"Connection",value:m.connectionId,onChange:M=>g(O=>({...O,connectionId:M.target.value,queueName:""})),error:p.connectionId,options:(o.data??[]).map(M=>({value:M.id,label:M.name}))}),t.jsx(ut,{label:"Queue",value:m.queueName,onChange:M=>y("queueName",M.target.value),error:p.queueName,options:[{value:"",label:j.isLoading?"Loading…":"Pick a queue",disabled:!0},...(j.data??[]).map(M=>({value:M.name,label:M.name}))]})]}):t.jsx(ut,{label:"Folder",value:m.folderId,onChange:M=>y("folderId",M.target.value),error:p.folderId,wrapperClassName:"sm:col-span-2",options:[{value:"",label:C.isLoading?"Loading…":(E=C.data)!=null&&E.length?"Pick a folder":"No folders yet",disabled:!0},...(C.data??[]).map(M=>{var O,Q;return{value:M.id,label:M.parentId?`${((Q=(O=C.data)==null?void 0:O.find(V=>V.id===M.parentId))==null?void 0:Q.name)??"?"} / ${M.name}`:M.name}})]}),t.jsx("p",{className:"text-[11px] text-fg-subtle sm:col-span-3",children:m.scopeType==="queue"?"A rule on one queue replaces wider rules of the same kind for that queue.":"Wide rules flag each queue that breaks them and notify once, naming the worst. The most specific rule of each kind wins: a queue or folder rule overrides this one for its queues."})]}),t.jsxs("fieldset",{className:"grid gap-3 rounded-md border border-border p-3",children:[t.jsx("legend",{className:"px-1 text-[11px] font-semibold tracking-wider text-fg-subtle uppercase",children:"Condition"}),t.jsx(ut,{label:"Kind",value:m.kind,onChange:M=>y("kind",M.target.value),options:kk.map(M=>({value:M,label:CC[M]}))}),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[(m.kind==="waiting_above"||m.kind==="failed_above")&&t.jsx(Ee,{label:m.kind==="waiting_above"?"Waiting jobs above":"Failures above",type:"number",min:1,value:m.threshold,onChange:M=>y("threshold",M.target.value),error:p.threshold}),m.kind==="failed_rate_above"&&t.jsx(Ee,{label:"Failure rate above (%)",type:"number",min:.1,max:100,step:.1,value:m.percent,onChange:M=>y("percent",M.target.value),error:p.percent}),m.kind==="duration_above"&&t.jsxs(t.Fragment,{children:[t.jsx(Ee,{label:"Slower than (seconds)",type:"number",min:.001,step:.1,value:m.seconds,onChange:M=>y("seconds",M.target.value),error:p.seconds}),t.jsx(ut,{label:"Percentile",value:m.percentile,onChange:M=>y("percentile",M.target.value),options:[{value:"95",label:"p95 (the slow tail)"},{value:"50",label:"p50 (the typical job)"}]})]}),m.kind!=="waiting_above"&&t.jsx(Ee,{label:"Window (minutes)",type:"number",min:1,max:1440,value:m.windowMinutes,onChange:M=>y("windowMinutes",M.target.value),error:p.windowMinutes}),(m.kind==="failed_rate_above"||m.kind==="duration_above")&&t.jsx(Ee,{label:m.kind==="duration_above"?"Min sample (completed jobs)":"Min sample (finished jobs)",type:"number",min:1,max:m.kind==="duration_above"?100:void 0,value:m.minSample,onChange:M=>y("minSample",M.target.value),error:p.minSample,hint:"Ignore windows with fewer jobs."})]}),m.kind==="duration_above"&&t.jsxs("p",{className:"text-xs text-fg-muted",children:["Time from a job starting its final attempt to completing, over the newest 100 completed jobs in the window. BullMQ metrics count jobs but do not time them, so this reads completed jobs still in Redis: with"," ",t.jsx("code",{className:"font-mono",children:"removeOnComplete: true"})," there is nothing to read and the rule never fires;"," ",t.jsx("code",{className:"font-mono",children:"{ count: N }"})," keeps exactly the recent jobs it needs."]}),Ck(m.kind)&&t.jsxs(t.Fragment,{children:[t.jsxs("p",{className:"text-xs text-fg-muted",children:["Measured from BullMQ's own per-minute metrics, so the number is right even when"," ",t.jsx("code",{className:"font-mono",children:"removeOnComplete"})," prunes the queue, and exact from the first evaluation — a restart does not reset the window."]}),m.scopeType==="queue"?m.connectionId&&m.queueName&&t.jsx(wC,{connectionId:m.connectionId,queueName:m.queueName}):m.scopeType==="folder"?m.folderId&&t.jsx(NC,{folder:(T=C.data)==null?void 0:T.find(M=>M.id===m.folderId)}):null]})]}),t.jsxs("fieldset",{className:"space-y-3 rounded-md border border-border p-3",children:[t.jsx("legend",{className:"px-1 text-[11px] font-semibold tracking-wider text-fg-subtle uppercase",children:"Notify"}),m.channels.length===0&&t.jsxs("p",{className:"text-xs text-fg-muted",children:["Dashboard only: breaking queues show up in ",t.jsx("span",{className:"text-fg",children:"Needs attention"})," and the rule keeps its fired/resolved history, but nobody is notified. Add a channel to be told."]}),m.channels.map((M,O)=>t.jsxs("div",{className:"grid gap-2 rounded-md bg-surface-2/50 p-2 sm:grid-cols-[130px_1fr_auto]",children:[t.jsx(ut,{"aria-label":"Channel type",value:M.type,onChange:Q=>b(O,{type:Q.target.value}),options:[{value:"slack",label:"Slack webhook"},{value:"webhook",label:"Webhook (POST)"}]}),t.jsx(Ee,{"aria-label":"URL",mono:!0,placeholder:M.type==="slack"?"https://hooks.slack.com/services/…":"https://example.com/hooks/bullmq",value:M.url,onChange:Q=>b(O,{url:Q.target.value})}),t.jsx(H,{size:"icon",variant:"ghost","aria-label":"Remove channel",className:"hover:text-danger",onClick:()=>g(Q=>({...Q,channels:Q.channels.filter((V,q)=>q!==O)})),children:t.jsx(ps,{})}),M.type==="webhook"&&t.jsx(Wi,{"aria-label":"Headers",mono:!0,rows:2,placeholder:`Authorization: Bearer …
533
+ X-Source: bullpane`,value:M.headersText,onChange:Q=>b(O,{headersText:Q.target.value}),wrapperClassName:"sm:col-span-3",hint:"One header per line, Name: value"})]},O)),p.channels&&t.jsx("p",{className:"text-xs text-danger",role:"alert",children:p.channels}),t.jsx(H,{size:"sm",variant:"ghost",leftIcon:t.jsx(Jn,{}),onClick:()=>g(M=>({...M,channels:[...M.channels,{type:"webhook",url:"",headersText:""}]})),children:"Add channel"})]}),m.channels.length>0&&t.jsx(Ee,{label:"Cooldown (minutes)",type:"number",min:1,max:1440,value:m.cooldownMinutes,onChange:M=>y("cooldownMinutes",M.target.value),error:p.cooldownMinutes,hint:"Minimum time between notifications while the rule keeps firing.",wrapperClassName:"max-w-xs"})]})})}const MC=[15,30,60,0],TC={15:"15 min",30:"30 min",60:"1 hour",0:"All"};function qC(e){if(!e)return!1;const n=_u(e.completed)+_u(e.failed);return(e.completed.length>0||e.failed.length>0)&&n>0}function IC(e,n){const r=(e==null?void 0:e.completed)??[],i=(e==null?void 0:e.failed)??[],o=Math.max(r.length,i.length),d=Math.min(n===0?o:n,o),h=m=>$C(m,o).slice(o-d);return{completed:h(r),failed:h(i),minutes:d,available:o,truncated:n!==0&&n>o}}function $C(e,n){return e.length>=n?e:[...Array.from({length:n-e.length},()=>0),...e]}function zC(e){if(e.minutes===0)return{perMinute:null,perHour:null,completed:0,failed:0,successPct:null};const n=_u(e.completed),r=_u(e.failed),i=n+r,o=n/e.minutes;return{perMinute:o,perHour:o*60,completed:n,failed:r,successPct:i>0?n/i*100:null}}function OC(e){return e.completed.map((n,r)=>{const i=e.failed[r]??0,o=n+i;return o>0?n/o*100:null})}function fv(e){const n=e.filter(o=>!!o&&o.length>0);if(n.length===0)return[];const r=Math.max(...n.map(o=>o.length)),i=new Array(r).fill(0);for(const o of n){const c=r-o.length;for(let d=0;d<o.length;d++)i[c+d]+=o[d]}return i}function _u(e){return(e??[]).reduce((n,r)=>n+r,0)}function AC(e){const n=e??[],r=[],i=[];for(const o of n){if(o.processedOn!=null&&o.timestamp!=null){const c=o.processedOn-o.timestamp;Number.isFinite(c)&&c>=0&&r.push(c)}if(o.finishedOn!=null&&o.processedOn!=null){const c=o.finishedOn-o.processedOn;Number.isFinite(c)&&c>=0&&i.push(c)}}return{wait:mv(r),process:mv(i),sampled:n.length}}function mv(e){if(e.length===0)return null;const n=[...e].sort((r,i)=>r-i);return{min:n[0],median:pv(n,50),p95:pv(n,95),max:n[n.length-1],count:n.length}}function pv(e,n){if(e.length===0)return 0;const r=Math.ceil(n/100*e.length);return e[Math.min(e.length-1,Math.max(0,r-1))]}const $n={top:10,right:8,bottom:20,left:40},xv=4;function gv({series:e,height:n=180,className:r,formatValue:i=ht,formatX:o=UC,maxY:c,ariaLabel:d,emptyText:h="No data"}){const m=N.useId(),g=N.useRef(null),[p,v]=N.useState(null),[j,C]=N.useState(720),y=Math.max(...e.map(q=>q.values.length),0),{max:b,plotW:k,plotH:S,scaleX:$,scaleY:z}=N.useMemo(()=>{const q=e.flatMap(Be=>Be.values.filter(Z=>Z!=null&&Number.isFinite(Z))),B=q.length?Math.max(...q):0,ce=c??QC(B),_e=Math.max(1,j-$n.left-$n.right),Ue=Math.max(1,n-$n.top-$n.bottom);return{max:ce,plotW:_e,plotH:Ue,scaleX:Be=>$n.left+(y>1?Be/(y-1)*_e:_e/2),scaleY:Be=>$n.top+Ue-(ce>0?Be/ce*Ue:0)}},[e,j,n,c,y]),E=y>0&&e.some(q=>q.values.some(B=>B!=null)),T=q=>{var Ge;const B=(Ge=g.current)==null?void 0:Ge.getBoundingClientRect();if(!B||y===0)return;const _e=((q.clientX-B.left)/B.width*j-$n.left)/k,Ue=Math.round(_e*(y-1));v(Ue>=0&&Ue<y?Ue:null)},[M,O]=N.useState(null),Q=N.useCallback(q=>{g.current=q,O(q)},[]);N.useEffect(()=>{if(!M||typeof ResizeObserver>"u")return;const q=new ResizeObserver(([B])=>{const ce=Math.round(B.contentRect.width);ce>0&&C(ce)});return q.observe(M),()=>q.disconnect()},[M]);const V=Array.from({length:xv+1},(q,B)=>b/xv*B);return t.jsxs("div",{ref:Q,className:F("relative w-full select-none",r),onPointerMove:T,onPointerLeave:()=>v(null),children:[t.jsxs("svg",{width:"100%",height:n,viewBox:`0 0 ${j} ${n}`,preserveAspectRatio:"none",role:"img","aria-label":d??e.map(q=>q.label).join(" and "),className:"overflow-visible",children:[t.jsx("defs",{children:e.map(q=>t.jsxs("linearGradient",{id:`area-${m}-${q.key}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:q.color,stopOpacity:.28}),t.jsx("stop",{offset:"100%",stopColor:q.color,stopOpacity:.02})]},q.key))}),V.map((q,B)=>{const ce=z(q);return t.jsxs("g",{children:[t.jsx("line",{x1:$n.left,x2:j-$n.right,y1:ce,y2:ce,stroke:"var(--border)",strokeWidth:1,shapeRendering:"crispEdges"}),t.jsx("text",{x:$n.left-6,y:ce+3,textAnchor:"end",className:"fill-[var(--fg-subtle)] text-[9px]",style:{fontVariantNumeric:"tabular-nums"},children:i(q)})]},B)}),E?t.jsxs(t.Fragment,{children:[e.map(q=>t.jsx(LC,{series:q,gradientId:`area-${m}-${q.key}`,scaleX:$,scaleY:z,baseline:$n.top+S},q.key)),p!=null&&t.jsxs("g",{pointerEvents:"none",children:[t.jsx("line",{x1:$(p),x2:$(p),y1:$n.top,y2:$n.top+S,stroke:"var(--fg-subtle)",strokeWidth:1,strokeDasharray:"3 3"}),e.map(q=>{const B=q.values[p];return B==null||!Number.isFinite(B)?null:t.jsx("circle",{cx:$(p),cy:z(B),r:3,fill:q.color,stroke:"var(--surface)",strokeWidth:1.5},q.key)})]})]}):t.jsx("text",{x:j/2,y:n/2,textAnchor:"middle",className:"fill-[var(--fg-subtle)] text-[11px]",children:h}),E&&y>1&&t.jsx("g",{children:[0,Math.floor((y-1)/2),y-1].map((q,B)=>t.jsx("text",{x:$(q),y:n-6,textAnchor:B===0?"start":B===2?"end":"middle",className:"fill-[var(--fg-subtle)] text-[9px]",children:o(q,y)},q))})]}),p!=null&&E&&t.jsx(FC,{xPct:$(p)/j*100,title:o(p,y),rows:e.map(q=>({label:q.label,color:q.color,value:q.values[p]})).filter(q=>q.value!=null&&Number.isFinite(q.value)),formatValue:i})]})}function LC({series:e,gradientId:n,scaleX:r,scaleY:i,baseline:o}){const c=[];let d=null;return e.values.forEach((h,m)=>{if(h==null||!Number.isFinite(h)){d=null;return}const g=[r(m),i(h)];d?d.push(g):(d=[g],c.push(d))}),t.jsx("g",{children:c.map((h,m)=>{const g=h.map(([p,v],j)=>`${j===0?"M":"L"}${p.toFixed(1)},${v.toFixed(1)}`).join(" ");return t.jsxs("g",{children:[e.area&&h.length>1&&t.jsx("path",{d:`${g} L${h[h.length-1][0].toFixed(1)},${o} L${h[0][0].toFixed(1)},${o} Z`,fill:`url(#${n})`}),h.length>1?t.jsx("path",{d:g,fill:"none",stroke:e.color,strokeWidth:1.6,strokeLinejoin:"round",strokeLinecap:"round",strokeDasharray:e.dashed?"4 3":void 0,vectorEffect:"non-scaling-stroke"}):t.jsx("circle",{cx:h[0][0],cy:h[0][1],r:1.8,fill:e.color})]},m)})})}function FC({xPct:e,title:n,rows:r,formatValue:i}){if(r.length===0)return null;const o=e>55;return t.jsxs("div",{className:"pointer-events-none absolute top-1 z-10 min-w-32 rounded-md border border-border bg-surface px-2 py-1.5 text-[11px] shadow-[var(--shadow)]",style:{left:`${e}%`,transform:o?"translateX(calc(-100% - 8px))":"translateX(8px)"},role:"status",children:[t.jsx("div",{className:"mb-1 text-fg-subtle",children:n}),r.map(c=>t.jsxs("div",{className:"flex items-center gap-1.5 whitespace-nowrap",children:[t.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{background:c.color},"aria-hidden":!0}),t.jsx("span",{className:"text-fg-muted",children:c.label}),t.jsx("span",{className:"num ml-auto font-medium text-fg",children:i(c.value)})]},c.label))]})}function DC({series:e,className:n}){return t.jsx("div",{className:F("flex flex-wrap items-center gap-3 text-[11px] text-fg-muted",n),children:e.map(r=>t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"h-0.5 w-3 rounded-full",style:{background:r.color},"aria-hidden":!0}),r.label]},r.key))})}function UC(e,n){const r=n-1-e;return r===0?"now":`${W(r)} min ago`}function QC(e){if(!Number.isFinite(e)||e<=0)return 4;const n=10**Math.floor(Math.log10(e));for(const r of[1,2,2.5,5,10]){const i=r*n;if(i>=e)return i}return 10*n}const BC=50;function VC({connectionId:e,queue:n,summary:r,onOpenState:i}){const[o,c]=N.useState(60),d=r==null?void 0:r.metrics,h=qC(d),m=N.useMemo(()=>IC(d,o),[d,o]),g=N.useMemo(()=>zC(m),[m]),p=N.useMemo(()=>OC(m),[m]);return t.jsxs("div",{className:"space-y-3",children:[t.jsx(KC,{counts:r==null?void 0:r.counts,onOpenState:i}),h?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsx("h2",{className:"text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:"Throughput & history"}),t.jsx(WC,{value:o,onChange:c,available:m.available})]}),m.truncated&&t.jsxs("p",{className:"text-[11px] text-fg-subtle",role:"status",children:["This queue only stores ",W(m.available)," minute",m.available===1?"":"s"," of metrics — showing everything it has. BullMQ keeps one point per minute up to the worker's ",t.jsx("code",{className:"font-mono text-fg-muted",children:"maxDataPoints"}),"."]}),t.jsx(ZC,{rates:r==null?void 0:r.rates,tp:g,minutes:m.minutes}),t.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[t.jsx(yv,{icon:t.jsx(Wf,{}),title:"Processed",hint:`Completed and failed per minute over the last ${W(m.minutes)} min, straight from BullMQ's own metrics collection.`,legend:HC,children:t.jsx(gv,{height:190,ariaLabel:"Completed and failed jobs per minute",series:[{key:"completed",label:"Completed",color:ot.completed.fg,values:m.completed,area:!0},{key:"failed",label:"Failed",color:ot.failed.fg,values:m.failed,area:!0}],formatValue:v=>ht(Math.round(v))})}),t.jsx(yv,{icon:t.jsx(Eo,{}),title:"Success rate",hint:"completed / (completed + failed) per minute. A minute where nothing finished is a gap, not 0 %.",children:t.jsx(gv,{height:190,maxY:100,ariaLabel:"Success rate per minute",series:[{key:"success",label:"Success",color:ot.completed.fg,values:p,area:!0}],formatValue:v=>`${Math.round(v)}%`})})]})]}):t.jsx(GC,{}),t.jsx(JC,{connectionId:e,queue:n,completedCount:(r==null?void 0:r.counts.completed)??0})]})}const HC=[{key:"completed",label:"Completed",color:ot.completed.fg},{key:"failed",label:"Failed",color:ot.failed.fg}];function KC({counts:e,onOpenState:n}){return t.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4 xl:grid-cols-8",children:oo.map(r=>{const i=ot[r],o=e==null?void 0:e[r];return t.jsxs("button",{type:"button",onClick:()=>n(r),className:"card group flex flex-col items-start gap-0.5 px-3 py-2.5 text-left transition-colors hover:border-border-strong hover:bg-surface-2",title:`Show ${i.label} jobs`,children:[t.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] font-medium tracking-wider text-fg-subtle uppercase",children:[t.jsx("span",{className:F("status-dot size-1.5",i.dotClass),"aria-hidden":!0}),i.label]}),t.jsx("span",{className:F("num text-2xl leading-tight font-semibold",o==null?"text-fg-subtle":o>0?i.textClass:"text-fg-muted"),children:o==null?"—":ht(o)})]},r)})})}function WC({value:e,onChange:n,available:r}){return t.jsx("div",{className:"flex items-center gap-0.5 rounded-md bg-surface-2 p-0.5",role:"group","aria-label":"Metrics range",children:MC.map(i=>{const o=i!==0&&i>r;return t.jsx("button",{type:"button","aria-pressed":e===i,onClick:()=>n(i),title:o?`Only ${W(r)} min of data available`:void 0,className:F("h-6 rounded px-2 text-[11px] font-medium transition-colors",e===i?"bg-surface text-fg shadow-sm":"text-fg-muted hover:text-fg",o&&e!==i&&"opacity-50"),children:TC[i]},i)})})}function ZC({rates:e,tp:n,minutes:r}){return t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[t.jsx(vv,{icon:t.jsx(ao,{}),label:"Throughput",value:n.perHour==null?"—":`${ht(Math.round(n.perHour))}`,unit:"jobs / hour",hint:`Mean over the last ${W(r)} min, projected to an hour. Not a count of the past hour.`}),t.jsx(vv,{icon:t.jsx(ao,{}),label:"Rate",value:n.perMinute==null?"—":n.perMinute.toFixed(n.perMinute<10?1:0),unit:"jobs / min",hint:`Mean completed per minute over the last ${W(r)} min.`}),t.jsxs("div",{className:"card px-3 py-2.5",children:[t.jsx("div",{className:"mb-1.5 text-[10px] font-medium tracking-wider text-fg-subtle uppercase",children:"Finished · window"}),t.jsxs("div",{className:"num flex items-baseline gap-3 text-sm",children:[t.jsxs("span",{style:{color:ot.completed.fg},children:[ht(n.completed)," ok"]}),t.jsxs("span",{style:{color:ot.failed.fg},children:[ht(n.failed)," failed"]}),t.jsx("span",{className:"ml-auto text-fg-muted",children:n.successPct==null?"—":_n(n.successPct)})]})]}),t.jsxs("div",{className:"card px-3 py-2.5",children:[t.jsxs("div",{className:"mb-1.5 flex items-center gap-1 text-[10px] font-medium tracking-wider text-fg-subtle uppercase",children:["Success · trailing window",t.jsx(Ce,{content:jm(e),className:"ml-auto normal-case",children:t.jsx("span",{className:"text-[10px] text-fg-subtle",children:(e==null?void 0:e.source)==="metrics"?"metrics":"zsets"})})]}),t.jsx(bm,{rates:e})]})]})}function vv({icon:e,label:n,value:r,unit:i,hint:o}){return t.jsxs("div",{className:"card px-3 py-2.5",children:[t.jsxs("div",{className:"mb-0.5 flex items-center gap-1.5 text-[10px] font-medium tracking-wider text-fg-subtle uppercase",children:[t.jsx("span",{className:"[&_svg]:size-3","aria-hidden":!0,children:e}),n,t.jsx(Ce,{content:o,className:"ml-auto",children:t.jsx(Yi,{className:"size-3 text-fg-subtle","aria-label":o})})]}),t.jsxs("div",{className:"flex items-baseline gap-1.5",children:[t.jsx("span",{className:"num text-2xl leading-tight font-semibold text-fg",children:r}),t.jsx("span",{className:"text-[11px] text-fg-subtle",children:i})]})]})}function yv({icon:e,title:n,hint:r,legend:i,children:o}){return t.jsxs("section",{className:"card p-3",children:[t.jsxs("header",{className:"mb-2 flex flex-wrap items-center gap-2",children:[t.jsxs("h3",{className:"flex items-center gap-1.5 text-xs font-semibold text-fg [&_svg]:size-3.5 [&_svg]:text-fg-subtle",children:[e,n]}),i&&t.jsx(DC,{series:i,className:"ml-auto"})]}),o,t.jsx("p",{className:"mt-1.5 text-[11px] leading-relaxed text-fg-subtle",children:r})]})}function GC(){return t.jsxs("div",{className:"card",children:[t.jsx(rn,{icon:t.jsx(Wf,{}),title:"This queue is not collecting metrics",description:t.jsxs(t.Fragment,{children:["BullMQ only records per-minute completed/failed counts when the ",t.jsx("strong",{className:"text-fg",children:"Worker"})," is created with the"," ",t.jsx("code",{className:"font-mono text-fg",children:"metrics"})," option. Nothing in Redis can be back-filled, so there is no history to show — turn it on and points start accumulating one per minute."]})}),t.jsx("div",{className:"px-6 pb-6",children:t.jsx(Em,{className:"mx-auto max-w-2xl",language:"ts",code:"new Worker(name, fn, { metrics: { maxDataPoints: MetricsTime.ONE_WEEK } })"})})]})}function JC({connectionId:e,queue:n,completedCount:r}){var h;const i=b0(e,n,{state:"completed",page:1,pageSize:BC,order:"desc"},{enabled:r>0}),o=N.useMemo(()=>{var m;return AC((m=i.data)==null?void 0:m.jobs)},[(h=i.data)==null?void 0:h.jobs]),c=o.sampled,d=`Measured from the ${W(c)} most recent completed job${c===1?"":"s"} on this queue. A sample, not a server-wide statistic — BullMQ stores no aggregate timings in Redis.`;return t.jsxs("section",{className:"space-y-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs("h2",{className:"flex items-center gap-1.5 text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:[t.jsx(Dy,{className:"size-3.5","aria-hidden":!0}),"Timings"]}),t.jsx(Ce,{content:d,children:t.jsxs("span",{className:"inline-flex items-center gap-1 rounded border border-border bg-surface-2 px-1.5 py-0.5 text-[10px] text-fg-muted",children:[t.jsx(Yi,{className:"size-3","aria-hidden":!0}),"sample of ",W(c)]})})]}),r===0?t.jsx("div",{className:"card",children:t.jsx(rn,{compact:!0,title:"No completed jobs yet",description:"Wait times and process times are derived from finished jobs."})}):t.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[t.jsx(jv,{title:"Response time",subtitle:"time in queue · processedOn − timestamp",stats:o.wait,loading:i.isLoading,color:ot.waiting.fg,note:d}),t.jsx(jv,{title:"Process time",subtitle:"time in workers · finishedOn − processedOn",stats:o.process,loading:i.isLoading,color:ot.active.fg,note:d})]})]})}function jv({title:e,subtitle:n,stats:r,loading:i,color:o,note:c}){const d=[{label:"min",value:(r==null?void 0:r.min)??null},{label:"median",value:(r==null?void 0:r.median)??null},{label:"p95",value:(r==null?void 0:r.p95)??null},{label:"max",value:(r==null?void 0:r.max)??null}];return t.jsxs("div",{className:"card p-3",title:c,children:[t.jsxs("header",{className:"mb-2 flex items-baseline gap-2",children:[t.jsxs("h3",{className:"flex items-center gap-1.5 text-xs font-semibold text-fg",children:[t.jsx("span",{className:"size-2 rounded-full",style:{background:o},"aria-hidden":!0}),e]}),t.jsx("span",{className:"truncate font-mono text-[10px] text-fg-subtle",children:n})]}),t.jsx("div",{className:"grid grid-cols-4 gap-px overflow-hidden rounded-md bg-border",children:d.map(h=>t.jsxs("div",{className:"bg-surface px-2 py-2",children:[t.jsx("div",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:h.label}),t.jsx("div",{className:"num truncate text-[15px] font-semibold text-fg",children:i?t.jsx("span",{className:"skeleton inline-block h-3.5 w-12"}):h.value==null?"—":An(h.value)})]},h.label))})]})}function bv(e,n){const r=e.trim();if(!r)return{value:{}};try{return{value:JSON.parse(r)}}catch(i){return{error:`${n}: ${i.message}`}}}function XC({open:e,onClose:n,connectionId:r,queue:i}){const o=o2(r,i),[c,d]=N.useState(""),[h,m]=N.useState(`{
534
+
535
+ }`),[g,p]=N.useState("{}"),[v,j]=N.useState({}),C=()=>{var $;const y=bv(h,"Data"),b=bv(g,"Options"),k={};if(y.error&&(k.data=y.error),b.error&&(k.opts=b.error),!b.error&&(typeof b.value!="object"||b.value===null||Array.isArray(b.value))&&(k.opts="Options must be a JSON object"),j(k),Object.keys(k).length)return;const S=yk.safeParse({name:c.trim()||void 0,data:y.value,opts:b.value});if(!S.success){j({name:($=S.error.issues[0])==null?void 0:$.message});return}o.mutate(S.data,{onSuccess:z=>{ee.success(`Job ${z.id} added to ${i}`),n()},onError:z=>ee.error(be(z))})};return t.jsx(En,{open:e,onClose:n,title:`Add job to ${i}`,description:"The job is added with the official BullMQ client; opts follow JobsOptions (delay, priority, attempts, backoff, …).",size:"lg",footer:t.jsxs(t.Fragment,{children:[t.jsx(H,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),t.jsx(H,{variant:"primary",size:"sm",onClick:C,loading:o.isPending,children:"Add job"})]}),children:t.jsxs("div",{className:"space-y-3",children:[t.jsx(Ee,{label:"Name",placeholder:"__default__",value:c,onChange:y=>d(y.target.value),error:v.name,mono:!0,autoFocus:!0}),t.jsx(Wi,{label:"Data (JSON)",mono:!0,rows:8,value:h,onChange:y=>m(y.target.value),error:v.data,spellCheck:!1}),t.jsx(Wi,{label:"Options (JSON)",mono:!0,rows:4,value:g,onChange:y=>p(y.target.value),error:v.opts,hint:'e.g. {"delay": 5000, "attempts": 3, "backoff": {"type": "exponential", "delay": 1000}}',spellCheck:!1})]})})}const YC=l0.shape.state.options,e_=[{label:"Any age",value:0},{label:"Older than 1 hour",value:36e5},{label:"Older than 1 day",value:864e5},{label:"Older than 7 days",value:7*864e5}];function t_({open:e,onClose:n,connectionId:r,queue:i,defaultState:o}){const c=w0(r,i),[d,h]=N.useState(o??"completed"),[m,g]=N.useState(0),[p,v]=N.useState("1000"),[j,C]=N.useState(null),y=()=>{var k;const b=l0.safeParse({state:d,grace:m,limit:Number(p)});if(!b.success){C(((k=b.error.issues[0])==null?void 0:k.message)??"Invalid input");return}C(null),c.mutate({action:"clean",body:b.data},{onSuccess:S=>{ee.success(`Cleaned ${W(S.removed??0)} ${d} jobs from ${i}`),n()},onError:S=>ee.error(be(S))})};return t.jsx(En,{open:e,onClose:n,title:`Clean ${i}`,description:"Removes jobs in a state, oldest first, up to the limit. Uses BullMQ's queue.clean().",size:"sm",footer:t.jsxs(t.Fragment,{children:[t.jsx(H,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),t.jsx(H,{variant:"danger",size:"sm",onClick:y,loading:c.isPending,children:"Clean jobs"})]}),children:t.jsxs("div",{className:"space-y-3",children:[t.jsx(ut,{label:"State",value:d,onChange:b=>h(b.target.value),options:YC.map(b=>({value:b,label:b}))}),t.jsx(ut,{label:"Grace period",value:String(m),onChange:b=>g(Number(b.target.value)),options:e_.map(b=>({value:String(b.value),label:b.label})),hint:"Only jobs older than this are removed."}),t.jsx(Ee,{label:"Limit",type:"number",min:1,max:1e5,value:p,onChange:b=>v(b.target.value),error:j??void 0,hint:"Maximum number of jobs to remove in this run (1–100,000)."})]})})}const wv="queueSetup.open";function n_({connectionId:e,queue:n,className:r}){const[i,o]=N.useState(()=>Lu(wv,!0)),c=am(e,n),d=c.data,h=()=>{o(m=>(po(wv,!m),!m))};return t.jsxs("section",{className:F("card overflow-hidden",r),"aria-label":"Queue setup",children:[t.jsxs("button",{type:"button",onClick:h,"aria-expanded":i,className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-surface-2/60",children:[i?t.jsx(ms,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}):t.jsx(Dn,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}),t.jsx("span",{className:"text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:"Setup"}),!i&&d&&t.jsx(s_,{data:d}),(d==null?void 0:d.rateLimitedNow)&&t.jsx(X0,{ttlMs:d.rateLimitedNow.ttlMs,since:c.dataUpdatedAt}),t.jsx("span",{className:"ml-auto text-[11px] text-fg-subtle",children:"from the server · refreshes every 10 s"})]}),i&&t.jsxs("div",{className:"border-t border-border px-3 py-2.5",children:[c.isLoading&&!d&&t.jsx("div",{className:"grid gap-x-6 gap-y-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5",children:Array.from({length:10},(m,g)=>t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx(du,{className:"h-2.5 w-20"}),t.jsx(du,{className:"h-3 w-28"})]},g))}),c.isError&&!d&&t.jsx("p",{className:"text-xs text-fg-muted",children:er(c.error)&&c.error.status===404?"Setup details are not available on this server version.":`Setup unavailable: ${be(c.error)}`}),d&&t.jsx(r_,{data:d,since:c.dataUpdatedAt})]})]})}function s_({data:e}){const n=Y0(e.library);return t.jsxs("span",{className:"flex min-w-0 items-center gap-2 truncate text-xs text-fg-muted",children:[t.jsx("span",{className:"font-mono",children:n?`${n.name} ${n.version}`:"library unknown"}),t.jsx("span",{className:"text-fg-subtle",children:"·"}),t.jsx("span",{children:e.workers?`${W(e.workers.count)} ${e.workers.count===1?"worker":"workers"}`:"workers unknown"}),t.jsx("span",{className:"text-fg-subtle",children:"·"}),t.jsxs("span",{children:["concurrency ",e.globalConcurrency??"not set"]})]})}function r_({data:e,since:n}){const r=Y0(e.library),i=e.groups;return t.jsxs(t.Fragment,{children:[t.jsxs("dl",{className:"grid gap-x-6 gap-y-2.5 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5",children:[t.jsx(Bs,{icon:t.jsx(CN,{}),label:"Library",children:r?t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsxs("span",{className:"font-mono",children:[r.name," ",r.version]}),e.isPro&&t.jsx(ye,{variant:"pro",size:"xs",className:"tracking-wider",children:"PRO"})]}):t.jsx(Er,{children:"unknown"})}),t.jsx(Bs,{icon:t.jsx(Ou,{}),label:"Workers connected",children:e.workers?t.jsx(Ce,{content:e.workers.names.length?a_(e.workers.names):"no worker names reported",side:"bottom",children:t.jsx("span",{className:"num cursor-help underline decoration-dotted underline-offset-2",children:W(e.workers.count)})}):t.jsx(Er,{title:"CLIENT LIST is unavailable on this Redis (ACL or managed service)",children:"unknown"})}),t.jsx(Bs,{icon:t.jsx(ao,{}),label:"Global concurrency",children:e.globalConcurrency!=null?t.jsx("span",{className:"num",children:W(e.globalConcurrency)}):t.jsx(Er,{children:"not set"})}),t.jsx(Bs,{icon:t.jsx(Dy,{}),label:"Global rate limit",children:e.globalRateLimit?t.jsxs("span",{className:"num",children:[W(e.globalRateLimit.max)," / ",ej(e.globalRateLimit.durationMs)]}):t.jsx(Er,{children:"not set"})}),t.jsx(Bs,{icon:t.jsx(jN,{}),label:"Rate limited now",children:e.rateLimitedNow?t.jsx(X0,{ttlMs:e.rateLimitedNow.ttlMs,since:n}):t.jsx("span",{className:"text-fg-muted",children:"no"})}),t.jsx(Bs,{icon:t.jsx(Iu,{}),label:"Groups",className:"xl:col-span-2",children:i?t.jsxs("span",{className:"flex flex-wrap items-center gap-x-3 gap-y-0.5",children:[t.jsxs("span",{className:"num",children:[W(i.count)," ",i.count===1?"group":"groups"]}),t.jsxs("span",{className:"num text-fg-muted",children:[W(i.byStatus.waiting)," waiting · ",W(i.byStatus.limited)," limited · ",W(i.byStatus.maxed)," maxed · ",W(i.byStatus.paused)," paused"]}),t.jsx(Ce,{content:"Groups with their own concurrency or rate limit (queue.setGroupConcurrency / setGroupRateLimit). The others use the worker's group option.",side:"bottom",children:t.jsxs("span",{className:"num cursor-help text-fg-muted underline decoration-dotted underline-offset-2",children:[W(i.configured)," with per-group overrides"]})}),t.jsxs("span",{className:"num text-fg-muted",children:[W(i.active)," with active jobs"]})]}):t.jsx(Er,{title:"No BullMQ Pro group keys found for this queue",children:"none observed"})}),t.jsx(Bs,{icon:t.jsx(lN,{}),label:"Batch",children:t.jsx(Ce,{content:"Batching is a Worker option (worker.opts.batch); BullMQ does not persist it in Redis or Postgres, so it cannot be read from here.",side:"bottom",children:t.jsx(Er,{className:"cursor-help underline decoration-dotted underline-offset-2",children:"not stored by BullMQ"})})}),t.jsx(Bs,{icon:t.jsx(Eo,{}),label:"Metrics",children:e.metricsEnabled?t.jsx("span",{className:"text-state-completed",children:"enabled"}):t.jsx(Er,{children:"disabled"})}),t.jsx(Bs,{icon:t.jsx(yN,{}),label:"Max events",children:e.maxLenEvents!=null?t.jsx("span",{className:"num",children:W(e.maxLenEvents)}):t.jsx(Er,{children:"not set"})})]}),t.jsxs("details",{className:"mt-2.5 border-t border-border pt-2 text-xs",children:[t.jsxs("summary",{className:"inline-flex cursor-pointer items-center gap-1.5 text-fg-muted select-none hover:text-fg",children:[t.jsx(Ey,{className:"size-3.5","aria-hidden":!0})," Raw meta",t.jsxs("span",{className:"num text-fg-subtle",children:["(",Object.keys(e.rawMeta??{}).length," fields)"]})]}),Object.keys(e.rawMeta??{}).length===0?t.jsx("p",{className:"mt-1.5 text-fg-subtle",children:"The meta hash has no extra fields."}):t.jsx("table",{className:"mt-1.5 w-auto text-[11px]",children:t.jsx("tbody",{children:Object.entries(e.rawMeta).sort(([o],[c])=>o.localeCompare(c)).map(([o,c])=>t.jsxs("tr",{className:"border-t border-border/60",children:[t.jsx("th",{scope:"row",className:"py-0.5 pr-4 text-left font-mono font-normal text-fg-muted",children:o}),t.jsx("td",{className:"py-0.5 font-mono break-all text-fg",children:c===""?t.jsx("span",{className:"text-fg-subtle",children:"(empty)"}):c})]},o))})})]})]})}function Bs({icon:e,label:n,children:r,className:i}){return t.jsxs("div",{className:F("flex min-w-0 items-start gap-2",i),children:[t.jsx("span",{className:"mt-0.5 shrink-0 text-fg-subtle [&_svg]:size-3.5","aria-hidden":!0,children:e}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:n}),t.jsx("dd",{className:"text-[13px] text-fg",children:r})]})]})}function Er({children:e,title:n,className:r}){return t.jsx("span",{className:F("text-fg-subtle",r),title:n,children:e})}function X0({ttlMs:e,since:n}){const r=al(1e3),i=Math.max(0,e-Math.max(0,r-n));return t.jsxs(ye,{variant:"custom",size:"xs",dot:!0,className:"border tracking-wide",style:{color:"var(--state-waiting)",background:"color-mix(in srgb, var(--state-waiting) 14%, transparent)",borderColor:"color-mix(in srgb, var(--state-waiting) 38%, transparent)"},children:["throttled · lifts in ",ej(i)]})}function Y0(e){if(!e)return null;const n=e.indexOf(":");return n<0?{name:e,version:""}:{name:e.slice(0,n),version:e.slice(n+1)}}function ej(e){return!Number.isFinite(e)||e<0?"–":e>=36e5&&e%36e5===0?`${e/36e5}h`:e>=6e4&&e%6e4===0?`${e/6e4}m`:e>=1e3?`${Math.round(e/100)/10}s`.replace(/\.0s$/,"s"):`${Math.round(e)}ms`}function a_(e){const n=e.slice(0,12);return n.join(", ")+(e.length>n.length?` +${e.length-n.length} more`:"")}function i_({connectionId:e,queue:n}){var b,k;const{isOperator:r}=yt(),[i,o]=N.useState(1),[c,d]=N.useState(25),[h,m]=N.useState(null),g=d2(e,n,{page:i,pageSize:c}),p=f2(e,n),v=((b=g.data)==null?void 0:b.schedulers)??[],j=((k=g.data)==null?void 0:k.total)??0,C=r?6:5,y=S=>p.mutate(S.key,{onSuccess:()=>{ee.success(`Scheduler ${S.key} removed`),m(null)},onError:$=>ee.error(be($))});return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"card overflow-hidden",children:[t.jsxs(fs,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(me,{children:"Key"}),t.jsx(me,{children:"Job name"}),t.jsx(me,{children:"Repeats"}),t.jsx(me,{children:"Timezone"}),t.jsx(me,{align:"right",children:"Next run"}),r&&t.jsx(me,{align:"right",children:"Actions"})]})}),t.jsxs("tbody",{children:[g.isLoading&&t.jsx(xt,{colSpan:C,children:t.jsx(Dt,{label:"Loading schedulers…"})}),g.isError&&!g.data&&t.jsx(xt,{colSpan:C,className:"text-danger",children:be(g.error)}),g.data&&v.length===0&&t.jsx(xt,{colSpan:C,children:t.jsx(c_,{queue:n})}),v.map(S=>t.jsxs(il,{children:[t.jsxs(pe,{mono:!0,children:[t.jsx("span",{className:"text-fg",title:S.key,children:S.key}),S.template&&t.jsx("span",{className:"ml-1.5 text-[11px] text-fg-subtle",title:o_(S),children:"template"})]}),t.jsx(pe,{mono:!0,muted:!0,children:S.name}),t.jsx(pe,{children:t.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[t.jsx(ye,{variant:"outline",size:"xs",className:"font-mono",children:tj(S)}),S.limit!=null&&t.jsxs("span",{className:"text-[11px] text-fg-subtle",title:"Maximum number of jobs this scheduler will ever produce",children:[W(S.iterationCount??0),"/",W(S.limit)," runs"]}),S.limit==null&&S.iterationCount!=null&&t.jsxs("span",{className:"text-[11px] text-fg-subtle",title:"Jobs produced so far",children:[W(S.iterationCount)," runs"]}),S.endDate!=null&&t.jsxs("span",{className:"text-[11px] text-fg-subtle",title:`Stops after ${xn(S.endDate)}`,children:["until ",Vr(S.endDate)]})]})}),t.jsx(pe,{muted:!0,children:S.tz??t.jsx("span",{className:"text-fg-subtle",children:"–"})}),t.jsx(pe,{align:"right",num:!0,children:S.next==null?t.jsx("span",{className:"text-fg-subtle",children:"–"}):t.jsx("span",{className:F(S.next<=Date.now()&&"text-warning"),title:xn(S.next),children:Vr(S.next)})}),r&&t.jsx(pe,{align:"right",children:t.jsx(H,{size:"sm",variant:"ghost",className:"text-fg-subtle hover:text-danger",leftIcon:t.jsx(ps,{}),"aria-label":`Remove scheduler ${S.key}`,title:"Remove this scheduler",loading:p.isPending&&p.variables===S.key,onClick:()=>m(S),children:"Remove"})})]},S.key))]})]}),j>0&&t.jsx("div",{className:F("border-t border-border px-3 py-2",g.isFetching&&"opacity-80"),children:t.jsx(Hu,{page:i,pageSize:c,total:j,count:v.length,onPage:o,onPageSize:S=>(d(S),o(1))})})]}),t.jsx(sn,{open:!!h,onClose:()=>m(null),title:"Remove job scheduler",description:h?`Stops "${h.key}" from producing new jobs and removes the job it already had scheduled. Jobs it produced in the past are not touched. Recreate it with queue.upsertJobScheduler().`:"",confirmText:"Remove",danger:!0,loading:p.isPending,onConfirm:()=>h&&y(h)})]})}function tj(e){return e.every!=null?`every ${l_(e.every)}`:e.pattern?e.pattern:"unknown"}function l_(e){if(e<1e3)return`${e}ms`;const n=[[864e5,"d"],[36e5,"h"],[6e4,"m"],[1e3,"s"]];for(const[r,i]of n)if(e>=r){const o=e/r;return`${Number.isInteger(o)?o:o.toFixed(1)}${i}`}return`${e}ms`}function o_(e){var r,i,o;const n=[`name: ${((r=e.template)==null?void 0:r.name)??e.name}`];return(i=e.template)!=null&&i.data&&n.push(`data: ${e.template.data}`),(o=e.template)!=null&&o.opts&&n.push(`opts: ${e.template.opts}`),n.join(`
536
+ `)}function c_({queue:e}){return t.jsxs("div",{className:"mx-auto flex max-w-xl flex-col items-center gap-2 py-6 text-center",children:[t.jsx(Ro,{className:"size-6 text-fg-subtle","aria-hidden":!0}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"No job schedulers on this queue"}),t.jsx("p",{className:"text-xs text-fg-muted",children:"A job scheduler (BullMQ calls it a repeatable job) stamps out the same job on a cron pattern or a fixed interval. It lives outside the job states, so it never shows up under Waiting or Delayed — only the single job it has queued next does."}),t.jsx("pre",{className:"mt-1 w-full overflow-x-auto rounded-md border border-border bg-surface-2 p-2.5 text-left font-mono text-[11px] leading-relaxed text-fg-muted",children:`const queue = new Queue("${e}");
537
+
538
+ await queue.upsertJobScheduler(
539
+ "nightly-report", // scheduler id
540
+ { pattern: "0 3 * * *", tz: "America/Sao_Paulo" },
541
+ { name: "report", data: { kind: "daily" } },
542
+ );
543
+
544
+ // or a fixed interval
545
+ await queue.upsertJobScheduler("heartbeat", { every: 30_000 });`}),t.jsxs("p",{className:"flex items-center gap-1.5 text-[11px] text-fg-subtle",children:[t.jsx(Ay,{className:"size-3","aria-hidden":!0}),"upsertJobScheduler is idempotent: calling it again updates the schedule instead of adding a second one."]})]})}function La({feature:e}){const n=uo[e],{pricing:r,checkoutUrl:i}=jt();return t.jsxs("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-8 px-6 py-10 lg:flex-row lg:items-center lg:gap-12",children:[t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"mb-3 inline-flex items-center gap-1.5 rounded-full border border-pro/40 bg-pro/10 px-2.5 py-1 text-[11px] font-medium tracking-wider text-pro uppercase",children:[t.jsx(io,{className:"size-3","aria-hidden":!0}),"Pro feature"]}),t.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-fg",children:n.title}),t.jsx("p",{className:"mt-2 max-w-md text-sm leading-relaxed text-fg-muted",children:n.tagline}),t.jsx("ul",{className:"mt-5 space-y-2.5",children:n.bullets.map(o=>t.jsxs("li",{className:"flex items-start gap-2.5 text-[13px] text-fg",children:[t.jsx(Kr,{className:"mt-0.5 size-4 shrink-0 text-success","aria-hidden":!0}),t.jsx("span",{children:o})]},o))}),t.jsxs("div",{className:"mt-7 flex flex-wrap items-center gap-3",children:[t.jsxs("a",{href:i||"#",target:"_blank",rel:"noreferrer noopener","aria-disabled":!i,className:"inline-flex h-9 items-center gap-2 rounded-md bg-accent px-4 text-[13px] font-medium text-accent-fg hover:bg-accent-hover aria-disabled:pointer-events-none aria-disabled:opacity-50",children:["Unlock Pro · $",r.monthlyUsd,"/mo or $",r.yearlyUsd,"/yr",t.jsx(Ur,{className:"size-4","aria-hidden":!0})]}),t.jsxs(Te,{to:"/settings/license",className:"inline-flex h-9 items-center gap-2 rounded-md border border-border-strong px-3 text-[13px] font-medium text-fg hover:bg-surface-2",children:[t.jsx(el,{className:"size-4","aria-hidden":!0}),"I have a key"]})]}),t.jsxs("p",{className:"mt-3 text-xs text-fg-subtle",children:["One key unlocks login with Users & roles, Alerts, Folders, Flows, the Audit log, SSO and MCP for one installation. $",r.monthlyUsd,"/month or $",r.yearlyUsd,"/year, unlimited users, cancel any time."]})]}),t.jsx("div",{className:"flex-1",children:t.jsx(u_,{feature:e})})]})}function u_({feature:e}){return t.jsxs("div",{"aria-hidden":!0,className:"relative overflow-hidden rounded-xl border border-border bg-surface p-3 shadow-[var(--shadow)]",children:[t.jsxs("div",{className:"mb-3 flex items-center gap-1.5",children:[t.jsx("span",{className:"size-2 rounded-full bg-fg-subtle/40"}),t.jsx("span",{className:"size-2 rounded-full bg-fg-subtle/40"}),t.jsx("span",{className:"size-2 rounded-full bg-fg-subtle/40"}),t.jsx("span",{className:"ml-3 h-2 w-24 rounded bg-surface-3"})]}),e==="alerts"&&t.jsx(d_,{}),e==="users"&&t.jsx(h_,{}),e==="folders"&&t.jsx(f_,{}),e==="flows"&&t.jsx(m_,{}),t.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-surface to-transparent"})]})}function su({className:e,children:n}){return t.jsx("div",{className:F("flex items-center gap-2 rounded-md border border-border bg-bg/60 px-2.5 py-2",e),children:n})}function On({w:e,className:n}){return t.jsx("span",{className:F("h-2 rounded bg-surface-3",n),style:{width:e}})}function d_(){return t.jsxs("div",{className:"space-y-2",children:[t.jsxs(su,{children:[t.jsx("span",{className:"status-dot pulse bg-danger"}),t.jsx(On,{w:"38%",className:"bg-fg-muted/50"}),t.jsx("span",{className:"ml-auto rounded bg-danger/15 px-1.5 py-0.5 text-[9px] font-medium text-danger",children:"FIRING"})]}),t.jsxs(su,{children:[t.jsx("span",{className:"status-dot bg-success"}),t.jsx(On,{w:"52%"}),t.jsx("span",{className:"ml-auto rounded bg-success/15 px-1.5 py-0.5 text-[9px] font-medium text-success",children:"OK"})]}),t.jsxs(su,{children:[t.jsx("span",{className:"status-dot bg-success"}),t.jsx(On,{w:"30%"}),t.jsx("span",{className:"ml-auto rounded bg-success/15 px-1.5 py-0.5 text-[9px] font-medium text-success",children:"OK"})]}),t.jsxs("div",{className:"mt-3 rounded-md border border-border bg-surface-2 p-2.5",children:[t.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[t.jsx("span",{className:"size-4 rounded bg-[#4A154B]"}),t.jsx(On,{w:"30%",className:"bg-fg-muted/50"}),t.jsx(On,{w:"12%",className:"ml-auto"})]}),t.jsx(On,{w:"80%",className:"mb-1.5"}),t.jsx(On,{w:"60%"})]})]})}function h_(){const e=[["admin","bg-pro/15 text-pro"],["operator","bg-info/15 text-info"],["operator","bg-info/15 text-info"],["viewer","bg-surface-3 text-fg-muted"]];return t.jsx("div",{className:"space-y-2",children:e.map(([n,r],i)=>t.jsxs(su,{children:[t.jsx("span",{className:"size-5 rounded-full bg-surface-3"}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx(On,{w:`${70+i*12}px`,className:"bg-fg-muted/50"}),t.jsx(On,{w:`${100+i*8}px`,className:"h-1.5"})]}),t.jsx("span",{className:F("ml-auto rounded px-1.5 py-0.5 text-[9px] font-medium",r),children:n})]},i))})}function f_(){return t.jsxs("div",{className:"space-y-1.5 text-[11px]",children:[[["Payments","bg-success",0,3],["Checkout","bg-success",1,2],["Refunds","bg-success",1,1],["Notifications","bg-info",0,4],["Data pipeline","bg-violet",0,2]].map(([e,n,r,i],o)=>t.jsxs("div",{className:"flex items-center gap-2 rounded px-2 py-1",style:{paddingLeft:8+r*16},children:[t.jsx("span",{className:F("size-3 rounded-sm",n)}),t.jsx("span",{className:"text-fg-muted",children:e}),t.jsx("span",{className:"ml-auto rounded bg-surface-3 px-1 text-[9px] text-fg-subtle",children:i})]},o)),t.jsxs("div",{className:"ml-6 space-y-1 border-l border-border pl-3",children:[t.jsx(On,{w:"60%"}),t.jsx(On,{w:"45%"}),t.jsx(On,{w:"70%"})]})]})}function m_(){const e=(n,r,i,o="bg-surface-2")=>t.jsxs("div",{className:F("absolute flex h-9 w-28 flex-col justify-center rounded-md border border-border px-2",o),style:{left:n,top:r},children:[t.jsx("span",{className:"text-[10px] font-medium text-fg",children:i}),t.jsx(On,{w:"50%",className:"mt-1 h-1.5"})]});return t.jsxs("div",{className:"relative h-52",children:[t.jsxs("svg",{className:"absolute inset-0 h-full w-full",fill:"none",stroke:"var(--fg-subtle)",strokeWidth:1.5,children:[t.jsx("path",{d:"M120 38 C 160 38, 160 98, 200 98"}),t.jsx("path",{d:"M120 158 C 160 158, 160 98, 200 98",strokeDasharray:"4 3",stroke:"var(--accent)"}),t.jsx("path",{d:"M312 98 C 350 98, 350 60, 380 60"}),t.jsx("path",{d:"M312 98 C 350 98, 350 136, 380 136"})]}),e(8,20,"ingest"),e(8,140,"backfill"),e(200,80,"process","bg-accent/10"),e(380,42,"notify"),e(380,118,"archive"),t.jsx("span",{className:"absolute top-[60px] left-[150px] rounded bg-surface px-1 text-[9px] text-fg-subtle",children:"×214"})]})}function p_(){const{has:e}=jt();return e("alerts")?t.jsx(g_,{}):t.jsx(La,{feature:"alerts"})}function nj(e){switch(e.kind){case"waiting_above":return`wait+prioritized > ${W(e.threshold)}`;case"failed_above":return`failed > ${W(e.threshold)} in ${e.windowMinutes}m`;case"failed_rate_above":return`failure rate > ${e.percent}% in ${e.windowMinutes}m (min ${e.minSample})`;case"duration_above":return`p${e.percentile} processing > ${e.seconds}s in ${e.windowMinutes}m (min ${e.minSample})`}}const x_={fired:"danger",resolved:"success",delivery_failed:"warning",no_metrics:"info"};function g_(){var $,z;const{isOperator:e}=yt(),n=lm(),r=xs(),i=Wr(),o=P0(),c=C2(),d=_2(),[h,m]=N.useState(null),[g,p]=N.useState(null),[v,j]=N.useState(""),C=k2({limit:100,alertId:v||void 0}),y=E=>{var T,M;return E?((M=(T=r.data)==null?void 0:T.find(O=>O.id===E))==null?void 0:M.name)??E:"–"},b=E=>{var T,M;return((M=(T=i.data)==null?void 0:T.find(O=>O.id===E))==null?void 0:M.name)??E},k=[...n.data??[]].sort((E,T)=>Number(T.firing)-Number(E.firing)||E.name.localeCompare(T.name)),S=k.filter(E=>E.firing).length;return t.jsxs(vt,{children:[t.jsx(gs,{title:t.jsxs("span",{className:"flex items-center gap-2",children:["Alerts",S>0&&t.jsxs(ye,{variant:"danger",dot:!0,children:[S," firing"]})]}),description:"Server-side rules: backlog from live counts, failures from BullMQ metrics counters. Delivered to Slack or any webhook.",actions:e&&t.jsx(H,{variant:"primary",size:"sm",leftIcon:t.jsx(Jn,{}),onClick:()=>m({alert:null}),children:"New alert"})}),t.jsx("div",{className:"card overflow-hidden",children:t.jsxs(fs,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(me,{className:"w-16",children:"State"}),t.jsx(me,{children:"Name"}),t.jsx(me,{children:"Scope"}),t.jsx(me,{children:"Condition"}),t.jsx(me,{children:"Channels"}),t.jsx(me,{children:"Last fired"}),t.jsx(me,{align:"right",children:t.jsx("span",{className:"sr-only",children:"Actions"})})]})}),t.jsxs("tbody",{children:[n.isLoading&&t.jsx(xt,{colSpan:7,children:t.jsx(Dt,{label:"Loading alerts…"})}),n.isError&&t.jsx(xt,{colSpan:7,className:"text-danger",children:be(n.error)}),n.data&&k.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:7,children:t.jsx(rn,{compact:!0,icon:t.jsx(Xi,{}),title:"No alerts yet",description:"Start with 'failures above threshold' on your most important queue and a Slack webhook.",action:e&&t.jsx(H,{size:"sm",variant:"primary",leftIcon:t.jsx(Jn,{}),onClick:()=>m({alert:null}),children:"New alert"})})})}),k.map(E=>{var T;return t.jsxs(il,{className:F(!E.enabled&&"opacity-60"),children:[t.jsx(pe,{children:E.firing?t.jsxs(ye,{variant:"danger",dot:!0,children:[t.jsx(Kf,{className:"size-3"})," firing"]}):E.enabled?t.jsx(SC,{measurement:E.measurement}):t.jsx(ye,{variant:"neutral",children:"off"})}),t.jsx(pe,{className:"font-medium",children:E.name}),t.jsx(pe,{muted:!0,children:E.scope.type==="queue"?t.jsxs(t.Fragment,{children:[y(E.scope.connectionId),t.jsx("span",{className:"text-fg-subtle",children:" / "}),t.jsx("span",{className:"font-mono text-xs",children:E.scope.queueName})]}):E.scope.type==="folder"?t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx(ye,{variant:"outline",size:"xs",children:"folder"}),b(E.scope.folderId)]}):E.scope.type==="connection"?t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx(ye,{variant:"outline",size:"xs",children:"connection"}),y(E.scope.connectionId)]}):t.jsx(ye,{variant:"outline",size:"xs",children:"every queue"})}),t.jsx(pe,{mono:!0,children:nj(E.condition)}),t.jsx(pe,{muted:!0,children:E.channels.length===0?t.jsx("span",{className:"text-[11px] text-fg-subtle",children:"dashboard only"}):t.jsxs(t.Fragment,{children:[E.channels.map((M,O)=>t.jsx(ye,{variant:"outline",size:"xs",className:"mr-1",children:M.type},O)),t.jsxs("span",{className:"text-[11px] text-fg-subtle",children:["· cooldown ",E.cooldownMinutes,"m"]})]})}),t.jsx(pe,{muted:!0,children:t.jsx(Wt,{value:E.lastFiredAt,emptyText:"never"})}),t.jsx(pe,{align:"right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e&&t.jsx(Zi,{size:"sm",checked:E.enabled,label:E.enabled?"Disable alert":"Enable alert",disabled:o.isPending&&((T=o.variables)==null?void 0:T.id)===E.id,onChange:M=>o.mutate({id:E.id,input:{enabled:M}},{onError:O=>ee.error(be(O))})}),e&&t.jsx(H,{size:"icon-xs",variant:"ghost",title:"Send test notification","aria-label":"Send test notification",loading:d.isPending&&d.variables===E.id,onClick:()=>d.mutate(E.id,{onSuccess:M=>{var Q,V;const O=((Q=M.results)==null?void 0:Q.filter(q=>!q.ok))??[];M.ok&&O.length===0?ee.success("Test notification sent",`${((V=M.results)==null?void 0:V.length)??0} channel(s) delivered`):ee.error("Some channels failed",O.map(q=>`${q.channel}: ${q.error??"error"}`).join("; "))},onError:M=>ee.error(be(M))}),children:t.jsx(_N,{})}),e&&t.jsx(H,{size:"icon-xs",variant:"ghost",title:"Edit","aria-label":"Edit alert",onClick:()=>m({alert:E}),children:t.jsx(To,{})}),e&&t.jsx(H,{size:"icon-xs",variant:"ghost",title:"Delete","aria-label":"Delete alert",className:"hover:text-danger",onClick:()=>p(E),children:t.jsx(ps,{})})]})})]},E.id)})]})]})}),t.jsxs("section",{className:"mt-6",children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[t.jsx("h2",{className:"text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:"Events"}),t.jsx(ut,{"aria-label":"Filter events by alert",className:"!h-7 !w-auto text-xs",value:v,onChange:E=>j(E.target.value),options:[{value:"",label:"All alerts"},...k.map(E=>({value:E.id,label:E.name}))]})]}),t.jsx("div",{className:"card overflow-hidden",children:t.jsxs(fs,{dense:!0,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(me,{className:"w-28",children:"When"}),t.jsx(me,{className:"w-28",children:"Status"}),t.jsx(me,{children:"Alert"}),t.jsx(me,{children:"Queue"}),t.jsx(me,{children:"Message"}),t.jsx(me,{align:"right",children:"Value"})]})}),t.jsxs("tbody",{children:[C.isLoading&&t.jsx(xt,{colSpan:6,children:t.jsx(Dt,{})}),C.data&&C.data.length===0&&t.jsx(xt,{colSpan:6,children:"No events yet"}),($=C.data)==null?void 0:$.map(E=>t.jsxs("tr",{children:[t.jsx(pe,{muted:!0,children:t.jsx(Wt,{value:E.createdAt})}),t.jsx(pe,{children:t.jsx(ye,{variant:x_[E.status],size:"xs",dot:!0,children:E.status.replace("_"," ")})}),t.jsx(pe,{className:"font-medium",children:E.alertName}),t.jsxs(pe,{muted:!0,children:[y(E.connectionId),E.queueName&&t.jsxs("span",{className:"text-fg-subtle",children:[" / ",E.queueName]})]}),t.jsx(pe,{className:"max-w-lg truncate",title:E.message,children:E.message}),t.jsx(pe,{num:!0,align:"right",muted:!0,children:E.value!=null?W(E.value):"–"})]},E.id))]})]})})]}),h&&t.jsx(Ku,{open:!0,onClose:()=>m(null),alert:h.alert},((z=h.alert)==null?void 0:z.id)??"new"),t.jsx(sn,{open:!!g,onClose:()=>p(null),title:`Delete "${g==null?void 0:g.name}"`,description:"The alert and its history of events are removed.",confirmText:"Delete",danger:!0,loading:c.isPending,onConfirm:()=>g&&c.mutate(g.id,{onSuccess:()=>(p(null),ee.success("Alert deleted")),onError:E=>ee.error(be(E))})})]})}function v_(e,n){const{has:r}=jt(),i=r("alerts"),o=lm(i),c=Wr(i&&r("folders")),d=N.useMemo(()=>{const h=o.data??[];if(h.length===0)return[];const m=c.data??[],g=new Map;for(const y of m)y.queues.some(b=>b.connectionId===e&&b.queueName===n)&&g.set(y.id,y.name);const p=[];for(const y of h)if(y.scope.type==="queue")y.scope.connectionId===e&&y.scope.queueName===n&&p.push({alert:y,via:{kind:"queue"}});else if(y.scope.type==="folder"){const b=g.get(y.scope.folderId);b!==void 0&&p.push({alert:y,via:{kind:"folder",folderId:y.scope.folderId,folderName:b}})}else y.scope.type==="connection"?y.scope.connectionId===e&&p.push({alert:y,via:{kind:"connection"}}):p.push({alert:y,via:{kind:"global"}});const v=y=>({global:0,connection:1,folder:2,queue:3})[y.via.kind],j=new Map;for(const y of p)y.alert.enabled&&j.set(y.alert.condition.kind,Math.max(j.get(y.alert.condition.kind)??-1,v(y)));const C=p.filter(y=>!y.alert.enabled||v(y)===j.get(y.alert.condition.kind));return p.length=0,p.push(...C),p.sort((y,b)=>Number(b.alert.firing)-Number(y.alert.firing)||Number(b.alert.enabled)-Number(y.alert.enabled)||y.alert.name.localeCompare(b.alert.name))},[o.data,c.data,e,n]);return{matches:d,firing:d.filter(h=>h.alert.firing).length,enabled:i}}function y_({matches:e,firing:n}){if(e.length===0)return null;const r=`${e.length} alert${e.length===1?"":"s"}`;return t.jsx(Ce,{content:n>0?`${n} of ${e.length} firing right now`:"Watching this queue",children:t.jsxs(Te,{to:oe.alerts,className:F("inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[11px] font-medium transition-colors",n>0?"border-danger/40 bg-danger/10 text-danger hover:bg-danger/20":"border-border text-fg-muted hover:bg-surface-hover hover:text-fg"),children:[n>0?t.jsx(Kf,{className:"size-3"}):t.jsx(Xi,{className:"size-3"}),n>0?`${n} firing`:r]})})}function j_({connectionId:e,queueName:n,matches:r,onCreate:i}){const{isOperator:o}=yt(),[c,d]=N.useState(null);return r.length===0?null:t.jsxs("section",{className:"rounded-md border border-border bg-surface","aria-label":"Alerts watching this queue",children:[t.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[t.jsx(Xi,{className:"size-3.5 text-fg-muted"}),t.jsx("h2",{className:"text-[11px] font-semibold uppercase tracking-wider text-fg-muted",children:"Alerts on this queue"}),t.jsx("span",{className:"text-[11px] text-fg-subtle",children:r.length}),t.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[t.jsx(Te,{to:oe.alerts,className:"text-[11px] text-accent hover:underline",children:"Manage all"}),o&&t.jsx(H,{size:"xs",variant:"ghost",leftIcon:t.jsx(Jn,{}),onClick:i,children:"Add"})]})]}),t.jsx("ul",{className:"divide-y divide-border",children:r.map(({alert:h,via:m})=>t.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2 text-[12px]",children:[t.jsx("span",{className:"shrink-0",children:h.firing?t.jsxs(ye,{variant:"danger",className:"gap-1",children:[t.jsx(Kf,{className:"size-3"})," firing"]}):h.enabled?t.jsx(ye,{variant:"success",children:"ok"}):t.jsx(ye,{variant:"neutral",children:"off"})}),t.jsx("span",{className:F("font-medium",!h.enabled&&"text-fg-muted"),children:h.name}),t.jsx("span",{className:"font-mono text-[11px] text-fg-muted",children:nj(h.condition)}),(m.kind==="connection"||m.kind==="global")&&t.jsx("span",{className:"rounded border border-border px-1 text-[10px] text-fg-muted",children:m.kind==="global"?"every queue":"whole connection"}),m.kind==="folder"&&t.jsx(Ce,{content:"This alert watches every queue in the folder",children:t.jsxs(Te,{to:oe.folder(m.folderId),className:"rounded border border-border px-1 text-[10px] text-fg-muted hover:text-fg",children:["via folder ",m.folderName]})}),t.jsxs("span",{className:"ml-auto flex items-center gap-3 text-[11px] text-fg-subtle",children:[t.jsx("span",{children:h.lastFiredAt?t.jsxs(t.Fragment,{children:["last fired ",t.jsx(Wt,{value:h.lastFiredAt})]}):"never fired"}),o&&t.jsx("button",{type:"button",className:"text-fg-muted hover:text-fg",onClick:()=>d(h),title:"Edit alert","aria-label":`Edit ${h.name}`,children:t.jsx(To,{className:"size-3.5"})})]})]},h.id))}),c&&t.jsx(Ku,{open:!0,onClose:()=>d(null),alert:c}),t.jsx("span",{className:"sr-only",children:`Alerts watching ${n} on connection ${e}`})]})}function b_({connectionId:e,queue:n,value:r,onChange:i,disabled:o,className:c}){var z;const d=N0(e,n,{page:1,pageSize:200}),[h,m]=N.useState(!1),[g,p]=N.useState(""),[v,j]=N.useState(0),C=N.useRef(null),y=N.useRef(null),b=N.useId(),k=((z=d.data)==null?void 0:z.groups)??[],S=N.useMemo(()=>{const E=g.trim().toLowerCase(),T=k.filter(Q=>!E||Q.id.toLowerCase().includes(E)).slice(0,100),M=E&&k.some(Q=>Q.id.toLowerCase()===E),O=[];return E||O.push({id:"",label:"All groups"}),O.push(...T.map(Q=>({id:Q.id,label:Q.id,waiting:Q.waiting}))),E&&!M&&O.push({id:g.trim(),label:`Use "${g.trim()}"`,custom:!0}),O},[k,g]);N.useEffect(()=>j(0),[g,h]),N.useEffect(()=>{if(!h)return;const E=T=>{var M;(M=y.current)!=null&&M.contains(T.target)||m(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[h]);const $=E=>{i(E),m(!1),p("")};return t.jsxs("div",{ref:y,className:F("relative",c),children:[t.jsxs("div",{className:F("control flex !h-7 !w-auto min-w-44 items-center gap-1.5 !px-2 text-xs",o&&"cursor-not-allowed opacity-50",r&&"border-pro/60"),children:[t.jsx(Iu,{className:"size-3.5 shrink-0 text-pro","aria-hidden":!0}),h?t.jsx("input",{ref:C,autoFocus:!0,role:"combobox","aria-expanded":h,"aria-controls":b,"aria-autocomplete":"list","aria-label":"Filter by group",className:"min-w-0 flex-1 bg-transparent font-mono outline-none placeholder:font-sans placeholder:text-fg-subtle",placeholder:"Type a group id…",value:g,onChange:E=>p(E.target.value),onKeyDown:E=>{E.key==="ArrowDown"?(E.preventDefault(),j(T=>Math.min(S.length-1,T+1))):E.key==="ArrowUp"?(E.preventDefault(),j(T=>Math.max(0,T-1))):E.key==="Enter"?(E.preventDefault(),S[v]&&$(S[v].id)):E.key==="Escape"&&(E.preventDefault(),m(!1),p(""))}}):t.jsx("button",{type:"button",disabled:o,className:"flex min-w-0 flex-1 items-center gap-1 text-left",onClick:()=>m(!0),"aria-haspopup":"listbox","aria-expanded":h,title:r?`Showing group ${r}`:"Filter jobs by group",children:r?t.jsx("span",{className:"truncate font-mono text-fg",children:r}):t.jsxs("span",{className:"truncate text-fg-muted",children:["All groups",d.data?t.jsxs("span",{className:"num text-fg-subtle",children:[" · ",ht(d.data.total)]}):null]})}),r&&!o?t.jsx("button",{type:"button",className:"rounded p-0.5 text-fg-subtle hover:text-fg","aria-label":"Clear group filter",onClick:()=>$(""),children:t.jsx(gn,{className:"size-3"})}):t.jsx(ms,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0})]}),h&&t.jsxs("ul",{id:b,role:"listbox",className:"absolute left-0 z-40 mt-1 max-h-64 w-72 overflow-auto rounded-md border border-border bg-surface p-1 text-xs shadow-[var(--shadow)]",children:[d.isLoading&&t.jsx("li",{className:"px-2 py-1.5 text-fg-subtle",children:"Loading groups…"}),!d.isLoading&&S.length===0&&t.jsx("li",{className:"px-2 py-1.5 text-fg-subtle",children:"No groups"}),S.map((E,T)=>{const M=E.id===r;return t.jsxs("li",{role:"option","aria-selected":M,className:F("flex cursor-pointer items-center gap-2 rounded px-2 py-1",T===v?"bg-surface-3 text-fg":"text-fg-muted hover:bg-surface-2 hover:text-fg"),onMouseEnter:()=>j(T),onMouseDown:O=>O.preventDefault(),onClick:()=>$(E.id),children:[t.jsx("span",{className:F("min-w-0 flex-1 truncate",E.id&&!E.custom&&"font-mono"),children:E.label}),E.waiting!=null&&t.jsxs("span",{className:"num text-[10px] text-fg-subtle",children:[ht(E.waiting)," waiting"]}),M&&t.jsx(Kr,{className:"size-3.5 text-accent","aria-hidden":!0})]},E.custom?`custom:${E.id}`:E.id||"__all__")}),d.data&&d.data.total>k.length&&t.jsxs("li",{className:"border-t border-border px-2 py-1 text-[10px] text-fg-subtle",children:["Showing the first ",k.length," of ",ht(d.data.total)," groups — type an id to filter or use it directly."]})]})]})}const w_={retry:"retried",promote:"promoted",remove:"removed",discard:"discarded"};function sj(e,n,r){return n==="promote"&&(r==null?void 0:r.mode)==="ran_copy"?`Job ${e} belongs to scheduler "${r.schedulerId}": ran a copy (${r.jobId}) now, the next scheduled run is unchanged`:n==="promote"&&(r==null?void 0:r.mode)==="skipped_next"?`Job ${e} promoted: scheduler "${r.schedulerId}" skips the run it was scheduled for`:`Job ${e} ${w_[n]}`}const N_=[{mode:"run_copy",title:"Run a copy now",detail:e=>`A one-off copy runs now. The scheduled run at ${e} still happens.`},{mode:"skip_next",title:"Promote and skip the next run",detail:e=>`The run scheduled for ${e} runs now instead. Nothing runs at ${e}; the scheduler continues with the run after it.`}];function rj({job:e,onClose:n,onPick:r,pending:i}){const o=e!=null&&e.delayedUntil?xn(e.delayedUntil):"its scheduled time";return t.jsx(En,{open:e!==null,onClose:n,size:"md",title:"Promote a scheduled job",description:e?t.jsxs(t.Fragment,{children:["Job ",t.jsx("span",{className:"font-mono",children:e.id})," is the next run of scheduler"," ",t.jsx("span",{className:"font-mono",children:e.repeatJobKey}),"."]}):void 0,footer:t.jsx(H,{variant:"ghost",size:"sm",onClick:n,disabled:!!i,children:"Cancel"}),children:t.jsx("div",{className:"flex flex-col gap-2",children:N_.map(c=>t.jsxs("button",{type:"button",disabled:!!i,onClick:()=>r(c.mode),className:"rounded-md border border-border bg-surface-2 px-3 py-2.5 text-left transition-colors hover:border-border-strong hover:bg-surface-3 disabled:opacity-60",children:[t.jsxs("span",{className:"block text-sm font-medium text-fg",children:[c.title,i===c.mode&&"…"]}),t.jsx("span",{className:"mt-0.5 block text-xs text-fg-muted",children:c.detail(o)})]},c.mode))})})}function k_(e){return!!e&&oo.includes(e)}function Bh({view:e="jobs"}={}){var ol,Lo,Ha,Ka,Wa,Za,Ga,qs,Is,cl,ul,dl,hl,fl,Ja,ml,lr,Xa,or,Fo,cr,Xr,Yr,Ya,Do;const{connectionId:n="",queue:r=""}=Fn(),[i,o]=Po(),c=an(),{isOperator:d,isAdmin:h}=yt(),m=k_(i.get("state"))?i.get("state"):"waiting",g=Math.max(1,Number(i.get("page")??1)||1),p=[25,50,100,200].includes(Number(i.get("pageSize")))?Number(i.get("pageSize")):25,v=i.get("order")==="asc"?"asc":"desc",j=i.get("q")??"",C=i.get("group")??"",[y,b]=N.useState(j),k=N.useCallback(le=>{o(it=>{const Qe=new URLSearchParams(it);for(const[Bt,ei]of Object.entries(le))ei==null||ei===""?Qe.delete(Bt):Qe.set(Bt,ei);return Qe},{replace:!0})},[o]),S=j0(n,r),$=v_(n,r),z=fm(n),E=!!S.data&&(S.data.isPro||S.data.groupsCount>0),T=j.trim().length>0,M=!T&&!!C,O=e==="metrics",Q=e==="schedulers",V=O||Q,q=b0(n,r,{state:m,page:g,pageSize:p,order:v,groupId:M?C:void 0},{enabled:!T&&!V}),B=r2(n,r,{state:m,q:j.trim(),limit:50},{enabled:T&&!V}),ce=im(n,r),_e=w0(n,r),Ue=l2(n,r),Ge=((ol=B.data)==null?void 0:ol.pages)??[],rt=Ge.flatMap(le=>le.jobs),Be=Ge.reduce((le,it)=>le+(it.scanned??0),0),Z=Ge.reduce((le,it)=>le+(it.skippedLargePayloads??0),0),de=Ge.length?Ge[Ge.length-1].total:((Ha=(Lo=S.data)==null?void 0:Lo.counts)==null?void 0:Ha[m])??0,se=T?rt:((Ka=q.data)==null?void 0:Ka.jobs)??[],A=N.useMemo(()=>se.map(le=>le.id),[se]),K=xC(A),[qe,Ae]=N.useState(null),[Ne,Le]=N.useState(null),[st,Je]=N.useState(null),[at,Qt]=N.useState(null),[rr,Fa]=N.useState(null),[ts,Ot]=N.useState(null),[zo,Da]=N.useState(!1),Rn=i.get("confirm");N.useEffect(()=>{if(Rn!=="drain"&&Rn!=="clean"&&Rn!=="obliterate")return;(Rn==="clean"?d:h)?Ot(Rn):ee.error(`${Rn==="clean"?"Cleaning":Rn==="drain"?"Draining":"Obliterating"} a queue needs the ${Rn==="clean"?"operator":"admin"} role`),o(it=>{const Qe=new URLSearchParams(it);return Qe.delete("confirm"),Qe},{replace:!0})},[Rn,h,d,o]);const{has:Oo,gate:Ua}=jt(),[ar,yn]=N.useState(!1),Zr=N.useRef(null),Qa=N.useCallback(()=>{var le,it;(le=Zr.current)==null||le.focus(),(it=Zr.current)==null||it.select()},[]);p0("/",le=>{le.preventDefault(),Qa()}),N.useEffect(()=>{if(i.get("search")!=="1")return;const le=window.setTimeout(Qa,0);return k({search:null}),()=>window.clearTimeout(le)},[i,k,Qa]),N.useEffect(()=>b(j),[j]);const on=(Wa=S.data)==null?void 0:Wa.counts,Ao=N.useMemo(()=>{var it,Qe;const le=[{value:"metrics",label:"Metrics",icon:t.jsx(Wf,{className:"size-3.5"})},{value:"schedulers",label:"Schedulers",count:((it=S.data)==null?void 0:it.schedulersCount)??null,icon:t.jsx(Ro,{className:"size-3.5"})},...oo.map(Bt=>({value:Bt,label:ot[Bt].label,count:(on==null?void 0:on[Bt])??null,tone:ot[Bt].dotClass}))];return(Qe=S.data)!=null&&Qe.isPro&&le.push({value:"groups",label:"Groups",count:S.data.groupsCount,icon:t.jsx(Iu,{className:"size-3.5 text-pro"})}),le},[on,(Za=S.data)==null?void 0:Za.isPro,(Ga=S.data)==null?void 0:Ga.groupsCount,(qs=S.data)==null?void 0:qs.schedulersCount]),Ba=(le,it,Qe)=>{ce.mutate({jobId:le,action:it,scheduler:Qe},{onSuccess:Bt=>{ee.success(sj(le,it,Bt)),Fa(null)},onError:Bt=>ee.error(be(Bt))})},Va=(le,it,Qe)=>{if(it==="remove"){Qt(le);return}if(it==="promote"&&(Qe!=null&&Qe.repeatJobKey)){Fa({id:Qe.id,repeatJobKey:Qe.repeatJobKey,delayedUntil:Qe.delayedUntil});return}Ba(le,it)},Gr=N.useMemo(()=>W0(T?"mixed":m),[T,m]),ll=le=>{const it=K.selectedIds;if(it.length!==0){if(it.length>Nu){ee.error(`Select at most ${W(Nu)} jobs per action (${W(it.length)} selected).`);return}Le(le),Ue.mutate({action:le,jobIds:it},{onSuccess:Qe=>{Ae(Qe),K.deselect(Qe.ok);const Bt=le==="retry"?"retried":le==="promote"?"promoted":"removed";Qe.failed.length===0?ee.success(`${W(Qe.ok.length)} ${Bt}`):ee.error(`${W(Qe.ok.length)} ${Bt} · ${W(Qe.failed.length)} failed`)},onError:Qe=>ee.error(be(Qe)),onSettled:()=>{Le(null),Je(null)}})}},ir=le=>{le==="remove"?Je("remove"):ll(le)},ns=(le,it)=>_e.mutate(le,{onSuccess:()=>{ee.success(it),Ot(null),le.action==="obliterate"&&c(oe.connection(n))},onError:Qe=>ee.error(be(Qe))}),Wu=()=>k({q:y.trim()||null,page:null}),Jr=()=>{b(""),k({q:null,page:null})};return t.jsxs(vt,{wide:!0,children:[t.jsxs("div",{className:"mb-3 flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h1",{className:"truncate font-mono text-lg font-semibold tracking-tight",children:r}),((Is=S.data)==null?void 0:Is.isPaused)&&t.jsx(ye,{variant:"warning",dot:!0,className:"tracking-wider",children:"PAUSED"}),((cl=S.data)==null?void 0:cl.isPro)&&t.jsx(ye,{variant:"pro",title:"BullMQ Pro groups detected",className:"tracking-wider",children:"PRO"}),S.isError&&t.jsx(ye,{variant:"danger",children:"unreachable"})]}),t.jsxs("p",{className:"mt-0.5 flex items-center gap-3 text-xs text-fg-muted",children:[t.jsxs("span",{className:"font-mono",children:[((ul=S.data)==null?void 0:ul.prefix)??"bull",":",r]}),((dl=S.data)==null?void 0:dl.metrics)&&S.data.metrics.completed.length>1&&t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{style:{color:ot.completed.fg},children:t.jsx(Gi,{values:S.data.metrics.completed,width:72,height:16,title:"Completed per minute"})}),t.jsx("span",{style:{color:ot.failed.fg},children:t.jsx(Gi,{values:S.data.metrics.failed,width:72,height:16,title:"Failed per minute"})})]}),t.jsx(y_,{matches:$.matches,firing:$.firing})]})]}),d&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx(H,{size:"sm",variant:"primary",leftIcon:t.jsx(Jn,{}),onClick:()=>Ot("add"),children:"Add job"}),t.jsx(H,{size:"sm",leftIcon:t.jsx(Xi,{}),onClick:()=>Ua("alerts",()=>Da(!0)),title:"Alert on this queue",children:"Create alert"}),t.jsx(H,{size:"sm",leftIcon:(hl=S.data)!=null&&hl.isPaused?t.jsx(Gf,{}):t.jsx(tl,{}),loading:_e.isPending&&(((fl=_e.variables)==null?void 0:fl.action)==="pause"||((Ja=_e.variables)==null?void 0:Ja.action)==="resume"),onClick:()=>{var le;return(le=S.data)!=null&&le.isPaused?ns({action:"resume"},"Queue resumed"):Ot("pause")},children:(ml=S.data)!=null&&ml.isPaused?"Resume":"Pause"}),t.jsx(H,{size:"sm",leftIcon:t.jsx($u,{}),onClick:()=>Ot("retryAll"),disabled:!on||on.failed===0,children:"Retry all failed"}),t.jsxs("div",{className:"relative",children:[t.jsx(H,{size:"sm",variant:"secondary",rightIcon:t.jsx(ms,{}),"aria-haspopup":"menu","aria-expanded":ar,onClick:()=>yn(le=>!le),children:"More"}),ar&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"fixed inset-0 z-30",onClick:()=>yn(!1),"aria-hidden":!0}),t.jsxs("div",{role:"menu",className:"absolute right-0 z-40 mt-1 w-56 rounded-lg border border-border bg-surface p-1 shadow-[var(--shadow)]",children:[t.jsx(Jc,{icon:t.jsx(mN,{}),label:"Clean…",hint:"remove by state and age",onClick:()=>(yn(!1),Ot("clean"))}),h&&t.jsxs(Te,{role:"menuitem",to:oe.audit({connectionId:n,queueName:r}),onClick:()=>yn(!1),className:"nav-item w-full text-left",children:[t.jsx(qo,{className:"size-3.5 shrink-0","aria-hidden":!0}),t.jsxs("span",{className:"flex-1",children:["Audit this queue",t.jsx("span",{className:"block text-[10px] text-fg-subtle",children:"who paused, cleaned or drained it"})]})]}),d&&t.jsx(Jc,{icon:t.jsx(Mo,{}),label:"Hide from the lists",hint:xS,onClick:()=>(yn(!1),z.hide(r))}),h&&t.jsx(Jc,{icon:t.jsx(ps,{}),label:"Drain",hint:"remove all waiting jobs",onClick:()=>(yn(!1),Ot("drain"))}),h&&t.jsx(Jc,{icon:t.jsx(pN,{}),label:"Obliterate…",hint:"deletes the queue and every job · permanent",danger:!0,onClick:()=>(yn(!1),Ot("obliterate"))})]})]})]})]})]}),t.jsx(n_,{connectionId:n,queue:r,className:"mb-3"}),t.jsx("div",{className:"mb-3",children:t.jsx(j_,{connectionId:n,queueName:r,matches:$.matches,onCreate:()=>Ua("alerts",()=>Da(!0))})}),!V&&t.jsxs("form",{className:"mb-3 flex flex-wrap items-center gap-2",role:"search",onSubmit:le=>{le.preventDefault(),Wu()},children:[t.jsxs("div",{className:"relative min-w-72 flex-1",children:[t.jsx(Ee,{ref:Zr,leftIcon:t.jsx(Gn,{}),placeholder:`Search job data, name, id or error in ${m}…`,"aria-label":"Search jobs",value:y,onChange:le=>b(le.target.value),onKeyDown:le=>{le.key==="Escape"&&(le.preventDefault(),Jr(),le.target.blur())},className:"!h-9 pr-16 text-[13px]"}),t.jsx("span",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 items-center gap-1",children:y||T?t.jsx("button",{type:"button",className:"rounded p-0.5 text-fg-subtle hover:text-fg","aria-label":"Clear search",onClick:Jr,children:t.jsx(gn,{className:"size-3.5"})}):t.jsx("span",{className:"hidden items-center gap-1 sm:flex",children:t.jsx(Ki,{children:"/"})})})]}),t.jsx(ut,{"aria-label":"State to search",className:"!h-9 !w-auto",value:m,onChange:le=>k({state:le.target.value,page:null,group:null}),options:oo.map(le=>({value:le,label:`in ${ot[le].label}`}))}),t.jsx(H,{type:"submit",size:"md",variant:T?"secondary":"primary",leftIcon:t.jsx(Gn,{}),disabled:!y.trim()&&!T,children:"Search"}),t.jsx("span",{className:"hidden text-[11px] text-fg-subtle lg:inline",children:"Enter to search · Esc to clear · substring match, server-side"})]}),t.jsxs("div",{className:"mb-3 flex flex-wrap items-end gap-3 border-b border-border",children:[t.jsx("div",{className:F("min-w-0 flex-1 transition-opacity",!V&&(M||T)&&"opacity-50"),title:M&&!V?"Clear the group filter to browse by state":void 0,children:t.jsx(Pm,{"aria-label":"Job state",items:Ao,value:O?"metrics":Q?"schedulers":m,onChange:le=>{le==="groups"?c(oe.groups(n,r)):le==="metrics"?c(oe.queueMetrics(n,r)):le==="schedulers"?c(`/c/${encodeURIComponent(n)}/q/${encodeURIComponent(r)}/schedulers`):V?c(oe.queue(n,r,le)):k({state:le,page:null,group:null})},className:"!border-b-0",size:"sm"})}),E&&!T&&!V&&t.jsxs("div",{className:"flex items-center gap-2 pb-1.5",children:[M&&t.jsxs("span",{className:"text-[11px] text-fg-muted",children:["showing group ",t.jsx("span",{className:"font-mono text-fg",children:C}),"'s waiting jobs"]}),t.jsx(b_,{connectionId:n,queue:r,value:C,onChange:le=>k({group:le||null,page:null})})]}),!T&&!V&&t.jsx(H,{size:"sm",variant:"ghost",className:"mb-1",leftIcon:t.jsx(eN,{}),onClick:()=>k({order:v==="desc"?"asc":"desc"}),title:"Toggle order",children:v==="desc"?"Newest first":"Oldest first"})]}),Q?t.jsx(i_,{connectionId:n,queue:r}):O?t.jsx(VC,{connectionId:n,queue:r,summary:S.data,onOpenState:le=>c(oe.queue(n,r,le))}):t.jsx("div",{className:"card overflow-hidden",children:T?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border bg-surface-2/50 px-3 py-2 text-xs",role:"status",children:[t.jsxs("span",{className:"flex items-center gap-2 text-fg-muted",children:[t.jsx(Gn,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}),B.isFetching&&!B.isFetchingNextPage?t.jsx(Dt,{label:`Scanning ${m} jobs for "${j}"…`}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"num font-semibold text-fg",children:W(rt.length)})," ",rt.length===1?"match":"matches"," · scanned ",t.jsx("span",{className:"num text-fg",children:W(Math.min(Be,de))})," of"," ",t.jsx("span",{className:"num text-fg",children:W(de)})," jobs in ",t.jsx("span",{className:ot[m].textClass,children:m}),!B.hasNextPage&&B.data&&t.jsx("span",{className:"text-fg-subtle",children:" · whole state scanned"}),Z>0&&t.jsxs("span",{className:"text-fg-subtle",title:"Payloads above the search size cap are not read into Lua; those jobs still match on id, name and error.",children:[" ","· ",W(Z)," ",Z===1?"payload":"payloads"," too large to search inside"]})]})]}),t.jsxs("span",{className:"flex items-center gap-2",children:[B.hasNextPage&&t.jsx(H,{size:"sm",onClick:()=>B.fetchNextPage(),loading:B.isFetchingNextPage,children:"Scan more"}),t.jsx(H,{size:"sm",variant:"ghost",leftIcon:t.jsx(gn,{}),onClick:Jr,children:"Clear"})]})]}),qe&&t.jsx(hv,{result:qe,onDismiss:()=>Ae(null)}),d&&t.jsx(dv,{selection:K,state:"mixed",queue:r,actions:Gr,onRun:ir,pending:Ne,searching:!0}),t.jsx(qf,{connectionId:n,queue:r,jobs:B.data?rt:void 0,loading:B.isLoading,error:B.error,emptyText:B.hasNextPage?"No matches yet — scan more to keep looking":`No ${m} job contains "${j}"`,canOperate:d,onAction:Va,pendingId:ce.isPending?(lr=ce.variables)==null?void 0:lr.jobId:null,showState:!1,showGroup:E,onGroupClick:le=>{Jr(),k({group:le,page:null})},highlight:j,selection:d?K:void 0}),t.jsxs("div",{className:"flex items-center justify-between border-t border-border px-3 py-2 text-xs text-fg-subtle",children:[t.jsx("span",{children:"Each scan reads a bounded slice of the state to keep the database happy."}),B.hasNextPage&&t.jsx(H,{size:"sm",onClick:()=>B.fetchNextPage(),loading:B.isFetchingNextPage,children:"Scan more"})]})]}):t.jsxs(t.Fragment,{children:[m==="active"&&(((Xa=S.data)==null?void 0:Xa.stalledCount)??0)>0&&t.jsxs("div",{className:"flex items-start gap-2 border-b border-border bg-warning/10 px-3 py-2 text-xs",role:"status",children:[t.jsx(Yf,{className:"mt-0.5 size-3.5 shrink-0 text-warning","aria-hidden":!0}),t.jsxs("span",{children:[t.jsx("span",{className:"num font-semibold text-fg",children:W(((or=S.data)==null?void 0:or.stalledCount)??0)})," of these are stalled (worker lost the lock).",t.jsx("span",{className:"text-fg-muted",children:" BullMQ still reports them as active; the next stalled check moves them back to waiting and bumps their stall counter."})]})]}),qe&&t.jsx(hv,{result:qe,onDismiss:()=>Ae(null)}),d&&t.jsx(dv,{selection:K,state:m,queue:r,actions:Gr,onRun:ir,pending:Ne}),t.jsx(qf,{connectionId:n,queue:r,jobs:(Fo=q.data)==null?void 0:Fo.jobs,loading:q.isLoading,error:q.error,emptyText:M?`No waiting jobs in group ${C}`:"No jobs in this state",canOperate:d,onAction:Va,pendingId:ce.isPending?(cr=ce.variables)==null?void 0:cr.jobId:null,showState:!1,showGroup:E,onGroupClick:le=>k({group:le,page:null}),selection:d?K:void 0}),t.jsx("div",{className:F("border-t border-border px-3 py-2",q.isFetching&&"opacity-80"),children:t.jsx(Hu,{page:g,pageSize:p,total:((Xr=q.data)==null?void 0:Xr.total)??(M?0:(on==null?void 0:on[m])??0),count:(Yr=q.data)==null?void 0:Yr.jobs.length,onPage:le=>k({page:String(le)}),onPageSize:le=>k({pageSize:String(le),page:null})})})]})}),d&&t.jsx(XC,{open:ts==="add",onClose:()=>Ot(null),connectionId:n,queue:r}),d&&Oo("alerts")&&zo&&t.jsx(Ku,{open:!0,onClose:()=>Da(!1),alert:null,initialScope:{type:"queue",connectionId:n,queueName:r}}),d&&t.jsx(t_,{open:ts==="clean",onClose:()=>Ot(null),connectionId:n,queue:r,defaultState:m==="waiting"?"wait":m==="waiting-children"?"completed":m}),t.jsx(sn,{open:st==="remove",onClose:()=>Je(null),title:"Remove selected jobs",description:`Remove ${W(K.selectedIds.length)} ${K.selectedIds.length===1?"job":"jobs"} from ${r}? This cannot be undone.`,confirmText:`Remove ${W(K.selectedIds.length)}`,danger:!0,loading:Ne==="remove",onConfirm:()=>ll("remove")}),t.jsx(sn,{open:at!==null,onClose:()=>Qt(null),title:"Remove job",description:`Remove job ${at??""} from ${r}? This cannot be undone.`,confirmText:"Remove",danger:!0,loading:ce.isPending,onConfirm:()=>{at&&Ba(at,"remove"),Qt(null)}}),t.jsx(rj,{job:rr,onClose:()=>Fa(null),onPick:le=>rr&&Ba(rr.id,"promote",le),pending:ce.isPending&&((Ya=ce.variables)==null?void 0:Ya.action)==="promote"?ce.variables.scheduler??null:null}),t.jsx(B0,{queue:ts==="pause"?r:null,onClose:()=>Ot(null),loading:_e.isPending&&((Do=_e.variables)==null?void 0:Do.action)==="pause",onConfirm:le=>ns({action:"pause",body:le?{reason:le}:{}},"Queue paused")}),t.jsx(sn,{open:ts==="retryAll",onClose:()=>Ot(null),title:"Retry all failed jobs",description:`Moves ${W((on==null?void 0:on.failed)??0)} failed jobs in ${r} back to waiting.`,confirmText:"Retry all",loading:_e.isPending,onConfirm:()=>ns({action:"retry-all",body:{state:"failed"}},"Retrying all failed jobs")}),t.jsx(sn,{open:ts==="drain",onClose:()=>Ot(null),title:"Drain queue",description:`Removes every waiting and prioritized job in ${r}. Active, completed and failed jobs are kept.`,confirmText:"Drain",danger:!0,loading:_e.isPending,onConfirm:()=>ns({action:"drain",body:{includeDelayed:!1}},"Queue drained")}),t.jsx(sn,{open:ts==="obliterate",onClose:()=>Ot(null),title:"Obliterate queue",description:"Deletes every key of this queue from Redis, including completed and failed history. This cannot be undone.",confirmText:"Obliterate",danger:!0,typeToConfirm:r,loading:_e.isPending,onConfirm:()=>ns({action:"obliterate"},`${r} obliterated`)})]})}function Jc({icon:e,label:n,hint:r,danger:i,onClick:o}){return t.jsxs("button",{role:"menuitem",type:"button",onClick:o,className:F("nav-item h-auto w-full py-1.5 text-left [&_svg]:size-3.5",i&&"text-danger hover:text-danger"),children:[e,t.jsxs("span",{className:"flex flex-col",children:[t.jsx("span",{className:F(!i&&"text-fg"),children:n}),r&&t.jsx("span",{className:"text-[11px] text-fg-subtle",children:r})]})]})}function aj({value:e,defaultExpandDepth:n=2,className:r,name:i}){return t.jsx("div",{className:F("font-mono text-xs leading-[1.6] text-fg",r),children:t.jsx(lj,{name:i,value:e,depth:0,expandDepth:n,last:!0})})}function ij(e){if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";const n=typeof e;return n==="object"?"object":n==="string"?"string":n==="number"||n==="bigint"?"number":n==="boolean"?"boolean":"other"}const Xc=200;function S_({value:e}){const[n,r]=N.useState(!1);switch(ij(e)){case"string":{const o=e,d=!n&&o.length>Xc?`${o.slice(0,Xc)}…`:o;return t.jsxs("span",{className:"text-success break-all",children:['"',d,'"',o.length>Xc&&t.jsx("button",{type:"button",className:"ml-1 rounded bg-surface-3 px-1 text-[10px] text-fg-muted hover:text-fg",onClick:()=>r(h=>!h),children:n?"less":`+${o.length-Xc} chars`})]})}case"number":return t.jsx("span",{className:"text-info",children:String(e)});case"boolean":return t.jsx("span",{className:"text-violet",children:String(e)});case"null":return t.jsx("span",{className:"text-fg-subtle",children:"null"});case"undefined":return t.jsx("span",{className:"text-fg-subtle",children:"undefined"});default:return t.jsx("span",{className:"text-fg-muted",children:String(e)})}}function lj({name:e,value:n,depth:r,expandDepth:i,last:o}){const c=ij(n),d=c==="object"||c==="array",[h,m]=N.useState(r<i),g=e!==void 0?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-fg",children:C_(e)?e:JSON.stringify(e)}),t.jsx("span",{className:"text-fg-subtle",children:": "})]}):null;if(!d)return t.jsxs("div",{className:"flex",style:{paddingLeft:r?16:0},children:[t.jsx("span",{className:"w-4 shrink-0"}),t.jsxs("span",{className:"min-w-0",children:[g,t.jsx(S_,{value:n}),!o&&t.jsx("span",{className:"text-fg-subtle",children:","})]})]});const p=c==="array"?n.map((y,b)=>[String(b),y]):Object.entries(n),[v,j]=c==="array"?["[","]"]:["{","}"],C=c==="array"?`${p.length} item${p.length===1?"":"s"}`:`${p.length} key${p.length===1?"":"s"}`;return p.length===0?t.jsxs("div",{className:"flex",style:{paddingLeft:r?16:0},children:[t.jsx("span",{className:"w-4 shrink-0"}),t.jsxs("span",{children:[g,t.jsxs("span",{className:"text-fg-muted",children:[v,j]}),!o&&t.jsx("span",{className:"text-fg-subtle",children:","})]})]}):t.jsxs("div",{style:{paddingLeft:r?16:0},children:[t.jsxs("div",{className:"flex",children:[t.jsx("button",{type:"button","aria-expanded":h,"aria-label":h?"Collapse":"Expand",onClick:()=>m(y=>!y),className:"flex w-4 shrink-0 items-start justify-center pt-[3px] text-fg-subtle hover:text-fg",children:h?t.jsx(ms,{className:"size-3"}):t.jsx(Dn,{className:"size-3"})}),t.jsxs("span",{className:"min-w-0 cursor-default",onClick:()=>!h&&m(!0),children:[g,t.jsx("span",{className:"text-fg-muted",children:v}),!h&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mx-1 rounded bg-surface-3 px-1 text-[10px] text-fg-subtle",children:C}),t.jsx("span",{className:"text-fg-muted",children:j}),!o&&t.jsx("span",{className:"text-fg-subtle",children:","})]})]})]}),h&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"border-l border-border/70",style:{marginLeft:7},children:p.map(([y,b],k)=>t.jsx(lj,{name:c==="array"?void 0:y,value:b,depth:r+1,expandDepth:i,last:k===p.length-1},y))}),t.jsxs("div",{className:"flex",children:[t.jsx("span",{className:"w-4 shrink-0"}),t.jsxs("span",{className:"text-fg-muted",children:[j,!o&&t.jsx("span",{className:"text-fg-subtle",children:","})]})]})]})]})}function C_(e){return/^[A-Za-z_$][\w$]*$/.test(e)}function __(){var E,T,M,O,Q;const{connectionId:e="",queue:n="",jobId:r=""}=Fn(),i=an(),{has:o}=jt(),{isOperator:c,isAdmin:d}=yt(),h=a2(e,n,r),m=im(e,n),[g,p]=N.useState("data"),[v,j]=N.useState(null),[C,y]=N.useState(!1),b=(V,q)=>m.mutate({jobId:r,action:V,scheduler:q},{onSuccess:B=>{ee.success(sj(r,V,B)),j(null),y(!1),V==="remove"&&i(oe.queue(e,n))},onError:B=>ee.error(be(B))});if(h.isLoading)return t.jsx(vt,{children:t.jsx(nl,{label:"Loading job…"})});if(h.isError||!h.data){const V=er(h.error)&&h.error.status===404;return t.jsx(vt,{children:t.jsx(rn,{title:V?"Job not found":"Could not load job",description:V?"It may have been removed or cleaned since you opened it.":be(h.error),action:t.jsxs(H,{variant:"secondary",leftIcon:t.jsx(uu,{}),onClick:()=>i(oe.queue(e,n)),children:["Back to ",n]})})})}const k=h.data,S=k.state==="failed"||k.state==="completed",$=k.state==="delayed",z=!!k.failedReason||(((E=k.stacktrace)==null?void 0:E.length)??0)>0;return t.jsxs(vt,{children:[t.jsxs("div",{className:"mb-4 flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs(Te,{to:oe.queue(e,n,k.state!=="unknown"?k.state:void 0),className:"mb-1 inline-flex items-center gap-1 text-xs text-fg-muted hover:text-fg",children:[t.jsx(uu,{className:"size-3.5"})," ",n]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("h1",{className:"truncate text-lg font-semibold tracking-tight",children:k.name}),t.jsx(L0,{state:k.state}),k.groupId&&t.jsx(Te,{to:oe.group(e,n,k.groupId),children:t.jsxs(ye,{variant:"pro",mono:!0,title:"BullMQ Pro group",children:["group ",k.groupId]})}),k.priority>0&&t.jsxs(ye,{variant:"violet",children:["priority ",k.priority]})]}),t.jsxs("p",{className:"mt-1 flex items-center gap-1 font-mono text-xs text-fg-muted",children:[t.jsx("span",{className:"select-all",children:k.id}),t.jsx(go,{value:k.id,label:"Copy id",size:"icon-xs"}),t.jsx(go,{value:()=>Cu(k),label:"Copy JSON",copiedLabel:"Copied JSON",showLabel:!0,size:"xs",icon:t.jsx(Ey,{}),className:"ml-1 font-sans"})]})]}),c&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[S&&t.jsx(H,{size:"sm",leftIcon:t.jsx($u,{}),onClick:()=>b("retry"),loading:m.isPending&&((T=m.variables)==null?void 0:T.action)==="retry",children:"Retry"}),$&&t.jsx(H,{size:"sm",leftIcon:t.jsx(Hf,{}),onClick:()=>k.repeatJobKey?y(!0):b("promote"),loading:m.isPending&&((M=m.variables)==null?void 0:M.action)==="promote",children:"Promote"}),t.jsx(H,{size:"sm",variant:"ghost",leftIcon:t.jsx(aN,{}),onClick:()=>j("discard"),title:"Mark as not retryable",children:"Discard"}),t.jsx(H,{size:"sm",variant:"ghost",className:"hover:text-danger",leftIcon:t.jsx(ps,{}),onClick:()=>j("remove"),children:"Remove"})]})]}),t.jsxs("div",{className:"mb-4 grid gap-3 lg:grid-cols-3",children:[t.jsx("div",{className:"card p-4 lg:col-span-2",children:t.jsx(R_,{job:k})}),t.jsxs("dl",{className:"card grid grid-cols-2 gap-x-4 gap-y-3 p-4 text-xs",children:[t.jsx(fa,{label:"Attempts",children:t.jsxs("span",{className:F(k.attemptsMade>1&&"text-warning"),children:[k.attemptsMade,k.attempts!=null&&t.jsxs("span",{className:"text-fg-subtle",children:[" / ",k.attempts]})]})}),k.state==="delayed"?t.jsx(fa,{label:"Runs at",children:t.jsx(P_,{at:k.delayedUntil})}):t.jsx(fa,{label:"Delay",children:k.delay?An(k.delay):"–"}),t.jsx(fa,{label:"Priority",children:k.priority||"–"}),t.jsx(fa,{label:"Progress",children:t.jsx(E_,{value:k.progress})}),t.jsx(fa,{label:"Parent",children:k.parent?t.jsxs(Te,{to:oe.job(e,Jg(k.parent.queueKey),k.parent.id),className:"inline-flex items-center gap-1 font-mono text-accent hover:underline",children:[t.jsx(gN,{className:"size-3"}),k.parent.queue||Jg(k.parent.queueKey),"/",k.parent.id]}):"–"}),t.jsx(fa,{label:"Children",children:k.dependencies?t.jsxs("span",{children:[t.jsx("span",{className:"text-success",children:W(k.dependencies.processed)})," done ·"," ",t.jsx("span",{className:F(k.dependencies.unprocessed>0&&"text-teal"),children:W(k.dependencies.unprocessed)})," pending"]}):"–"})]}),(k.parent||k.dependencies)&&t.jsx("div",{className:"mt-3 border-t border-border pt-3",children:t.jsxs(Te,{to:oe.jobTree(e,n,k.id),className:"inline-flex items-center gap-1.5 text-[13px] text-accent hover:underline",children:[t.jsx(SN,{className:"size-3.5","aria-hidden":!0}),"View flow tree"]})})]}),t.jsx(Pm,{"aria-label":"Job details",size:"sm",className:"mb-3",value:g,onChange:p,items:[{value:"data",label:"Data"},{value:"opts",label:"Options",count:Object.keys(k.opts??{}).length},{value:"returnvalue",label:"Return value"},{value:"error",label:"Error",tone:z?"bg-danger":void 0},{value:"logs",label:"Logs",count:k.logsCount??((O=k.logs)==null?void 0:O.length)??0},...d&&o("audit")?[{value:"audit",label:"Audit"}]:[]]}),g==="data"&&t.jsx(Vh,{value:k.data,empty:"No data"}),g==="opts"&&t.jsx(Vh,{value:k.opts,empty:"No options"}),g==="returnvalue"&&t.jsx(Vh,{value:k.returnvalue,empty:"No return value (job has not completed)"}),g==="error"&&t.jsx(M_,{job:k}),g==="logs"&&t.jsx(T_,{connectionId:e,queue:n,jobId:r,initial:k.logs,total:k.logsCount}),g==="audit"&&t.jsx(q_,{connectionId:e,queue:n,jobId:r}),t.jsx(rj,{job:C&&k.repeatJobKey?{id:k.id,repeatJobKey:k.repeatJobKey,delayedUntil:k.delayedUntil}:null,onClose:()=>y(!1),onPick:V=>b("promote",V),pending:m.isPending&&((Q=m.variables)==null?void 0:Q.action)==="promote"?m.variables.scheduler??null:null}),t.jsx(sn,{open:v==="remove",onClose:()=>j(null),title:"Remove job",description:`Job ${r} will be deleted from ${n}. Active jobs cannot be removed while locked.`,confirmText:"Remove",danger:!0,loading:m.isPending,onConfirm:()=>b("remove")}),t.jsx(sn,{open:v==="discard",onClose:()=>j(null),title:"Discard job",description:"Marks the job as not retryable: attemptsMade is set to the max so backoff retries stop. The job itself is kept.",confirmText:"Discard",loading:m.isPending,onConfirm:()=>b("discard")})]})}function fa({label:e,children:n}){return t.jsxs("div",{className:"min-w-0",children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:e}),t.jsx("dd",{className:"num truncate text-[13px] text-fg",children:n})]})}function P_({at:e}){return e?t.jsxs("span",{className:"flex flex-col leading-tight",children:[t.jsx(Wt,{value:e}),t.jsx("span",{className:"font-mono text-[10px] text-fg-subtle",children:Pf(e)})]}):t.jsx(t.Fragment,{children:"–"})}function E_({value:e}){if(e==null)return t.jsx(t.Fragment,{children:"–"});if(typeof e=="number"){const n=Math.max(0,Math.min(100,e));return t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"h-1.5 w-16 overflow-hidden rounded bg-surface-3",children:t.jsx("span",{className:"block h-full bg-accent",style:{width:`${n}%`}})}),t.jsxs("span",{children:[n,"%"]})]})}return t.jsx("span",{className:"font-mono text-[11px]",title:Cu(e),children:Cu(e,0).slice(0,40)})}function R_({job:e}){var g;const n=al(1e3),r=e.timestamp,i=e.processedOn,o=e.finishedOn,c=i?i-r:e.state==="waiting"||e.state==="delayed"||e.state==="prioritized"?n-r:null,d=i?o??(e.state==="active"?n:null):null,h=i&&d?d-i:null,m=[{label:"Created",ts:r,tone:"bg-info"},{label:"Processed",ts:i,tone:"bg-accent"},{label:o&&e.state==="failed"?"Failed":"Finished",ts:o,tone:e.state==="failed"?"bg-danger":"bg-success"}];return t.jsxs("div",{children:[t.jsx("h2",{className:"mb-3 text-[10px] font-semibold tracking-wider text-fg-subtle uppercase",children:"Timeline"}),t.jsxs("ol",{className:"relative flex items-start justify-between gap-2",children:[t.jsx("span",{className:"absolute top-[7px] right-4 left-4 -z-0 h-px bg-border","aria-hidden":!0}),m.map((p,v)=>t.jsxs("li",{className:F("relative z-[1] flex flex-1 flex-col",v===1?"items-center text-center":v===2?"items-end text-right":"items-start"),children:[t.jsx("span",{className:F("status-dot size-3.5 ring-4 ring-surface",p.ts?p.tone:"bg-surface-3",!p.ts&&e.state==="active"&&v===2&&"pulse bg-accent/50")}),t.jsx("span",{className:"mt-1.5 text-xs font-medium text-fg",children:p.label}),t.jsx("span",{className:"text-[11px] text-fg-muted",children:p.ts?t.jsx(Wt,{value:p.ts}):e.state==="active"&&v===2?"running…":e.state==="delayed"&&v===1&&e.delayedUntil?t.jsxs(t.Fragment,{children:["runs ",t.jsx(Wt,{value:e.delayedUntil})]}):"–"}),p.ts&&t.jsx("span",{className:"font-mono text-[10px] text-fg-subtle",children:Pf(p.ts)}),!p.ts&&e.state==="delayed"&&v===1&&e.delayedUntil&&t.jsx("span",{className:"font-mono text-[10px] text-fg-subtle",children:Pf(e.delayedUntil)})]},p.label))]}),t.jsxs("div",{className:"mt-4 flex flex-wrap gap-4 border-t border-border pt-3 text-xs",children:[t.jsxs("span",{children:[t.jsx("span",{className:"text-fg-subtle",children:"Wait "}),t.jsx("span",{className:"num text-fg",children:c!=null?An(c):"–"})]}),t.jsxs("span",{children:[t.jsx("span",{className:"text-fg-subtle",children:"Run "}),t.jsx("span",{className:F("num text-fg",e.state==="active"&&"text-accent"),children:h!=null?An(h):"–"})]}),t.jsxs("span",{children:[t.jsx("span",{className:"text-fg-subtle",children:"Total "}),t.jsx("span",{className:"num text-fg",children:o?An(o-r):"–"})]}),t.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-fg-subtle",children:[t.jsx("span",{className:F("status-dot",((g=$S[e.state])==null?void 0:g.dot)??"bg-fg-subtle")})," ",e.state]})]})]})}function Vh({value:e,empty:n}){const[r,i]=N.useState(!1),o=N.useMemo(()=>Cu(e),[e]),c=e==null||typeof e=="object"&&Object.keys(e).length===0;return t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex h-8 items-center justify-between border-b border-border bg-surface-2/60 pr-1 pl-3",children:[t.jsxs("div",{className:"flex items-center gap-1 text-[11px]",children:[t.jsx("button",{type:"button",className:F("rounded px-1.5 py-0.5",r?"text-fg-subtle hover:text-fg":"bg-surface-3 text-fg"),onClick:()=>i(!1),children:"Tree"}),t.jsx("button",{type:"button",className:F("rounded px-1.5 py-0.5",r?"bg-surface-3 text-fg":"text-fg-subtle hover:text-fg"),onClick:()=>i(!0),children:"Raw"})]}),t.jsx(go,{value:o,size:"icon-xs"})]}),t.jsx("div",{className:"max-h-[60vh] overflow-auto p-3",children:c?t.jsx("p",{className:"text-xs text-fg-subtle",children:n}):r?t.jsx("pre",{className:"font-mono text-xs leading-relaxed whitespace-pre-wrap break-all",children:o}):t.jsx(aj,{value:e,defaultExpandDepth:3})})]})}function M_({job:e}){var n;return!e.failedReason&&(!e.stacktrace||e.stacktrace.length===0)?t.jsx("div",{className:"card p-6 text-center text-xs text-fg-subtle",children:"No error recorded for this job"}):t.jsxs("div",{className:"space-y-3",children:[e.failedReason&&t.jsx("div",{className:"rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-[13px] break-words text-danger",children:e.failedReason}),(n=e.stacktrace)==null?void 0:n.map((r,i)=>t.jsx(Em,{code:r,header:`Stacktrace · attempt ${i+1} of ${e.stacktrace.length}`,wrap:!0,maxHeight:360},i))]})}function T_({connectionId:e,queue:n,jobId:r,initial:i,total:o}){var p,v;const[c,d]=N.useState(!1),h=i2(e,n,r,c?{}:{start:0,end:199},!0),m=((p=h.data)==null?void 0:p.logs)??i??[],g=((v=h.data)==null?void 0:v.count)??o??m.length;return m.length===0?t.jsx("div",{className:"card p-6 text-center text-xs text-fg-subtle",children:"No logs. Use job.log() in your processor to emit lines here."}):t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex h-8 items-center justify-between border-b border-border bg-surface-2/60 pr-1 pl-3 text-[11px] text-fg-subtle",children:[t.jsxs("span",{children:[W(m.length)," of ",W(g)," lines"]}),t.jsxs("div",{className:"flex items-center gap-1",children:[!c&&m.length<g&&t.jsx(H,{size:"xs",variant:"ghost",onClick:()=>d(!0),children:"Load all"}),t.jsx(go,{value:m.join(`
546
+ `),size:"icon-xs"})]})]}),t.jsx("ol",{className:"max-h-[60vh] overflow-auto p-2 font-mono text-xs leading-relaxed",children:m.map((j,C)=>t.jsxs("li",{className:"flex gap-3 hover:bg-surface-2/50",children:[t.jsx("span",{className:"num w-10 shrink-0 select-none text-right text-fg-subtle",children:C+1}),t.jsx("span",{className:"whitespace-pre-wrap break-all",children:j})]},C))})]})}function q_({connectionId:e,queue:n,jobId:r}){var c;const i=I2(e,n,r),o=((c=i.data)==null?void 0:c.entries)??[];return i.isLoading?t.jsx("div",{className:"card p-6 text-center text-xs text-fg-subtle",children:"Loading history…"}):i.isError?t.jsx("div",{className:"card p-6 text-center text-xs text-fg-subtle",children:"Could not read the audit log."}):o.length===0?t.jsx("div",{className:"card p-6 text-center text-xs text-fg-subtle",children:"Nobody has acted on this job through the dashboard. Worker activity is not audited — only what people do here."}):t.jsxs("div",{className:"card divide-y divide-border",children:[o.map(d=>t.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 py-2.5 text-xs",children:[t.jsx(Wt,{value:d.createdAt,className:"w-24 shrink-0 text-fg-muted"}),t.jsx("span",{className:"font-medium text-fg",children:d.actorName??d.actorEmail??"anonymous"}),t.jsx("span",{className:"text-fg-muted",children:rm[d.action]}),d.result==="error"&&t.jsx(ye,{variant:"danger",size:"xs",title:d.errorMessage??void 0,children:"refused"}),d.ip&&t.jsx("span",{className:"num ml-auto text-[11px] text-fg-subtle",children:d.ip})]},d.id)),t.jsx("div",{className:"px-4 py-2",children:t.jsxs(Te,{to:oe.audit({connectionId:e,queueName:n}),className:"inline-flex items-center gap-1.5 text-xs text-accent hover:underline",children:[t.jsx(qo,{className:"size-3.5","aria-hidden":!0})," Full audit log for this queue"]})})]})}const oj={waiting:"info",limited:"violet",maxed:"danger",paused:"warning"},cj={waiting:"In rotation: the next worker fetch may take a job from this group.",limited:"Hit its rate limit. Pro parks the group until the window resets.",maxed:"Every concurrency slot of the group is busy. Frees up when one of its jobs finishes.",paused:"Paused with queue.pauseGroup(). Jobs keep arriving, none are processed."},Nv="No per-group override in Redis. The worker's own group option applies (a worker option, not stored in Redis).";function I_(){var v,j,C;const{connectionId:e="",queue:n=""}=Fn(),r=an(),[i,o]=N.useState(1),[c,d]=N.useState(50),h=j0(e,n),m=N0(e,n,{page:i,pageSize:c}),g=al(1e3),p=6;return t.jsxs(vt,{wide:!0,children:[t.jsx(gs,{title:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Te,{to:oe.queue(e,n),className:"text-fg-muted hover:text-fg",children:n}),t.jsx("span",{className:"text-fg-subtle",children:"/"}),"Groups",t.jsx(ye,{variant:"pro",children:"BullMQ Pro"})]}),description:`Groups partition a queue for fairness, with their own concurrency and rate limit. ${h.data?`${W(h.data.groupsCount)} groups with jobs.`:""}`}),m.data&&t.jsx($_,{byStatus:m.data.byStatus,total:m.data.total}),t.jsxs("div",{className:"card overflow-hidden",children:[t.jsxs(fs,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(me,{children:"Group"}),t.jsx(me,{children:"Status"}),t.jsx(me,{align:"right",children:"Waiting"}),t.jsx(me,{align:"right",children:"Active / concurrency"}),t.jsx(me,{align:"right",children:"Rate limit"}),t.jsx(me,{align:"right",children:"Next"})]})}),t.jsxs("tbody",{children:[m.isLoading&&t.jsx(xt,{colSpan:p,children:t.jsx(Dt,{label:"Loading groups…"})}),m.isError&&!m.data&&t.jsx(xt,{colSpan:p,className:"text-danger",children:be(m.error)}),m.data&&m.data.groups.length===0&&t.jsx(xt,{colSpan:p,children:"No groups with jobs right now. Add jobs with opts.group.id to see them here."}),(v=m.data)==null?void 0:v.groups.map(y=>t.jsx(z_,{g:y,now:g,onOpen:()=>r(oe.group(e,n,y.id)),href:oe.group(e,n,y.id)},y.id))]})]}),t.jsx("div",{className:"border-t border-border px-3 py-2",children:t.jsx(Hu,{page:i,pageSize:c,total:((j=m.data)==null?void 0:j.total)??0,count:(C=m.data)==null?void 0:C.groups.length,onPage:o,onPageSize:y=>(d(y),o(1))})})]})]})}function $_({byStatus:e,total:n}){return t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[vk.map(r=>t.jsx(Ce,{content:cj[r],side:"bottom",children:t.jsxs("span",{className:F("inline-flex cursor-help items-center gap-1.5 rounded-md border border-border px-2 py-1",e[r]===0&&"opacity-60"),children:[t.jsx(ye,{variant:oj[r],dot:!0,size:"xs",children:r}),t.jsx("span",{className:"num font-medium",children:W(e[r])})]})},r)),t.jsxs("span",{className:"text-fg-subtle",children:[W(n)," ",n===1?"group":"groups"," with jobs"]})]})}function z_({g:e,now:n,onOpen:r,href:i}){const o=e.concurrency!==null,c=o?Math.min(100,Math.round(e.active/Math.max(1,e.concurrency??1)*100)):0;return t.jsxs(il,{onActivate:r,children:[t.jsx(pe,{mono:!0,children:t.jsx(Te,{to:i,className:"text-accent hover:underline",children:e.id})}),t.jsx(pe,{className:"whitespace-nowrap",children:t.jsx(ye,{variant:oj[e.status],dot:!0,size:"xs",title:cj[e.status],children:e.status})}),t.jsxs(pe,{num:!0,align:"right",children:[W(e.waiting),e.prioritized>0&&t.jsx(Ce,{content:"Jobs added with opts.priority. Pro serves the group's plain list first, then these.",side:"bottom",children:t.jsxs("span",{className:"ml-1.5 cursor-help text-[10px] text-fg-subtle",children:["+",W(e.prioritized)," prioritized"]})})]}),t.jsx(pe,{num:!0,align:"right",children:t.jsxs("span",{className:"inline-flex items-center justify-end gap-2",children:[o&&t.jsx("span",{className:"h-1.5 w-14 overflow-hidden rounded-full bg-surface-2","aria-hidden":!0,children:t.jsx("span",{className:F("block h-full rounded-full",c>=100?"bg-danger":"bg-accent"),style:{width:`${c}%`}})}),t.jsxs("span",{children:[W(e.active),t.jsx("span",{className:"text-fg-subtle",children:" / "}),o?t.jsx(Ce,{content:"Per-group override set with queue.setGroupConcurrency().",side:"bottom",children:t.jsx("span",{className:"cursor-help",children:W(e.concurrency)})}):t.jsx(Ce,{content:Nv,side:"bottom",children:t.jsx("span",{className:"cursor-help text-fg-subtle",children:"worker default"})})]})]})}),t.jsx(pe,{num:!0,align:"right",children:e.rateLimit?t.jsx(Ce,{content:"Per-group override set with queue.setGroupRateLimit(): max jobs per window.",side:"bottom",children:t.jsxs("span",{className:"cursor-help",children:[W(e.rateLimit.max),t.jsx("span",{className:"text-fg-subtle",children:" / "}),An(e.rateLimit.durationMs)]})}):t.jsx(Ce,{content:Nv,side:"bottom",children:t.jsx("span",{className:"cursor-help text-fg-subtle",children:"worker default"})})}),t.jsx(pe,{num:!0,align:"right",muted:!0,children:t.jsx(O_,{g:e,now:n})})]})}function O_({g:e,now:n}){if(e.status==="limited"&&e.limitedUntil!==null){const r=e.limitedUntil-n;return t.jsx("span",{title:new Date(e.limitedUntil).toLocaleTimeString(),children:r>0?`resumes in ${An(r)}`:"resuming…"})}return e.status==="maxed"&&e.since!==null?t.jsxs("span",{title:new Date(e.since).toLocaleTimeString(),children:["at cap for ",An(n-e.since)]}):e.status==="paused"&&e.since!==null?t.jsxs("span",{title:new Date(e.since).toLocaleTimeString(),children:["paused for ",An(n-e.since)]}):e.status==="waiting"?t.jsx("span",{children:"in rotation"}):t.jsx("span",{children:"–"})}function A_(){var y,b,k,S;const{connectionId:e="",queue:n="",groupId:r=""}=Fn(),{isOperator:i}=yt(),[o,c]=N.useState(1),[d,h]=N.useState(25),m=u2(e,n,r,{page:o,pageSize:d}),g=im(e,n),[p,v]=N.useState(null),j=($,z)=>g.mutate({jobId:$,action:z},{onSuccess:()=>ee.success(`Job ${$} ${z==="remove"?"removed":z}`),onError:E=>ee.error(be(E))}),C=($,z)=>z==="remove"?v($):j($,z);return t.jsxs(vt,{wide:!0,children:[t.jsx(gs,{title:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsxs(Te,{to:oe.groups(e,n),className:"inline-flex items-center gap-1 text-fg-muted hover:text-fg",children:[t.jsx(uu,{className:"size-4"})," Groups"]}),t.jsx("span",{className:"text-fg-subtle",children:"/"}),t.jsx(Iu,{className:"size-4 text-pro","aria-hidden":!0}),t.jsx("span",{className:"font-mono",children:r})]}),description:`Jobs waiting in group ${r} of ${n}, in the order Pro will serve them: the group's list first, then its prioritized jobs.`}),t.jsxs("div",{className:"card overflow-hidden",children:[t.jsx(qf,{connectionId:e,queue:n,jobs:(y=m.data)==null?void 0:y.jobs,loading:m.isLoading,error:m.error,canOperate:i,onAction:C,pendingId:g.isPending?(b=g.variables)==null?void 0:b.jobId:null,emptyText:"No jobs waiting in this group"}),t.jsx("div",{className:"border-t border-border px-3 py-2",children:t.jsx(Hu,{page:o,pageSize:d,total:((k=m.data)==null?void 0:k.total)??0,count:(S=m.data)==null?void 0:S.jobs.length,onPage:c,onPageSize:$=>(h($),c(1))})})]}),t.jsx(sn,{open:p!==null,onClose:()=>v(null),title:"Remove job",description:`Remove job ${p??""} from ${n}? This cannot be undone.`,confirmText:"Remove",danger:!0,loading:g.isPending,onConfirm:()=>{p&&j(p,"remove"),v(null)}})]})}function uj({open:e,onClose:n,initial:r,onSave:i,saving:o,title:c="Assign queues",description:d="Pick queues from any connection. A queue can live in several folders."}){const{byConnection:h,isLoading:m}=rl(),[g,p]=N.useState(""),[v,j]=N.useState(new Set),C=k=>`${k.connectionId} ${k.queueName}`;N.useEffect(()=>{e&&j(new Set(r.map(C)))},[e,r]);const y=k=>j(S=>{const $=new Set(S),z=C(k);return $.has(z)?$.delete(z):$.add(z),$}),b=g.trim().toLowerCase();return t.jsxs(En,{open:e,onClose:n,size:"md",title:c,description:d,footer:t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"mr-auto text-xs text-fg-muted",children:[v.size," selected"]}),t.jsx(H,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),t.jsx(H,{variant:"primary",size:"sm",loading:o,onClick:()=>i([...v].map(k=>{const[S,$]=k.split(" ");return{connectionId:S,queueName:$}})),children:"Save"})]}),children:[t.jsx(Ee,{leftIcon:t.jsx(Gn,{}),placeholder:"Filter queues…",value:g,onChange:k=>p(k.target.value),autoFocus:!0,"aria-label":"Filter queues"}),t.jsxs("div",{className:"mt-3 max-h-[50vh] space-y-3 overflow-y-auto",children:[m&&t.jsx(nl,{}),h.map(({connection:k,queues:S})=>{const $=S.filter(z=>!b||z.name.toLowerCase().includes(b)).sort((z,E)=>z.name.localeCompare(E.name));return $.length===0?null:t.jsxs("div",{children:[t.jsxs("div",{className:"mb-1 flex items-center justify-between text-[11px] font-semibold tracking-wider text-fg-subtle uppercase",children:[k.name,t.jsx("button",{type:"button",className:"font-normal tracking-normal normal-case hover:text-fg",onClick:()=>j(z=>{const E=new Set(z),T=$.every(M=>E.has(C({connectionId:k.id,queueName:M.name})));return $.forEach(M=>T?E.delete(C({connectionId:k.id,queueName:M.name})):E.add(C({connectionId:k.id,queueName:M.name}))),E}),children:"toggle all"})]}),t.jsx("div",{className:"grid gap-1 sm:grid-cols-2",children:$.map(z=>{const E={connectionId:k.id,queueName:z.name};return t.jsx(mm,{label:z.name,checked:v.has(C(E)),onChange:()=>y(E),className:"rounded px-1.5 py-1 hover:bg-surface-2"},z.name)})})]},k.id)})]})]})}const Pu=["#5b8def","#3fb950","#d29922","#f85149","#a371f7","#39c5bb","#f778ba","#9aa3ad"];function L_(){const{has:e}=jt();return e("folders")?t.jsx(F_,{}):t.jsx(La,{feature:"folders"})}function F_(){const{isOperator:e}=yt(),n=Wr(),[r,i]=N.useState(null),[o,c]=N.useState(null),d=n.data??[],h=N.useMemo(()=>d.filter(p=>!p.parentId).sort((p,v)=>p.position-v.position||p.name.localeCompare(v.name)),[d]),m=p=>d.filter(v=>v.parentId===p).sort((v,j)=>v.position-j.position||v.name.localeCompare(j.name)),g=d.find(p=>p.id===r)??null;return N.useEffect(()=>{!r&&h[0]&&i(h[0].id)},[h,r]),n.isLoading?t.jsx(vt,{children:t.jsx(nl,{})}):t.jsxs(vt,{children:[t.jsx(gs,{title:"Folders",description:"Group queues from any connection into folders. Nested one level. The sidebar mirrors this tree.",actions:e&&t.jsx(H,{variant:"primary",size:"sm",leftIcon:t.jsx(Ig,{}),onClick:()=>c({parentId:null}),children:"New folder"})}),d.length===0?t.jsx(rn,{icon:t.jsx(Ys,{}),title:"No folders yet",description:"Without folders the sidebar shows one implicit folder per connection. Create a folder to organise queues by team, product or environment.",action:e&&t.jsx(H,{variant:"primary",leftIcon:t.jsx(Ig,{}),onClick:()=>c({parentId:null}),children:"Create the first folder"})}):t.jsxs("div",{className:"grid gap-4 lg:grid-cols-[280px_1fr]",children:[t.jsx("div",{className:"card p-1.5",children:h.map(p=>t.jsxs("div",{children:[t.jsx(kv,{folder:p,selected:r===p.id,onSelect:()=>i(p.id),onAddChild:e?()=>c({parentId:p.id}):void 0}),m(p.id).map(v=>t.jsx(kv,{folder:v,depth:1,selected:r===v.id,onSelect:()=>i(v.id)},v.id))]},p.id))}),t.jsx("div",{children:g?t.jsx(D_,{folder:g,allFolders:d,canEdit:e,onDeleted:()=>i(null)},g.id):t.jsx(rn,{compact:!0,title:"Select a folder"})})]}),t.jsx(U_,{open:!!o,parentId:(o==null?void 0:o.parentId)??null,roots:h,onClose:()=>c(null),onCreated:p=>i(p.id)})]})}function kv({folder:e,depth:n=0,selected:r,onSelect:i,onAddChild:o}){return t.jsxs("div",{className:F("group flex h-8 items-center gap-2 rounded-md pr-1 text-[13px]",r?"bg-surface-3 text-fg":"text-fg-muted hover:bg-surface-2 hover:text-fg"),style:{paddingLeft:8+n*16},children:[t.jsxs("button",{type:"button",onClick:i,className:"flex min-w-0 flex-1 items-center gap-2 text-left","aria-current":r||void 0,children:[t.jsx(Ys,{className:"size-4 shrink-0",style:{color:e.color??"var(--fg-subtle)"},"aria-hidden":!0}),t.jsx("span",{className:"truncate",children:e.name}),t.jsx("span",{className:"num ml-auto text-[10px] text-fg-subtle",children:e.queues.length})]}),o&&t.jsx(H,{size:"icon-xs",variant:"ghost",className:"opacity-0 group-hover:opacity-100 focus-visible:opacity-100",title:"Add subfolder","aria-label":"Add subfolder",onClick:o,children:t.jsx(Jn,{})})]})}function D_({folder:e,allFolders:n,canEdit:r,onDeleted:i}){var E;const o=C0(),c=w2(),d=_0(),{byConnection:h}=rl(),[m,g]=N.useState(!1),[p,v]=N.useState(e.name),[j,C]=N.useState(!1),[y,b]=N.useState(!1),k=n.filter(T=>T.parentId===e.id),S=()=>{const T=p.trim();if(!T||T===e.name){g(!1),v(e.name);return}o.mutate({id:e.id,input:{name:T}},{onSuccess:()=>g(!1),onError:M=>ee.error(be(M))})},$=T=>d.mutate({id:e.id,input:{queues:e.queues.filter(M=>!(M.connectionId===T.connectionId&&M.queueName===T.queueName))}},{onError:M=>ee.error(be(M))}),z=T=>{var M;return((M=h.find(O=>O.connection.id===T))==null?void 0:M.connection.name)??T};return t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"card p-4",children:[t.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[t.jsx(Ys,{className:"mt-1 size-6",style:{color:e.color??"var(--fg-subtle)"},"aria-hidden":!0}),t.jsxs("div",{className:"min-w-0 flex-1",children:[m?t.jsxs("form",{className:"flex items-center gap-2",onSubmit:T=>{T.preventDefault(),S()},children:[t.jsx(Ee,{autoFocus:!0,value:p,onChange:T=>v(T.target.value),className:"!h-8 max-w-xs","aria-label":"Folder name",onKeyDown:T=>T.key==="Escape"&&(g(!1),v(e.name))}),t.jsx(H,{size:"icon-sm",type:"submit",variant:"primary","aria-label":"Save",loading:o.isPending,children:t.jsx(Kr,{})}),t.jsx(H,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:()=>(g(!1),v(e.name)),children:t.jsx(gn,{})})]}):t.jsxs("h2",{className:"flex items-center gap-2 text-base font-semibold",children:[e.name,r&&t.jsx(H,{size:"icon-xs",variant:"ghost","aria-label":"Rename",onClick:()=>g(!0),children:t.jsx(To,{})})]}),t.jsxs("p",{className:"text-xs text-fg-muted",children:[e.parentId?`Subfolder of ${((E=n.find(T=>T.id===e.parentId))==null?void 0:E.name)??"?"}`:"Top-level folder"," · ",e.queues.length," queues",k.length>0&&` · ${k.length} subfolders`]})]}),t.jsxs(Te,{to:oe.folder(e.id),className:"inline-flex h-7 items-center gap-1.5 rounded-md border border-border px-2.5 text-xs font-medium text-fg hover:bg-surface-2",title:"Open this folder's dashboard",children:["Open folder",t.jsx(sN,{className:"size-3.5","aria-hidden":!0})]}),r&&t.jsx(H,{size:"sm",variant:"ghost",className:"hover:text-danger",leftIcon:t.jsx(ps,{}),onClick:()=>b(!0),children:"Delete"})]}),r&&t.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-4",children:[t.jsxs("div",{children:[t.jsx("span",{className:"mb-1 block text-[10px] tracking-wide text-fg-subtle uppercase",children:"Colour"}),t.jsxs("div",{className:"flex gap-1.5",role:"radiogroup","aria-label":"Folder colour",children:[Pu.map(T=>t.jsx("button",{type:"button",role:"radio","aria-checked":e.color===T,"aria-label":T,className:F("size-5 rounded-full ring-offset-2 ring-offset-surface transition-shadow",e.color===T&&"ring-2 ring-fg"),style:{background:T},onClick:()=>o.mutate({id:e.id,input:{color:T}},{onError:M=>ee.error(be(M))})},T)),t.jsx("button",{type:"button",role:"radio","aria-checked":!e.color,"aria-label":"No colour",className:F("size-5 rounded-full border border-dashed border-border-strong ring-offset-2 ring-offset-surface",!e.color&&"ring-2 ring-fg"),onClick:()=>o.mutate({id:e.id,input:{color:null}},{onError:T=>ee.error(be(T))})})]})]}),!k.length&&t.jsx(ut,{label:"Parent",className:"!h-8 w-56",value:e.parentId??"",onChange:T=>o.mutate({id:e.id,input:{parentId:T.target.value||null}},{onError:M=>ee.error(be(M))}),options:[{value:"",label:"None (top level)"},...n.filter(T=>!T.parentId&&T.id!==e.id).map(T=>({value:T.id,label:T.name}))]})]})]}),t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center justify-between border-b border-border px-4 py-2.5",children:[t.jsx("h3",{className:"text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:"Queues"}),r&&t.jsx(H,{size:"sm",leftIcon:t.jsx(Jn,{}),onClick:()=>C(!0),children:"Assign queues"})]}),e.queues.length===0?t.jsx("p",{className:"px-4 py-8 text-center text-xs text-fg-subtle",children:"No queues assigned yet."}):t.jsx("ul",{className:"divide-y divide-border",children:e.queues.map(T=>t.jsxs("li",{className:"flex items-center gap-3 px-4 py-2 text-[13px]",children:[t.jsx(Te,{to:oe.queue(T.connectionId,T.queueName),className:"font-medium hover:underline",children:T.queueName}),t.jsx(ye,{variant:"outline",size:"xs",children:z(T.connectionId)}),r&&t.jsx(H,{size:"icon-xs",variant:"ghost",className:"ml-auto hover:text-danger","aria-label":"Remove from folder",onClick:()=>$(T),children:t.jsx(gn,{})})]},`${T.connectionId}/${T.queueName}`))})]}),t.jsx(uj,{open:j,onClose:()=>C(!1),initial:e.queues,onSave:T=>d.mutate({id:e.id,input:{queues:T}},{onSuccess:()=>(C(!1),ee.success("Folder updated")),onError:M=>ee.error(be(M))}),saving:d.isPending}),t.jsx(sn,{open:y,onClose:()=>b(!1),title:`Delete "${e.name}"`,description:k.length>0?"Subfolders move up to the top level. Queues themselves are untouched.":"Queues themselves are untouched.",confirmText:"Delete folder",danger:!0,loading:c.isPending,onConfirm:()=>c.mutate(e.id,{onSuccess:()=>(b(!1),i(),ee.success("Folder deleted")),onError:T=>ee.error(be(T))})})]})}function U_({open:e,parentId:n,roots:r,onClose:i,onCreated:o}){const c=b2(),[d,h]=N.useState(""),[m,g]=N.useState(Pu[0]),[p,v]=N.useState(n??""),[j,C]=N.useState(null);N.useEffect(()=>v(n??""),[n,e]);const y=()=>{var k;const b=o0.safeParse({name:d.trim(),color:m,parentId:p||null});if(!b.success){C(((k=b.error.issues[0])==null?void 0:k.message)??"Invalid");return}c.mutate(b.data,{onSuccess:S=>{ee.success(`Folder "${S.name}" created`),o(S),i()},onError:S=>ee.error(be(S))})};return t.jsx(En,{open:e,onClose:i,size:"sm",title:"New folder",footer:t.jsxs(t.Fragment,{children:[t.jsx(H,{variant:"ghost",size:"sm",onClick:i,children:"Cancel"}),t.jsx(H,{variant:"primary",size:"sm",onClick:y,loading:c.isPending,children:"Create"})]}),children:t.jsxs("form",{className:"space-y-3",onSubmit:b=>{b.preventDefault(),y()},children:[t.jsx(Ee,{label:"Name",autoFocus:!0,value:d,onChange:b=>h(b.target.value),error:j}),t.jsxs("div",{children:[t.jsx("span",{className:"mb-1 block text-xs font-medium text-fg-muted",children:"Colour"}),t.jsx("div",{className:"flex gap-1.5",role:"radiogroup","aria-label":"Folder colour",children:Pu.map(b=>t.jsx("button",{type:"button",role:"radio","aria-checked":m===b,"aria-label":b,className:F("size-5 rounded-full ring-offset-2 ring-offset-surface",m===b&&"ring-2 ring-fg"),style:{background:b},onClick:()=>g(b)},b))})]}),t.jsx(ut,{label:"Parent folder",value:p,onChange:b=>v(b.target.value),options:[{value:"",label:"None (top level)"},...r.map(b=>({value:b.id,label:b.name}))],hint:"Folders nest one level deep."})]})})}const Q_=["waiting","active","completed","failed","delayed"];function B_(e){var m,g,p,v;const n={waiting:0,active:0,completed:0,failed:0,delayed:0,prioritized:0,paused:0,"waiting-children":0};let r=0,i=0,o=0,c=null;const d=[];for(const{queue:j}of e){for(const C of Object.keys(n))n[C]+=j.counts[C]??0;r+=((m=j.rates)==null?void 0:m.completed)??0,i+=((g=j.rates)==null?void 0:g.failed)??0,(p=j.rates)!=null&&p.windowMinutes&&(c=j.rates.windowMinutes),j.metrics&&j.metrics.completed.length>0&&(o+=1),(v=j.rates)!=null&&v.retentionSkewed&&d.push(j.name)}const h=r+i;return{counts:n,completed:r,failed:i,successPct:h>0?r/h*100:null,completedSeries:fv(e.map(j=>{var C;return(C=j.queue.metrics)==null?void 0:C.completed})),failedSeries:fv(e.map(j=>{var C;return(C=j.queue.metrics)==null?void 0:C.failed})),withMetrics:o,windowMinutes:c,skewedQueues:d}}function V_({entries:e,className:n}){const r=N.useMemo(()=>B_(e),[e]),i=r.windowMinutes?r.windowMinutes%60===0?`${r.windowMinutes/60}h`:`${r.windowMinutes}m`:"1h",o=r.completedSeries.length>1,c=r.skewedQueues.length>0,d=c?`${r.skewedQueues.length===1?`Queue "${r.skewedQueues[0]}"`:`${r.skewedQueues.length} queues (${r.skewedQueues.slice(0,3).join(", ")}${r.skewedQueues.length>3?", …":""})`} feed this total. ${vm}`:"";return t.jsxs("div",{className:F("grid gap-2 sm:grid-cols-3 xl:grid-cols-7",n),children:[Q_.map(h=>{const m=ot[h],g=r.counts[h];return t.jsxs("div",{className:"card px-3 py-2.5",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-medium tracking-wider text-fg-subtle uppercase",children:[t.jsx("span",{className:F("status-dot size-1.5",m.dotClass),"aria-hidden":!0}),m.label]}),t.jsx("div",{className:F("num text-2xl leading-tight font-semibold",g>0?m.textClass:"text-fg-muted"),children:ht(g)})]},h)}),t.jsxs("div",{className:"card px-3 py-2.5",children:[t.jsxs("div",{className:"flex items-center gap-1 text-[10px] font-medium tracking-wider text-fg-subtle uppercase",children:["Success · ",i,c&&t.jsx(Ce,{content:d,className:"ml-auto",children:t.jsx(Xn,{className:"size-3 text-warning","aria-label":"This total is unreliable: some queues prune completed jobs"})})]}),t.jsx(Ce,{content:`${W(r.completed)} completed · ${W(r.failed)} failed across ${e.length} ${e.length===1?"queue":"queues"}${c?`
547
+
548
+ ${d}`:""}`,children:t.jsx("div",{className:F("num text-2xl leading-tight font-semibold",c&&"opacity-50",r.successPct==null?"text-fg-subtle":r.successPct<90?"text-state-failed":"text-state-completed"),children:r.successPct==null?"—":_n(r.successPct)})}),t.jsx("div",{className:F("mt-1 flex h-1.5 w-full overflow-hidden rounded-full bg-surface-3",c&&"opacity-50"),role:"img","aria-label":r.successPct==null?"No finished jobs":`${_n(r.successPct)} success${c?", unreliable: some queues prune completed jobs":""}`,children:r.successPct!=null&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"h-full",style:{width:`${r.successPct}%`,background:ot.completed.fg}}),t.jsx("span",{className:"h-full flex-1",style:{background:ot.failed.fg,opacity:r.successPct>=100?0:1}})]})})]}),t.jsxs("div",{className:"card flex flex-col px-3 py-2.5",children:[t.jsx("div",{className:"text-[10px] font-medium tracking-wider text-fg-subtle uppercase",children:"Completed / min"}),o?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mt-1 block",style:{color:ot.completed.fg},children:t.jsx(Gi,{values:r.completedSeries,width:140,height:30,title:"Combined completed per minute",className:"w-full"})}),t.jsxs("span",{className:"mt-auto text-[10px] text-fg-subtle",children:[W(r.withMetrics)," of ",W(e.length)," queues report metrics"]})]}):t.jsx("span",{className:"mt-2 text-[11px] leading-relaxed text-fg-subtle",children:"No queue in this folder collects metrics."})]})]})}function H_(e){let n="";for(const r of e)r==="*"?n+=".*":r==="?"?n+=".":n+=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^${n}$`,"i")}function K_(e,n){const r=e.trim();if(!r)return!1;try{return H_(r).test(n)}catch{return!1}}const Yc="__any__";function W_({open:e,onClose:n,existing:r,onImport:i,saving:o}){const{byConnection:c}=rl(),[d,h]=N.useState(""),[m,g]=N.useState(Yc),p=N.useMemo(()=>new Set(r.map(y=>`${y.connectionId} ${y.queueName}`)),[r]),v=N.useMemo(()=>{const y=d.trim();if(!y)return[];const b=[];for(const{connection:k,queues:S}of c)if(!(m!==Yc&&k.id!==m))for(const $ of S){if(!K_(y,$.name))continue;const z={connectionId:k.id,queueName:$.name};b.push({ref:z,connectionName:k.name,already:p.has(`${k.id} ${$.name}`)})}return b.sort((k,S)=>k.ref.queueName.localeCompare(S.ref.queueName))},[d,m,c,p]),j=v.filter(y=>!y.already),C=()=>{i([...r,...j.map(y=>y.ref)])};return t.jsx(En,{open:e,onClose:n,size:"md",title:"Import matching queues",description:"Add every queue whose name matches a pattern, in one go.",footer:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mr-auto text-xs text-fg-muted",children:d.trim()===""?"Type a pattern to preview":`${W(j.length)} to add · ${W(v.length-j.length)} already in folder`}),t.jsx(H,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),t.jsxs(H,{variant:"primary",size:"sm",leftIcon:t.jsx(gf,{}),loading:o,disabled:j.length===0,onClick:C,children:["Import ",j.length>0?W(j.length):""]})]}),children:t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"grid gap-3 sm:grid-cols-[1fr_200px]",children:[t.jsx(Ee,{label:"Pattern",mono:!0,autoFocus:!0,placeholder:"channels*",value:d,onChange:y=>h(y.target.value),hint:"* matches any run of characters, ? matches exactly one. Case-insensitive."}),t.jsx(ut,{label:"Connection",value:m,onChange:y=>g(y.target.value),options:[{value:Yc,label:"Any connection"},...c.map(y=>({value:y.connection.id,label:y.connection.name}))]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1.5 text-[11px] text-fg-subtle",children:[t.jsx("span",{children:"Examples:"}),["channels*","*-retry","email-?"].map(y=>t.jsx("button",{type:"button",onClick:()=>h(y),className:"rounded border border-border bg-surface-2 px-1.5 py-0.5 font-mono text-fg-muted hover:text-fg",children:y},y))]}),t.jsxs("div",{className:"rounded-md border border-border",children:[t.jsxs("div",{className:"flex items-center justify-between border-b border-border bg-surface-2/50 px-3 py-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle uppercase",children:["Preview",t.jsxs("span",{className:"num font-normal tracking-normal normal-case",children:[W(v.length)," matching"]})]}),t.jsx("div",{className:"max-h-64 overflow-y-auto",children:d.trim()===""?t.jsx("p",{className:"px-3 py-6 text-center text-xs text-fg-subtle",children:"Nothing to preview yet."}):v.length===0?t.jsxs("p",{className:"px-3 py-6 text-center text-xs text-fg-subtle",children:["No queue matches ",t.jsx("span",{className:"font-mono text-fg-muted",children:d.trim()}),m!==Yc&&" on this connection","."]}):t.jsx("ul",{className:"divide-y divide-border",children:v.map(y=>t.jsxs("li",{className:"flex items-center gap-2 px-3 py-1.5 text-xs",children:[t.jsx("span",{className:"truncate font-mono text-fg",children:y.ref.queueName}),t.jsx(ye,{variant:"outline",size:"xs",children:y.connectionName}),y.already&&t.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-fg-subtle",children:"already in folder"})]},`${y.ref.connectionId}/${y.ref.queueName}`))})})]}),t.jsxs("p",{className:"flex items-start gap-2 rounded-md border border-border bg-surface-2/50 px-3 py-2 text-[11px] leading-relaxed text-fg-muted",children:[t.jsx(Yi,{className:"mt-0.5 size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}),t.jsxs("span",{children:["Imports the queues matching this pattern ",t.jsx("strong",{className:"text-fg",children:"now"}),". New queues that appear later are"," ",t.jsx("strong",{className:"text-fg",children:"not"})," added automatically — run the import again when they show up."]})]})]})})}function Z_({open:e,onClose:n,folder:r,allFolders:i}){const o=C0(),[c,d]=N.useState(r.name),[h,m]=N.useState(r.color),[g,p]=N.useState(r.parentId??""),[v,j]=N.useState(null),C=i.some(k=>k.parentId===r.id),y=i.filter(k=>!k.parentId&&k.id!==r.id),b=()=>{var S;const k=bk.safeParse({name:c.trim(),color:h,parentId:g||null});if(!k.success){j(((S=k.error.issues[0])==null?void 0:S.message)??"Invalid");return}o.mutate({id:r.id,input:k.data},{onSuccess:()=>{ee.success("Folder updated"),n()},onError:$=>ee.error(be($))})};return t.jsx(En,{open:e,onClose:n,size:"sm",title:"Edit folder",footer:t.jsxs(t.Fragment,{children:[t.jsx(H,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),t.jsx(H,{variant:"primary",size:"sm",onClick:b,loading:o.isPending,children:"Save changes"})]}),children:t.jsxs("form",{className:"space-y-3",onSubmit:k=>{k.preventDefault(),b()},children:[t.jsx(Ee,{label:"Name",autoFocus:!0,value:c,onChange:k=>d(k.target.value),error:v}),t.jsxs("div",{children:[t.jsx("span",{className:"mb-1 block text-xs font-medium text-fg-muted",children:"Colour"}),t.jsxs("div",{className:"flex flex-wrap gap-1.5",role:"radiogroup","aria-label":"Folder colour",children:[Pu.map(k=>t.jsx("button",{type:"button",role:"radio","aria-checked":h===k,"aria-label":k,className:F("size-5 rounded-full ring-offset-2 ring-offset-surface transition-shadow",h===k&&"ring-2 ring-fg"),style:{background:k},onClick:()=>m(k)},k)),t.jsx("button",{type:"button",role:"radio","aria-checked":!h,"aria-label":"No colour",className:F("size-5 rounded-full border border-dashed border-border-strong ring-offset-2 ring-offset-surface",!h&&"ring-2 ring-fg"),onClick:()=>m(null)})]})]}),t.jsx(ut,{label:"Parent folder",value:g,disabled:C,onChange:k=>p(k.target.value),options:[{value:"",label:"None (top level)"},...y.map(k=>({value:k.id,label:k.name}))],hint:C?"This folder has subfolders, so it must stay top-level.":"Folders nest one level deep."})]})})}function G_(){const{has:e}=jt();return e("folders")?t.jsx(J_,{}):t.jsx(La,{feature:"folders"})}function J_(){const{folderId:e=""}=Fn(),{isOperator:n}=yt(),{has:r,gate:i}=jt(),o=Wr(),{byConnection:c,isLoading:d}=rl(),h=_0(),[m,g]=N.useState(null),{sort:p,setSort:v,filter:j,setFilter:C}=gm(`folder.${e}`,Sm,km),y=o.data??[],b=y.find(O=>O.id===e)??null,{entries:k,missing:S}=N.useMemo(()=>{const O=[],Q=[];for(const V of(b==null?void 0:b.queues)??[]){const q=c.find(ce=>ce.connection.id===V.connectionId),B=q==null?void 0:q.queues.find(ce=>ce.name===V.queueName);q&&B?O.push({connection:q.connection,queue:B}):Q.push(V)}return{entries:O,missing:Q}},[b,c]),$=N.useMemo(()=>k.filter(O=>xm(O,j)),[k,j]),z=(O,Q,V=!0)=>{b&&h.mutate({id:b.id,input:{queues:O}},{onSuccess:()=>{ee.success(Q),V&&g(null)},onError:q=>ee.error(be(q))})},E=O=>z(((b==null?void 0:b.queues)??[]).filter(Q=>!(Q.connectionId===O.connectionId&&Q.queueName===O.queueName)),`${O.queueName} removed from ${(b==null?void 0:b.name)??"folder"}`,!1);if(o.isLoading)return t.jsx(vt,{wide:!0,children:t.jsx(nl,{})});if(!b)return t.jsx(vt,{wide:!0,children:t.jsx(rn,{icon:t.jsx(Ys,{}),title:"Folder not found",description:"It may have been deleted.",action:t.jsx(Te,{to:oe.folders,className:"text-accent hover:underline",children:"Back to folders"})})});const T=b.parentId?y.find(O=>O.id===b.parentId):null,M=b.queues.length===0;return t.jsxs(vt,{wide:!0,children:[t.jsxs("div",{className:"mb-4 flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"size-3 shrink-0 rounded-full ring-2 ring-inset ring-white/10",style:{background:b.color??"var(--fg-subtle)"},"aria-hidden":!0}),t.jsx("h1",{className:"truncate text-lg font-semibold tracking-tight",children:b.name})]}),t.jsxs("p",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 text-xs text-fg-muted",children:[T&&t.jsxs(t.Fragment,{children:[t.jsx(Te,{to:`/folders/${encodeURIComponent(T.id)}`,className:"hover:underline",children:T.name}),t.jsx("span",{className:"text-fg-subtle",children:"/"})]}),t.jsxs("span",{className:"num",children:[W(b.queues.length)," ",b.queues.length===1?"queue":"queues"]}),S.length>0&&t.jsxs("span",{className:"text-state-waiting",title:S.map(O=>O.queueName).join(", "),children:["· ",W(S.length)," not found"]}),t.jsx("span",{className:"text-fg-subtle",children:"·"}),t.jsx(Te,{to:oe.folders,className:"hover:underline",children:"Manage folders"})]})]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n&&t.jsx(H,{size:"sm",variant:"secondary",leftIcon:t.jsx(To,{}),onClick:()=>g("edit"),children:"Edit"}),n&&t.jsx(H,{size:"sm",variant:"secondary",leftIcon:t.jsx(gf,{}),onClick:()=>g("import"),title:"Import queues matching a pattern",children:"Import matching"}),n&&t.jsx(H,{size:"sm",variant:"primary",leftIcon:t.jsx(Jn,{}),onClick:()=>g("add"),children:"Add queue"}),t.jsx(H,{size:"sm",leftIcon:t.jsx(Xi,{}),onClick:()=>i("alerts",()=>g("alert")),title:"Alert on every queue in this folder",children:"Create alert"})]})]}),t.jsx(V_,{entries:k,className:"mb-4"}),M?t.jsx("div",{className:"card",children:t.jsx(rn,{icon:t.jsx(Ys,{}),title:"This folder is empty",description:"Add queues by hand, or import every queue whose name matches a pattern like channels* or *-retry.",action:n&&t.jsxs(t.Fragment,{children:[t.jsx(H,{variant:"primary",leftIcon:t.jsx(Jn,{}),onClick:()=>g("add"),children:"Add queue"}),t.jsx(H,{leftIcon:t.jsx(gf,{}),onClick:()=>g("import"),children:"Import matching queues"})]})})}):t.jsxs("section",{className:"space-y-3","aria-label":"Queues in this folder",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsx("h2",{className:"text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:"Queues"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Nm,{value:j,onChange:C,"aria-label":"Filter queues in this folder"}),t.jsxs("span",{className:"num whitespace-nowrap text-xs text-fg-subtle",children:[$.length," of ",k.length]})]})]}),d&&k.length===0?t.jsx(wm,{}):$.length>0?t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:"repeat(auto-fill, minmax(230px, 1fr))"},children:$.map(O=>t.jsx(X_,{entry:O,onRemove:n?()=>E({connectionId:O.connection.id,queueName:O.queue.name}):void 0,removing:h.isPending},Pa(O)))}):null,t.jsx("div",{className:"card overflow-hidden",children:t.jsx(Cm,{rows:$,showConnection:!0,sort:p,onSort:v,message:d&&k.length===0?"Loading queues…":j?"No queue matches the filter":"None of this folder's queues could be resolved on their connections."})}),S.length>0&&t.jsxs("div",{className:"card px-4 py-3",children:[t.jsx("h3",{className:"mb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle uppercase",children:"Not found on their connection"}),t.jsx("ul",{className:"flex flex-wrap gap-2",children:S.map(O=>{var Q;return t.jsxs("li",{className:"flex items-center gap-1.5 rounded border border-border bg-surface-2 px-2 py-1 text-xs",children:[t.jsx("span",{className:"font-mono text-fg-muted line-through",children:O.queueName}),t.jsx(ye,{variant:"outline",size:"xs",children:((Q=c.find(V=>V.connection.id===O.connectionId))==null?void 0:Q.connection.name)??O.connectionId}),n&&t.jsx(H,{size:"icon-xs",variant:"ghost",className:"hover:text-danger","aria-label":`Remove ${O.queueName}`,onClick:()=>E(O),children:t.jsx(gn,{})})]},`${O.connectionId}/${O.queueName}`)})}),t.jsx("p",{className:"mt-2 text-[11px] text-fg-subtle",children:"These queues are referenced by the folder but were not discovered on their connection — renamed, obliterated, or the connection is down."})]})]}),n&&m==="edit"&&t.jsx(Z_,{open:!0,onClose:()=>g(null),folder:b,allFolders:y}),n&&t.jsx(uj,{open:m==="add",onClose:()=>g(null),initial:b.queues,saving:h.isPending,onSave:O=>z(O,"Folder updated"),title:`Add queues to ${b.name}`}),n&&t.jsx(W_,{open:m==="import",onClose:()=>g(null),existing:b.queues,saving:h.isPending,onImport:O=>z(O,`Imported into ${b.name}`)}),m==="alert"&&r("alerts")&&t.jsx(Ku,{open:!0,onClose:()=>g(null),alert:null,initialScope:{type:"folder",folderId:b.id}})]})}function X_({entry:e,onRemove:n,removing:r}){return t.jsxs("div",{className:"group/card relative",children:[t.jsx(Vu,{entry:e,showConnection:!0}),n&&t.jsx(H,{size:"icon-xs",variant:"ghost",disabled:r,onClick:n,"aria-label":`Remove ${e.queue.name} from this folder`,title:"Remove from folder",className:"absolute top-2 right-8 z-10 bg-surface/90 opacity-0 backdrop-blur-sm transition-opacity group-hover/card:opacity-100 focus-visible:opacity-100 hover:text-danger",children:t.jsx(gn,{})})]})}const If={admin:"Everything, including connections, users, license, drain and obliterate.",operator:"Manage jobs and queues, alerts, folders and flow edges. No settings.",viewer:"Read-only access to queues, jobs, alerts and flows."};function Y_(){const{has:e}=jt();return e("users")?t.jsx(f0,{role:"admin",children:t.jsx(e3,{})}):t.jsx(La,{feature:"users"})}function e3(){const{user:e}=yt(),n=P2(),r=R2(),[i,o]=N.useState(!1),[c,d]=N.useState(null),h=[...n.data??[]].sort((p,v)=>+!!p.disabledAt-+!!v.disabledAt||p.name.localeCompare(v.name)),m=h.filter(p=>p.role==="admin"&&!p.disabledAt).length,g=(p,v)=>r.mutate({id:p.id,input:{disabled:v}},{onSuccess:()=>{d(null),ee.success(v?`${p.name} disabled`:`${p.name} re-enabled`,v?"Their sessions are revoked; the account keeps its history.":"They can sign in again.")},onError:j=>ee.error(be(j))});return t.jsxs(vt,{children:[t.jsx(gs,{title:"Users",description:"Roles are enforced on every API call, not only in the UI.",actions:t.jsx(H,{variant:"primary",size:"sm",leftIcon:t.jsx(TN,{}),onClick:()=>o(!0),children:"Invite user"})}),t.jsx("div",{className:"card overflow-hidden",children:t.jsxs(fs,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(me,{children:"Name"}),t.jsx(me,{children:"Email"}),t.jsx(me,{className:"w-40",children:"Role"}),t.jsx(me,{children:"Created"}),t.jsx(me,{children:"Last login"}),t.jsx(me,{align:"right",children:t.jsx("span",{className:"sr-only",children:"Actions"})})]})}),t.jsxs("tbody",{children:[n.isLoading&&t.jsx(xt,{colSpan:6,children:t.jsx(Dt,{label:"Loading users…"})}),n.isError&&t.jsx(xt,{colSpan:6,className:"text-danger",children:be(n.error)}),h.map(p=>{var k;const v=p.id===(e==null?void 0:e.id),j=!!p.disabledAt,C=p.role==="admin"&&!j&&m<=1,y=v?"You cannot disable your own account":C?"Cannot disable the last admin":null,b=r.isPending&&((k=r.variables)==null?void 0:k.id)===p.id;return t.jsxs("tr",{className:F(j&&"text-fg-muted"),children:[t.jsxs(pe,{className:"font-medium",children:[t.jsx("span",{className:F(j&&"line-through decoration-fg-subtle"),children:p.name}),v&&t.jsx(ye,{variant:"outline",size:"xs",className:"ml-1.5",children:"you"}),j&&t.jsx(Ce,{content:t.jsxs(t.Fragment,{children:["Disabled ",t.jsx(Wt,{value:p.disabledAt,withAbsolute:!0}),". Cannot sign in; sessions revoked."]}),side:"bottom",children:t.jsx(ye,{variant:"neutral",size:"xs",className:"ml-1.5",children:"disabled"})})]}),t.jsx(pe,{muted:!0,children:p.email}),t.jsx(pe,{children:t.jsx(Ce,{content:v?"Ask another admin to change your role":C?"Promote someone else to admin first":If[p.role],block:!0,children:t.jsx(ut,{"aria-label":`Role of ${p.name}`,className:"!h-7 text-xs",value:p.role,disabled:v||C||j||b,onChange:S=>r.mutate({id:p.id,input:{role:S.target.value}},{onSuccess:()=>ee.success(`${p.name} is now ${S.target.value}`),onError:$=>ee.error(be($))}),options:wu.map(S=>({value:S,label:S}))})})}),t.jsx(pe,{muted:!0,children:t.jsx(Wt,{value:p.createdAt})}),t.jsx(pe,{muted:!0,children:t.jsx(Wt,{value:p.lastLoginAt,emptyText:"never"})}),t.jsx(pe,{align:"right",children:j?t.jsx(Ce,{content:"Re-enable: they can sign in again with the same account",side:"left",children:t.jsx(H,{size:"xs",variant:"ghost",leftIcon:t.jsx(MN,{}),"aria-label":`Re-enable ${p.name}`,loading:b,onClick:()=>g(p,!1),children:"Enable"})}):t.jsx(Ce,{content:y??"Disable: revokes access, keeps the account and its history",side:"left",children:t.jsx(H,{size:"icon-xs",variant:"ghost",className:"hover:text-danger","aria-label":`Disable ${p.name}`,disabled:!!y||b,onClick:()=>d(p),children:t.jsx(qN,{})})})})]},p.id)})]})]})}),t.jsx("div",{className:"mt-4 grid gap-2 text-xs text-fg-muted sm:grid-cols-3",children:wu.map(p=>t.jsxs("div",{className:"card p-3",children:[t.jsx(ye,{variant:p==="admin"?"pro":p==="operator"?"info":"neutral",className:"mb-1.5",children:p}),t.jsx("p",{children:If[p]})]},p))}),t.jsx(t3,{open:i,onClose:()=>o(!1)}),t.jsx(sn,{open:!!c,onClose:()=>d(null),title:`Disable ${c==null?void 0:c.name}`,description:`${c==null?void 0:c.email} loses access immediately: active sessions are revoked and password or SSO sign-in is refused. The account and its audit history stay, and you can re-enable it any time.`,confirmText:"Disable user",danger:!0,loading:r.isPending,onConfirm:()=>c&&g(c,!0)})]})}function Sv(){const e="ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789",n=new Uint8Array(16);return crypto.getRandomValues(n),Array.from(n,r=>e[r%e.length]).join("")}function t3({open:e,onClose:n}){const r=E2(),{has:i}=jt(),o=i("sso"),[c,d]=N.useState({name:"",email:"",role:"viewer",password:Sv()}),[h,m]=N.useState(!1),[g,p]=N.useState({}),v=C=>y=>d(b=>({...b,[C]:y.target.value})),j=()=>{const C={name:c.name.trim(),email:c.email.trim(),role:c.role,...h?{}:{password:c.password}},y=mk.safeParse(C);if(!y.success){const b={};for(const k of y.error.issues)b[String(k.path[0])]=k.message;p(b);return}r.mutate(y.data,{onSuccess:b=>{ee.success(`${b.name} invited`,h?"They can now sign in with SSO using that email.":"Share the temporary password with them over a secure channel."),n()},onError:b=>ee.error(be(b))})};return t.jsx(En,{open:e,onClose:n,size:"sm",title:"Invite user",description:h?"The account is created without a password; they sign in through your identity provider.":"There is no email delivery: copy the temporary password and share it yourself.",footer:t.jsxs(t.Fragment,{children:[t.jsx(H,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),t.jsx(H,{variant:"primary",size:"sm",onClick:j,loading:r.isPending,children:"Create user"})]}),children:t.jsxs("form",{className:"space-y-3",onSubmit:C=>{C.preventDefault(),j()},children:[t.jsx(Ee,{label:"Name",autoFocus:!0,value:c.name,onChange:v("name"),error:g.name}),t.jsx(Ee,{label:"Email",type:"email",value:c.email,onChange:v("email"),error:g.email}),t.jsx(ut,{label:"Role",value:c.role,onChange:v("role"),options:wu.map(C=>({value:C,label:C})),hint:If[c.role]}),o&&t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx(Zi,{checked:h,onChange:m,label:"SSO only (no password)"}),t.jsx("button",{type:"button",className:"text-xs font-medium text-fg",onClick:()=>m(!h),children:"SSO only (no password)"})]}),h?t.jsx("p",{className:"rounded-md border border-border bg-surface-2 px-3 py-2 text-xs text-fg-muted",children:"This account will have no password and can only sign in through an identity provider. Make sure the email matches the one your IdP sends."}):t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx(Ee,{label:"Temporary password",mono:!0,value:c.password,onChange:v("password"),error:g.password,wrapperClassName:"flex-1",autoComplete:"off",spellCheck:!1}),t.jsx(H,{size:"icon",variant:"ghost","aria-label":"Generate password",title:"Generate",onClick:()=>d(C=>({...C,password:Sv()})),children:t.jsx(Jf,{})})]})]})})}const n3=50,s3=new Set(Rk);function r3(){const{has:e}=jt();return e("audit")?t.jsx(f0,{role:"admin",children:t.jsx(i3,{})}):t.jsx(La,{feature:"audit"})}function a3(){const[e,n]=Po();return[N.useMemo(()=>{const c=e.get("action"),d=e.get("result");return{actorId:e.get("actorId")||void 0,action:c&&sm.includes(c)?c:void 0,connectionId:e.get("connectionId")||void 0,queueName:e.get("queueName")||void 0,jobId:e.get("jobId")||void 0,result:d==="ok"||d==="error"?d:void 0,from:e.get("from")||void 0,to:e.get("to")||void 0}},[e]),c=>{n(d=>{const h=new URLSearchParams(d);for(const[m,g]of Object.entries(c))g?h.set(m,g):h.delete(m);return h},{replace:!0})},()=>n(new URLSearchParams,{replace:!0})]}const Cv=(e,n)=>e?new Date(`${e}T${n?"23:59:59.999":"00:00:00.000"}Z`).toISOString():void 0,_v=e=>e?e.slice(0,10):"";function i3(){var v;const[e,n,r]=a3(),i=xs(),o=T2(),c=M2(e,n3),[d,h]=N.useState(null),m=((v=c.data)==null?void 0:v.pages.flatMap(j=>j.entries))??[],g=Object.values(e).filter(Boolean).length,p=j=>{var C,y;return((y=(C=i.data)==null?void 0:C.find(b=>b.id===j))==null?void 0:y.name)??null};return t.jsxs(vt,{wide:!0,children:[t.jsx(gs,{title:"Audit log",description:"Every mutating action, who did it and whether it worked. Append-only: nothing here can be edited or deleted from the UI.",actions:t.jsxs(t.Fragment,{children:[g>0&&t.jsx(H,{size:"sm",variant:"ghost",leftIcon:t.jsx(gn,{}),onClick:r,children:"Clear filters"}),t.jsxs("a",{href:q2(e),className:"inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-border bg-surface-2 px-2.5 text-xs font-medium text-fg hover:border-border-strong hover:bg-surface-3 [&_svg]:size-3.5",children:[t.jsx(fN,{"aria-hidden":!0}),"Export CSV"]})]})}),t.jsxs("div",{className:"card mb-3 flex flex-wrap items-end gap-2 p-3",children:[t.jsx(ut,{label:"Who",className:"!h-7 w-44 text-xs",value:e.actorId??"",onChange:j=>n({actorId:j.target.value}),options:[{value:"",label:"Anyone"},...(o.data??[]).filter(j=>j.id).map(j=>({value:j.id,label:j.name??j.email??j.id}))]}),t.jsx(ut,{label:"Action",className:"!h-7 w-52 text-xs",value:e.action??"",onChange:j=>n({action:j.target.value}),options:[{value:"",label:"Any action"},...sm.map(j=>({value:j,label:`${rm[j]} (${j})`}))]}),t.jsx(ut,{label:"Connection",className:"!h-7 w-40 text-xs",value:e.connectionId??"",onChange:j=>n({connectionId:j.target.value}),options:[{value:"",label:"Any connection"},...(i.data??[]).map(j=>({value:j.id,label:j.name}))]}),t.jsx(Ee,{label:"Queue",className:"!h-7 w-40 text-xs",placeholder:"exact name",value:e.queueName??"",onChange:j=>n({queueName:j.target.value})}),t.jsx(ut,{label:"Result",className:"!h-7 w-32 text-xs",value:e.result??"",onChange:j=>n({result:j.target.value}),options:[{value:"",label:"Any result"},{value:"ok",label:"ok"},{value:"error",label:"refused / failed"}]}),t.jsx(Ee,{label:"From",type:"date",className:"!h-7 w-36 text-xs",value:_v(e.from),onChange:j=>n({from:Cv(j.target.value,!1)})}),t.jsx(Ee,{label:"To",type:"date",className:"!h-7 w-36 text-xs",value:_v(e.to),onChange:j=>n({to:Cv(j.target.value,!0)})}),e.jobId&&t.jsxs(ye,{variant:"outline",mono:!0,className:"mb-1",children:["job ",e.jobId,t.jsx("button",{type:"button","aria-label":"Clear job filter",onClick:()=>n({jobId:void 0}),children:t.jsx(gn,{className:"size-3"})})]})]}),t.jsx("div",{className:"card overflow-hidden",children:t.jsxs(fs,{dense:!0,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(me,{className:"w-8"}),t.jsx(me,{className:"w-32",children:"When"}),t.jsx(me,{className:"w-56",children:"Who"}),t.jsx(me,{className:"w-56",children:"Action"}),t.jsx(me,{children:"Target"}),t.jsx(me,{className:"w-28",children:"Result"}),t.jsx(me,{className:"w-32",children:"IP"})]})}),t.jsxs("tbody",{children:[c.isLoading&&t.jsx(xt,{colSpan:7,children:t.jsx(Dt,{label:"Loading the audit log…"})}),c.isError&&t.jsx(xt,{colSpan:7,className:"text-danger",children:be(c.error)}),!c.isLoading&&!c.isError&&m.length===0&&t.jsx(xt,{colSpan:7,children:t.jsx(rn,{compact:!0,icon:t.jsx(qo,{}),title:g>0?"Nothing matches these filters":"Nothing recorded yet",description:g>0?"Widen the date range or clear a filter.":"The log fills as people act: pausing a queue, retrying a job, inviting a user. Reads are never recorded."})}),m.map(j=>t.jsx(l3,{entry:j,open:d===j.id,onToggle:()=>h(d===j.id?null:j.id),connectionStillExists:!!p(j.connectionId)},j.id))]})]})}),t.jsxs("div",{className:"mt-3 flex items-center justify-between gap-3 text-xs text-fg-muted",children:[t.jsxs("span",{className:"num",children:[m.length," ",m.length===1?"entry":"entries"," loaded"]}),c.hasNextPage&&t.jsx(H,{size:"sm",variant:"secondary",loading:c.isFetchingNextPage,onClick:()=>void c.fetchNextPage(),children:"Load 50 more"})]}),t.jsxs("p",{className:"mt-4 text-xs text-fg-subtle",children:["Retention is ",t.jsx("code",{className:"font-mono",children:"BULLPANE_AUDIT_RETENTION_DAYS"})," (default 365). Rows leave only by age — there is no delete endpoint, on purpose. The job payload is never recorded: ",t.jsx("code",{className:"font-mono",children:"detail"})," ","holds the parameters of an action and, where it helps, the payload size in bytes."]})]})}function l3({entry:e,open:n,onToggle:r,connectionStillExists:i}){var h;const o=s3.has(e.action),c=e.result==="error",d=!!e.detail||!!e.userAgent||!!e.errorMessage;return t.jsxs(t.Fragment,{children:[t.jsxs("tr",{className:F(c&&"bg-danger/5"),children:[t.jsx(pe,{children:d?t.jsx("button",{type:"button","aria-label":n?"Hide detail":"Show detail","aria-expanded":n,onClick:r,className:"rounded p-0.5 text-fg-subtle hover:text-fg",children:n?t.jsx(ms,{className:"size-3.5"}):t.jsx(Dn,{className:"size-3.5"})}):null}),t.jsx(pe,{muted:!0,children:t.jsx(Wt,{value:e.createdAt})}),t.jsx(pe,{children:e.actorName||e.actorEmail?t.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[t.jsx("span",{className:"truncate font-medium",children:e.actorName??"—"}),e.actorRole&&t.jsx(ye,{size:"xs",variant:e.actorRole==="admin"?"pro":e.actorRole==="operator"?"info":"neutral",children:e.actorRole}),e.actorEmail&&t.jsx("span",{className:"truncate text-[11px] text-fg-subtle",children:e.actorEmail})]}):t.jsx(Ce,{content:"No session — an anonymous request, e.g. a failed login on an unknown email",children:t.jsx("span",{className:"cursor-help text-fg-subtle",children:"anonymous"})})}),t.jsxs(pe,{children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[o&&t.jsx(Xf,{className:"size-3.5 shrink-0 text-warning","aria-label":"High-risk action"}),t.jsx("span",{className:F(o&&"font-medium"),children:rm[e.action]}),t.jsx(Ce,{content:e.action,children:t.jsx("code",{className:"cursor-help font-mono text-[10px] text-fg-subtle",children:e.action})})]}),typeof((h=e.detail)==null?void 0:h.reason)=="string"&&e.detail.reason&&t.jsxs("p",{className:"mt-0.5 max-w-md truncate text-[11px] text-fg-muted italic",title:e.detail.reason,children:["“",e.detail.reason,"”"]})]}),t.jsx(pe,{children:t.jsx(o3,{entry:e,connectionStillExists:i})}),t.jsx(pe,{children:c?t.jsx(Ce,{content:e.errorMessage??"The action was refused or failed",children:t.jsx(ye,{variant:"danger",size:"xs",className:"cursor-help",children:"refused"})}):t.jsx(ye,{variant:"success",size:"xs",children:"ok"})}),t.jsx(pe,{muted:!0,mono:!0,children:e.ip??"–"})]}),n&&t.jsx("tr",{children:t.jsx("td",{colSpan:7,className:"bg-surface-2 !px-4 !py-3",children:t.jsxs("dl",{className:"grid gap-3 text-xs sm:grid-cols-[10rem_1fr]",children:[t.jsx("dt",{className:"text-fg-subtle",children:"Exact time"}),t.jsx("dd",{className:"num",children:xn(e.createdAt)}),e.errorMessage&&t.jsxs(t.Fragment,{children:[t.jsx("dt",{className:"text-fg-subtle",children:"Why it failed"}),t.jsx("dd",{className:"text-danger",children:e.errorMessage})]}),e.userAgent&&t.jsxs(t.Fragment,{children:[t.jsx("dt",{className:"text-fg-subtle",children:"User agent"}),t.jsx("dd",{className:"font-mono text-[11px] break-all text-fg-muted",children:e.userAgent})]}),t.jsxs("dt",{className:"text-fg-subtle",children:["Detail",t.jsx("span",{className:"mt-0.5 block text-[10px] text-fg-subtle",children:"parameters only — never the job payload"})]}),t.jsx("dd",{children:e.detail?t.jsx(aj,{value:e.detail,defaultExpandDepth:3}):t.jsx("span",{className:"text-fg-subtle",children:"no parameters recorded"})})]})})})]})}function o3({entry:e,connectionStillExists:n}){if(!e.connectionId&&!e.queueName)return t.jsx("span",{className:"text-fg-subtle",children:"–"});const r=e.connectionName??e.connectionId;return t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1 text-xs",children:[r&&t.jsx(t.Fragment,{children:n&&e.connectionId?t.jsx(Te,{to:oe.connection(e.connectionId),className:"text-accent hover:underline",children:r}):t.jsx(Ce,{content:"This connection no longer exists — the name is the one it had at the time",children:t.jsx("span",{className:"cursor-help text-fg-muted line-through",children:r})})}),e.queueName&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-fg-subtle",children:"/"}),n&&e.connectionId?t.jsx(Te,{to:oe.queue(e.connectionId,e.queueName),className:"font-mono text-accent hover:underline",children:e.queueName}):t.jsx("span",{className:"font-mono text-fg-muted line-through",children:e.queueName})]}),e.jobId&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-fg-subtle",children:"/"}),n&&e.connectionId&&e.queueName?t.jsxs(Te,{to:oe.job(e.connectionId,e.queueName,e.jobId),className:"font-mono text-accent hover:underline",title:"The job may have been removed since",children:["#",e.jobId]}):t.jsxs("span",{className:"font-mono text-fg-muted",children:["#",e.jobId]})]})]})}function c3(){const{has:e}=jt();return e("alerts")?t.jsx(u3,{}):t.jsx(d3,{})}function u3(){const r=(lm().data??[]).filter(o=>o.enabled),i=o=>r.filter(c=>c.scope.type===o).length;return t.jsxs("div",{className:"max-w-xl space-y-4",children:[t.jsxs("p",{className:"text-xs text-fg-muted",children:[t.jsx("strong",{className:"font-medium text-fg",children:"Needs attention"})," is driven by your alert rules. Every queue that breaks an enabled rule gets a card at the top of the Overview, with the value, the window and the threshold. Paused queues and queues with a backlog but no worker are always flagged."]}),t.jsxs("ul",{className:"space-y-1 text-xs text-fg-muted",children:[t.jsxs("li",{children:["Scope each rule to ",t.jsx("span",{className:"text-fg",children:"every queue"}),", a ",t.jsx("span",{className:"text-fg",children:"connection"}),", a"," ",t.jsx("span",{className:"text-fg",children:"folder"})," or ",t.jsx("span",{className:"text-fg",children:"one queue"}),". The most specific rule of each kind wins, so a queue rule overrides the global one for that queue."]}),t.jsx("li",{children:"Failure count and failure rate come from BullMQ metrics over the window, so removeOnComplete cannot skew them."}),t.jsx("li",{children:"Processing time is the p50 or p95 of the jobs completed in the window."}),t.jsx("li",{children:"A rule without channels is dashboard only; add Slack or a webhook to be notified as well."})]}),t.jsx("p",{className:"text-xs text-fg-subtle",children:r.length===0?"No enabled rule yet.":`${r.length} enabled: ${i("global")} on every queue, ${i("connection")} per connection, ${i("folder")} per folder, ${i("queue")} per queue.`}),t.jsx(Te,{to:oe.alerts,className:"inline-flex text-xs text-accent hover:underline",children:"Manage rules →"})]})}function d3(){const{isAdmin:e}=yt(),n=S0(),r=j2(),[i,o]=N.useState(""),[c,d]=N.useState(""),h=n.data;if(N.useEffect(()=>{h&&(o(String(h.waitingAbove)),d(String(h.failedAbove)))},[h]),n.isLoading)return t.jsx(Dt,{});const m=wk.safeParse({waitingAbove:Number(i===""?0:i),failedAbove:Number(c===""?0:c)}),g=!!h&&m.success&&(m.data.waitingAbove!==h.waitingAbove||m.data.failedAbove!==h.failedAbove),p=()=>{m.success&&r.mutate(m.data,{onSuccess:()=>ee.success("Attention thresholds saved"),onError:v=>ee.error(be(v))})};return t.jsxs("div",{className:"max-w-xl space-y-5",children:[t.jsxs("p",{className:"text-xs text-fg-muted",children:["When a queue shows up in ",t.jsx("strong",{className:"font-medium text-fg",children:"Needs attention"})," at the top of the Overview. Failing, paused and stuck-with-no-worker queues are always flagged — these two add the cases only you can define.",t.jsx("span",{className:"text-fg-subtle",children:" Set 0 to turn a rule off."})]}),t.jsxs("p",{className:"rounded-md border border-border bg-surface-2/50 px-3 py-2 text-xs text-fg-muted",children:[t.jsx("span",{className:"font-medium text-fg",children:"Pro:"})," rules per queue, folder, connection or everywhere, on failure rate and processing time over a window, measured from BullMQ metrics — the same rules can notify Slack or a webhook."," ",t.jsx(Te,{to:oe.alerts,className:"text-accent hover:underline",children:"See Alerts"})]}),t.jsx(Ee,{label:"Waiting above",hint:"Flag a queue whose waiting backlog passes this, even when a worker is draining it. Leave at 0 if your queues run deep on purpose.",inputMode:"numeric",value:i,disabled:!e,onChange:v=>o(v.target.value.replace(/[^0-9]/g,""))}),t.jsx(Ee,{label:"Failed above",hint:"Flag a queue whose failed list passes this. At 0 any failed job at all is flagged, which is the previous behaviour.",inputMode:"numeric",value:c,disabled:!e,onChange:v=>d(v.target.value.replace(/[^0-9]/g,""))}),e?t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(H,{variant:"primary",disabled:!g||r.isPending,onClick:p,children:r.isPending?"Saving…":"Save"}),g&&t.jsx(H,{variant:"ghost",onClick:()=>{o(String((h==null?void 0:h.waitingAbove)??ku.waitingAbove)),d(String((h==null?void 0:h.failedAbove)??ku.failedAbove))},children:"Cancel"})]}):t.jsx("p",{className:"text-xs text-fg-subtle",children:"Only an administrator can change these."})]})}const ru={host:"localhost",port:"6379",username:"",password:"",db:"0",tls:!1};function h3(e){try{const n=new URL(e);if(n.protocol!=="redis:"&&n.protocol!=="rediss:")return{...ru};const r=Ev(n.password);return{host:n.hostname||ru.host,port:n.port||(n.protocol==="rediss:"?"6380":"6379"),username:Ev(n.username),password:r==="****"?"":r,db:n.pathname.replace(/^\//,"")||"0",tls:n.protocol==="rediss:"}}catch{return{...ru}}}function Pv(e){const n=e.username||e.password?`${encodeURIComponent(e.username)}:${encodeURIComponent(e.password)}@`:"",r=e.host.includes(":")&&!e.host.startsWith("[")?`[${e.host}]`:e.host,i=e.db.trim()&&e.db.trim()!=="0"?`/${e.db.trim()}`:"";return`${e.tls?"rediss":"redis"}://${n}${r.trim()}:${e.port.trim()||"6379"}${i}`}function f3(e,n){return e.host!==n.host||e.port!==n.port||e.username!==n.username||e.db!==n.db||e.tls!==n.tls}function Ev(e){try{return decodeURIComponent(e)}catch{return e}}function m3(){var v;const{isAdmin:e}=yt(),{demo:n}=jt(),r=xs(),i=x2(),[o,c]=Po(),[d,h]=N.useState(null),[m,g]=N.useState(null);N.useEffect(()=>{if(e){if(o.get("new"))h({connection:null}),c({},{replace:!0});else if(o.get("edit")&&r.data){const j=r.data.find(C=>C.id===o.get("edit"));j&&h({connection:j}),c({},{replace:!0})}}},[o,c,r.data,e]);const p=r.data??[];return t.jsxs("div",{children:[t.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[t.jsxs("p",{className:"text-xs text-fg-muted",children:["Each connection points at one Redis (or cluster) with a BullMQ key prefix, or at the Postgres schema of BullMQ 6's Postgres backend. On Redis, queues are discovered with ",t.jsx("span",{className:"font-mono",children:"SCAN"}),", never ",t.jsx("span",{className:"font-mono",children:"KEYS"}),"."]}),e&&t.jsx(H,{variant:"primary",size:"sm",leftIcon:t.jsx(Jn,{}),onClick:()=>h({connection:null}),disabled:n,title:n?"Locked in the demo":void 0,children:"Add connection"})]}),n&&t.jsx("p",{className:"mb-3 rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-xs text-warning",children:"Demo mode: connections are read-only."}),t.jsx("div",{className:"card overflow-hidden",children:t.jsxs(fs,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(me,{children:"Name"}),t.jsx(me,{children:"URL"}),t.jsx(me,{children:"Prefix / schema"}),t.jsx(me,{children:"Filter"}),t.jsx(me,{children:"Status"}),t.jsx(me,{children:"Added"}),t.jsx(me,{align:"right",children:t.jsx("span",{className:"sr-only",children:"Actions"})})]})}),t.jsxs("tbody",{children:[r.isLoading&&t.jsx(xt,{colSpan:7,children:t.jsx(Dt,{})}),r.data&&p.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:7,children:t.jsx(rn,{compact:!0,icon:t.jsx(Aa,{}),title:"No connections",description:e?"Add your first Redis or Postgres connection.":"Ask an admin to add one."})})}),p.map(j=>{var C;return t.jsxs("tr",{children:[t.jsxs(pe,{className:"font-medium",children:[t.jsx(Te,{to:oe.connection(j.id),className:"hover:underline",children:j.name}),j.kind==="postgres"&&t.jsx(ye,{variant:"outline",size:"xs",className:"ml-1.5",children:"postgres"}),j.cluster&&t.jsx(ye,{variant:"outline",size:"xs",className:"ml-1.5",children:"cluster"})]}),t.jsx(pe,{mono:!0,muted:!0,className:"max-w-xs truncate",title:j.url,children:j.url}),t.jsx(pe,{mono:!0,children:j.prefix}),t.jsx(pe,{mono:!0,muted:!0,children:j.queueFilter??"–"}),t.jsxs(pe,{children:[t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Du,{status:j.status,withLabel:!0,pulse:!0}),((C=j.status)==null?void 0:C.ok)&&j.status.redisVersion&&t.jsxs("span",{className:"text-[11px] text-fg-subtle",children:["v",j.status.redisVersion]})]}),j.status&&!j.status.ok&&j.status.error&&t.jsx("p",{className:"mt-0.5 max-w-xs truncate text-[11px] text-danger",title:j.status.error,children:j.status.error})]}),t.jsx(pe,{muted:!0,children:t.jsx(Wt,{value:j.createdAt})}),t.jsx(pe,{align:"right",children:e&&t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsx(H,{size:"icon-xs",variant:"ghost","aria-label":"Edit connection",title:"Edit",onClick:()=>h({connection:j}),disabled:n,children:t.jsx(To,{})}),t.jsx(H,{size:"icon-xs",variant:"ghost","aria-label":"Delete connection",title:"Delete",className:"hover:text-danger",onClick:()=>g(j),disabled:n,children:t.jsx(ps,{})})]})})]},j.id)})]})]})}),d&&t.jsx(p3,{open:!0,onClose:()=>h(null),connection:d.connection},((v=d.connection)==null?void 0:v.id)??"new"),t.jsx(sn,{open:!!m,onClose:()=>g(null),title:`Remove "${m==null?void 0:m.name}"`,description:"Only the dashboard entry is removed. Nothing in Redis or Postgres is touched. Folders and alerts pointing at this connection stop working.",confirmText:"Remove connection",danger:!0,typeToConfirm:m==null?void 0:m.name,loading:i.isPending,onConfirm:()=>m&&i.mutate(m.id,{onSuccess:()=>(g(null),ee.success("Connection removed")),onError:j=>ee.error(be(j))})})]})}function p3({open:e,onClose:n,connection:r}){const i=m2(),o=p2(),c=g2(),[d,h]=N.useState({name:(r==null?void 0:r.name)??"",kind:(r==null?void 0:r.kind)??"redis",url:r?"":"redis://localhost:6379",prefix:(r==null?void 0:r.prefix)??"bull",cluster:(r==null?void 0:r.cluster)??!1,queueFilter:(r==null?void 0:r.queueFilter)??""}),[m,g]=N.useState({}),[p,v]=N.useState(null),[j,C]=N.useState("fields"),y=r?h3(r.url):ru,[b,k]=N.useState(y),S=(q,B)=>{h(ce=>({...ce,[q]:B})),v(null)},$=d.kind==="postgres",z=q=>{h(B=>({...B,kind:q,url:q==="postgres"?B.url.startsWith("redis")?"":B.url:B.url||"redis://localhost:6379",prefix:B.prefix===tu[B.kind]||!B.prefix?tu[q]:B.prefix,cluster:q==="postgres"?!1:B.cluster})),g({}),v(null)},E=(q,B)=>{k(ce=>({...ce,[q]:B})),v(null)},T=()=>j==="url"||$?d.url.trim():r&&!b.password&&!f3(b,y)?"":Pv(b),M=()=>{const q=T(),B={name:d.name.trim(),kind:d.kind,url:q,prefix:d.prefix.trim()||tu[d.kind],cluster:d.cluster,queueFilter:d.queueFilter.trim()||null};r&&!B.url&&(B.url=r.url);const ce=gk.safeParse(B);if(!ce.success){const _e={};for(const Ue of ce.error.issues)_e[String(Ue.path[0])]=Ue.message;return g(_e),null}return g({}),ce.data},O=()=>{const q=M();if(!q)return;const B=ce=>{ee.success(`Connection "${ce.name}" saved`),n()};if(r){const ce={name:q.name,prefix:q.prefix,cluster:q.cluster,queueFilter:q.queueFilter};T()&&(ce.url=q.url),o.mutate({id:r.id,input:ce},{onSuccess:B,onError:_e=>ee.error(be(_e))})}else i.mutate(q,{onSuccess:B,onError:ce=>ee.error(be(ce))})},Q=()=>{const q=T();if(!q){g({url:r?j==="url"||$?"Enter the URL (with password) to test it":"Enter the password to test the stored connection":"URL is required"});return}c.mutate({kind:d.kind,url:q,prefix:d.prefix.trim()||void 0,cluster:d.cluster},{onSuccess:v,onError:B=>v({ok:!1,error:be(B)})})},V=i.isPending||o.isPending;return t.jsx(En,{open:e,onClose:n,size:"md",title:r?`Edit ${r.name}`:"Add connection",description:"Credentials are stored server-side and never sent back to the browser.",footer:t.jsxs(t.Fragment,{children:[t.jsx(H,{variant:"ghost",size:"sm",onClick:n,children:"Cancel"}),t.jsx(H,{variant:"secondary",size:"sm",leftIcon:t.jsx(Oy,{}),onClick:Q,loading:c.isPending,children:"Test connection"}),t.jsx(H,{variant:"primary",size:"sm",onClick:O,loading:V,children:r?"Save":"Add connection"})]}),children:t.jsxs("form",{className:"space-y-3",onSubmit:q=>{q.preventDefault(),O()},children:[t.jsx(Ee,{label:"Name",autoFocus:!0,value:d.name,onChange:q=>S("name",q.target.value),error:m.name,placeholder:"production"}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-xs font-medium text-fg-muted",children:"Backend"}),r?t.jsx("span",{className:"text-xs text-fg",children:$?"Postgres (BullMQ 6)":"Redis"}):t.jsx("div",{className:"inline-flex rounded-md border border-border p-0.5 text-xs",role:"tablist","aria-label":"Where the queues live",children:["redis","postgres"].map(q=>t.jsx("button",{type:"button",role:"tab","aria-selected":d.kind===q,className:`rounded px-2 py-0.5 ${d.kind===q?"bg-surface-3 text-fg":"text-fg-muted hover:text-fg"}`,onClick:()=>z(q),children:q==="redis"?"Redis":"Postgres (BullMQ 6)"},q))})]}),$?t.jsx(Ee,{label:"Postgres URL",mono:!0,value:d.url,onChange:q=>S("url",q.target.value),error:m.url,placeholder:r?`${r.url} (leave empty to keep)`:"postgres://user:password@host:5432/app",hint:"The database your BullMQ workers use. Add ?sslmode=require for TLS. A read-only role is enough to browse; actions need write access.",autoComplete:"off",spellCheck:!1}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-xs font-medium text-fg-muted",children:"Redis"}),t.jsx("div",{className:"inline-flex rounded-md border border-border p-0.5 text-xs",role:"tablist","aria-label":"How to enter the Redis address",children:["fields","url"].map(q=>t.jsx("button",{type:"button",role:"tab","aria-selected":j===q,className:`rounded px-2 py-0.5 ${j===q?"bg-surface-3 text-fg":"text-fg-muted hover:text-fg"}`,onClick:()=>(C(q),v(null)),children:q==="fields"?"Host & password":"Connection URL"},q))})]}),j==="url"?t.jsx(Ee,{label:"Redis URL",mono:!0,value:d.url,onChange:q=>S("url",q.target.value),error:m.url,placeholder:r?`${r.url} (leave empty to keep)`:"redis://:password@host:6379/0",hint:"redis:// or rediss:// (TLS). Include the password; it is redacted everywhere in the UI.",autoComplete:"off",spellCheck:!1}):t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"grid gap-3 sm:grid-cols-[1fr_120px]",children:[t.jsx(Ee,{label:"Host",mono:!0,value:b.host,onChange:q=>E("host",q.target.value),placeholder:"cache.internal",autoComplete:"off",spellCheck:!1}),t.jsx(Ee,{label:"Port",mono:!0,inputMode:"numeric",value:b.port,onChange:q=>E("port",q.target.value)})]}),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[t.jsx(Ee,{label:"Username (optional)",mono:!0,value:b.username,onChange:q=>E("username",q.target.value),placeholder:"default",autoComplete:"off",spellCheck:!1}),t.jsx(Ee,{label:"Password",type:"password",mono:!0,value:b.password,onChange:q=>E("password",q.target.value),placeholder:r?"leave empty to keep the stored one":"optional",hint:r?"Stored server-side and never shown again. Changing the host or TLS needs it typed again.":"Stored server-side, redacted everywhere in the UI.",autoComplete:"new-password"})]}),t.jsxs("div",{className:"grid items-end gap-3 sm:grid-cols-[120px_1fr]",children:[t.jsx(Ee,{label:"Database",mono:!0,inputMode:"numeric",value:b.db,onChange:q=>E("db",q.target.value)}),t.jsxs("div",{className:"flex items-start gap-2.5 pb-1",children:[t.jsx(Zi,{checked:b.tls,onChange:q=>E("tls",q),label:"TLS",className:"mt-0.5"}),t.jsxs("button",{type:"button",className:"text-left text-xs",onClick:()=>E("tls",!b.tls),children:[t.jsx("span",{className:"font-medium text-fg",children:"TLS"}),t.jsx("span",{className:"text-fg-muted",children:" (rediss://) — required by ElastiCache with in-transit encryption, Redis Cloud, Upstash and most managed Redis."})]})]})]}),m.url&&t.jsx("p",{className:"text-xs text-danger",children:m.url}),t.jsx("p",{className:"font-mono text-[11px] text-fg-subtle",children:T()?Pv({...b,password:b.password?"****":""}):`${(r==null?void 0:r.url)??""} (unchanged)`})]})]}),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[$?t.jsx(Ee,{label:"Schema",mono:!0,value:d.prefix,onChange:q=>S("prefix",q.target.value),error:m.prefix,hint:"BullMQ default is bullmq"}):t.jsx(Ee,{label:"Key prefix",mono:!0,value:d.prefix,onChange:q=>S("prefix",q.target.value),error:m.prefix,hint:"BullMQ default is bull"}),t.jsx(Ee,{label:"Queue filter (optional)",mono:!0,value:d.queueFilter,onChange:q=>S("queueFilter",q.target.value),error:m.queueFilter,placeholder:"payments-*",hint:"Glob over queue names; limits discovery."})]}),!$&&t.jsx(mm,{label:"Redis Cluster",description:"Use cluster-aware client. Each queue lives in one hash slot, so all reads stay single-node.",checked:d.cluster,onChange:q=>S("cluster",q.target.checked)}),p&&t.jsxs("div",{className:`flex items-start gap-2 rounded-md border px-3 py-2 text-xs ${p.ok?"border-success/40 bg-success/10 text-success":"border-danger/40 bg-danger/10 text-danger"}`,role:"status",children:[p.ok?t.jsx(Zf,{className:"mt-px size-4 shrink-0"}):t.jsx(Ry,{className:"mt-px size-4 shrink-0"}),t.jsx("div",{children:p.ok?t.jsxs(t.Fragment,{children:["Connected",p.latencyMs!=null&&` in ${p.latencyMs} ms`,p.redisVersion&&` · ${$?"Postgres":"Redis"} ${p.redisVersion}`,p.queuesFound!=null&&` · ${p.queuesFound} queues found`]}):t.jsxs(t.Fragment,{children:["Failed: ",p.error??"unknown error"]})})]})]})})}const Rv={active:{label:"active",variant:"success"},grace:{label:"grace period",variant:"warning"},expired:{label:"expired",variant:"danger"},invalid:{label:"invalid",variant:"danger"}};function x3(e){if(e.source==="offline")return e.status==="expired"?"This offline key has expired. Ask for a renewed key or activate a subscription key.":e.status==="invalid"?"This key does not verify against this build. Paste it again or ask for a new one.":null;switch(e.status){case"grace":return`bullpane.com could not be reached (${e.lastCheckError??"unknown error"}). Pro keeps working until ${xn(e.leaseExpiresAt)}; the server retries once a day, or check now.`;case"expired":return e.lastCheckError?`${e.lastCheckError} Renew the subscription on bullpane.com, then check again.`:"The lease ran out without reaching bullpane.com. Restore the connection and check now.";case"invalid":return e.lastCheckError??"The store rejected this key.";default:return null}}function g3(){const{isAdmin:e,setEdition:n}=yt(),{edition:r,isPro:i,demo:o,pricing:c,checkoutUrl:d,has:h}=jt(),m=$2(),g=O2(),p=z2(),[v,j]=N.useState(""),[C,y]=N.useState(null),[b,k]=N.useState(!1),S=()=>{const M=v.trim();if(!M){y("Paste the license key");return}y(null),m.mutate(M,{onSuccess:O=>{n(O),j(""),ee.success("Pro unlocked",O.license?`Licensed to ${O.license.licensee}`:void 0)},onError:O=>{er(O)&&(O.body.error==="invalid_license"||O.body.error==="license_already_activated"||O.body.error==="license_server_unavailable")?y(O.body.message||"This key is not valid"):y(be(O))}})},$=()=>p.mutate(void 0,{onSuccess:M=>{var Q,V,q,B;n(M);const O=(Q=M.license)==null?void 0:Q.status;O==="active"?ee.success("License verified",`Lease renewed until ${xn((V=M.license)==null?void 0:V.leaseExpiresAt)}`):O==="grace"?ee.error("Could not reach bullpane.com",((q=M.license)==null?void 0:q.lastCheckError)??void 0):ee.error("License not valid",((B=M.license)==null?void 0:B.lastCheckError)??void 0)},onError:M=>ee.error(be(M))}),z=r.license,E=z?x3(z):null,T=(z==null?void 0:z.source)==="online";return t.jsxs("div",{className:"grid gap-4 lg:grid-cols-[1fr_360px]",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"card p-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex size-10 items-center justify-center rounded-lg bg-surface-2",children:i?t.jsx(zu,{className:"size-5 text-pro"}):t.jsx(io,{className:"size-5 text-fg-subtle"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h2",{className:"text-sm font-semibold",children:o?"Demo mode":i?"Pro edition":"Free edition"}),t.jsx(cm,{})]}),t.jsx("p",{className:"text-xs text-fg-muted",children:o?"Every Pro feature is unlocked for the playground. Settings that could break the demo are read-only.":i?"All features unlocked for this installation.":"Everything bull-board does, plus search. Team features need a Pro key."})]}),T&&e&&!o&&t.jsx(H,{variant:"outline",size:"sm",leftIcon:t.jsx(Jf,{}),onClick:$,loading:p.isPending,children:"Check now"})]}),z&&t.jsxs("dl",{className:"mt-4 grid grid-cols-2 gap-3 border-t border-border pt-4 text-xs sm:grid-cols-4",children:[t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:"Licensee"}),t.jsx("dd",{className:"truncate text-fg",children:z.licensee})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:"Email"}),t.jsx("dd",{className:"truncate text-fg",children:z.email})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:T?"Plan":"Issued"}),t.jsx("dd",{className:"text-fg",children:T?"Subscription":Su(z.issuedAt)})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:T?"Paid until":"Expires"}),t.jsxs("dd",{className:"text-fg",children:[z.expiresAt?Su(z.expiresAt):T?"Renews automatically":"Never"," ",t.jsx(ye,{variant:Rv[z.status].variant,size:"xs",className:"ml-1",children:Rv[z.status].label})]})]}),T&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:"Last verified"}),t.jsx("dd",{className:"text-fg",title:z.lastCheckedAt?xn(z.lastCheckedAt):void 0,children:z.lastCheckedAt?Vr(z.lastCheckedAt):"never"})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:"Works offline until"}),t.jsx("dd",{className:"text-fg",children:xn(z.leaseExpiresAt)})]}),t.jsxs("div",{className:"col-span-2",children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:"Activation"}),t.jsx("dd",{className:"truncate font-mono text-fg",children:z.activationId})]})]})]}),E&&t.jsx("p",{className:`mt-3 rounded-md border px-3 py-2 text-xs ${(z==null?void 0:z.status)==="grace"?"border-warning/40 bg-warning/10 text-warning":"border-danger/40 bg-danger/10 text-danger"}`,children:E}),o&&t.jsx("p",{className:"mt-3 rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-xs text-warning",children:"Demo mode notice: license changes are blocked here. Run your own instance to activate a key."})]}),t.jsxs("div",{className:"card p-4",children:[t.jsx("h3",{className:"mb-3 text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:"Features"}),t.jsx("ul",{className:"grid gap-2 sm:grid-cols-2",children:nm.map(M=>t.jsxs("li",{className:"flex items-start gap-2 rounded-md border border-border p-2.5 text-xs",children:[h(M)?t.jsx(Kr,{className:"mt-px size-4 shrink-0 text-success"}):t.jsx(io,{className:"mt-px size-4 shrink-0 text-fg-subtle"}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-fg",children:uo[M].title}),t.jsx("p",{className:"text-fg-muted",children:uo[M].tagline})]})]},M))})]})]}),t.jsxs("div",{className:"space-y-4",children:[e?t.jsxs("div",{className:"card p-4",children:[t.jsxs("h3",{className:"mb-1 flex items-center gap-2 text-sm font-semibold",children:[t.jsx(el,{className:"size-4"})," ",i&&!o?"Replace license key":"Activate a license key"]}),t.jsx("p",{className:"mb-3 text-xs text-fg-muted",children:"Paste the key from your bullpane.com receipt. One key runs one installation: it is activated once against bullpane.com, re-checked daily, and keeps working for 7 days without internet. Nothing about your queues or jobs is sent."}),t.jsx(Wi,{mono:!0,rows:3,value:v,onChange:M=>j(M.target.value),placeholder:"BULLPANE-XXXX-XXXX-XXXX",error:C,spellCheck:!1,disabled:o,"aria-label":"License key"}),t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[t.jsx(H,{variant:"primary",size:"sm",onClick:S,loading:m.isPending,disabled:o,children:"Activate"}),z&&!o&&t.jsx(H,{variant:"ghost",size:"sm",className:"hover:text-danger",leftIcon:t.jsx(ps,{}),onClick:()=>k(!0),children:"Remove license"})]})]}):t.jsx("div",{className:"card p-4 text-xs text-fg-muted",children:"Only admins can change the license."}),!i&&t.jsxs("div",{className:"card border-pro/30 p-4",children:[t.jsxs("p",{className:"text-sm font-semibold",children:["Unlock Pro · $",c.monthlyUsd,"/month or $",c.yearlyUsd,"/year"]}),t.jsx("p",{className:"mt-1 text-xs text-fg-muted",children:"One installation, unlimited connections, queues and users. Cancel any time; your data stays."}),t.jsxs("a",{href:d||"#",target:"_blank",rel:"noreferrer noopener","aria-disabled":!d,className:"mt-3 inline-flex h-8 items-center gap-2 rounded-md bg-accent px-3 text-xs font-medium text-accent-fg hover:bg-accent-hover aria-disabled:pointer-events-none aria-disabled:opacity-50",children:["Get a key ",t.jsx(Ur,{className:"size-3.5"})]})]})]}),t.jsx(sn,{open:b,onClose:()=>k(!1),title:"Remove license",description:T?"The installation goes back to the free edition, which has NO LOGIN: anyone who can reach this URL will be able to retry, promote and delete jobs. The key is released so it can be activated on another server. Alerts, folders, flow edges and your user accounts are kept in the database but become inaccessible until a key is activated again.":"The installation goes back to the free edition, which has NO LOGIN: anyone who can reach this URL will be able to retry, promote and delete jobs. Alerts, folders, flow edges and your user accounts are kept in the database but become inaccessible until a key is activated again.",confirmText:"Remove license",danger:!0,loading:g.isPending,onConfirm:()=>g.mutate(void 0,{onSuccess:M=>{n(M),k(!1),ee.success("License removed")},onError:M=>ee.error(be(M))})})]})}function v3(){const e=Yk(),{edition:n,checkoutUrl:r}=jt();return t.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[t.jsxs("div",{className:"card p-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(um,{className:"size-9"}),t.jsxs("div",{children:[t.jsx("h2",{className:"text-sm font-semibold",children:"Bullpane"}),t.jsx("p",{className:"text-xs text-fg-muted",children:"Self-hosted dashboard for BullMQ and BullMQ Pro."})]})]}),t.jsxs("dl",{className:"mt-4 grid grid-cols-2 gap-3 border-t border-border pt-4 text-xs",children:[t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:"Server version"}),t.jsx("dd",{className:"font-mono text-fg",children:e.data?e.data.version:e.isError?"unknown":t.jsx(du,{})})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:"Server uptime"}),t.jsx("dd",{className:"text-fg",children:e.data?fo(e.data.uptime):e.isError?"unknown":t.jsx(du,{})})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:"Edition"}),t.jsxs("dd",{className:"text-fg",children:[n.tier,n.demo&&" (demo)"]})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:"UI build"}),t.jsx("dd",{className:"font-mono text-fg",children:"production"})]})]})]}),t.jsxs("div",{className:"card p-4",children:[t.jsx("h3",{className:"mb-2 text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:"Links"}),t.jsxs("ul",{className:"space-y-1.5 text-[13px]",children:[t.jsx("li",{children:t.jsxs("a",{href:"https://docs.bullmq.io",target:"_blank",rel:"noreferrer noopener",className:"inline-flex items-center gap-1.5 text-accent hover:underline",children:["BullMQ documentation ",t.jsx(Ur,{className:"size-3.5"})]})}),r&&t.jsx("li",{children:t.jsxs("a",{href:r,target:"_blank",rel:"noreferrer noopener",className:"inline-flex items-center gap-1.5 text-accent hover:underline",children:["Buy a Pro license (from $",n.pricing.monthlyUsd,"/mo) ",t.jsx(Ur,{className:"size-3.5"})]})}),t.jsx("li",{children:t.jsxs("a",{href:"/api/health",target:"_blank",rel:"noreferrer noopener",className:"inline-flex items-center gap-1.5 text-accent hover:underline",children:["API health ",t.jsx(Ur,{className:"size-3.5"})]})})]}),t.jsx("h3",{className:"mt-5 mb-2 text-xs font-semibold tracking-wider text-fg-subtle uppercase",children:"How it reads Redis"}),t.jsxs("ul",{className:"list-disc space-y-1 pl-4 text-xs text-fg-muted",children:[t.jsxs("li",{children:["Discovery via ",t.jsx("span",{className:"font-mono",children:"SCAN"}),", never ",t.jsx("span",{className:"font-mono",children:"KEYS"}),"; cached 30 s."]}),t.jsx("li",{children:"Counts, pages and details are single Lua round trips per queue."}),t.jsx("li",{children:"Payloads are truncated inside Redis for list views."}),t.jsx("li",{children:"Writes go through the official bullmq library."})]})]})]})}const y3={oidc:"OIDC",saml:"SAML 2.0"};function j3(){const{has:e}=jt();return e("sso")?t.jsx(b3,{}):t.jsx(La,{feature:"sso"})}function au({label:e,value:n}){const[r,i]=N.useState(!1);return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"w-24 shrink-0 text-[11px] uppercase tracking-wide text-fg-subtle",children:e}),t.jsx("code",{className:"min-w-0 flex-1 truncate rounded bg-surface-2 px-2 py-1 text-[11px] text-fg-muted",children:n}),t.jsx(H,{size:"icon-xs",variant:"ghost","aria-label":`Copy ${e}`,onClick:()=>{var o;(o=navigator.clipboard)==null||o.writeText(n).then(()=>{i(!0),setTimeout(()=>i(!1),1500)},()=>ee.error("Could not copy to the clipboard"))},children:r?t.jsx(Kr,{className:"size-3 text-success"}):t.jsx(Ty,{className:"size-3"})})]})}function b3(){var k;const e=L2(),n=E0(),r=R0(),i=D2(),o=U2(),c=Q2(),[d,h]=N.useState(!1),[m,g]=N.useState(null),[p,v]=N.useState({}),j=e.data??[],C=j.filter(S=>S.enabled).length,y=((k=n.data)==null?void 0:k.requireSso)??!1,b=async S=>{try{const $=await c.mutateAsync(S.id);v(z=>({...z,[S.id]:$}))}catch($){v(z=>({...z,[S.id]:{ok:!1,message:be($)}}))}};return t.jsxs("div",{className:"space-y-5",children:[t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Single sign-on"}),t.jsxs("p",{className:"mt-1 max-w-2xl text-xs text-fg-muted",children:["Let your team sign in with your identity provider. By default accounts are not created automatically: add the person under ",t.jsx("span",{className:"text-fg",children:"Users & roles"})," first, then they can sign in with SSO using that same email. Or turn on ",t.jsx("span",{className:"text-fg",children:"auto-provisioning"})," below for your company's email domains."]})]}),t.jsx(H,{variant:"primary",leftIcon:t.jsx(Jn,{className:"size-4"}),onClick:()=>h(!0),children:"Add provider"})]}),e.isLoading?t.jsx("div",{className:"flex justify-center py-8",children:t.jsx(Dt,{})}):j.length===0?t.jsxs("div",{className:"card p-6 text-center",children:[t.jsx(zu,{className:"mx-auto size-6 text-fg-subtle"}),t.jsx("p",{className:"mt-2 text-sm text-fg",children:"No identity provider yet"}),t.jsx("p",{className:"mx-auto mt-1 max-w-md text-xs text-fg-muted",children:"Add an OIDC provider (Google Workspace, Microsoft Entra ID, Okta, Keycloak, Authentik) or a SAML 2.0 provider."})]}):t.jsx("div",{className:"space-y-3",children:j.map(S=>{const $=p[S.id];return t.jsxs("div",{className:"card p-4",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"truncate text-sm font-medium text-fg",children:S.name}),t.jsx(ye,{variant:"neutral",children:y3[S.kind]}),!S.enabled&&t.jsx(ye,{variant:"warning",children:"disabled"}),S.kind==="oidc"&&!S.hasSecret&&t.jsx(ye,{variant:"danger",children:"no client secret"})]}),t.jsx("p",{className:"mt-1 truncate text-xs text-fg-muted",children:S.kind==="oidc"?String(S.config.issuer??""):String(S.config.entryPoint??"")})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(Zi,{checked:S.enabled,label:"Enabled",onChange:z=>{i.mutate({id:S.id,input:{enabled:z}},{onError:E=>ee.error(be(E))})}}),t.jsx(H,{size:"sm",variant:"secondary",leftIcon:t.jsx(Oy,{className:"size-3.5"}),loading:c.isPending&&c.variables===S.id,onClick:()=>void b(S),children:"Test"}),t.jsx(H,{size:"icon-sm",variant:"ghost","aria-label":"Delete provider",onClick:()=>g(S),children:t.jsx(ps,{className:"size-3.5"})})]})]}),t.jsx("div",{className:"mt-3 space-y-1.5 border-t border-border pt-3",children:S.kind==="oidc"?t.jsx(au,{label:"Redirect URI",value:S.callbackUrl}):t.jsxs(t.Fragment,{children:[t.jsx(au,{label:"ACS URL",value:S.callbackUrl}),S.entityId&&t.jsx(au,{label:"Entity ID",value:S.entityId})]})}),$&&t.jsxs("div",{className:`mt-3 rounded-md border px-3 py-2 text-xs ${$.ok?"border-success/40 bg-success/10 text-success":"border-danger/40 bg-danger/10 text-danger"}`,children:[t.jsxs("p",{className:"flex items-center gap-1.5 font-medium",children:[$.ok?t.jsx(Kr,{className:"size-3.5"}):t.jsx(gn,{className:"size-3.5"}),$.message]}),$.details&&t.jsx("dl",{className:"mt-2 space-y-0.5 text-fg-muted",children:Object.entries($.details).map(([z,E])=>t.jsxs("div",{className:"flex gap-2",children:[t.jsx("dt",{className:"w-44 shrink-0 font-mono text-[10px] uppercase",children:z}),t.jsx("dd",{className:"min-w-0 truncate font-mono text-[10px]",children:E})]},z))})]})]},S.id)})}),t.jsxs("div",{className:"card p-4",children:[t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-fg",children:"Require SSO"}),t.jsxs("p",{className:"mt-1 max-w-2xl text-xs text-fg-muted",children:["Hide the password form and send everyone through your identity provider."," ",t.jsx("span",{className:"text-fg",children:"Admin accounts keep password sign-in"})," so a misconfigured provider cannot lock you out of your own installation. Set ",t.jsx("code",{className:"text-[11px]",children:"BULLPANE_ALLOW_PASSWORD_LOGIN=true"})," to allow it for everyone."]})]}),t.jsx(Zi,{checked:y,disabled:n.isLoading||r.isPending,onChange:S=>{r.mutate({requireSso:S},{onSuccess:()=>ee.success(S?"SSO is now required":"Password sign-in is available again"),onError:$=>ee.error(be($))})}})]}),y&&C===0&&t.jsxs("p",{className:"mt-3 flex items-center gap-1.5 rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-xs text-warning",children:[t.jsx(Xn,{className:"size-3.5 shrink-0"}),"SSO is required but no provider is enabled. Only admins can sign in right now."]})]}),t.jsx(w3,{}),d&&t.jsx(N3,{onClose:()=>h(!1)}),t.jsx(sn,{open:m!==null,title:"Delete this provider?",confirmText:"Delete",danger:!0,description:m?`Anyone who signs in through "${m.name}" will have to use another method. The Bullpane accounts themselves are not touched.`:"",loading:o.isPending,onClose:()=>g(null),onConfirm:()=>{m&&o.mutate(m.id,{onSuccess:()=>{ee.success(`Deleted ${m.name}`),g(null)},onError:S=>{ee.error(be(S)),g(null)}})}})]})}function w3(){var p,v;const e=E0(),n=R0(),r=((p=e.data)==null?void 0:p.autoProvisionDomains)??[],i=((v=e.data)==null?void 0:v.autoProvision)??!1,[o,c]=N.useState(null),[d,h]=N.useState(null),m=o??r.join(", "),g=()=>{h(null);const j=m.split(/[\s,]+/).map(y=>y.trim()).filter(y=>y!==""),C=[];for(const y of j){const b=n0.safeParse(y);if(!b.success){h(`"${y}" is not a domain. Use something like example.com.`);return}C.push(b.data)}n.mutate({autoProvisionDomains:C},{onSuccess:()=>{c(null),ee.success("Domains saved")},onError:y=>h(be(y))})};return t.jsxs("div",{className:"card p-4",children:[t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-fg",children:"Let anyone from your domains sign in"}),t.jsxs("p",{className:"mt-1 max-w-2xl text-xs text-fg-muted",children:["When someone your identity provider authenticates has no Bullpane account yet and their email ends in one of the domains below, create one for them as a ",t.jsx("span",{className:"text-fg",children:"viewer"})," instead of refusing. They can look at every queue but change nothing; promote them under Users & roles if they need more. Disabled accounts stay disabled."]})]}),t.jsx(Zi,{checked:i,label:"Auto-provision SSO accounts",disabled:e.isLoading||n.isPending,onChange:j=>{if(j&&r.length===0){h("Save at least one domain first.");return}n.mutate({autoProvision:j},{onSuccess:()=>ee.success(j?"New SSO users from your domains now get a viewer account":"SSO accounts must be invited again"),onError:C=>ee.error(be(C))})}})]}),t.jsxs("div",{className:"mt-3 flex items-start gap-2",children:[t.jsx(Ee,{label:"Allowed email domains",hint:"Comma separated. Exact match: example.com does not include sub.example.com.",placeholder:"example.com",mono:!0,wrapperClassName:"flex-1",value:m,onChange:j=>c(j.target.value),error:d??void 0}),t.jsx(H,{className:"mt-5",variant:"secondary",disabled:o===null,loading:n.isPending,onClick:g,children:"Save"})]})]})}function N3({onClose:e}){const n=F2(),[r,i]=N.useState("oidc"),[o,c]=N.useState(""),[d,h]=N.useState(""),[m,g]=N.useState(""),[p,v]=N.useState(""),[j,C]=N.useState(""),[y,b]=N.useState(""),[k,S]=N.useState(""),[$,z]=N.useState(""),[E,T]=N.useState(""),[M,O]=N.useState(null),Q=()=>{var B;O(null);const V=r==="oidc"?{kind:"oidc",name:o.trim(),config:{issuer:d.trim(),clientId:m.trim(),clientSecret:p,...j.trim()?{emailClaim:j.trim()}:{}}}:{kind:"saml",name:o.trim(),config:{entryPoint:y.trim(),issuer:k.trim(),idpCert:$.trim(),...E.trim()?{emailAttribute:E.trim()}:{}}},q=pk.safeParse(V);if(!q.success){O(((B=q.error.issues[0])==null?void 0:B.message)??"Check the fields above");return}n.mutate(q.data,{onSuccess:ce=>{ee.success(`Added ${ce.name}. Enter the redirect URI at your IdP, then use Test.`),e()},onError:ce=>O(be(ce))})};return t.jsx(En,{open:!0,onClose:e,title:"Add an identity provider",description:"Unless auto-provisioning is on, invite people under Users & roles first.",size:"md",footer:t.jsxs(t.Fragment,{children:[t.jsx(H,{variant:"ghost",onClick:e,children:"Cancel"}),t.jsx(H,{variant:"primary",loading:n.isPending,onClick:Q,children:"Add provider"})]}),children:t.jsxs("div",{className:"space-y-3",children:[t.jsxs(ut,{label:"Protocol",value:r,onChange:V=>i(V.target.value),children:[t.jsx("option",{value:"oidc",children:"OIDC / OpenID Connect"}),t.jsx("option",{value:"saml",children:"SAML 2.0"})]}),t.jsx(Ee,{label:"Display name",placeholder:r==="oidc"?"Google Workspace":"Corporate SSO",hint:"Shown on the sign-in button.",value:o,onChange:V=>c(V.target.value),required:!0}),r==="oidc"?t.jsxs(t.Fragment,{children:[t.jsx(Ee,{label:"Issuer URL",placeholder:"https://accounts.google.com",hint:"Endpoints are discovered from /.well-known/openid-configuration, so this is the only URL you need.",value:d,onChange:V=>h(V.target.value),required:!0}),t.jsx(Ee,{label:"Client ID",value:m,onChange:V=>g(V.target.value),required:!0}),t.jsx(Ee,{label:"Client secret",type:"password",hint:"Stored encrypted and never shown again.",value:p,onChange:V=>v(V.target.value),required:!0}),t.jsx(Ee,{label:"Email claim (optional)",placeholder:"email",hint:"Override only if your provider puts the email somewhere else, e.g. upn.",value:j,onChange:V=>C(V.target.value)})]}):t.jsxs(t.Fragment,{children:[t.jsx(Ee,{label:"Sign-in URL (SSO endpoint)",placeholder:"https://idp.example.com/sso/saml",value:y,onChange:V=>b(V.target.value),required:!0}),t.jsx(Ee,{label:"IdP entity ID",placeholder:"https://idp.example.com/metadata",value:k,onChange:V=>S(V.target.value),required:!0}),t.jsx(Wi,{label:"IdP signing certificate",rows:5,placeholder:"-----BEGIN CERTIFICATE-----",hint:"PEM or base64. Assertions must be signed; there is no way to disable that.",value:$,onChange:V=>z(V.target.value),required:!0}),t.jsx(Ee,{label:"Email attribute (optional)",placeholder:"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress",value:E,onChange:V=>T(V.target.value)})]}),M&&t.jsx("p",{role:"alert",className:"rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-xs text-danger",children:M})]})})}const Mv=[{value:"off",label:"Off",hint:"No MCP client can connect or call anything."},{value:"read",label:"Read only",hint:"Clients can list queues, read jobs, logs and schedulers. Nothing changes."},{value:"write",label:"Read & write",hint:"Operators and admins may also let a client retry, promote, remove and add jobs and pause queues. Viewers still only read."}];function k3(){const{has:e}=jt();return e("mcp")?t.jsx(S3,{}):t.jsx(La,{feature:"mcp"})}function S3(){var C;const{isAdmin:e}=yt(),n=B2(),r=V2(),[i,o]=N.useState(!1),c=H2(e&&i),d=K2(),[h,m]=N.useState(null);if(n.isLoading||!n.data)return t.jsx("div",{className:"flex justify-center py-8",children:t.jsx(Dt,{})});const{maxAccess:g,endpoint:p,reachableFromCloud:v}=n.data,j=c.data??[];return t.jsxs("div",{className:"space-y-5",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-sm font-semibold text-fg",children:"MCP"}),t.jsx("p",{className:"mt-1 max-w-2xl text-xs text-fg-muted",children:"Connect your AI to this Bullpane: Claude, or any MCP client that supports OAuth. Each person signs in with their own Bullpane login (or SSO) and picks read or read & write. A client acts as that person, with their role: what they cannot do in the dashboard, the client cannot do either. Every change is in the audit log, and draining, cleaning or obliterating a queue always comes back here for a human to confirm."})]}),t.jsxs("div",{className:"card space-y-3 p-4",children:[t.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-fg-subtle",children:"Access for MCP clients"}),t.jsx(ut,{label:"Most a client can do on this install",value:g,disabled:!e||r.isPending,onChange:y=>r.mutate({maxAccess:y.target.value},{onSuccess:()=>ee.success("MCP access updated. It applies to connected clients on their next call."),onError:b=>ee.error(be(b))}),options:Mv.map(y=>({value:y.value,label:y.label})),hint:e?(C=Mv.find(y=>y.value===g))==null?void 0:C.hint:"Only an admin can change this.",wrapperClassName:"max-w-md"})]}),t.jsxs("div",{className:"card space-y-3 p-4",children:[t.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-fg-subtle",children:"Connect a client"}),t.jsx(au,{label:"Server URL",value:p}),!v&&t.jsxs("div",{className:"flex gap-2 rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-xs text-fg",children:[t.jsx(Xn,{className:"mt-0.5 size-3.5 shrink-0 text-warning"}),t.jsxs("span",{children:["Cloud-hosted clients such as claude.ai and Claude Desktop connect from their provider's servers, so they need this URL to be public HTTPS. It looks private (check ",t.jsx("span",{className:"font-mono",children:"PUBLIC_URL"}),"). Clients that run on your machine, such as Claude Code, work on a private network."]})]}),t.jsxs("dl",{className:"space-y-2 text-xs text-fg-muted",children:[t.jsxs("div",{children:[t.jsx("dt",{className:"font-medium text-fg",children:"claude.ai and Claude Desktop"}),t.jsx("dd",{children:"Settings → Connectors → Add custom connector, paste the server URL, then Connect and sign in."})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"font-medium text-fg",children:"Claude Code"}),t.jsxs("dd",{children:[t.jsxs("code",{className:"rounded bg-surface-2 px-1.5 py-0.5 font-mono text-[11px]",children:["claude mcp add --transport http bullpane ",p]}),", then run ",t.jsx("code",{className:"font-mono",children:"/mcp"})," to sign in."]})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"font-medium text-fg",children:"Any other MCP client"}),t.jsx("dd",{children:"Add the server URL as a remote (HTTP) MCP server. The client registers itself and opens this Bullpane to sign in."})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-fg-subtle",children:i?"All connected clients":"Your connected clients"}),e&&t.jsx(H,{size:"sm",variant:"ghost",onClick:()=>o(y=>!y),children:i?"Show only mine":"Show everyone's"})]}),c.isLoading?t.jsx("div",{className:"flex justify-center py-6",children:t.jsx(Dt,{})}):j.length===0?t.jsxs("div",{className:"card p-6 text-center",children:[t.jsx(Py,{className:"mx-auto size-6 text-fg-subtle"}),t.jsx("p",{className:"mt-2 text-sm text-fg",children:"No client connected"}),t.jsx("p",{className:"mx-auto mt-1 max-w-md text-xs text-fg-muted",children:"Add the server URL to Claude and sign in; the connection shows up here."})]}):t.jsx("div",{className:"card divide-y divide-border",children:j.map(y=>t.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"truncate text-sm font-medium text-fg",children:y.clientName}),t.jsx(ye,{variant:y.access==="write"?"warning":"neutral",children:y.access==="write"?"read & write":"read"})]}),t.jsxs("p",{className:"mt-0.5 truncate text-xs text-fg-muted",children:[i&&t.jsxs(t.Fragment,{children:[y.userEmail," · "]}),y.redirectHost," · connected ",Vr(y.createdAt)," · ",y.lastUsedAt?`last used ${Vr(y.lastUsedAt)}`:"not used yet"]})]}),t.jsx(H,{size:"sm",variant:"ghost",leftIcon:t.jsx(Yf,{className:"size-3.5"}),onClick:()=>m(y),children:"Disconnect"})]},y.id))})]}),t.jsx(sn,{open:h!==null,onClose:()=>m(null),title:"Disconnect client",description:h?`${h.clientName} (${h.userEmail}) loses access on its next call. Connecting again needs a new sign-in.`:void 0,confirmText:"Disconnect",danger:!0,loading:d.isPending,onConfirm:()=>h&&d.mutate(h.id,{onSuccess:()=>{ee.success(`${h.clientName} disconnected`),m(null)},onError:y=>ee.error(be(y))})})]})}const C3=["connections","attention","sso","mcp","license","about"];function _3(){const{tab:e}=Fn(),n=an();if(!e||!C3.includes(e))return t.jsx(Qr,{to:"/settings/connections",replace:!0});const r=e;return t.jsxs(vt,{children:[t.jsx(gs,{title:"Settings"}),t.jsx(Pm,{"aria-label":"Settings sections",className:"mb-5",value:r,onChange:i=>n(`/settings/${i}`),items:[{value:"connections",label:"Connections",icon:t.jsx(Aa,{className:"size-3.5"})},{value:"attention",label:"Attention",icon:t.jsx(Xn,{className:"size-3.5"})},{value:"sso",label:"SSO",icon:t.jsx(zu,{className:"size-3.5"})},{value:"mcp",label:"MCP",icon:t.jsx(Py,{className:"size-3.5"})},{value:"license",label:"License",icon:t.jsx(el,{className:"size-3.5"})},{value:"about",label:"About",icon:t.jsx(Yi,{className:"size-3.5"})}]}),r==="connections"&&t.jsx(m3,{}),r==="attention"&&t.jsx(c3,{}),r==="sso"&&t.jsx(j3,{}),r==="mcp"&&t.jsx(k3,{}),r==="license"&&t.jsx(g3,{}),r==="about"&&t.jsx(v3,{})]})}const P3=[{label:"Any time",ms:0},{label:"Next hour",ms:36e5},{label:"Next 24 hours",ms:864e5},{label:"Next 7 days",ms:6048e5}];function E3(){var r;const e=xs();if(e.isLoading)return t.jsx(vt,{children:t.jsx(Dt,{label:"Loading…"})});const n=(r=e.data)==null?void 0:r[0];return n?t.jsx(Qr,{to:oe.schedulers(n.id),replace:!0}):t.jsx(vt,{children:t.jsx(rn,{icon:t.jsx(Ro,{}),title:"No connections",description:"Add a Redis connection first; schedulers are listed per connection."})})}function R3(){var p;const{connectionId:e}=Fn(),n=xs(),r=an(),[i,o]=N.useState(""),[c,d]=N.useState(0),h=h2(e,{...i.trim()?{q:i.trim()}:{},...c>0?{withinMs:c}:{}}),m=((p=h.data)==null?void 0:p.schedulers)??[],g=h.data;return t.jsxs(vt,{children:[t.jsx(gs,{title:"Schedulers",description:g?`${W(g.total)} across ${W(g.queuesWithSchedulers)} of ${W(g.queuesScanned)} queues`:void 0,actions:n.data&&n.data.length>1?t.jsx(ut,{"aria-label":"Connection",value:e??"",onChange:v=>r(oe.schedulers(v.target.value)),children:n.data.map(v=>t.jsx("option",{value:v.id,children:v.name},v.id))}):void 0}),t.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[t.jsx(Ee,{value:i,onChange:v=>o(v.target.value),placeholder:"Filter by scheduler id, job name or queue…","aria-label":"Filter schedulers",leftIcon:t.jsx(Gn,{className:"size-3.5"}),className:"w-full sm:w-80"}),t.jsx(ut,{"aria-label":"Next run within",value:String(c),onChange:v=>d(Number(v.target.value)),children:P3.map(v=>t.jsx("option",{value:v.ms,children:v.label},v.ms))}),h.isFetching&&t.jsx(Dt,{className:"size-3.5"})]}),g&&g.failed.length>0&&t.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-xs text-fg-muted",children:[t.jsx(Xn,{className:"mt-0.5 size-3.5 shrink-0 text-warning","aria-hidden":!0}),t.jsxs("span",{children:["Could not read schedulers from ",g.failed.length," queue",g.failed.length===1?"":"s",":"," ",t.jsx("span",{className:"font-mono",children:g.failed.map(v=>v.queueName).join(", ")}),". The rest of the list is complete."]})]}),t.jsx("div",{className:"card overflow-hidden",children:t.jsxs(fs,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(me,{children:"Queue"}),t.jsx(me,{children:"Scheduler"}),t.jsx(me,{children:"Job name"}),t.jsx(me,{children:"Repeats"}),t.jsx(me,{align:"right",children:"Next run"})]})}),t.jsxs("tbody",{children:[h.isLoading&&t.jsx(xt,{colSpan:5,children:t.jsx(Dt,{label:"Reading schedulers…"})}),h.isError&&!g&&t.jsx(xt,{colSpan:5,className:"text-danger",children:be(h.error)}),g&&m.length===0&&t.jsx(xt,{colSpan:5,children:t.jsx(T3,{filtered:!!i.trim()||c>0,total:g.total})}),m.map(v=>t.jsx(M3,{s:v,connectionId:e},`${v.queueName}:${v.key}`))]})]})}),g&&m.length>0&&m.length<g.total&&t.jsxs("p",{className:"mt-2 text-[11px] text-fg-subtle",children:["Showing ",W(m.length)," of ",W(g.total),". Narrow the filter to see the rest."]})]})}function M3({s:e,connectionId:n}){const r=e.next!=null&&e.next<=Date.now();return t.jsxs(il,{children:[t.jsx(pe,{children:t.jsx(Te,{to:oe.queueSchedulers(n,e.queueName),className:"text-accent hover:underline",children:e.queueName})}),t.jsx(pe,{mono:!0,children:t.jsx("span",{className:"text-fg",title:e.key,children:e.key})}),t.jsx(pe,{mono:!0,muted:!0,children:e.name}),t.jsx(pe,{children:t.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[t.jsx(ye,{variant:"outline",size:"xs",className:"font-mono",children:tj(e)}),e.tz&&t.jsx("span",{className:"text-[11px] text-fg-subtle",children:e.tz}),e.iterationCount===0&&t.jsx("span",{className:"text-[11px] text-warning",title:"This scheduler has never produced a job",children:"never ran"})]})}),t.jsx(pe,{align:"right",num:!0,children:e.next==null?t.jsx("span",{className:"text-fg-subtle",title:"No next run: the scheduler ended or hit its limit",children:"–"}):t.jsxs("span",{className:F("inline-flex items-center gap-1",r&&"text-warning"),title:xn(e.next),children:[r&&t.jsx(My,{className:"size-3","aria-hidden":!0}),Vr(e.next)]})})]})}function T3({filtered:e,total:n}){return e&&n>0?t.jsxs("div",{className:"py-6 text-center text-sm text-fg-muted",children:["No scheduler matches this filter. This connection has ",W(n)," in total."]}):t.jsxs("div",{className:"mx-auto flex max-w-xl flex-col items-center gap-2 py-6 text-center",children:[t.jsx(Ro,{className:"size-6 text-fg-subtle","aria-hidden":!0}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"No job schedulers on this connection"}),t.jsx("p",{className:"text-xs text-fg-muted",children:"A job scheduler (BullMQ calls it a repeatable job) stamps out the same job on a cron pattern or a fixed interval. It lives outside the job states, so it never shows up under Waiting or Delayed — only the single job it has queued next does."}),t.jsxs("p",{className:"flex items-center gap-1.5 text-[11px] text-fg-subtle",children:[t.jsx(Ay,{className:"size-3","aria-hidden":!0}),"Create one with ",t.jsx("span",{className:"font-mono",children:"queue.upsertJobScheduler()"}),"."]})]})}function q3(){return t.jsx(vt,{children:t.jsx(rn,{icon:t.jsx(uN,{}),title:"Page not found",description:"The link may be stale, or the queue or connection was removed.",action:t.jsx(Te,{to:"/",className:"text-accent hover:underline",children:"Back to overview"})})})}const I3=N.lazy(()=>Eu(()=>import("./FlowsPage-CRkXK3KR.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.FlowsPage}))),$3=N.lazy(()=>Eu(()=>import("./FlowsPage-CRkXK3KR.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.FlowsIndexPage}))),z3=N.lazy(()=>Eu(()=>import("./McpConsentPage-BXb_LIdx.js"),[]).then(e=>({default:e.McpConsentPage}))),O3=N.lazy(()=>Eu(()=>import("./JobTreePage-CcNNhc6M.js"),__vite__mapDeps([3,1,2])).then(e=>({default:e.JobTreePage})));function eu({children:e}){return t.jsx(N.Suspense,{fallback:t.jsx(nl,{}),children:e})}const A3=new Ww({defaultOptions:{queries:{retry:(e,n)=>er(n)&&n.status>0&&n.status<500?!1:e<2,retryDelay:e=>Math.min(1e3*2**e,8e3),staleTime:1e3,refetchOnWindowFocus:!0,refetchIntervalInBackground:!1},mutations:{retry:!1}}});function L3(){return t.jsx(jw,{client:A3,children:t.jsx(mw,{children:t.jsxs(Fk,{children:[t.jsxs(aw,{children:[t.jsx(ct,{path:"/login",element:t.jsx(Gg,{children:t.jsx(jS,{})})}),t.jsx(ct,{path:"/setup",element:t.jsx(Gg,{children:t.jsx(bS,{})})}),t.jsx(ct,{path:"/oauth/consent",element:t.jsx(eu,{children:t.jsx(z3,{})})}),t.jsx(ct,{element:t.jsx(Dk,{}),children:t.jsxs(ct,{element:t.jsx(yS,{}),children:[t.jsx(ct,{index:!0,element:t.jsx(eC,{})}),t.jsx(ct,{path:"c/:connectionId",element:t.jsx(nC,{})}),t.jsx(ct,{path:"c/:connectionId/q/:queue",element:t.jsx(Bh,{})}),t.jsx(ct,{path:"c/:connectionId/q/:queue/metrics",element:t.jsx(Bh,{view:"metrics"})}),t.jsx(ct,{path:"c/:connectionId/q/:queue/schedulers",element:t.jsx(Bh,{view:"schedulers"})}),t.jsx(ct,{path:"c/:connectionId/q/:queue/groups",element:t.jsx(I_,{})}),t.jsx(ct,{path:"c/:connectionId/q/:queue/groups/:groupId",element:t.jsx(A_,{})}),t.jsx(ct,{path:"c/:connectionId/q/:queue/j/:jobId",element:t.jsx(__,{})}),t.jsx(ct,{path:"c/:connectionId/q/:queue/j/:jobId/tree",element:t.jsx(eu,{children:t.jsx(O3,{})})}),t.jsx(ct,{path:"health",element:t.jsx(dC,{})}),t.jsx(ct,{path:"schedulers",element:t.jsx(E3,{})}),t.jsx(ct,{path:"schedulers/:connectionId",element:t.jsx(R3,{})}),t.jsx(ct,{path:"folders",element:t.jsx(L_,{})}),t.jsx(ct,{path:"folders/:folderId",element:t.jsx(G_,{})}),t.jsx(ct,{path:"alerts",element:t.jsx(p_,{})}),t.jsx(ct,{path:"users",element:t.jsx(Y_,{})}),t.jsx(ct,{path:"audit",element:t.jsx(r3,{})}),t.jsxs(t.Fragment,{children:[t.jsx(ct,{path:"flows",element:t.jsx(eu,{children:t.jsx($3,{})})}),t.jsx(ct,{path:"flows/:connectionId",element:t.jsx(eu,{children:t.jsx(I3,{})})})]}),t.jsx(ct,{path:"settings",element:t.jsx(Qr,{to:"/settings/connections",replace:!0})}),t.jsx(ct,{path:"settings/:tab",element:t.jsx(_3,{})}),t.jsx(ct,{path:"*",element:t.jsx(q3,{})})]})})]}),t.jsx(Hk,{}),t.jsx(Lk,{})]})})})}mb.createRoot(document.getElementById("root")).render(t.jsx(N.StrictMode,{children:t.jsx(L3,{})}));export{A0 as A,H as B,Xn as C,En as D,rn as E,H3 as F,K3 as G,Py as H,Yi as I,U3 as J,gs as K,La as L,gN as M,Qr as N,Bu as O,vt as P,$y as Q,Jf as R,Dt as S,ps as T,TS as U,Vr as V,IN as W,zf as X,rb as Y,ob as Z,xs as a,Fn as b,re as c,an as d,yt as e,N as f,Q3 as g,B3 as h,V3 as i,t as j,ut as k,W as l,Jn as m,be as n,ye as o,Te as p,Ur as q,oe as r,ot as s,ee as t,jt as u,F as v,Ee as w,ht as x,Po as y,Ln as z};