bullpane 0.6.2 → 0.7.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.
@@ -1,548 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowsPage-CE4Fl11b.js","assets/flowLayout-GUFMVhrV.js","assets/flowLayout-BnuhLJ6X.css","assets/JobTreePage-CxJzFwh9.js"])))=>i.map(i=>d[i]);
2
- var nb=Object.defineProperty;var lg=e=>{throw TypeError(e)};var sb=(e,n,r)=>n in e?nb(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var $h=(e,n,r)=>sb(e,typeof n!="symbol"?n+"":n,r),zh=(e,n,r)=>n.has(e)||lg("Cannot "+r);var _=(e,n,r)=>(zh(e,n,"read from private field"),r?r.call(e):n.get(e)),ge=(e,n,r)=>n.has(e)?lg("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(e):n.set(e,r),te=(e,n,r,i)=>(zh(e,n,"write to private field"),i?i.call(e,r):n.set(e,r),r),Pe=(e,n,r)=>(zh(e,n,"access private method"),r);var Yc=(e,n,r,i)=>({set _(o){te(e,n,o,r)},get _(){return _(e,n,i)}});function rb(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 ab(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Oh={exports:{}},Yl={},Ah={exports:{}},Be={};/**
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 og;function ib(){if(og)return Be;og=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 S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,b={};function k(A,Z,Ae){this.props=A,this.context=Z,this.refs=b,this.updater=Ae||S}k.prototype.isReactComponent={},k.prototype.setState=function(A,Z){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,Z,"setState")},k.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function C(){}C.prototype=k.prototype;function O(A,Z,Ae){this.props=A,this.context=Z,this.refs=b,this.updater=Ae||S}var z=O.prototype=new C;z.constructor=O,y(z,k.prototype),z.isPureReactComponent=!0;var E=Array.isArray,M=Object.prototype.hasOwnProperty,T={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function Q(A,Z,Ae){var Fe,Ce={},De=null,Qe=null;if(Z!=null)for(Fe in Z.ref!==void 0&&(Qe=Z.ref),Z.key!==void 0&&(De=""+Z.key),Z)M.call(Z,Fe)&&!$.hasOwnProperty(Fe)&&(Ce[Fe]=Z[Fe]);var Je=arguments.length-2;if(Je===1)Ce.children=Ae;else if(1<Je){for(var lt=Array(Je),Qt=0;Qt<Je;Qt++)lt[Qt]=arguments[Qt+2];Ce.children=lt}if(A&&A.defaultProps)for(Fe in Je=A.defaultProps,Je)Ce[Fe]===void 0&&(Ce[Fe]=Je[Fe]);return{$$typeof:e,type:A,key:De,ref:Qe,props:Ce,_owner:T.current}}function B(A,Z){return{$$typeof:e,type:A.type,key:Z,ref:A.ref,props:A.props,_owner:A._owner}}function q(A){return typeof A=="object"&&A!==null&&A.$$typeof===e}function V(A){var Z={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(Ae){return Z[Ae]})}var re=/\/+/g;function ue(A,Z){return typeof A=="object"&&A!==null&&A.key!=null?V(""+A.key):Z.toString(36)}function qe(A,Z,Ae,Fe,Ce){var De=typeof A;(De==="undefined"||De==="boolean")&&(A=null);var Qe=!1;if(A===null)Qe=!0;else switch(De){case"string":case"number":Qe=!0;break;case"object":switch(A.$$typeof){case e:case n:Qe=!0}}if(Qe)return Qe=A,Ce=Ce(Qe),A=Fe===""?"."+ue(Qe,0):Fe,E(Ce)?(Ae="",A!=null&&(Ae=A.replace(re,"$&/")+"/"),qe(Ce,Z,Ae,"",function(Qt){return Qt})):Ce!=null&&(q(Ce)&&(Ce=B(Ce,Ae+(!Ce.key||Qe&&Qe.key===Ce.key?"":(""+Ce.key).replace(re,"$&/")+"/")+A)),Z.push(Ce)),1;if(Qe=0,Fe=Fe===""?".":Fe+":",E(A))for(var Je=0;Je<A.length;Je++){De=A[Je];var lt=Fe+ue(De,Je);Qe+=qe(De,Z,Ae,lt,Ce)}else if(lt=j(A),typeof lt=="function")for(A=lt.call(A),Je=0;!(De=A.next()).done;)De=De.value,lt=Fe+ue(De,Je++),Qe+=qe(De,Z,Ae,lt,Ce);else if(De==="object")throw Z=String(A),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.");return Qe}function Ke(A,Z,Ae){if(A==null)return A;var Fe=[],Ce=0;return qe(A,Fe,"","",function(De){return Z.call(Ae,De,Ce++)}),Fe}function ut(A){if(A._status===-1){var Z=A._result;Z=Z(),Z.then(function(Ae){(A._status===0||A._status===-1)&&(A._status=1,A._result=Ae)},function(Ae){(A._status===0||A._status===-1)&&(A._status=2,A._result=Ae)}),A._status===-1&&(A._status=0,A._result=Z)}if(A._status===1)return A._result.default;throw A._result}var Le={current:null},K={transition:null},me={ReactCurrentDispatcher:Le,ReactCurrentBatchConfig:K,ReactCurrentOwner:T};function ne(){throw Error("act(...) is not supported in production builds of React.")}return Be.Children={map:Ke,forEach:function(A,Z,Ae){Ke(A,function(){Z.apply(this,arguments)},Ae)},count:function(A){var Z=0;return Ke(A,function(){Z++}),Z},toArray:function(A){return Ke(A,function(Z){return Z})||[]},only:function(A){if(!q(A))throw Error("React.Children.only expected to receive a single React element child.");return A}},Be.Component=k,Be.Fragment=r,Be.Profiler=o,Be.PureComponent=O,Be.StrictMode=i,Be.Suspense=m,Be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=me,Be.act=ne,Be.cloneElement=function(A,Z,Ae){if(A==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+A+".");var Fe=y({},A.props),Ce=A.key,De=A.ref,Qe=A._owner;if(Z!=null){if(Z.ref!==void 0&&(De=Z.ref,Qe=T.current),Z.key!==void 0&&(Ce=""+Z.key),A.type&&A.type.defaultProps)var Je=A.type.defaultProps;for(lt in Z)M.call(Z,lt)&&!$.hasOwnProperty(lt)&&(Fe[lt]=Z[lt]===void 0&&Je!==void 0?Je[lt]:Z[lt])}var lt=arguments.length-2;if(lt===1)Fe.children=Ae;else if(1<lt){Je=Array(lt);for(var Qt=0;Qt<lt;Qt++)Je[Qt]=arguments[Qt+2];Fe.children=Je}return{$$typeof:e,type:A.type,key:Ce,ref:De,props:Fe,_owner:Qe}},Be.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},Be.createElement=Q,Be.createFactory=function(A){var Z=Q.bind(null,A);return Z.type=A,Z},Be.createRef=function(){return{current:null}},Be.forwardRef=function(A){return{$$typeof:h,render:A}},Be.isValidElement=q,Be.lazy=function(A){return{$$typeof:p,_payload:{_status:-1,_result:A},_init:ut}},Be.memo=function(A,Z){return{$$typeof:g,type:A,compare:Z===void 0?null:Z}},Be.startTransition=function(A){var Z=K.transition;K.transition={};try{A()}finally{K.transition=Z}},Be.unstable_act=ne,Be.useCallback=function(A,Z){return Le.current.useCallback(A,Z)},Be.useContext=function(A){return Le.current.useContext(A)},Be.useDebugValue=function(){},Be.useDeferredValue=function(A){return Le.current.useDeferredValue(A)},Be.useEffect=function(A,Z){return Le.current.useEffect(A,Z)},Be.useId=function(){return Le.current.useId()},Be.useImperativeHandle=function(A,Z,Ae){return Le.current.useImperativeHandle(A,Z,Ae)},Be.useInsertionEffect=function(A,Z){return Le.current.useInsertionEffect(A,Z)},Be.useLayoutEffect=function(A,Z){return Le.current.useLayoutEffect(A,Z)},Be.useMemo=function(A,Z){return Le.current.useMemo(A,Z)},Be.useReducer=function(A,Z,Ae){return Le.current.useReducer(A,Z,Ae)},Be.useRef=function(A){return Le.current.useRef(A)},Be.useState=function(A){return Le.current.useState(A)},Be.useSyncExternalStore=function(A,Z,Ae){return Le.current.useSyncExternalStore(A,Z,Ae)},Be.useTransition=function(){return Le.current.useTransition()},Be.version="18.3.1",Be}var cg;function Uf(){return cg||(cg=1,Ah.exports=ib()),Ah.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 ug;function lb(){if(ug)return Yl;ug=1;var e=Uf(),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,S=null;g!==void 0&&(j=""+g),m.key!==void 0&&(j=""+m.key),m.ref!==void 0&&(S=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:S,props:v,_owner:o.current}}return Yl.Fragment=r,Yl.jsx=d,Yl.jsxs=d,Yl}var dg;function ob(){return dg||(dg=1,Oh.exports=lb()),Oh.exports}var t=ob(),N=Uf();const cb=ab(N),ub=rb({__proto__:null,default:cb},[N]);var eu={},Lh={exports:{}},kn={},Fh={exports:{}},Dh={};/**
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 hg;function db(){return hg||(hg=1,(function(e){function n(K,me){var ne=K.length;K.push(me);e:for(;0<ne;){var A=ne-1>>>1,Z=K[A];if(0<o(Z,me))K[A]=me,K[ne]=Z,ne=A;else break e}}function r(K){return K.length===0?null:K[0]}function i(K){if(K.length===0)return null;var me=K[0],ne=K.pop();if(ne!==me){K[0]=ne;e:for(var A=0,Z=K.length,Ae=Z>>>1;A<Ae;){var Fe=2*(A+1)-1,Ce=K[Fe],De=Fe+1,Qe=K[De];if(0>o(Ce,ne))De<Z&&0>o(Qe,Ce)?(K[A]=Qe,K[De]=ne,A=De):(K[A]=Ce,K[Fe]=ne,A=Fe);else if(De<Z&&0>o(Qe,ne))K[A]=Qe,K[De]=ne,A=De;else break e}}return me}function o(K,me){var ne=K.sortIndex-me.sortIndex;return ne!==0?ne:K.id-me.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,S=!1,y=!1,b=!1,k=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,O=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(K){for(var me=r(g);me!==null;){if(me.callback===null)i(g);else if(me.startTime<=K)i(g),me.sortIndex=me.expirationTime,n(m,me);else break;me=r(g)}}function E(K){if(b=!1,z(K),!y)if(r(m)!==null)y=!0,ut(M);else{var me=r(g);me!==null&&Le(E,me.startTime-K)}}function M(K,me){y=!1,b&&(b=!1,C(Q),Q=-1),S=!0;var ne=j;try{for(z(me),v=r(m);v!==null&&(!(v.expirationTime>me)||K&&!V());){var A=v.callback;if(typeof A=="function"){v.callback=null,j=v.priorityLevel;var Z=A(v.expirationTime<=me);me=e.unstable_now(),typeof Z=="function"?v.callback=Z:v===r(m)&&i(m),z(me)}else i(m);v=r(m)}if(v!==null)var Ae=!0;else{var Fe=r(g);Fe!==null&&Le(E,Fe.startTime-me),Ae=!1}return Ae}finally{v=null,j=ne,S=!1}}var T=!1,$=null,Q=-1,B=5,q=-1;function V(){return!(e.unstable_now()-q<B)}function re(){if($!==null){var K=e.unstable_now();q=K;var me=!0;try{me=$(!0,K)}finally{me?ue():(T=!1,$=null)}}else T=!1}var ue;if(typeof O=="function")ue=function(){O(re)};else if(typeof MessageChannel<"u"){var qe=new MessageChannel,Ke=qe.port2;qe.port1.onmessage=re,ue=function(){Ke.postMessage(null)}}else ue=function(){k(re,0)};function ut(K){$=K,T||(T=!0,ue())}function Le(K,me){Q=k(function(){K(e.unstable_now())},me)}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(K){K.callback=null},e.unstable_continueExecution=function(){y||S||(y=!0,ut(M))},e.unstable_forceFrameRate=function(K){0>K||125<K?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<K?Math.floor(1e3/K):5},e.unstable_getCurrentPriorityLevel=function(){return j},e.unstable_getFirstCallbackNode=function(){return r(m)},e.unstable_next=function(K){switch(j){case 1:case 2:case 3:var me=3;break;default:me=j}var ne=j;j=me;try{return K()}finally{j=ne}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(K,me){switch(K){case 1:case 2:case 3:case 4:case 5:break;default:K=3}var ne=j;j=K;try{return me()}finally{j=ne}},e.unstable_scheduleCallback=function(K,me,ne){var A=e.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?A+ne:A):ne=A,K){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=ne+Z,K={id:p++,callback:me,priorityLevel:K,startTime:ne,expirationTime:Z,sortIndex:-1},ne>A?(K.sortIndex=ne,n(g,K),r(m)===null&&K===r(g)&&(b?(C(Q),Q=-1):b=!0,Le(E,ne-A))):(K.sortIndex=Z,n(m,K),y||S||(y=!0,ut(M))),K},e.unstable_shouldYield=V,e.unstable_wrapCallback=function(K){var me=j;return function(){var ne=j;j=me;try{return K.apply(this,arguments)}finally{j=ne}}}})(Dh)),Dh}var fg;function hb(){return fg||(fg=1,Fh.exports=db()),Fh.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 mg;function fb(){if(mg)return kn;mg=1;var e=Uf(),n=hb();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 S(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"||S(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 C=/[\-:]([a-z])/g;function O(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(C,O);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(C,O);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(C,O);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,M=Symbol.for("react.element"),T=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),q=Symbol.for("react.provider"),V=Symbol.for("react.context"),re=Symbol.for("react.forward_ref"),ue=Symbol.for("react.suspense"),qe=Symbol.for("react.suspense_list"),Ke=Symbol.for("react.memo"),ut=Symbol.for("react.lazy"),Le=Symbol.for("react.offscreen"),K=Symbol.iterator;function me(s){return s===null||typeof s!="object"?null:(s=K&&s[K]||s["@@iterator"],typeof s=="function"?s:null)}var ne=Object.assign,A;function Z(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 Ae=!1;function Fe(s,a){if(!s||Ae)return"";Ae=!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{Ae=!1,Error.prepareStackTrace=l}return(s=s?s.displayName||s.name:"")?Z(s):""}function Ce(s){switch(s.tag){case 5:return Z(s.type);case 16:return Z("Lazy");case 13:return Z("Suspense");case 19:return Z("SuspenseList");case 0:case 2:case 15:return s=Fe(s.type,!1),s;case 11:return s=Fe(s.type.render,!1),s;case 1:return s=Fe(s.type,!0),s;default:return""}}function De(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 $:return"Fragment";case T:return"Portal";case B:return"Profiler";case Q:return"StrictMode";case ue:return"Suspense";case qe:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case V:return(s.displayName||"Context")+".Consumer";case q:return(s._context.displayName||"Context")+".Provider";case re:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case Ke:return a=s.displayName||null,a!==null?a:De(s.type)||"Memo";case ut:a=s._payload,s=s._init;try{return De(s(a))}catch{}}return null}function Qe(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 De(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 lt(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Qt(s){var a=lt(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 Yr(s){s._valueTracker||(s._valueTracker=Qt(s))}function Fo(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var l=a.getValue(),u="";return s&&(u=lt(s)?s.checked?"true":"false":s.value),s=u,s!==l?(a.setValue(s),!0):!1}function lr(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 or(s,a){var l=a.checked;return ne({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:l??s._wrapperState.initialChecked})}function Wa(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 Za(s,a){a=a.checked,a!=null&&z(s,"checked",a,!1)}function ea(s,a){Za(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")?Ot(s,a.type,l):a.hasOwnProperty("defaultValue")&&Ot(s,a.type,Je(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(s.defaultChecked=!!a.defaultChecked)}function qs(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 Ot(s,a,l){(a!=="number"||lr(s.ownerDocument)!==s)&&(l==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+l&&(s.defaultValue=""+l))}var ta=Array.isArray;function ps(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 En(s,a){if(a.dangerouslySetInnerHTML!=null)throw Error(r(91));return ne({},a,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function Do(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(ta(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 ll(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 ol(s){var a=s.textContent;a===s._wrapperState.initialValue&&a!==""&&a!==null&&(s.value=a)}function xs(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 na(s,a){return s==null||s==="http://www.w3.org/1999/xhtml"?xs(a):s==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var cr,on=(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(cr=cr||document.createElement("div"),cr.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=cr.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;a.firstChild;)s.appendChild(a.firstChild)}});function sa(s,a){if(a){var l=s.firstChild;if(l&&l===s.lastChild&&l.nodeType===3){l.nodeValue=a;return}}s.textContent=a}var Is={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},Uo=["Webkit","ms","Moz","O"];Object.keys(Is).forEach(function(s){Uo.forEach(function(a){a=a+s.charAt(0).toUpperCase()+s.substring(1),Is[a]=Is[s]})});function cl(s,a,l){return a==null||typeof a=="boolean"||a===""?"":l||typeof a!="number"||a===0||Is.hasOwnProperty(s)&&Is[s]?(""+a).trim():a+"px"}function ul(s,a){s=s.style;for(var l in a)if(a.hasOwnProperty(l)){var u=l.indexOf("--")===0,f=cl(l,a[l],u);l==="float"&&(l="cssFloat"),u?s.setProperty(l,f):s[l]=f}}var Qo=ne({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 $s(s,a){if(a){if(Qo[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 dl(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 ur=null;function Ga(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Ja=null,zs=null,Os=null;function hl(s){if(s=Al(s)){if(typeof Ja!="function")throw Error(r(280));var a=s.stateNode;a&&(a=mc(a),Ja(s.stateNode,s.type,a))}}function fl(s){zs?Os?Os.push(s):Os=[s]:zs=s}function ml(){if(zs){var s=zs,a=Os;if(Os=zs=null,hl(s),a)for(s=0;s<a.length;s++)hl(a[s])}}function pl(s,a){return s(a)}function xl(){}var Xa=!1;function gl(s,a,l){if(Xa)return s(a,l);Xa=!0;try{return pl(s,a,l)}finally{Xa=!1,(zs!==null||Os!==null)&&(xl(),ml())}}function dr(s,a){var l=s.stateNode;if(l===null)return null;var u=mc(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 Ya=!1;if(h)try{var hr={};Object.defineProperty(hr,"passive",{get:function(){Ya=!0}}),window.addEventListener("test",hr,hr),window.removeEventListener("test",hr,hr)}catch{Ya=!1}function Bo(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 fr=!1,ra=null,aa=!1,ei=null,Vo={onError:function(s){fr=!0,ra=s}};function Ho(s,a,l,u,f,x,w,P,R){fr=!1,ra=null,Bo.apply(Vo,arguments)}function Ko(s,a,l,u,f,x,w,P,R){if(Ho.apply(this,arguments),fr){if(fr){var U=ra;fr=!1,ra=null}else throw Error(r(198));aa||(aa=!0,ei=U)}}function gs(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 vl(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 yl(s){if(gs(s)!==s)throw Error(r(188))}function ce(s){var a=s.alternate;if(!a){if(a=gs(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 yl(f),s;if(x===u)return yl(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 rt(s){return s=ce(s),s!==null?et(s):null}function et(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var a=et(s);if(a!==null)return a;s=s.sibling}return null}var Bt=n.unstable_scheduleCallback,ti=n.unstable_cancelCallback,fj=n.unstable_shouldYield,mj=n.unstable_requestPaint,Pt=n.unstable_now,pj=n.unstable_getCurrentPriorityLevel,td=n.unstable_ImmediatePriority,zm=n.unstable_UserBlockingPriority,Wo=n.unstable_NormalPriority,xj=n.unstable_LowPriority,Om=n.unstable_IdlePriority,Zo=null,vs=null;function gj(s){if(vs&&typeof vs.onCommitFiberRoot=="function")try{vs.onCommitFiberRoot(Zo,s,void 0,(s.current.flags&128)===128)}catch{}}var ts=Math.clz32?Math.clz32:jj,vj=Math.log,yj=Math.LN2;function jj(s){return s>>>=0,s===0?32:31-(vj(s)/yj|0)|0}var Go=64,Jo=4194304;function jl(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 Xo(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=jl(P):(x&=w,x!==0&&(u=jl(x)))}else w=l&~f,w!==0?u=jl(w):x!==0&&(u=jl(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-ts(a),f=1<<l,u|=s[l],a&=~f;return u}function bj(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 wj(s,a){for(var l=s.suspendedLanes,u=s.pingedLanes,f=s.expirationTimes,x=s.pendingLanes;0<x;){var w=31-ts(x),P=1<<w,R=f[w];R===-1?((P&l)===0||(P&u)!==0)&&(f[w]=bj(P,a)):R<=a&&(s.expiredLanes|=P),x&=~P}}function nd(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function Am(){var s=Go;return Go<<=1,(Go&4194240)===0&&(Go=64),s}function sd(s){for(var a=[],l=0;31>l;l++)a.push(s);return a}function bl(s,a,l){s.pendingLanes|=a,a!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,a=31-ts(a),s[a]=l}function Nj(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-ts(l),x=1<<f;a[f]=0,u[f]=-1,s[f]=-1,l&=~x}}function rd(s,a){var l=s.entangledLanes|=a;for(s=s.entanglements;l;){var u=31-ts(l),f=1<<u;f&a|s[u]&a&&(s[u]|=a),l&=~f}}var at=0;function Lm(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var Fm,ad,Dm,Um,Qm,id=!1,Yo=[],mr=null,pr=null,xr=null,wl=new Map,Nl=new Map,gr=[],kj="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 Bm(s,a){switch(s){case"focusin":case"focusout":mr=null;break;case"dragenter":case"dragleave":pr=null;break;case"mouseover":case"mouseout":xr=null;break;case"pointerover":case"pointerout":wl.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Nl.delete(a.pointerId)}}function kl(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=Al(a),a!==null&&ad(a)),s):(s.eventSystemFlags|=u,a=s.targetContainers,f!==null&&a.indexOf(f)===-1&&a.push(f),s)}function Sj(s,a,l,u,f){switch(a){case"focusin":return mr=kl(mr,s,a,l,u,f),!0;case"dragenter":return pr=kl(pr,s,a,l,u,f),!0;case"mouseover":return xr=kl(xr,s,a,l,u,f),!0;case"pointerover":var x=f.pointerId;return wl.set(x,kl(wl.get(x)||null,s,a,l,u,f)),!0;case"gotpointercapture":return x=f.pointerId,Nl.set(x,kl(Nl.get(x)||null,s,a,l,u,f)),!0}return!1}function Vm(s){var a=ia(s.target);if(a!==null){var l=gs(a);if(l!==null){if(a=l.tag,a===13){if(a=vl(l),a!==null){s.blockedOn=a,Qm(s.priority,function(){Dm(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 ec(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var l=od(s.domEventName,s.eventSystemFlags,a[0],s.nativeEvent);if(l===null){l=s.nativeEvent;var u=new l.constructor(l.type,l);ur=u,l.target.dispatchEvent(u),ur=null}else return a=Al(l),a!==null&&ad(a),s.blockedOn=l,!1;a.shift()}return!0}function Hm(s,a,l){ec(s)&&l.delete(a)}function Cj(){id=!1,mr!==null&&ec(mr)&&(mr=null),pr!==null&&ec(pr)&&(pr=null),xr!==null&&ec(xr)&&(xr=null),wl.forEach(Hm),Nl.forEach(Hm)}function Sl(s,a){s.blockedOn===a&&(s.blockedOn=null,id||(id=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Cj)))}function Cl(s){function a(f){return Sl(f,s)}if(0<Yo.length){Sl(Yo[0],s);for(var l=1;l<Yo.length;l++){var u=Yo[l];u.blockedOn===s&&(u.blockedOn=null)}}for(mr!==null&&Sl(mr,s),pr!==null&&Sl(pr,s),xr!==null&&Sl(xr,s),wl.forEach(a),Nl.forEach(a),l=0;l<gr.length;l++)u=gr[l],u.blockedOn===s&&(u.blockedOn=null);for(;0<gr.length&&(l=gr[0],l.blockedOn===null);)Vm(l),l.blockedOn===null&&gr.shift()}var ni=E.ReactCurrentBatchConfig,tc=!0;function _j(s,a,l,u){var f=at,x=ni.transition;ni.transition=null;try{at=1,ld(s,a,l,u)}finally{at=f,ni.transition=x}}function Pj(s,a,l,u){var f=at,x=ni.transition;ni.transition=null;try{at=4,ld(s,a,l,u)}finally{at=f,ni.transition=x}}function ld(s,a,l,u){if(tc){var f=od(s,a,l,u);if(f===null)Sd(s,a,u,nc,l),Bm(s,u);else if(Sj(f,s,a,l,u))u.stopPropagation();else if(Bm(s,u),a&4&&-1<kj.indexOf(s)){for(;f!==null;){var x=Al(f);if(x!==null&&Fm(x),x=od(s,a,l,u),x===null&&Sd(s,a,u,nc,l),x===f)break;f=x}f!==null&&u.stopPropagation()}else Sd(s,a,u,null,l)}}var nc=null;function od(s,a,l,u){if(nc=null,s=Ga(u),s=ia(s),s!==null)if(a=gs(s),a===null)s=null;else if(l=a.tag,l===13){if(s=vl(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 nc=s,null}function Km(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(pj()){case td:return 1;case zm:return 4;case Wo:case xj:return 16;case Om:return 536870912;default:return 16}default:return 16}}var vr=null,cd=null,sc=null;function Wm(){if(sc)return sc;var s,a=cd,l=a.length,u,f="value"in vr?vr.value:vr.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 sc=f.slice(s,1<u?1-u:void 0)}function rc(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 ac(){return!0}function Zm(){return!1}function Rn(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)?ac:Zm,this.isPropagationStopped=Zm,this}return ne(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=ac)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=ac)},persist:function(){},isPersistent:ac}),a}var si={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ud=Rn(si),_l=ne({},si,{view:0,detail:0}),Ej=Rn(_l),dd,hd,Pl,ic=ne({},_l,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:md,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!==Pl&&(Pl&&s.type==="mousemove"?(dd=s.screenX-Pl.screenX,hd=s.screenY-Pl.screenY):hd=dd=0,Pl=s),dd)},movementY:function(s){return"movementY"in s?s.movementY:hd}}),Gm=Rn(ic),Rj=ne({},ic,{dataTransfer:0}),Mj=Rn(Rj),Tj=ne({},_l,{relatedTarget:0}),fd=Rn(Tj),qj=ne({},si,{animationName:0,elapsedTime:0,pseudoElement:0}),Ij=Rn(qj),$j=ne({},si,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),zj=Rn($j),Oj=ne({},si,{data:0}),Jm=Rn(Oj),Aj={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Lj={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"},Fj={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Dj(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=Fj[s])?!!a[s]:!1}function md(){return Dj}var Uj=ne({},_l,{key:function(s){if(s.key){var a=Aj[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=rc(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?Lj[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:md,charCode:function(s){return s.type==="keypress"?rc(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?rc(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),Qj=Rn(Uj),Bj=ne({},ic,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Xm=Rn(Bj),Vj=ne({},_l,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:md}),Hj=Rn(Vj),Kj=ne({},si,{propertyName:0,elapsedTime:0,pseudoElement:0}),Wj=Rn(Kj),Zj=ne({},ic,{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}),Gj=Rn(Zj),Jj=[9,13,27,32],pd=h&&"CompositionEvent"in window,El=null;h&&"documentMode"in document&&(El=document.documentMode);var Xj=h&&"TextEvent"in window&&!El,Ym=h&&(!pd||El&&8<El&&11>=El),ep=" ",tp=!1;function np(s,a){switch(s){case"keyup":return Jj.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sp(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var ri=!1;function Yj(s,a){switch(s){case"compositionend":return sp(a);case"keypress":return a.which!==32?null:(tp=!0,ep);case"textInput":return s=a.data,s===ep&&tp?null:s;default:return null}}function e1(s,a){if(ri)return s==="compositionend"||!pd&&np(s,a)?(s=Wm(),sc=cd=vr=null,ri=!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 Ym&&a.locale!=="ko"?null:a.data;default:return null}}var t1={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 rp(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!t1[s.type]:a==="textarea"}function ap(s,a,l,u){fl(u),a=dc(a,"onChange"),0<a.length&&(l=new ud("onChange","change",null,l,u),s.push({event:l,listeners:a}))}var Rl=null,Ml=null;function n1(s){Np(s,0)}function lc(s){var a=ci(s);if(Fo(a))return s}function s1(s,a){if(s==="change")return a}var ip=!1;if(h){var xd;if(h){var gd="oninput"in document;if(!gd){var lp=document.createElement("div");lp.setAttribute("oninput","return;"),gd=typeof lp.oninput=="function"}xd=gd}else xd=!1;ip=xd&&(!document.documentMode||9<document.documentMode)}function op(){Rl&&(Rl.detachEvent("onpropertychange",cp),Ml=Rl=null)}function cp(s){if(s.propertyName==="value"&&lc(Ml)){var a=[];ap(a,Ml,s,Ga(s)),gl(n1,a)}}function r1(s,a,l){s==="focusin"?(op(),Rl=a,Ml=l,Rl.attachEvent("onpropertychange",cp)):s==="focusout"&&op()}function a1(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return lc(Ml)}function i1(s,a){if(s==="click")return lc(a)}function l1(s,a){if(s==="input"||s==="change")return lc(a)}function o1(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var ns=typeof Object.is=="function"?Object.is:o1;function Tl(s,a){if(ns(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)||!ns(s[f],a[f]))return!1}return!0}function up(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function dp(s,a){var l=up(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=up(l)}}function hp(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?hp(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function fp(){for(var s=window,a=lr();a instanceof s.HTMLIFrameElement;){try{var l=typeof a.contentWindow.location.href=="string"}catch{l=!1}if(l)s=a.contentWindow;else break;a=lr(s.document)}return a}function vd(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 c1(s){var a=fp(),l=s.focusedElem,u=s.selectionRange;if(a!==l&&l&&l.ownerDocument&&hp(l.ownerDocument.documentElement,l)){if(u!==null&&vd(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=dp(l,x);var w=dp(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 u1=h&&"documentMode"in document&&11>=document.documentMode,ai=null,yd=null,ql=null,jd=!1;function mp(s,a,l){var u=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;jd||ai==null||ai!==lr(u)||(u=ai,"selectionStart"in u&&vd(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}),ql&&Tl(ql,u)||(ql=u,u=dc(yd,"onSelect"),0<u.length&&(a=new ud("onSelect","select",null,a,l),s.push({event:a,listeners:u}),a.target=ai)))}function oc(s,a){var l={};return l[s.toLowerCase()]=a.toLowerCase(),l["Webkit"+s]="webkit"+a,l["Moz"+s]="moz"+a,l}var ii={animationend:oc("Animation","AnimationEnd"),animationiteration:oc("Animation","AnimationIteration"),animationstart:oc("Animation","AnimationStart"),transitionend:oc("Transition","TransitionEnd")},bd={},pp={};h&&(pp=document.createElement("div").style,"AnimationEvent"in window||(delete ii.animationend.animation,delete ii.animationiteration.animation,delete ii.animationstart.animation),"TransitionEvent"in window||delete ii.transitionend.transition);function cc(s){if(bd[s])return bd[s];if(!ii[s])return s;var a=ii[s],l;for(l in a)if(a.hasOwnProperty(l)&&l in pp)return bd[s]=a[l];return s}var xp=cc("animationend"),gp=cc("animationiteration"),vp=cc("animationstart"),yp=cc("transitionend"),jp=new Map,bp="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 yr(s,a){jp.set(s,a),c(a,[s])}for(var wd=0;wd<bp.length;wd++){var Nd=bp[wd],d1=Nd.toLowerCase(),h1=Nd[0].toUpperCase()+Nd.slice(1);yr(d1,"on"+h1)}yr(xp,"onAnimationEnd"),yr(gp,"onAnimationIteration"),yr(vp,"onAnimationStart"),yr("dblclick","onDoubleClick"),yr("focusin","onFocus"),yr("focusout","onBlur"),yr(yp,"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 Il="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(" "),f1=new Set("cancel close invalid load scroll toggle".split(" ").concat(Il));function wp(s,a,l){var u=s.type||"unknown-event";s.currentTarget=l,Ko(u,a,void 0,s),s.currentTarget=null}function Np(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;wp(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;wp(f,P,U),x=R}}}if(aa)throw s=ei,aa=!1,ei=null,s}function mt(s,a){var l=a[Md];l===void 0&&(l=a[Md]=new Set);var u=s+"__bubble";l.has(u)||(kp(a,s,2,!1),l.add(u))}function kd(s,a,l){var u=0;a&&(u|=4),kp(l,s,u,a)}var uc="_reactListening"+Math.random().toString(36).slice(2);function $l(s){if(!s[uc]){s[uc]=!0,i.forEach(function(l){l!=="selectionchange"&&(f1.has(l)||kd(l,!1,s),kd(l,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[uc]||(a[uc]=!0,kd("selectionchange",!1,a))}}function kp(s,a,l,u){switch(Km(a)){case 1:var f=_j;break;case 4:f=Pj;break;default:f=ld}l=f.bind(null,a,l,s),f=void 0,!Ya||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 Sd(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=ia(P),w===null)return;if(R=w.tag,R===5||R===6){u=x=w;continue e}P=P.parentNode}}u=u.return}gl(function(){var U=x,J=Ga(l),X=[];e:{var G=jp.get(s);if(G!==void 0){var he=ud,we=s;switch(s){case"keypress":if(rc(l)===0)break e;case"keydown":case"keyup":he=Qj;break;case"focusin":we="focus",he=fd;break;case"focusout":we="blur",he=fd;break;case"beforeblur":case"afterblur":he=fd;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=Gm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":he=Mj;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":he=Hj;break;case xp:case gp:case vp:he=Ij;break;case yp:he=Wj;break;case"scroll":he=Ej;break;case"wheel":he=Gj;break;case"copy":case"cut":case"paste":he=zj;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":he=Xm}var Ne=(a&4)!==0,Et=!Ne&&s==="scroll",L=Ne?G!==null?G+"Capture":null:G;Ne=[];for(var I=U,D;I!==null;){D=I;var se=D.stateNode;if(D.tag===5&&se!==null&&(D=se,L!==null&&(se=dr(I,L),se!=null&&Ne.push(zl(I,se,D)))),Et)break;I=I.return}0<Ne.length&&(G=new he(G,we,null,l,J),X.push({event:G,listeners:Ne}))}}if((a&7)===0){e:{if(G=s==="mouseover"||s==="pointerover",he=s==="mouseout"||s==="pointerout",G&&l!==ur&&(we=l.relatedTarget||l.fromElement)&&(ia(we)||we[As]))break e;if((he||G)&&(G=J.window===J?J:(G=J.ownerDocument)?G.defaultView||G.parentWindow:window,he?(we=l.relatedTarget||l.toElement,he=U,we=we?ia(we):null,we!==null&&(Et=gs(we),we!==Et||we.tag!==5&&we.tag!==6)&&(we=null)):(he=null,we=U),he!==we)){if(Ne=Gm,se="onMouseLeave",L="onMouseEnter",I="mouse",(s==="pointerout"||s==="pointerover")&&(Ne=Xm,se="onPointerLeave",L="onPointerEnter",I="pointer"),Et=he==null?G:ci(he),D=we==null?G:ci(we),G=new Ne(se,I+"leave",he,l,J),G.target=Et,G.relatedTarget=D,se=null,ia(J)===U&&(Ne=new Ne(L,I+"enter",we,l,J),Ne.target=D,Ne.relatedTarget=Et,se=Ne),Et=se,he&&we)t:{for(Ne=he,L=we,I=0,D=Ne;D;D=li(D))I++;for(D=0,se=L;se;se=li(se))D++;for(;0<I-D;)Ne=li(Ne),I--;for(;0<D-I;)L=li(L),D--;for(;I--;){if(Ne===L||L!==null&&Ne===L.alternate)break t;Ne=li(Ne),L=li(L)}Ne=null}else Ne=null;he!==null&&Sp(X,G,he,Ne,!1),we!==null&&Et!==null&&Sp(X,Et,we,Ne,!0)}}e:{if(G=U?ci(U):window,he=G.nodeName&&G.nodeName.toLowerCase(),he==="select"||he==="input"&&G.type==="file")var ke=s1;else if(rp(G))if(ip)ke=l1;else{ke=a1;var Me=r1}else(he=G.nodeName)&&he.toLowerCase()==="input"&&(G.type==="checkbox"||G.type==="radio")&&(ke=i1);if(ke&&(ke=ke(s,U))){ap(X,ke,l,J);break e}Me&&Me(s,G,U),s==="focusout"&&(Me=G._wrapperState)&&Me.controlled&&G.type==="number"&&Ot(G,"number",G.value)}switch(Me=U?ci(U):window,s){case"focusin":(rp(Me)||Me.contentEditable==="true")&&(ai=Me,yd=U,ql=null);break;case"focusout":ql=yd=ai=null;break;case"mousedown":jd=!0;break;case"contextmenu":case"mouseup":case"dragend":jd=!1,mp(X,l,J);break;case"selectionchange":if(u1)break;case"keydown":case"keyup":mp(X,l,J)}var Te;if(pd)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 ri?np(s,l)&&(Ie="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&(Ie="onCompositionStart");Ie&&(Ym&&l.locale!=="ko"&&(ri||Ie!=="onCompositionStart"?Ie==="onCompositionEnd"&&ri&&(Te=Wm()):(vr=J,cd="value"in vr?vr.value:vr.textContent,ri=!0)),Me=dc(U,Ie),0<Me.length&&(Ie=new Jm(Ie,s,null,l,J),X.push({event:Ie,listeners:Me}),Te?Ie.data=Te:(Te=sp(l),Te!==null&&(Ie.data=Te)))),(Te=Xj?Yj(s,l):e1(s,l))&&(U=dc(U,"onBeforeInput"),0<U.length&&(J=new Jm("onBeforeInput","beforeinput",null,l,J),X.push({event:J,listeners:U}),J.data=Te))}Np(X,a)})}function zl(s,a,l){return{instance:s,listener:a,currentTarget:l}}function dc(s,a){for(var l=a+"Capture",u=[];s!==null;){var f=s,x=f.stateNode;f.tag===5&&x!==null&&(f=x,x=dr(s,l),x!=null&&u.unshift(zl(s,x,f)),x=dr(s,a),x!=null&&u.push(zl(s,x,f))),s=s.return}return u}function li(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function Sp(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=dr(l,x),R!=null&&w.unshift(zl(l,R,P))):f||(R=dr(l,x),R!=null&&w.push(zl(l,R,P)))),l=l.return}w.length!==0&&s.push({event:a,listeners:w})}var m1=/\r\n?/g,p1=/\u0000|\uFFFD/g;function Cp(s){return(typeof s=="string"?s:""+s).replace(m1,`
39
- `).replace(p1,"")}function hc(s,a,l){if(a=Cp(a),Cp(s)!==a&&l)throw Error(r(425))}function fc(){}var Cd=null,_d=null;function Pd(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 Ed=typeof setTimeout=="function"?setTimeout:void 0,x1=typeof clearTimeout=="function"?clearTimeout:void 0,_p=typeof Promise=="function"?Promise:void 0,g1=typeof queueMicrotask=="function"?queueMicrotask:typeof _p<"u"?function(s){return _p.resolve(null).then(s).catch(v1)}:Ed;function v1(s){setTimeout(function(){throw s})}function Rd(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),Cl(a);return}u--}else l!=="$"&&l!=="$?"&&l!=="$!"||u++;l=f}while(l);Cl(a)}function jr(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 Pp(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 oi=Math.random().toString(36).slice(2),ys="__reactFiber$"+oi,Ol="__reactProps$"+oi,As="__reactContainer$"+oi,Md="__reactEvents$"+oi,y1="__reactListeners$"+oi,j1="__reactHandles$"+oi;function ia(s){var a=s[ys];if(a)return a;for(var l=s.parentNode;l;){if(a=l[As]||l[ys]){if(l=a.alternate,a.child!==null||l!==null&&l.child!==null)for(s=Pp(s);s!==null;){if(l=s[ys])return l;s=Pp(s)}return a}s=l,l=s.parentNode}return null}function Al(s){return s=s[ys]||s[As],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function ci(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(r(33))}function mc(s){return s[Ol]||null}var Td=[],ui=-1;function br(s){return{current:s}}function pt(s){0>ui||(s.current=Td[ui],Td[ui]=null,ui--)}function dt(s,a){ui++,Td[ui]=s.current,s.current=a}var wr={},Jt=br(wr),yn=br(!1),la=wr;function di(s,a){var l=s.type.contextTypes;if(!l)return wr;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 jn(s){return s=s.childContextTypes,s!=null}function pc(){pt(yn),pt(Jt)}function Ep(s,a,l){if(Jt.current!==wr)throw Error(r(168));dt(Jt,a),dt(yn,l)}function Rp(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,Qe(s)||"Unknown",f));return ne({},l,u)}function xc(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||wr,la=Jt.current,dt(Jt,s),dt(yn,yn.current),!0}function Mp(s,a,l){var u=s.stateNode;if(!u)throw Error(r(169));l?(s=Rp(s,a,la),u.__reactInternalMemoizedMergedChildContext=s,pt(yn),pt(Jt),dt(Jt,s)):pt(yn),dt(yn,l)}var Ls=null,gc=!1,qd=!1;function Tp(s){Ls===null?Ls=[s]:Ls.push(s)}function b1(s){gc=!0,Tp(s)}function Nr(){if(!qd&&Ls!==null){qd=!0;var s=0,a=at;try{var l=Ls;for(at=1;s<l.length;s++){var u=l[s];do u=u(!0);while(u!==null)}Ls=null,gc=!1}catch(f){throw Ls!==null&&(Ls=Ls.slice(s+1)),Bt(td,Nr),f}finally{at=a,qd=!1}}return null}var hi=[],fi=0,vc=null,yc=0,Dn=[],Un=0,oa=null,Fs=1,Ds="";function ca(s,a){hi[fi++]=yc,hi[fi++]=vc,vc=s,yc=a}function qp(s,a,l){Dn[Un++]=Fs,Dn[Un++]=Ds,Dn[Un++]=oa,oa=s;var u=Fs;s=Ds;var f=32-ts(u)-1;u&=~(1<<f),l+=1;var x=32-ts(a)+f;if(30<x){var w=f-f%5;x=(u&(1<<w)-1).toString(32),u>>=w,f-=w,Fs=1<<32-ts(a)+f|l<<f|u,Ds=x+s}else Fs=1<<x|l<<f|u,Ds=s}function Id(s){s.return!==null&&(ca(s,1),qp(s,1,0))}function $d(s){for(;s===vc;)vc=hi[--fi],hi[fi]=null,yc=hi[--fi],hi[fi]=null;for(;s===oa;)oa=Dn[--Un],Dn[Un]=null,Ds=Dn[--Un],Dn[Un]=null,Fs=Dn[--Un],Dn[Un]=null}var Mn=null,Tn=null,gt=!1,ss=null;function Ip(s,a){var l=Hn(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 $p(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,Mn=s,Tn=jr(a.firstChild),!0):!1;case 6:return a=s.pendingProps===""||a.nodeType!==3?null:a,a!==null?(s.stateNode=a,Mn=s,Tn=null,!0):!1;case 13:return a=a.nodeType!==8?null:a,a!==null?(l=oa!==null?{id:Fs,overflow:Ds}:null,s.memoizedState={dehydrated:a,treeContext:l,retryLane:1073741824},l=Hn(18,null,null,0),l.stateNode=a,l.return=s,s.child=l,Mn=s,Tn=null,!0):!1;default:return!1}}function zd(s){return(s.mode&1)!==0&&(s.flags&128)===0}function Od(s){if(gt){var a=Tn;if(a){var l=a;if(!$p(s,a)){if(zd(s))throw Error(r(418));a=jr(l.nextSibling);var u=Mn;a&&$p(s,a)?Ip(u,l):(s.flags=s.flags&-4097|2,gt=!1,Mn=s)}}else{if(zd(s))throw Error(r(418));s.flags=s.flags&-4097|2,gt=!1,Mn=s}}}function zp(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;Mn=s}function jc(s){if(s!==Mn)return!1;if(!gt)return zp(s),gt=!0,!1;var a;if((a=s.tag!==3)&&!(a=s.tag!==5)&&(a=s.type,a=a!=="head"&&a!=="body"&&!Pd(s.type,s.memoizedProps)),a&&(a=Tn)){if(zd(s))throw Op(),Error(r(418));for(;a;)Ip(s,a),a=jr(a.nextSibling)}if(zp(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){Tn=jr(s.nextSibling);break e}a--}else l!=="$"&&l!=="$!"&&l!=="$?"||a++}s=s.nextSibling}Tn=null}}else Tn=Mn?jr(s.stateNode.nextSibling):null;return!0}function Op(){for(var s=Tn;s;)s=jr(s.nextSibling)}function mi(){Tn=Mn=null,gt=!1}function Ad(s){ss===null?ss=[s]:ss.push(s)}var w1=E.ReactCurrentBatchConfig;function Ll(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 bc(s,a){throw s=Object.prototype.toString.call(a),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s))}function Ap(s){var a=s._init;return a(s._payload)}function Lp(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=Mr(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,se){return I===null||I.tag!==6?(I=Eh(D,L.mode,se),I.return=L,I):(I=f(I,D),I.return=L,I)}function R(L,I,D,se){var ke=D.type;return ke===$?J(L,I,D.props.children,se,D.key):I!==null&&(I.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===ut&&Ap(ke)===I.type)?(se=f(I,D.props),se.ref=Ll(L,I,D),se.return=L,se):(se=Vc(D.type,D.key,D.props,null,L.mode,se),se.ref=Ll(L,I,D),se.return=L,se)}function U(L,I,D,se){return I===null||I.tag!==4||I.stateNode.containerInfo!==D.containerInfo||I.stateNode.implementation!==D.implementation?(I=Rh(D,L.mode,se),I.return=L,I):(I=f(I,D.children||[]),I.return=L,I)}function J(L,I,D,se,ke){return I===null||I.tag!==7?(I=ga(D,L.mode,se,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=Eh(""+I,L.mode,D),I.return=L,I;if(typeof I=="object"&&I!==null){switch(I.$$typeof){case M:return D=Vc(I.type,I.key,I.props,null,L.mode,D),D.ref=Ll(L,null,I),D.return=L,D;case T:return I=Rh(I,L.mode,D),I.return=L,I;case ut:var se=I._init;return X(L,se(I._payload),D)}if(ta(I)||me(I))return I=ga(I,L.mode,D,null),I.return=L,I;bc(L,I)}return null}function G(L,I,D,se){var ke=I!==null?I.key:null;if(typeof D=="string"&&D!==""||typeof D=="number")return ke!==null?null:P(L,I,""+D,se);if(typeof D=="object"&&D!==null){switch(D.$$typeof){case M:return D.key===ke?R(L,I,D,se):null;case T:return D.key===ke?U(L,I,D,se):null;case ut:return ke=D._init,G(L,I,ke(D._payload),se)}if(ta(D)||me(D))return ke!==null?null:J(L,I,D,se,null);bc(L,D)}return null}function he(L,I,D,se,ke){if(typeof se=="string"&&se!==""||typeof se=="number")return L=L.get(D)||null,P(I,L,""+se,ke);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case M:return L=L.get(se.key===null?D:se.key)||null,R(I,L,se,ke);case T:return L=L.get(se.key===null?D:se.key)||null,U(I,L,se,ke);case ut:var Me=se._init;return he(L,I,D,Me(se._payload),ke)}if(ta(se)||me(se))return L=L.get(D)||null,J(I,L,se,ke,null);bc(I,se)}return null}function we(L,I,D,se){for(var ke=null,Me=null,Te=I,Ie=I=0,Ft=null;Te!==null&&Ie<D.length;Ie++){Te.index>Ie?(Ft=Te,Te=null):Ft=Te.sibling;var tt=G(L,Te,D[Ie],se);if(tt===null){Te===null&&(Te=Ft);break}s&&Te&&tt.alternate===null&&a(L,Te),I=x(tt,I,Ie),Me===null?ke=tt:Me.sibling=tt,Me=tt,Te=Ft}if(Ie===D.length)return l(L,Te),gt&&ca(L,Ie),ke;if(Te===null){for(;Ie<D.length;Ie++)Te=X(L,D[Ie],se),Te!==null&&(I=x(Te,I,Ie),Me===null?ke=Te:Me.sibling=Te,Me=Te);return gt&&ca(L,Ie),ke}for(Te=u(L,Te);Ie<D.length;Ie++)Ft=he(Te,L,Ie,D[Ie],se),Ft!==null&&(s&&Ft.alternate!==null&&Te.delete(Ft.key===null?Ie:Ft.key),I=x(Ft,I,Ie),Me===null?ke=Ft:Me.sibling=Ft,Me=Ft);return s&&Te.forEach(function(Tr){return a(L,Tr)}),gt&&ca(L,Ie),ke}function Ne(L,I,D,se){var ke=me(D);if(typeof ke!="function")throw Error(r(150));if(D=ke.call(D),D==null)throw Error(r(151));for(var Me=ke=null,Te=I,Ie=I=0,Ft=null,tt=D.next();Te!==null&&!tt.done;Ie++,tt=D.next()){Te.index>Ie?(Ft=Te,Te=null):Ft=Te.sibling;var Tr=G(L,Te,tt.value,se);if(Tr===null){Te===null&&(Te=Ft);break}s&&Te&&Tr.alternate===null&&a(L,Te),I=x(Tr,I,Ie),Me===null?ke=Tr:Me.sibling=Tr,Me=Tr,Te=Ft}if(tt.done)return l(L,Te),gt&&ca(L,Ie),ke;if(Te===null){for(;!tt.done;Ie++,tt=D.next())tt=X(L,tt.value,se),tt!==null&&(I=x(tt,I,Ie),Me===null?ke=tt:Me.sibling=tt,Me=tt);return gt&&ca(L,Ie),ke}for(Te=u(L,Te);!tt.done;Ie++,tt=D.next())tt=he(Te,L,Ie,tt.value,se),tt!==null&&(s&&tt.alternate!==null&&Te.delete(tt.key===null?Ie:tt.key),I=x(tt,I,Ie),Me===null?ke=tt:Me.sibling=tt,Me=tt);return s&&Te.forEach(function(tb){return a(L,tb)}),gt&&ca(L,Ie),ke}function Et(L,I,D,se){if(typeof D=="object"&&D!==null&&D.type===$&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case M:e:{for(var ke=D.key,Me=I;Me!==null;){if(Me.key===ke){if(ke=D.type,ke===$){if(Me.tag===7){l(L,Me.sibling),I=f(Me,D.props.children),I.return=L,L=I;break e}}else if(Me.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===ut&&Ap(ke)===Me.type){l(L,Me.sibling),I=f(Me,D.props),I.ref=Ll(L,Me,D),I.return=L,L=I;break e}l(L,Me);break}else a(L,Me);Me=Me.sibling}D.type===$?(I=ga(D.props.children,L.mode,se,D.key),I.return=L,L=I):(se=Vc(D.type,D.key,D.props,null,L.mode,se),se.ref=Ll(L,I,D),se.return=L,L=se)}return w(L);case T:e:{for(Me=D.key;I!==null;){if(I.key===Me)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=Rh(D,L.mode,se),I.return=L,L=I}return w(L);case ut:return Me=D._init,Et(L,I,Me(D._payload),se)}if(ta(D))return we(L,I,D,se);if(me(D))return Ne(L,I,D,se);bc(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=Eh(D,L.mode,se),I.return=L,L=I),w(L)):l(L,I)}return Et}var pi=Lp(!0),Fp=Lp(!1),wc=br(null),Nc=null,xi=null,Ld=null;function Fd(){Ld=xi=Nc=null}function Dd(s){var a=wc.current;pt(wc),s._currentValue=a}function Ud(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 gi(s,a){Nc=s,Ld=xi=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&a)!==0&&(bn=!0),s.firstContext=null)}function Qn(s){var a=s._currentValue;if(Ld!==s)if(s={context:s,memoizedValue:a,next:null},xi===null){if(Nc===null)throw Error(r(308));xi=s,Nc.dependencies={lanes:0,firstContext:s}}else xi=xi.next=s;return a}var ua=null;function Qd(s){ua===null?ua=[s]:ua.push(s)}function Dp(s,a,l,u){var f=a.interleaved;return f===null?(l.next=l,Qd(a)):(l.next=f.next,f.next=l),a.interleaved=l,Us(s,u)}function Us(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 kr=!1;function Bd(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Up(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 Qs(s,a){return{eventTime:s,lane:a,tag:0,payload:null,callback:null,next:null}}function Sr(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,Us(s,l)}return f=u.interleaved,f===null?(a.next=a,Qd(u)):(a.next=f.next,f.next=a),u.interleaved=a,Us(s,l)}function kc(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,rd(s,l)}}function Qp(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 Sc(s,a,l,u){var f=s.updateQueue;kr=!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 we=s,Ne=P;switch(G=a,he=l,Ne.tag){case 1:if(we=Ne.payload,typeof we=="function"){X=we.call(he,X,G);break e}X=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=Ne.payload,G=typeof we=="function"?we.call(he,X,G):we,G==null)break e;X=ne({},X,G);break e;case 2:kr=!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);fa|=w,s.lanes=w,s.memoizedState=X}}function Bp(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 Fl={},js=br(Fl),Dl=br(Fl),Ul=br(Fl);function da(s){if(s===Fl)throw Error(r(174));return s}function Vd(s,a){switch(dt(Ul,a),dt(Dl,s),dt(js,Fl),s=a.nodeType,s){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:na(null,"");break;default:s=s===8?a.parentNode:a,a=s.namespaceURI||null,s=s.tagName,a=na(a,s)}pt(js),dt(js,a)}function vi(){pt(js),pt(Dl),pt(Ul)}function Vp(s){da(Ul.current);var a=da(js.current),l=na(a,s.type);a!==l&&(dt(Dl,s),dt(js,l))}function Hd(s){Dl.current===s&&(pt(js),pt(Dl))}var wt=br(0);function Cc(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 Kd=[];function Wd(){for(var s=0;s<Kd.length;s++)Kd[s]._workInProgressVersionPrimary=null;Kd.length=0}var _c=E.ReactCurrentDispatcher,Zd=E.ReactCurrentBatchConfig,ha=0,Nt=null,qt=null,At=null,Pc=!1,Ql=!1,Bl=0,N1=0;function Xt(){throw Error(r(321))}function Gd(s,a){if(a===null)return!1;for(var l=0;l<a.length&&l<s.length;l++)if(!ns(s[l],a[l]))return!1;return!0}function Jd(s,a,l,u,f,x){if(ha=x,Nt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,_c.current=s===null||s.memoizedState===null?_1:P1,s=l(u,f),Ql){x=0;do{if(Ql=!1,Bl=0,25<=x)throw Error(r(301));x+=1,At=qt=null,a.updateQueue=null,_c.current=E1,s=l(u,f)}while(Ql)}if(_c.current=Mc,a=qt!==null&&qt.next!==null,ha=0,At=qt=Nt=null,Pc=!1,a)throw Error(r(300));return s}function Xd(){var s=Bl!==0;return Bl=0,s}function bs(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return At===null?Nt.memoizedState=At=s:At=At.next=s,At}function Bn(){if(qt===null){var s=Nt.alternate;s=s!==null?s.memoizedState:null}else s=qt.next;var a=At===null?Nt.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?Nt.memoizedState=At=s:At=At.next=s}return At}function Vl(s,a){return typeof a=="function"?a(s):a}function Yd(s){var a=Bn(),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((ha&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,Nt.lanes|=J,fa|=J}U=U.next}while(U!==null&&U!==x);R===null?w=u:R.next=P,ns(u,a.memoizedState)||(bn=!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,Nt.lanes|=x,fa|=x,f=f.next;while(f!==s)}else f===null&&(l.lanes=0);return[a.memoizedState,l.dispatch]}function eh(s){var a=Bn(),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);ns(x,a.memoizedState)||(bn=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),l.lastRenderedState=x}return[x,u]}function Hp(){}function Kp(s,a){var l=Nt,u=Bn(),f=a(),x=!ns(u.memoizedState,f);if(x&&(u.memoizedState=f,bn=!0),u=u.queue,th(Gp.bind(null,l,u,s),[s]),u.getSnapshot!==a||x||At!==null&&At.memoizedState.tag&1){if(l.flags|=2048,Hl(9,Zp.bind(null,l,u,f,a),void 0,null),Lt===null)throw Error(r(349));(ha&30)!==0||Wp(l,a,f)}return f}function Wp(s,a,l){s.flags|=16384,s={getSnapshot:a,value:l},a=Nt.updateQueue,a===null?(a={lastEffect:null,stores:null},Nt.updateQueue=a,a.stores=[s]):(l=a.stores,l===null?a.stores=[s]:l.push(s))}function Zp(s,a,l,u){a.value=l,a.getSnapshot=u,Jp(a)&&Xp(s)}function Gp(s,a,l){return l(function(){Jp(a)&&Xp(s)})}function Jp(s){var a=s.getSnapshot;s=s.value;try{var l=a();return!ns(s,l)}catch{return!0}}function Xp(s){var a=Us(s,1);a!==null&&ls(a,s,1,-1)}function Yp(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:Vl,lastRenderedState:s},a.queue=s,s=s.dispatch=C1.bind(null,Nt,s),[a.memoizedState,s]}function Hl(s,a,l,u){return s={tag:s,create:a,destroy:l,deps:u,next:null},a=Nt.updateQueue,a===null?(a={lastEffect:null,stores:null},Nt.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 ex(){return Bn().memoizedState}function Ec(s,a,l,u){var f=bs();Nt.flags|=s,f.memoizedState=Hl(1|a,l,void 0,u===void 0?null:u)}function Rc(s,a,l,u){var f=Bn();u=u===void 0?null:u;var x=void 0;if(qt!==null){var w=qt.memoizedState;if(x=w.destroy,u!==null&&Gd(u,w.deps)){f.memoizedState=Hl(a,l,x,u);return}}Nt.flags|=s,f.memoizedState=Hl(1|a,l,x,u)}function tx(s,a){return Ec(8390656,8,s,a)}function th(s,a){return Rc(2048,8,s,a)}function nx(s,a){return Rc(4,2,s,a)}function sx(s,a){return Rc(4,4,s,a)}function rx(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 ax(s,a,l){return l=l!=null?l.concat([s]):null,Rc(4,4,rx.bind(null,a,s),l)}function nh(){}function ix(s,a){var l=Bn();a=a===void 0?null:a;var u=l.memoizedState;return u!==null&&a!==null&&Gd(a,u[1])?u[0]:(l.memoizedState=[s,a],s)}function lx(s,a){var l=Bn();a=a===void 0?null:a;var u=l.memoizedState;return u!==null&&a!==null&&Gd(a,u[1])?u[0]:(s=s(),l.memoizedState=[s,a],s)}function ox(s,a,l){return(ha&21)===0?(s.baseState&&(s.baseState=!1,bn=!0),s.memoizedState=l):(ns(l,a)||(l=Am(),Nt.lanes|=l,fa|=l,s.baseState=!0),a)}function k1(s,a){var l=at;at=l!==0&&4>l?l:4,s(!0);var u=Zd.transition;Zd.transition={};try{s(!1),a()}finally{at=l,Zd.transition=u}}function cx(){return Bn().memoizedState}function S1(s,a,l){var u=Er(s);if(l={lane:u,action:l,hasEagerState:!1,eagerState:null,next:null},ux(s))dx(a,l);else if(l=Dp(s,a,l,u),l!==null){var f=un();ls(l,s,u,f),hx(l,a,u)}}function C1(s,a,l){var u=Er(s),f={lane:u,action:l,hasEagerState:!1,eagerState:null,next:null};if(ux(s))dx(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,ns(P,w)){var R=a.interleaved;R===null?(f.next=f,Qd(a)):(f.next=R.next,R.next=f),a.interleaved=f;return}}catch{}finally{}l=Dp(s,a,f,u),l!==null&&(f=un(),ls(l,s,u,f),hx(l,a,u))}}function ux(s){var a=s.alternate;return s===Nt||a!==null&&a===Nt}function dx(s,a){Ql=Pc=!0;var l=s.pending;l===null?a.next=a:(a.next=l.next,l.next=a),s.pending=a}function hx(s,a,l){if((l&4194240)!==0){var u=a.lanes;u&=s.pendingLanes,l|=u,a.lanes=l,rd(s,l)}}var Mc={readContext:Qn,useCallback:Xt,useContext:Xt,useEffect:Xt,useImperativeHandle:Xt,useInsertionEffect:Xt,useLayoutEffect:Xt,useMemo:Xt,useReducer:Xt,useRef:Xt,useState:Xt,useDebugValue:Xt,useDeferredValue:Xt,useTransition:Xt,useMutableSource:Xt,useSyncExternalStore:Xt,useId:Xt,unstable_isNewReconciler:!1},_1={readContext:Qn,useCallback:function(s,a){return bs().memoizedState=[s,a===void 0?null:a],s},useContext:Qn,useEffect:tx,useImperativeHandle:function(s,a,l){return l=l!=null?l.concat([s]):null,Ec(4194308,4,rx.bind(null,a,s),l)},useLayoutEffect:function(s,a){return Ec(4194308,4,s,a)},useInsertionEffect:function(s,a){return Ec(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=S1.bind(null,Nt,s),[u.memoizedState,s]},useRef:function(s){var a=bs();return s={current:s},a.memoizedState=s},useState:Yp,useDebugValue:nh,useDeferredValue:function(s){return bs().memoizedState=s},useTransition:function(){var s=Yp(!1),a=s[0];return s=k1.bind(null,s[1]),bs().memoizedState=s,[a,s]},useMutableSource:function(){},useSyncExternalStore:function(s,a,l){var u=Nt,f=bs();if(gt){if(l===void 0)throw Error(r(407));l=l()}else{if(l=a(),Lt===null)throw Error(r(349));(ha&30)!==0||Wp(u,a,l)}f.memoizedState=l;var x={value:l,getSnapshot:a};return f.queue=x,tx(Gp.bind(null,u,x,s),[s]),u.flags|=2048,Hl(9,Zp.bind(null,u,x,l,a),void 0,null),l},useId:function(){var s=bs(),a=Lt.identifierPrefix;if(gt){var l=Ds,u=Fs;l=(u&~(1<<32-ts(u)-1)).toString(32)+l,a=":"+a+"R"+l,l=Bl++,0<l&&(a+="H"+l.toString(32)),a+=":"}else l=N1++,a=":"+a+"r"+l.toString(32)+":";return s.memoizedState=a},unstable_isNewReconciler:!1},P1={readContext:Qn,useCallback:ix,useContext:Qn,useEffect:th,useImperativeHandle:ax,useInsertionEffect:nx,useLayoutEffect:sx,useMemo:lx,useReducer:Yd,useRef:ex,useState:function(){return Yd(Vl)},useDebugValue:nh,useDeferredValue:function(s){var a=Bn();return ox(a,qt.memoizedState,s)},useTransition:function(){var s=Yd(Vl)[0],a=Bn().memoizedState;return[s,a]},useMutableSource:Hp,useSyncExternalStore:Kp,useId:cx,unstable_isNewReconciler:!1},E1={readContext:Qn,useCallback:ix,useContext:Qn,useEffect:th,useImperativeHandle:ax,useInsertionEffect:nx,useLayoutEffect:sx,useMemo:lx,useReducer:eh,useRef:ex,useState:function(){return eh(Vl)},useDebugValue:nh,useDeferredValue:function(s){var a=Bn();return qt===null?a.memoizedState=s:ox(a,qt.memoizedState,s)},useTransition:function(){var s=eh(Vl)[0],a=Bn().memoizedState;return[s,a]},useMutableSource:Hp,useSyncExternalStore:Kp,useId:cx,unstable_isNewReconciler:!1};function rs(s,a){if(s&&s.defaultProps){a=ne({},a),s=s.defaultProps;for(var l in s)a[l]===void 0&&(a[l]=s[l]);return a}return a}function sh(s,a,l,u){a=s.memoizedState,l=l(u,a),l=l==null?a:ne({},a,l),s.memoizedState=l,s.lanes===0&&(s.updateQueue.baseState=l)}var Tc={isMounted:function(s){return(s=s._reactInternals)?gs(s)===s:!1},enqueueSetState:function(s,a,l){s=s._reactInternals;var u=un(),f=Er(s),x=Qs(u,f);x.payload=a,l!=null&&(x.callback=l),a=Sr(s,x,f),a!==null&&(ls(a,s,f,u),kc(a,s,f))},enqueueReplaceState:function(s,a,l){s=s._reactInternals;var u=un(),f=Er(s),x=Qs(u,f);x.tag=1,x.payload=a,l!=null&&(x.callback=l),a=Sr(s,x,f),a!==null&&(ls(a,s,f,u),kc(a,s,f))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var l=un(),u=Er(s),f=Qs(l,u);f.tag=2,a!=null&&(f.callback=a),a=Sr(s,f,u),a!==null&&(ls(a,s,u,l),kc(a,s,u))}};function fx(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?!Tl(l,u)||!Tl(f,x):!0}function mx(s,a,l){var u=!1,f=wr,x=a.contextType;return typeof x=="object"&&x!==null?x=Qn(x):(f=jn(a)?la:Jt.current,u=a.contextTypes,x=(u=u!=null)?di(s,f):wr),a=new a(l,x),s.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Tc,s.stateNode=a,a._reactInternals=s,u&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=f,s.__reactInternalMemoizedMaskedChildContext=x),a}function px(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&&Tc.enqueueReplaceState(a,a.state,null)}function rh(s,a,l,u){var f=s.stateNode;f.props=l,f.state=s.memoizedState,f.refs={},Bd(s);var x=a.contextType;typeof x=="object"&&x!==null?f.context=Qn(x):(x=jn(a)?la:Jt.current,f.context=di(s,x)),f.state=s.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(sh(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&&Tc.enqueueReplaceState(f,f.state,null),Sc(s,l,f,u),f.state=s.memoizedState),typeof f.componentDidMount=="function"&&(s.flags|=4194308)}function yi(s,a){try{var l="",u=a;do l+=Ce(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 ah(s,a,l){return{value:s,source:null,stack:l??null,digest:a??null}}function ih(s,a){try{console.error(a.value)}catch(l){setTimeout(function(){throw l})}}var R1=typeof WeakMap=="function"?WeakMap:Map;function xx(s,a,l){l=Qs(-1,l),l.tag=3,l.payload={element:null};var u=a.value;return l.callback=function(){Lc||(Lc=!0,bh=u),ih(s,a)},l}function gx(s,a,l){l=Qs(-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(){ih(s,a)}}var x=s.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(l.callback=function(){ih(s,a),typeof u!="function"&&(_r===null?_r=new Set([this]):_r.add(this));var w=a.stack;this.componentDidCatch(a.value,{componentStack:w!==null?w:""})}),l}function vx(s,a,l){var u=s.pingCache;if(u===null){u=s.pingCache=new R1;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=B1.bind(null,s,a,l),a.then(s,s))}function yx(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 jx(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=Qs(-1,1),a.tag=2,Sr(l,a,1))),l.lanes|=1),s):(s.flags|=65536,s.lanes=f,s)}var M1=E.ReactCurrentOwner,bn=!1;function cn(s,a,l,u){a.child=s===null?Fp(a,null,l,u):pi(a,s.child,l,u)}function bx(s,a,l,u,f){l=l.render;var x=a.ref;return gi(a,f),u=Jd(s,a,l,u,x,f),l=Xd(),s!==null&&!bn?(a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~f,Bs(s,a,f)):(gt&&l&&Id(a),a.flags|=1,cn(s,a,u,f),a.child)}function wx(s,a,l,u,f){if(s===null){var x=l.type;return typeof x=="function"&&!Ph(x)&&x.defaultProps===void 0&&l.compare===null&&l.defaultProps===void 0?(a.tag=15,a.type=x,Nx(s,a,x,u,f)):(s=Vc(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:Tl,l(w,u)&&s.ref===a.ref)return Bs(s,a,f)}return a.flags|=1,s=Mr(x,u),s.ref=a.ref,s.return=a,a.child=s}function Nx(s,a,l,u,f){if(s!==null){var x=s.memoizedProps;if(Tl(x,u)&&s.ref===a.ref)if(bn=!1,a.pendingProps=u=x,(s.lanes&f)!==0)(s.flags&131072)!==0&&(bn=!0);else return a.lanes=s.lanes,Bs(s,a,f)}return lh(s,a,l,u,f)}function kx(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(bi,qn),qn|=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(bi,qn),qn|=s,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},u=x!==null?x.baseLanes:l,dt(bi,qn),qn|=u}else x!==null?(u=x.baseLanes|l,a.memoizedState=null):u=l,dt(bi,qn),qn|=u;return cn(s,a,f,l),a.child}function Sx(s,a){var l=a.ref;(s===null&&l!==null||s!==null&&s.ref!==l)&&(a.flags|=512,a.flags|=2097152)}function lh(s,a,l,u,f){var x=jn(l)?la:Jt.current;return x=di(a,x),gi(a,f),l=Jd(s,a,l,u,x,f),u=Xd(),s!==null&&!bn?(a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~f,Bs(s,a,f)):(gt&&u&&Id(a),a.flags|=1,cn(s,a,l,f),a.child)}function Cx(s,a,l,u,f){if(jn(l)){var x=!0;xc(a)}else x=!1;if(gi(a,f),a.stateNode===null)Ic(s,a),mx(a,l,u),rh(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=Qn(U):(U=jn(l)?la:Jt.current,U=di(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)&&px(a,w,u,U),kr=!1;var G=a.memoizedState;w.state=G,Sc(a,u,w,f),R=a.memoizedState,P!==u||G!==R||yn.current||kr?(typeof J=="function"&&(sh(a,l,J,u),R=a.memoizedState),(P=kr||fx(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,Up(s,a),P=a.memoizedProps,U=a.type===a.elementType?P:rs(a.type,P),w.props=U,X=a.pendingProps,G=w.context,R=l.contextType,typeof R=="object"&&R!==null?R=Qn(R):(R=jn(l)?la:Jt.current,R=di(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)&&px(a,w,u,R),kr=!1,G=a.memoizedState,w.state=G,Sc(a,u,w,f);var we=a.memoizedState;P!==X||G!==we||yn.current||kr?(typeof he=="function"&&(sh(a,l,he,u),we=a.memoizedState),(U=kr||fx(a,l,U,u,G,we,R)||!1)?(J||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(u,we,R),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(u,we,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=we),w.props=u,w.state=we,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 oh(s,a,l,u,x,f)}function oh(s,a,l,u,f,x){Sx(s,a);var w=(a.flags&128)!==0;if(!u&&!w)return f&&Mp(a,l,!1),Bs(s,a,x);u=a.stateNode,M1.current=a;var P=w&&typeof l.getDerivedStateFromError!="function"?null:u.render();return a.flags|=1,s!==null&&w?(a.child=pi(a,s.child,null,x),a.child=pi(a,null,P,x)):cn(s,a,P,x),a.memoizedState=u.state,f&&Mp(a,l,!0),a.child}function _x(s){var a=s.stateNode;a.pendingContext?Ep(s,a.pendingContext,a.pendingContext!==a.context):a.context&&Ep(s,a.context,!1),Vd(s,a.containerInfo)}function Px(s,a,l,u,f){return mi(),Ad(f),a.flags|=256,cn(s,a,l,u),a.child}var ch={dehydrated:null,treeContext:null,retryLane:0};function uh(s){return{baseLanes:s,cachePool:null,transitions:null}}function Ex(s,a,l){var u=a.pendingProps,f=wt.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(wt,f&1),s===null)return Od(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=Hc(w,u,0,null),s=ga(s,u,l,null),x.return=a,s.return=a,x.sibling=s,a.child=x,a.child.memoizedState=uh(l),a.memoizedState=ch,s):dh(a,w));if(f=s.memoizedState,f!==null&&(P=f.dehydrated,P!==null))return T1(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=Mr(f,R),u.subtreeFlags=f.subtreeFlags&14680064),P!==null?x=Mr(P,x):(x=ga(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?uh(l):{baseLanes:w.baseLanes|l,cachePool:null,transitions:w.transitions},x.memoizedState=w,x.childLanes=s.childLanes&~l,a.memoizedState=ch,u}return x=s.child,s=x.sibling,u=Mr(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 dh(s,a){return a=Hc({mode:"visible",children:a},s.mode,0,null),a.return=s,s.child=a}function qc(s,a,l,u){return u!==null&&Ad(u),pi(a,s.child,null,l),s=dh(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function T1(s,a,l,u,f,x,w){if(l)return a.flags&256?(a.flags&=-257,u=ah(Error(r(422))),qc(s,a,w,u)):a.memoizedState!==null?(a.child=s.child,a.flags|=128,null):(x=u.fallback,f=a.mode,u=Hc({mode:"visible",children:u.children},f,0,null),x=ga(x,f,w,null),x.flags|=2,u.return=a,x.return=a,u.sibling=x,a.child=u,(a.mode&1)!==0&&pi(a,s.child,null,w),a.child.memoizedState=uh(w),a.memoizedState=ch,x);if((a.mode&1)===0)return qc(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=ah(x,u,void 0),qc(s,a,w,u)}if(P=(w&s.childLanes)!==0,bn||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,Us(s,f),ls(u,s,f,-1))}return _h(),u=ah(Error(r(421))),qc(s,a,w,u)}return f.data==="$?"?(a.flags|=128,a.child=s.child,a=V1.bind(null,s),f._reactRetry=a,null):(s=x.treeContext,Tn=jr(f.nextSibling),Mn=a,gt=!0,ss=null,s!==null&&(Dn[Un++]=Fs,Dn[Un++]=Ds,Dn[Un++]=oa,Fs=s.id,Ds=s.overflow,oa=a),a=dh(a,u.children),a.flags|=4096,a)}function Rx(s,a,l){s.lanes|=a;var u=s.alternate;u!==null&&(u.lanes|=a),Ud(s.return,a,l)}function hh(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 Mx(s,a,l){var u=a.pendingProps,f=u.revealOrder,x=u.tail;if(cn(s,a,u.children,l),u=wt.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&&Rx(s,l,a);else if(s.tag===19)Rx(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(wt,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&&Cc(s)===null&&(f=l),l=l.sibling;l=f,l===null?(f=a.child,a.child=null):(f=l.sibling,l.sibling=null),hh(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&&Cc(s)===null){a.child=f;break}s=f.sibling,f.sibling=l,l=f,f=s}hh(a,!0,l,null,x);break;case"together":hh(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function Ic(s,a){(a.mode&1)===0&&s!==null&&(s.alternate=null,a.alternate=null,a.flags|=2)}function Bs(s,a,l){if(s!==null&&(a.dependencies=s.dependencies),fa|=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=Mr(s,s.pendingProps),a.child=l,l.return=a;s.sibling!==null;)s=s.sibling,l=l.sibling=Mr(s,s.pendingProps),l.return=a;l.sibling=null}return a.child}function q1(s,a,l){switch(a.tag){case 3:_x(a),mi();break;case 5:Vp(a);break;case 1:jn(a.type)&&xc(a);break;case 4:Vd(a,a.stateNode.containerInfo);break;case 10:var u=a.type._context,f=a.memoizedProps.value;dt(wc,u._currentValue),u._currentValue=f;break;case 13:if(u=a.memoizedState,u!==null)return u.dehydrated!==null?(dt(wt,wt.current&1),a.flags|=128,null):(l&a.child.childLanes)!==0?Ex(s,a,l):(dt(wt,wt.current&1),s=Bs(s,a,l),s!==null?s.sibling:null);dt(wt,wt.current&1);break;case 19:if(u=(l&a.childLanes)!==0,(s.flags&128)!==0){if(u)return Mx(s,a,l);a.flags|=128}if(f=a.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),dt(wt,wt.current),u)break;return null;case 22:case 23:return a.lanes=0,kx(s,a,l)}return Bs(s,a,l)}var Tx,fh,qx,Ix;Tx=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}},fh=function(){},qx=function(s,a,l,u){var f=s.memoizedProps;if(f!==u){s=a.stateNode,da(js.current);var x=null;switch(l){case"input":f=or(s,f),u=or(s,u),x=[];break;case"select":f=ne({},f,{value:void 0}),u=ne({},u,{value:void 0}),x=[];break;case"textarea":f=En(s,f),u=En(s,u),x=[];break;default:typeof f.onClick!="function"&&typeof u.onClick=="function"&&(s.onclick=fc)}$s(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"&&mt("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)}},Ix=function(s,a,l,u){l!==u&&(a.flags|=4)};function Kl(s,a){if(!gt)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 Yt(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 I1(s,a,l){var u=a.pendingProps;switch($d(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Yt(a),null;case 1:return jn(a.type)&&pc(),Yt(a),null;case 3:return u=a.stateNode,vi(),pt(yn),pt(Jt),Wd(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(jc(a)?a.flags|=4:s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,ss!==null&&(kh(ss),ss=null))),fh(s,a),Yt(a),null;case 5:Hd(a);var f=da(Ul.current);if(l=a.type,s!==null&&a.stateNode!=null)qx(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 Yt(a),null}if(s=da(js.current),jc(a)){u=a.stateNode,l=a.type;var x=a.memoizedProps;switch(u[ys]=a,u[Ol]=x,s=(a.mode&1)!==0,l){case"dialog":mt("cancel",u),mt("close",u);break;case"iframe":case"object":case"embed":mt("load",u);break;case"video":case"audio":for(f=0;f<Il.length;f++)mt(Il[f],u);break;case"source":mt("error",u);break;case"img":case"image":case"link":mt("error",u),mt("load",u);break;case"details":mt("toggle",u);break;case"input":Wa(u,x),mt("invalid",u);break;case"select":u._wrapperState={wasMultiple:!!x.multiple},mt("invalid",u);break;case"textarea":Do(u,x),mt("invalid",u)}$s(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&&hc(u.textContent,P,s),f=["children",P]):typeof P=="number"&&u.textContent!==""+P&&(x.suppressHydrationWarning!==!0&&hc(u.textContent,P,s),f=["children",""+P]):o.hasOwnProperty(w)&&P!=null&&w==="onScroll"&&mt("scroll",u)}switch(l){case"input":Yr(u),qs(u,x,!0);break;case"textarea":Yr(u),ol(u);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(u.onclick=fc)}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=xs(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[Ol]=u,Tx(s,a,!1,!1),a.stateNode=s;e:{switch(w=dl(l,u),l){case"dialog":mt("cancel",s),mt("close",s),f=u;break;case"iframe":case"object":case"embed":mt("load",s),f=u;break;case"video":case"audio":for(f=0;f<Il.length;f++)mt(Il[f],s);f=u;break;case"source":mt("error",s),f=u;break;case"img":case"image":case"link":mt("error",s),mt("load",s),f=u;break;case"details":mt("toggle",s),f=u;break;case"input":Wa(s,u),f=or(s,u),mt("invalid",s);break;case"option":f=u;break;case"select":s._wrapperState={wasMultiple:!!u.multiple},f=ne({},u,{value:void 0}),mt("invalid",s);break;case"textarea":Do(s,u),f=En(s,u),mt("invalid",s);break;default:f=u}$s(l,f),P=f;for(x in P)if(P.hasOwnProperty(x)){var R=P[x];x==="style"?ul(s,R):x==="dangerouslySetInnerHTML"?(R=R?R.__html:void 0,R!=null&&on(s,R)):x==="children"?typeof R=="string"?(l!=="textarea"||R!=="")&&sa(s,R):typeof R=="number"&&sa(s,""+R):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(o.hasOwnProperty(x)?R!=null&&x==="onScroll"&&mt("scroll",s):R!=null&&z(s,x,R,w))}switch(l){case"input":Yr(s),qs(s,u,!1);break;case"textarea":Yr(s),ol(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?ps(s,!!u.multiple,x,!1):u.defaultValue!=null&&ps(s,!!u.multiple,u.defaultValue,!0);break;default:typeof f.onClick=="function"&&(s.onclick=fc)}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 Yt(a),null;case 6:if(s&&a.stateNode!=null)Ix(s,a,s.memoizedProps,u);else{if(typeof u!="string"&&a.stateNode===null)throw Error(r(166));if(l=da(Ul.current),da(js.current),jc(a)){if(u=a.stateNode,l=a.memoizedProps,u[ys]=a,(x=u.nodeValue!==l)&&(s=Mn,s!==null))switch(s.tag){case 3:hc(u.nodeValue,l,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&hc(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 Yt(a),null;case 13:if(pt(wt),u=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(gt&&Tn!==null&&(a.mode&1)!==0&&(a.flags&128)===0)Op(),mi(),a.flags|=98560,x=!1;else if(x=jc(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 mi(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Yt(a),x=!1}else ss!==null&&(kh(ss),ss=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||(wt.current&1)!==0?It===0&&(It=3):_h())),a.updateQueue!==null&&(a.flags|=4),Yt(a),null);case 4:return vi(),fh(s,a),s===null&&$l(a.stateNode.containerInfo),Yt(a),null;case 10:return Dd(a.type._context),Yt(a),null;case 17:return jn(a.type)&&pc(),Yt(a),null;case 19:if(pt(wt),x=a.memoizedState,x===null)return Yt(a),null;if(u=(a.flags&128)!==0,w=x.rendering,w===null)if(u)Kl(x,!1);else{if(It!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(w=Cc(s),w!==null){for(a.flags|=128,Kl(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(wt,wt.current&1|2),a.child}s=s.sibling}x.tail!==null&&Pt()>wi&&(a.flags|=128,u=!0,Kl(x,!1),a.lanes=4194304)}else{if(!u)if(s=Cc(w),s!==null){if(a.flags|=128,u=!0,l=s.updateQueue,l!==null&&(a.updateQueue=l,a.flags|=4),Kl(x,!0),x.tail===null&&x.tailMode==="hidden"&&!w.alternate&&!gt)return Yt(a),null}else 2*Pt()-x.renderingStartTime>wi&&l!==1073741824&&(a.flags|=128,u=!0,Kl(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=wt.current,dt(wt,u?l&1|2:l&1),a):(Yt(a),null);case 22:case 23:return Ch(),u=a.memoizedState!==null,s!==null&&s.memoizedState!==null!==u&&(a.flags|=8192),u&&(a.mode&1)!==0?(qn&1073741824)!==0&&(Yt(a),a.subtreeFlags&6&&(a.flags|=8192)):Yt(a),null;case 24:return null;case 25:return null}throw Error(r(156,a.tag))}function $1(s,a){switch($d(a),a.tag){case 1:return jn(a.type)&&pc(),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return vi(),pt(yn),pt(Jt),Wd(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 5:return Hd(a),null;case 13:if(pt(wt),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(r(340));mi()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return pt(wt),null;case 4:return vi(),null;case 10:return Dd(a.type._context),null;case 22:case 23:return Ch(),null;case 24:return null;default:return null}}var $c=!1,en=!1,z1=typeof WeakSet=="function"?WeakSet:Set,ve=null;function ji(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 mh(s,a,l){try{l()}catch(u){St(s,a,u)}}var $x=!1;function O1(s,a){if(Cd=tc,s=fp(),vd(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(_d={focusedElem:s,selectionRange:l},tc=!1,ve=a;ve!==null;)if(a=ve,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,ve=s;else for(;ve!==null;){a=ve;try{var we=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(we!==null){var Ne=we.memoizedProps,Et=we.memoizedState,L=a.stateNode,I=L.getSnapshotBeforeUpdate(a.elementType===a.type?Ne:rs(a.type,Ne),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(se){St(a,a.return,se)}if(s=a.sibling,s!==null){s.return=a.return,ve=s;break}ve=a.return}return we=$x,$x=!1,we}function Wl(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&&mh(a,l,x)}f=f.next}while(f!==u)}}function zc(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 ph(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 zx(s){var a=s.alternate;a!==null&&(s.alternate=null,zx(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&(delete a[ys],delete a[Ol],delete a[Md],delete a[y1],delete a[j1])),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 Ox(s){return s.tag===5||s.tag===3||s.tag===4}function Ax(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Ox(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 xh(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=fc));else if(u!==4&&(s=s.child,s!==null))for(xh(s,a,l),s=s.sibling;s!==null;)xh(s,a,l),s=s.sibling}function gh(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(gh(s,a,l),s=s.sibling;s!==null;)gh(s,a,l),s=s.sibling}var Vt=null,as=!1;function Cr(s,a,l){for(l=l.child;l!==null;)Lx(s,a,l),l=l.sibling}function Lx(s,a,l){if(vs&&typeof vs.onCommitFiberUnmount=="function")try{vs.onCommitFiberUnmount(Zo,l)}catch{}switch(l.tag){case 5:en||ji(l,a);case 6:var u=Vt,f=as;Vt=null,Cr(s,a,l),Vt=u,as=f,Vt!==null&&(as?(s=Vt,l=l.stateNode,s.nodeType===8?s.parentNode.removeChild(l):s.removeChild(l)):Vt.removeChild(l.stateNode));break;case 18:Vt!==null&&(as?(s=Vt,l=l.stateNode,s.nodeType===8?Rd(s.parentNode,l):s.nodeType===1&&Rd(s,l),Cl(s)):Rd(Vt,l.stateNode));break;case 4:u=Vt,f=as,Vt=l.stateNode.containerInfo,as=!0,Cr(s,a,l),Vt=u,as=f;break;case 0:case 11:case 14:case 15:if(!en&&(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)&&mh(l,a,w),f=f.next}while(f!==u)}Cr(s,a,l);break;case 1:if(!en&&(ji(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)}Cr(s,a,l);break;case 21:Cr(s,a,l);break;case 22:l.mode&1?(en=(u=en)||l.memoizedState!==null,Cr(s,a,l),en=u):Cr(s,a,l);break;default:Cr(s,a,l)}}function Fx(s){var a=s.updateQueue;if(a!==null){s.updateQueue=null;var l=s.stateNode;l===null&&(l=s.stateNode=new z1),a.forEach(function(u){var f=H1.bind(null,s,u);l.has(u)||(l.add(u),u.then(f,f))})}}function is(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,as=!1;break e;case 3:Vt=P.stateNode.containerInfo,as=!0;break e;case 4:Vt=P.stateNode.containerInfo,as=!0;break e}P=P.return}if(Vt===null)throw Error(r(160));Lx(x,w,f),Vt=null,as=!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;)Dx(a,s),a=a.sibling}function Dx(s,a){var l=s.alternate,u=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(is(a,s),ws(s),u&4){try{Wl(3,s,s.return),zc(3,s)}catch(Ne){St(s,s.return,Ne)}try{Wl(5,s,s.return)}catch(Ne){St(s,s.return,Ne)}}break;case 1:is(a,s),ws(s),u&512&&l!==null&&ji(l,l.return);break;case 5:if(is(a,s),ws(s),u&512&&l!==null&&ji(l,l.return),s.flags&32){var f=s.stateNode;try{sa(f,"")}catch(Ne){St(s,s.return,Ne)}}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&&Za(f,x),dl(P,w);var U=dl(P,x);for(w=0;w<R.length;w+=2){var J=R[w],X=R[w+1];J==="style"?ul(f,X):J==="dangerouslySetInnerHTML"?on(f,X):J==="children"?sa(f,X):z(f,J,X,U)}switch(P){case"input":ea(f,x);break;case"textarea":ll(f,x);break;case"select":var G=f._wrapperState.wasMultiple;f._wrapperState.wasMultiple=!!x.multiple;var he=x.value;he!=null?ps(f,!!x.multiple,he,!1):G!==!!x.multiple&&(x.defaultValue!=null?ps(f,!!x.multiple,x.defaultValue,!0):ps(f,!!x.multiple,x.multiple?[]:"",!1))}f[Ol]=x}catch(Ne){St(s,s.return,Ne)}}break;case 6:if(is(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(Ne){St(s,s.return,Ne)}}break;case 3:if(is(a,s),ws(s),u&4&&l!==null&&l.memoizedState.isDehydrated)try{Cl(a.containerInfo)}catch(Ne){St(s,s.return,Ne)}break;case 4:is(a,s),ws(s);break;case 13:is(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||(jh=Pt())),u&4&&Fx(s);break;case 22:if(J=l!==null&&l.memoizedState!==null,s.mode&1?(en=(U=en)||J,is(a,s),en=U):is(a,s),ws(s),u&8192){if(U=s.memoizedState!==null,(s.stateNode.isHidden=U)&&!J&&(s.mode&1)!==0)for(ve=s,J=s.child;J!==null;){for(X=ve=J;ve!==null;){switch(G=ve,he=G.child,G.tag){case 0:case 11:case 14:case 15:Wl(4,G,G.return);break;case 1:ji(G,G.return);var we=G.stateNode;if(typeof we.componentWillUnmount=="function"){u=G,l=G.return;try{a=u,we.props=a.memoizedProps,we.state=a.memoizedState,we.componentWillUnmount()}catch(Ne){St(u,l,Ne)}}break;case 5:ji(G,G.return);break;case 22:if(G.memoizedState!==null){Bx(X);continue}}he!==null?(he.return=G,ve=he):Bx(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=cl("display",w))}catch(Ne){St(s,s.return,Ne)}}}else if(X.tag===6){if(J===null)try{X.stateNode.nodeValue=U?"":X.memoizedProps}catch(Ne){St(s,s.return,Ne)}}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:is(a,s),ws(s),u&4&&Fx(s);break;case 21:break;default:is(a,s),ws(s)}}function ws(s){var a=s.flags;if(a&2){try{e:{for(var l=s.return;l!==null;){if(Ox(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&&(sa(f,""),u.flags&=-33);var x=Ax(s);gh(s,x,f);break;case 3:case 4:var w=u.stateNode.containerInfo,P=Ax(s);xh(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 A1(s,a,l){ve=s,Ux(s)}function Ux(s,a,l){for(var u=(s.mode&1)!==0;ve!==null;){var f=ve,x=f.child;if(f.tag===22&&u){var w=f.memoizedState!==null||$c;if(!w){var P=f.alternate,R=P!==null&&P.memoizedState!==null||en;P=$c;var U=en;if($c=w,(en=R)&&!U)for(ve=f;ve!==null;)w=ve,R=w.child,w.tag===22&&w.memoizedState!==null?Vx(f):R!==null?(R.return=w,ve=R):Vx(f);for(;x!==null;)ve=x,Ux(x),x=x.sibling;ve=f,$c=P,en=U}Qx(s)}else(f.subtreeFlags&8772)!==0&&x!==null?(x.return=f,ve=x):Qx(s)}}function Qx(s){for(;ve!==null;){var a=ve;if((a.flags&8772)!==0){var l=a.alternate;try{if((a.flags&8772)!==0)switch(a.tag){case 0:case 11:case 15:en||zc(5,a);break;case 1:var u=a.stateNode;if(a.flags&4&&!en)if(l===null)u.componentDidMount();else{var f=a.elementType===a.type?l.memoizedProps:rs(a.type,l.memoizedProps);u.componentDidUpdate(f,l.memoizedState,u.__reactInternalSnapshotBeforeUpdate)}var x=a.updateQueue;x!==null&&Bp(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}Bp(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&&Cl(X)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}en||a.flags&512&&ph(a)}catch(G){St(a,a.return,G)}}if(a===s){ve=null;break}if(l=a.sibling,l!==null){l.return=a.return,ve=l;break}ve=a.return}}function Bx(s){for(;ve!==null;){var a=ve;if(a===s){ve=null;break}var l=a.sibling;if(l!==null){l.return=a.return,ve=l;break}ve=a.return}}function Vx(s){for(;ve!==null;){var a=ve;try{switch(a.tag){case 0:case 11:case 15:var l=a.return;try{zc(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{ph(a)}catch(R){St(a,x,R)}break;case 5:var w=a.return;try{ph(a)}catch(R){St(a,w,R)}}}catch(R){St(a,a.return,R)}if(a===s){ve=null;break}var P=a.sibling;if(P!==null){P.return=a.return,ve=P;break}ve=a.return}}var L1=Math.ceil,Oc=E.ReactCurrentDispatcher,vh=E.ReactCurrentOwner,Vn=E.ReactCurrentBatchConfig,Xe=0,Lt=null,Rt=null,Ht=0,qn=0,bi=br(0),It=0,Zl=null,fa=0,Ac=0,yh=0,Gl=null,wn=null,jh=0,wi=1/0,Vs=null,Lc=!1,bh=null,_r=null,Fc=!1,Pr=null,Dc=0,Jl=0,wh=null,Uc=-1,Qc=0;function un(){return(Xe&6)!==0?Pt():Uc!==-1?Uc:Uc=Pt()}function Er(s){return(s.mode&1)===0?1:(Xe&2)!==0&&Ht!==0?Ht&-Ht:w1.transition!==null?(Qc===0&&(Qc=Am()),Qc):(s=at,s!==0||(s=window.event,s=s===void 0?16:Km(s.type)),s)}function ls(s,a,l,u){if(50<Jl)throw Jl=0,wh=null,Error(r(185));bl(s,l,u),((Xe&2)===0||s!==Lt)&&(s===Lt&&((Xe&2)===0&&(Ac|=l),It===4&&Rr(s,Ht)),Nn(s,u),l===1&&Xe===0&&(a.mode&1)===0&&(wi=Pt()+500,gc&&Nr()))}function Nn(s,a){var l=s.callbackNode;wj(s,a);var u=Xo(s,s===Lt?Ht:0);if(u===0)l!==null&&ti(l),s.callbackNode=null,s.callbackPriority=0;else if(a=u&-u,s.callbackPriority!==a){if(l!=null&&ti(l),a===1)s.tag===0?b1(Kx.bind(null,s)):Tp(Kx.bind(null,s)),g1(function(){(Xe&6)===0&&Nr()}),l=null;else{switch(Lm(u)){case 1:l=td;break;case 4:l=zm;break;case 16:l=Wo;break;case 536870912:l=Om;break;default:l=Wo}l=tg(l,Hx.bind(null,s))}s.callbackPriority=a,s.callbackNode=l}}function Hx(s,a){if(Uc=-1,Qc=0,(Xe&6)!==0)throw Error(r(327));var l=s.callbackNode;if(Ni()&&s.callbackNode!==l)return null;var u=Xo(s,s===Lt?Ht:0);if(u===0)return null;if((u&30)!==0||(u&s.expiredLanes)!==0||a)a=Bc(s,u);else{a=u;var f=Xe;Xe|=2;var x=Zx();(Lt!==s||Ht!==a)&&(Vs=null,wi=Pt()+500,pa(s,a));do try{U1();break}catch(P){Wx(s,P)}while(!0);Fd(),Oc.current=x,Xe=f,Rt!==null?a=0:(Lt=null,Ht=0,a=It)}if(a!==0){if(a===2&&(f=nd(s),f!==0&&(u=f,a=Nh(s,f))),a===1)throw l=Zl,pa(s,0),Rr(s,u),Nn(s,Pt()),l;if(a===6)Rr(s,u);else{if(f=s.current.alternate,(u&30)===0&&!F1(f)&&(a=Bc(s,u),a===2&&(x=nd(s),x!==0&&(u=x,a=Nh(s,x))),a===1))throw l=Zl,pa(s,0),Rr(s,u),Nn(s,Pt()),l;switch(s.finishedWork=f,s.finishedLanes=u,a){case 0:case 1:throw Error(r(345));case 2:xa(s,wn,Vs);break;case 3:if(Rr(s,u),(u&130023424)===u&&(a=jh+500-Pt(),10<a)){if(Xo(s,0)!==0)break;if(f=s.suspendedLanes,(f&u)!==u){un(),s.pingedLanes|=s.suspendedLanes&f;break}s.timeoutHandle=Ed(xa.bind(null,s,wn,Vs),a);break}xa(s,wn,Vs);break;case 4:if(Rr(s,u),(u&4194240)===u)break;for(a=s.eventTimes,f=-1;0<u;){var w=31-ts(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*L1(u/1960))-u,10<u){s.timeoutHandle=Ed(xa.bind(null,s,wn,Vs),u);break}xa(s,wn,Vs);break;case 5:xa(s,wn,Vs);break;default:throw Error(r(329))}}}return Nn(s,Pt()),s.callbackNode===l?Hx.bind(null,s):null}function Nh(s,a){var l=Gl;return s.current.memoizedState.isDehydrated&&(pa(s,a).flags|=256),s=Bc(s,a),s!==2&&(a=wn,wn=l,a!==null&&kh(a)),s}function kh(s){wn===null?wn=s:wn.push.apply(wn,s)}function F1(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(!ns(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 Rr(s,a){for(a&=~yh,a&=~Ac,s.suspendedLanes|=a,s.pingedLanes&=~a,s=s.expirationTimes;0<a;){var l=31-ts(a),u=1<<l;s[l]=-1,a&=~u}}function Kx(s){if((Xe&6)!==0)throw Error(r(327));Ni();var a=Xo(s,0);if((a&1)===0)return Nn(s,Pt()),null;var l=Bc(s,a);if(s.tag!==0&&l===2){var u=nd(s);u!==0&&(a=u,l=Nh(s,u))}if(l===1)throw l=Zl,pa(s,0),Rr(s,a),Nn(s,Pt()),l;if(l===6)throw Error(r(345));return s.finishedWork=s.current.alternate,s.finishedLanes=a,xa(s,wn,Vs),Nn(s,Pt()),null}function Sh(s,a){var l=Xe;Xe|=1;try{return s(a)}finally{Xe=l,Xe===0&&(wi=Pt()+500,gc&&Nr())}}function ma(s){Pr!==null&&Pr.tag===0&&(Xe&6)===0&&Ni();var a=Xe;Xe|=1;var l=Vn.transition,u=at;try{if(Vn.transition=null,at=1,s)return s()}finally{at=u,Vn.transition=l,Xe=a,(Xe&6)===0&&Nr()}}function Ch(){qn=bi.current,pt(bi)}function pa(s,a){s.finishedWork=null,s.finishedLanes=0;var l=s.timeoutHandle;if(l!==-1&&(s.timeoutHandle=-1,x1(l)),Rt!==null)for(l=Rt.return;l!==null;){var u=l;switch($d(u),u.tag){case 1:u=u.type.childContextTypes,u!=null&&pc();break;case 3:vi(),pt(yn),pt(Jt),Wd();break;case 5:Hd(u);break;case 4:vi();break;case 13:pt(wt);break;case 19:pt(wt);break;case 10:Dd(u.type._context);break;case 22:case 23:Ch()}l=l.return}if(Lt=s,Rt=s=Mr(s.current,null),Ht=qn=a,It=0,Zl=null,yh=Ac=fa=0,wn=Gl=null,ua!==null){for(a=0;a<ua.length;a++)if(l=ua[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}ua=null}return s}function Wx(s,a){do{var l=Rt;try{if(Fd(),_c.current=Mc,Pc){for(var u=Nt.memoizedState;u!==null;){var f=u.queue;f!==null&&(f.pending=null),u=u.next}Pc=!1}if(ha=0,At=qt=Nt=null,Ql=!1,Bl=0,vh.current=null,l===null||l.return===null){It=1,Zl=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=yx(w);if(he!==null){he.flags&=-257,jx(he,w,P,x,a),he.mode&1&&vx(x,U,a),a=he,R=U;var we=a.updateQueue;if(we===null){var Ne=new Set;Ne.add(R),a.updateQueue=Ne}else we.add(R);break e}else{if((a&1)===0){vx(x,U,a),_h();break e}R=Error(r(426))}}else if(gt&&P.mode&1){var Et=yx(w);if(Et!==null){(Et.flags&65536)===0&&(Et.flags|=256),jx(Et,w,P,x,a),Ad(yi(R,P));break e}}x=R=yi(R,P),It!==4&&(It=2),Gl===null?Gl=[x]:Gl.push(x),x=w;do{switch(x.tag){case 3:x.flags|=65536,a&=-a,x.lanes|=a;var L=xx(x,R,a);Qp(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"&&(_r===null||!_r.has(D)))){x.flags|=65536,a&=-a,x.lanes|=a;var se=gx(x,P,a);Qp(x,se);break e}}x=x.return}while(x!==null)}Jx(l)}catch(ke){a=ke,Rt===l&&l!==null&&(Rt=l=l.return);continue}break}while(!0)}function Zx(){var s=Oc.current;return Oc.current=Mc,s===null?Mc:s}function _h(){(It===0||It===3||It===2)&&(It=4),Lt===null||(fa&268435455)===0&&(Ac&268435455)===0||Rr(Lt,Ht)}function Bc(s,a){var l=Xe;Xe|=2;var u=Zx();(Lt!==s||Ht!==a)&&(Vs=null,pa(s,a));do try{D1();break}catch(f){Wx(s,f)}while(!0);if(Fd(),Xe=l,Oc.current=u,Rt!==null)throw Error(r(261));return Lt=null,Ht=0,It}function D1(){for(;Rt!==null;)Gx(Rt)}function U1(){for(;Rt!==null&&!fj();)Gx(Rt)}function Gx(s){var a=eg(s.alternate,s,qn);s.memoizedProps=s.pendingProps,a===null?Jx(s):Rt=a,vh.current=null}function Jx(s){var a=s;do{var l=a.alternate;if(s=a.return,(a.flags&32768)===0){if(l=I1(l,a,qn),l!==null){Rt=l;return}}else{if(l=$1(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 xa(s,a,l){var u=at,f=Vn.transition;try{Vn.transition=null,at=1,Q1(s,a,l,u)}finally{Vn.transition=f,at=u}return null}function Q1(s,a,l,u){do Ni();while(Pr!==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(Nj(s,x),s===Lt&&(Rt=Lt=null,Ht=0),(l.subtreeFlags&2064)===0&&(l.flags&2064)===0||Fc||(Fc=!0,tg(Wo,function(){return Ni(),null})),x=(l.flags&15990)!==0,(l.subtreeFlags&15990)!==0||x){x=Vn.transition,Vn.transition=null;var w=at;at=1;var P=Xe;Xe|=4,vh.current=null,O1(s,l),Dx(l,s),c1(_d),tc=!!Cd,_d=Cd=null,s.current=l,A1(l),mj(),Xe=P,at=w,Vn.transition=x}else s.current=l;if(Fc&&(Fc=!1,Pr=s,Dc=f),x=s.pendingLanes,x===0&&(_r=null),gj(l.stateNode),Nn(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(Lc)throw Lc=!1,s=bh,bh=null,s;return(Dc&1)!==0&&s.tag!==0&&Ni(),x=s.pendingLanes,(x&1)!==0?s===wh?Jl++:(Jl=0,wh=s):Jl=0,Nr(),null}function Ni(){if(Pr!==null){var s=Lm(Dc),a=Vn.transition,l=at;try{if(Vn.transition=null,at=16>s?16:s,Pr===null)var u=!1;else{if(s=Pr,Pr=null,Dc=0,(Xe&6)!==0)throw Error(r(331));var f=Xe;for(Xe|=4,ve=s.current;ve!==null;){var x=ve,w=x.child;if((ve.flags&16)!==0){var P=x.deletions;if(P!==null){for(var R=0;R<P.length;R++){var U=P[R];for(ve=U;ve!==null;){var J=ve;switch(J.tag){case 0:case 11:case 15:Wl(8,J,x)}var X=J.child;if(X!==null)X.return=J,ve=X;else for(;ve!==null;){J=ve;var G=J.sibling,he=J.return;if(zx(J),J===U){ve=null;break}if(G!==null){G.return=he,ve=G;break}ve=he}}}var we=x.alternate;if(we!==null){var Ne=we.child;if(Ne!==null){we.child=null;do{var Et=Ne.sibling;Ne.sibling=null,Ne=Et}while(Ne!==null)}}ve=x}}if((x.subtreeFlags&2064)!==0&&w!==null)w.return=x,ve=w;else e:for(;ve!==null;){if(x=ve,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Wl(9,x,x.return)}var L=x.sibling;if(L!==null){L.return=x.return,ve=L;break e}ve=x.return}}var I=s.current;for(ve=I;ve!==null;){w=ve;var D=w.child;if((w.subtreeFlags&2064)!==0&&D!==null)D.return=w,ve=D;else e:for(w=I;ve!==null;){if(P=ve,(P.flags&2048)!==0)try{switch(P.tag){case 0:case 11:case 15:zc(9,P)}}catch(ke){St(P,P.return,ke)}if(P===w){ve=null;break e}var se=P.sibling;if(se!==null){se.return=P.return,ve=se;break e}ve=P.return}}if(Xe=f,Nr(),vs&&typeof vs.onPostCommitFiberRoot=="function")try{vs.onPostCommitFiberRoot(Zo,s)}catch{}u=!0}return u}finally{at=l,Vn.transition=a}}return!1}function Xx(s,a,l){a=yi(l,a),a=xx(s,a,1),s=Sr(s,a,1),a=un(),s!==null&&(bl(s,1,a),Nn(s,a))}function St(s,a,l){if(s.tag===3)Xx(s,s,l);else for(;a!==null;){if(a.tag===3){Xx(a,s,l);break}else if(a.tag===1){var u=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(_r===null||!_r.has(u))){s=yi(l,s),s=gx(a,s,1),a=Sr(a,s,1),s=un(),a!==null&&(bl(a,1,s),Nn(a,s));break}}a=a.return}}function B1(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()-jh?pa(s,0):yh|=l),Nn(s,a)}function Yx(s,a){a===0&&((s.mode&1)===0?a=1:(a=Jo,Jo<<=1,(Jo&130023424)===0&&(Jo=4194304)));var l=un();s=Us(s,a),s!==null&&(bl(s,a,l),Nn(s,l))}function V1(s){var a=s.memoizedState,l=0;a!==null&&(l=a.retryLane),Yx(s,l)}function H1(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),Yx(s,l)}var eg;eg=function(s,a,l){if(s!==null)if(s.memoizedProps!==a.pendingProps||yn.current)bn=!0;else{if((s.lanes&l)===0&&(a.flags&128)===0)return bn=!1,q1(s,a,l);bn=(s.flags&131072)!==0}else bn=!1,gt&&(a.flags&1048576)!==0&&qp(a,yc,a.index);switch(a.lanes=0,a.tag){case 2:var u=a.type;Ic(s,a),s=a.pendingProps;var f=di(a,Jt.current);gi(a,l),f=Jd(null,a,u,s,f,l);var x=Xd();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,jn(u)?(x=!0,xc(a)):x=!1,a.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Bd(a),f.updater=Tc,a.stateNode=f,f._reactInternals=a,rh(a,u,s,l),a=oh(null,a,u,!0,x,l)):(a.tag=0,gt&&x&&Id(a),cn(null,a,f,l),a=a.child),a;case 16:u=a.elementType;e:{switch(Ic(s,a),s=a.pendingProps,f=u._init,u=f(u._payload),a.type=u,f=a.tag=W1(u),s=rs(u,s),f){case 0:a=lh(null,a,u,s,l);break e;case 1:a=Cx(null,a,u,s,l);break e;case 11:a=bx(null,a,u,s,l);break e;case 14:a=wx(null,a,u,rs(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:rs(u,f),lh(s,a,u,f,l);case 1:return u=a.type,f=a.pendingProps,f=a.elementType===u?f:rs(u,f),Cx(s,a,u,f,l);case 3:e:{if(_x(a),s===null)throw Error(r(387));u=a.pendingProps,x=a.memoizedState,f=x.element,Up(s,a),Sc(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=yi(Error(r(423)),a),a=Px(s,a,u,l,f);break e}else if(u!==f){f=yi(Error(r(424)),a),a=Px(s,a,u,l,f);break e}else for(Tn=jr(a.stateNode.containerInfo.firstChild),Mn=a,gt=!0,ss=null,l=Fp(a,null,u,l),a.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(mi(),u===f){a=Bs(s,a,l);break e}cn(s,a,u,l)}a=a.child}return a;case 5:return Vp(a),s===null&&Od(a),u=a.type,f=a.pendingProps,x=s!==null?s.memoizedProps:null,w=f.children,Pd(u,f)?w=null:x!==null&&Pd(u,x)&&(a.flags|=32),Sx(s,a),cn(s,a,w,l),a.child;case 6:return s===null&&Od(a),null;case 13:return Ex(s,a,l);case 4:return Vd(a,a.stateNode.containerInfo),u=a.pendingProps,s===null?a.child=pi(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:rs(u,f),bx(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(wc,u._currentValue),u._currentValue=w,x!==null)if(ns(x.value,w)){if(x.children===f.children&&!yn.current){a=Bs(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=Qs(-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),Ud(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),Ud(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,gi(a,l),f=Qn(f),u=u(f),a.flags|=1,cn(s,a,u,l),a.child;case 14:return u=a.type,f=rs(u,a.pendingProps),f=rs(u.type,f),wx(s,a,u,f,l);case 15:return Nx(s,a,a.type,a.pendingProps,l);case 17:return u=a.type,f=a.pendingProps,f=a.elementType===u?f:rs(u,f),Ic(s,a),a.tag=1,jn(u)?(s=!0,xc(a)):s=!1,gi(a,l),mx(a,u,f),rh(a,u,f,l),oh(null,a,u,!0,s,l);case 19:return Mx(s,a,l);case 22:return kx(s,a,l)}throw Error(r(156,a.tag))};function tg(s,a){return Bt(s,a)}function K1(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 Hn(s,a,l,u){return new K1(s,a,l,u)}function Ph(s){return s=s.prototype,!(!s||!s.isReactComponent)}function W1(s){if(typeof s=="function")return Ph(s)?1:0;if(s!=null){if(s=s.$$typeof,s===re)return 11;if(s===Ke)return 14}return 2}function Mr(s,a){var l=s.alternate;return l===null?(l=Hn(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 Vc(s,a,l,u,f,x){var w=2;if(u=s,typeof s=="function")Ph(s)&&(w=1);else if(typeof s=="string")w=5;else e:switch(s){case $:return ga(l.children,f,x,a);case Q:w=8,f|=8;break;case B:return s=Hn(12,l,a,f|2),s.elementType=B,s.lanes=x,s;case ue:return s=Hn(13,l,a,f),s.elementType=ue,s.lanes=x,s;case qe:return s=Hn(19,l,a,f),s.elementType=qe,s.lanes=x,s;case Le:return Hc(l,f,x,a);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case q:w=10;break e;case V:w=9;break e;case re:w=11;break e;case Ke:w=14;break e;case ut:w=16,u=null;break e}throw Error(r(130,s==null?s:typeof s,""))}return a=Hn(w,l,a,f),a.elementType=s,a.type=u,a.lanes=x,a}function ga(s,a,l,u){return s=Hn(7,s,u,a),s.lanes=l,s}function Hc(s,a,l,u){return s=Hn(22,s,u,a),s.elementType=Le,s.lanes=l,s.stateNode={isHidden:!1},s}function Eh(s,a,l){return s=Hn(6,s,null,a),s.lanes=l,s}function Rh(s,a,l){return a=Hn(4,s.children!==null?s.children:[],s.key,a),a.lanes=l,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}function Z1(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=sd(0),this.expirationTimes=sd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sd(0),this.identifierPrefix=u,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function Mh(s,a,l,u,f,x,w,P,R){return s=new Z1(s,a,l,P,R),a===1?(a=1,x===!0&&(a|=8)):a=0,x=Hn(3,null,null,a),s.current=x,x.stateNode=s,x.memoizedState={element:u,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},Bd(x),s}function G1(s,a,l){var u=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:u==null?null:""+u,children:s,containerInfo:a,implementation:l}}function ng(s){if(!s)return wr;s=s._reactInternals;e:{if(gs(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(jn(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(jn(l))return Rp(s,l,a)}return a}function sg(s,a,l,u,f,x,w,P,R){return s=Mh(l,u,!0,s,f,x,w,P,R),s.context=ng(null),l=s.current,u=un(),f=Er(l),x=Qs(u,f),x.callback=a??null,Sr(l,x,f),s.current.lanes=f,bl(s,f,u),Nn(s,u),s}function Kc(s,a,l,u){var f=a.current,x=un(),w=Er(f);return l=ng(l),a.context===null?a.context=l:a.pendingContext=l,a=Qs(x,w),a.payload={element:s},u=u===void 0?null:u,u!==null&&(a.callback=u),s=Sr(f,a,w),s!==null&&(ls(s,f,w,x),kc(s,f,w)),w}function Wc(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 rg(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<a?l:a}}function Th(s,a){rg(s,a),(s=s.alternate)&&rg(s,a)}function J1(){return null}var ag=typeof reportError=="function"?reportError:function(s){console.error(s)};function qh(s){this._internalRoot=s}Zc.prototype.render=qh.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(r(409));Kc(s,a,null,null)},Zc.prototype.unmount=qh.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;ma(function(){Kc(null,s,null,null)}),a[As]=null}};function Zc(s){this._internalRoot=s}Zc.prototype.unstable_scheduleHydration=function(s){if(s){var a=Um();s={blockedOn:null,target:s,priority:a};for(var l=0;l<gr.length&&a!==0&&a<gr[l].priority;l++);gr.splice(l,0,s),l===0&&Vm(s)}};function Ih(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function Gc(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function ig(){}function X1(s,a,l,u,f){if(f){if(typeof u=="function"){var x=u;u=function(){var U=Wc(w);x.call(U)}}var w=sg(a,u,s,0,null,!1,!1,"",ig);return s._reactRootContainer=w,s[As]=w.current,$l(s.nodeType===8?s.parentNode:s),ma(),w}for(;f=s.lastChild;)s.removeChild(f);if(typeof u=="function"){var P=u;u=function(){var U=Wc(R);P.call(U)}}var R=Mh(s,0,!1,null,null,!1,!1,"",ig);return s._reactRootContainer=R,s[As]=R.current,$l(s.nodeType===8?s.parentNode:s),ma(function(){Kc(a,R,l,u)}),R}function Jc(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=Wc(w);P.call(R)}}Kc(a,w,s,f)}else w=X1(l,a,s,f,u);return Wc(w)}Fm=function(s){switch(s.tag){case 3:var a=s.stateNode;if(a.current.memoizedState.isDehydrated){var l=jl(a.pendingLanes);l!==0&&(rd(a,l|1),Nn(a,Pt()),(Xe&6)===0&&(wi=Pt()+500,Nr()))}break;case 13:ma(function(){var u=Us(s,1);if(u!==null){var f=un();ls(u,s,1,f)}}),Th(s,1)}},ad=function(s){if(s.tag===13){var a=Us(s,134217728);if(a!==null){var l=un();ls(a,s,134217728,l)}Th(s,134217728)}},Dm=function(s){if(s.tag===13){var a=Er(s),l=Us(s,a);if(l!==null){var u=un();ls(l,s,a,u)}Th(s,a)}},Um=function(){return at},Qm=function(s,a){var l=at;try{return at=s,a()}finally{at=l}},Ja=function(s,a,l){switch(a){case"input":if(ea(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=mc(u);if(!f)throw Error(r(90));Fo(u),ea(u,f)}}}break;case"textarea":ll(s,l);break;case"select":a=l.value,a!=null&&ps(s,!!l.multiple,a,!1)}},pl=Sh,xl=ma;var Y1={usingClientEntryPoint:!1,Events:[Al,ci,mc,fl,ml,Sh]},Xl={findFiberByHostInstance:ia,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},eb={bundleType:Xl.bundleType,version:Xl.version,rendererPackageName:Xl.rendererPackageName,rendererConfig:Xl.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=rt(s),s===null?null:s.stateNode},findFiberByHostInstance:Xl.findFiberByHostInstance||J1,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 Xc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xc.isDisabled&&Xc.supportsFiber)try{Zo=Xc.inject(eb),vs=Xc}catch{}}return kn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Y1,kn.createPortal=function(s,a){var l=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ih(a))throw Error(r(200));return G1(s,a,null,l)},kn.createRoot=function(s,a){if(!Ih(s))throw Error(r(299));var l=!1,u="",f=ag;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onRecoverableError!==void 0&&(f=a.onRecoverableError)),a=Mh(s,1,!1,null,null,l,!1,u,f),s[As]=a.current,$l(s.nodeType===8?s.parentNode:s),new qh(a)},kn.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=rt(a),s=s===null?null:s.stateNode,s},kn.flushSync=function(s){return ma(s)},kn.hydrate=function(s,a,l){if(!Gc(a))throw Error(r(200));return Jc(null,s,a,!0,l)},kn.hydrateRoot=function(s,a,l){if(!Ih(s))throw Error(r(405));var u=l!=null&&l.hydratedSources||null,f=!1,x="",w=ag;if(l!=null&&(l.unstable_strictMode===!0&&(f=!0),l.identifierPrefix!==void 0&&(x=l.identifierPrefix),l.onRecoverableError!==void 0&&(w=l.onRecoverableError)),a=sg(a,null,s,1,l??null,f,!1,x,w),s[As]=a.current,$l(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 Zc(a)},kn.render=function(s,a,l){if(!Gc(a))throw Error(r(200));return Jc(null,s,a,!1,l)},kn.unmountComponentAtNode=function(s){if(!Gc(s))throw Error(r(40));return s._reactRootContainer?(ma(function(){Jc(null,null,s,!1,function(){s._reactRootContainer=null,s[As]=null})}),!0):!1},kn.unstable_batchedUpdates=Sh,kn.unstable_renderSubtreeIntoContainer=function(s,a,l,u){if(!Gc(l))throw Error(r(200));if(s==null||s._reactInternals===void 0)throw Error(r(38));return Jc(s,a,l,!1,u)},kn.version="18.3.1-next-f1338f8080-20240426",kn}var pg;function Hv(){if(pg)return Lh.exports;pg=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(),Lh.exports=fb(),Lh.exports}var xg;function mb(){if(xg)return eu;xg=1;var e=Hv();return eu.createRoot=e.createRoot,eu.hydrateRoot=e.hydrateRoot,eu}var pb=mb();const xb="modulepreload",gb=function(e){return"/"+e},gg={},$u=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=gb(g),g in gg)return;gg[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":xb,p||(j.as="script"),j.crossOrigin="",j.href=g,m&&j.setAttribute("nonce",m),document.head.appendChild(j),p)return new Promise((S,y)=>{j.addEventListener("load",S),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)})};Hv();/**
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 oo(){return oo=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},oo.apply(null,arguments)}var Br;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Br||(Br={}));const vg="popstate";function vb(e){e===void 0&&(e={});function n(i,o){let{pathname:c,search:d,hash:h}=i.location;return Xh("",{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:hu(o)}return jb(n,r,null,e)}function yt(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Kv(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function yb(){return Math.random().toString(36).substr(2,8)}function yg(e,n){return{usr:e.state,key:e.key,idx:n}}function Xh(e,n,r,i){return r===void 0&&(r=null),oo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof n=="string"?Xi(n):n,{state:r,key:n&&n.key||i||yb()})}function hu(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 Xi(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 jb(e,n,r,i){i===void 0&&(i={});let{window:o=document.defaultView,v5Compat:c=!1}=i,d=o.history,h=Br.Pop,m=null,g=p();g==null&&(g=0,d.replaceState(oo({},d.state,{idx:g}),""));function p(){return(d.state||{idx:null}).idx}function v(){h=Br.Pop;let k=p(),C=k==null?null:k-g;g=k,m&&m({action:h,location:b.location,delta:C})}function j(k,C){h=Br.Push;let O=Xh(b.location,k,C);g=p()+1;let z=yg(O,g),E=b.createHref(O);try{d.pushState(z,"",E)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;o.location.assign(E)}c&&m&&m({action:h,location:b.location,delta:1})}function S(k,C){h=Br.Replace;let O=Xh(b.location,k,C);g=p();let z=yg(O,g),E=b.createHref(O);d.replaceState(z,"",E),c&&m&&m({action:h,location:b.location,delta:0})}function y(k){let C=o.location.origin!=="null"?o.location.origin:o.location.href,O=typeof k=="string"?k:hu(k);return O=O.replace(/ $/,"%20"),yt(C,"No window.location.(origin|href) available to create URL for href: "+O),new URL(O,C)}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(vg,v),m=k,()=>{o.removeEventListener(vg,v),m=null}},createHref(k){return n(o,k)},createURL:y,encodeLocation(k){let C=y(k);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:j,replace:S,go(k){return d.go(k)}};return b}var jg;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(jg||(jg={}));function bb(e,n,r){return r===void 0&&(r="/"),wb(e,n,r)}function wb(e,n,r,i){let o=typeof n=="string"?Xi(n):n,c=Ui(o.pathname||"/",r);if(c==null)return null;let d=Wv(e);Nb(d);let h=null,m=Gv(c);for(let g=0;h==null&&g<d.length;++g)h=Tb(d[g],m);return h}function Wv(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("/")&&(yt(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=Vr([i,m.relativePath]),p=r.concat(m);c.children&&c.children.length>0&&(yt(c.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+g+'".')),Wv(c.children,n,p,g)),!(c.path==null&&!c.index)&&n.push({path:g,score:Rb(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 Zv(c.path))o(c,d,m)}),n}function Zv(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=Zv(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 Nb(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:Mb(n.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}const kb=/^:[\w-]+$/,Sb=3,Cb=2,_b=1,Pb=10,Eb=-2,bg=e=>e==="*";function Rb(e,n){let r=e.split("/"),i=r.length;return r.some(bg)&&(i+=Eb),n&&(i+=Cb),r.filter(o=>!bg(o)).reduce((o,c)=>o+(kb.test(c)?Sb:c===""?_b:Pb),i)}function Mb(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 Tb(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=fu({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:Vr([c,v.pathname]),pathnameBase:zb(Vr([c,v.pathnameBase])),route:j}),v.pathnameBase!=="/"&&(c=Vr([c,v.pathnameBase]))}return d}function fu(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,i]=qb(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:S}=p;if(j==="*"){let b=h[v]||"";d=c.slice(0,c.length-b.length).replace(/(.)\/+$/,"$1")}const y=h[v];return S&&!y?g[j]=void 0:g[j]=(y||"").replace(/%2F/g,"/"),g},{}),pathname:c,pathnameBase:d,pattern:e}}function qb(e,n,r){n===void 0&&(n=!1),r===void 0&&(r=!0),Kv(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 Gv(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return Kv(!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 Ui(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 Ib(e,n){n===void 0&&(n="/");let{pathname:r,search:i="",hash:o=""}=typeof e=="string"?Xi(e):e,c;return r?(r=Jv(r),r.startsWith("/")?c=wg(r.substring(1),"/"):c=wg(r,n)):c=n,{pathname:c,search:Ob(i),hash:Ab(o)}}function wg(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 Uh(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 $b(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function Qf(e,n){let r=$b(e);return n?r.map((i,o)=>o===r.length-1?i.pathname:i.pathnameBase):r.map(i=>i.pathnameBase)}function Bf(e,n,r,i){i===void 0&&(i=!1);let o;typeof e=="string"?o=Xi(e):(o=oo({},e),yt(!o.pathname||!o.pathname.includes("?"),Uh("?","pathname","search",o)),yt(!o.pathname||!o.pathname.includes("#"),Uh("#","pathname","hash",o)),yt(!o.search||!o.search.includes("#"),Uh("#","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=Ib(o,h),g=d&&d!=="/"&&d.endsWith("/"),p=(c||d===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(g||p)&&(m.pathname+="/"),m}const Jv=e=>e.replace(/\/\/+/g,"/"),Vr=e=>Jv(e.join("/")),zb=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Ob=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Ab=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Lb(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Xv=["post","put","patch","delete"];new Set(Xv);const Fb=["get",...Xv];new Set(Fb);/**
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 co(){return co=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},co.apply(null,arguments)}const zu=N.createContext(null),Yv=N.createContext(null),ir=N.createContext(null),Ou=N.createContext(null),Ts=N.createContext({outlet:null,matches:[],isDataRoute:!1}),ey=N.createContext(null);function Db(e,n){let{relative:r}=n===void 0?{}:n;Ua()||yt(!1);let{basename:i,navigator:o}=N.useContext(ir),{hash:c,pathname:d,search:h}=Au(e,{relative:r}),m=d;return i!=="/"&&(m=d==="/"?i:Vr([i,d])),o.createHref({pathname:m,search:h,hash:c})}function Ua(){return N.useContext(Ou)!=null}function An(){return Ua()||yt(!1),N.useContext(Ou).location}function Ng(e){Ua()||yt(!1);let{pathname:n}=An();return N.useMemo(()=>fu(e,Gv(n)),[n,e])}function ty(e){N.useContext(ir).static||N.useLayoutEffect(e)}function ln(){let{isDataRoute:e}=N.useContext(Ts);return e?nw():Ub()}function Ub(){Ua()||yt(!1);let e=N.useContext(zu),{basename:n,future:r,navigator:i}=N.useContext(ir),{matches:o}=N.useContext(Ts),{pathname:c}=An(),d=JSON.stringify(Qf(o,r.v7_relativeSplatPath)),h=N.useRef(!1);return ty(()=>{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=Bf(g,JSON.parse(d),c,p.relative==="path");e==null&&n!=="/"&&(v.pathname=v.pathname==="/"?n:Vr([n,v.pathname])),(p.replace?i.replace:i.push)(v,p.state,p)},[n,i,d,c,e])}const Qb=N.createContext(null);function Bb(e){let n=N.useContext(Ts).outlet;return n&&N.createElement(Qb.Provider,{value:e},n)}function Ln(){let{matches:e}=N.useContext(Ts),n=e[e.length-1];return n?n.params:{}}function Au(e,n){let{relative:r}=n===void 0?{}:n,{future:i}=N.useContext(ir),{matches:o}=N.useContext(Ts),{pathname:c}=An(),d=JSON.stringify(Qf(o,i.v7_relativeSplatPath));return N.useMemo(()=>Bf(e,JSON.parse(d),c,r==="path"),[e,d,c,r])}function Vb(e,n){return Hb(e,n)}function Hb(e,n,r,i){Ua()||yt(!1);let{navigator:o}=N.useContext(ir),{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=An(),p;if(n){var v;let k=typeof n=="string"?Xi(n):n;m==="/"||(v=k.pathname)!=null&&v.startsWith(m)||yt(!1),p=k}else p=g;let j=p.pathname||"/",S=j;if(m!=="/"){let k=m.replace(/^\//,"").split("/");S="/"+j.replace(/^\//,"").split("/").slice(k.length).join("/")}let y=bb(e,{pathname:S}),b=Jb(y&&y.map(k=>Object.assign({},k,{params:Object.assign({},h,k.params),pathname:Vr([m,o.encodeLocation?o.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?m:Vr([m,o.encodeLocation?o.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),c,r,i);return n&&b?N.createElement(Ou.Provider,{value:{location:co({pathname:"/",search:"",hash:"",state:null,key:"default"},p),navigationType:Br.Pop}},b):b}function Kb(){let e=tw(),n=Lb(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 Wb=N.createElement(Kb,null);class Zb 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(ey.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Gb(e){let{routeContext:n,match:r,children:i}=e,o=N.useContext(zu);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 Jb(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||yt(!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:S}=r,y=v.route.loader&&j[v.route.id]===void 0&&(!S||S[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 S,y=!1,b=null,k=null;r&&(S=h&&v.route.id?h[v.route.id]:void 0,b=v.route.errorElement||Wb,m&&(g<0&&j===0?(sw("route-fallback"),y=!0,k=null):g===j&&(y=!0,k=v.route.hydrateFallbackElement||null)));let C=n.concat(d.slice(0,j+1)),O=()=>{let z;return S?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(Gb,{match:v,routeContext:{outlet:p,matches:C,isDataRoute:r!=null},children:z})};return r&&(v.route.ErrorBoundary||v.route.errorElement||j===0)?N.createElement(Zb,{location:r.location,revalidation:r.revalidation,component:b,error:S,children:O(),routeContext:{outlet:null,matches:C,isDataRoute:!0}}):O()},null)}var ny=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(ny||{}),sy=(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})(sy||{});function Xb(e){let n=N.useContext(zu);return n||yt(!1),n}function Yb(e){let n=N.useContext(Yv);return n||yt(!1),n}function ew(e){let n=N.useContext(Ts);return n||yt(!1),n}function ry(e){let n=ew(),r=n.matches[n.matches.length-1];return r.route.id||yt(!1),r.route.id}function tw(){var e;let n=N.useContext(ey),r=Yb(),i=ry();return n!==void 0?n:(e=r.errors)==null?void 0:e[i]}function nw(){let{router:e}=Xb(ny.UseNavigateStable),n=ry(sy.UseNavigateStable),r=N.useRef(!1);return ty(()=>{r.current=!0}),N.useCallback(function(o,c){c===void 0&&(c={}),r.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,co({fromRouteId:n},c)))},[e,n])}const kg={};function sw(e,n,r){kg[e]||(kg[e]=!0)}function rw(e,n){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Kr(e){let{to:n,replace:r,state:i,relative:o}=e;Ua()||yt(!1);let{future:c,static:d}=N.useContext(ir),{matches:h}=N.useContext(Ts),{pathname:m}=An(),g=ln(),p=Bf(n,Qf(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 ay(e){return Bb(e.context)}function ot(e){yt(!1)}function aw(e){let{basename:n="/",children:r=null,location:i,navigationType:o=Br.Pop,navigator:c,static:d=!1,future:h}=e;Ua()&&yt(!1);let m=n.replace(/^\/*/,"/"),g=N.useMemo(()=>({basename:m,navigator:c,static:d,future:co({v7_relativeSplatPath:!1},h)}),[m,h,c,d]);typeof i=="string"&&(i=Xi(i));let{pathname:p="/",search:v="",hash:j="",state:S=null,key:y="default"}=i,b=N.useMemo(()=>{let k=Ui(p,m);return k==null?null:{location:{pathname:k,search:v,hash:j,state:S,key:y},navigationType:o}},[m,p,v,j,S,y,o]);return b==null?null:N.createElement(ir.Provider,{value:g},N.createElement(Ou.Provider,{children:r,value:b}))}function iw(e){let{children:n,location:r}=e;return Vb(Yh(n),r)}new Promise(()=>{});function Yh(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,Yh(i.props.children,c));return}i.type!==ot&&yt(!1),!i.props.index||!i.props.children||yt(!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=Yh(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 mu(){return mu=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},mu.apply(null,arguments)}function iy(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 lw(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ow(e,n){return e.button===0&&(!n||n==="_self")&&!lw(e)}function ef(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 cw(e,n){let r=ef(e);return n&&n.forEach((i,o)=>{r.has(o)||n.getAll(o).forEach(c=>{r.append(o,c)})}),r}const uw=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],dw=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],hw="6";try{window.__reactRouterVersion=hw}catch{}const fw=N.createContext({isTransitioning:!1}),mw="startTransition",Sg=ub[mw];function pw(e){let{basename:n,children:r,future:i,window:o}=e,c=N.useRef();c.current==null&&(c.current=vb({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&&Sg?Sg(()=>m(v)):m(v)},[m,g]);return N.useLayoutEffect(()=>d.listen(p),[d,p]),N.useEffect(()=>rw(i),[i]),N.createElement(aw,{basename:n,children:r,location:h.location,navigationType:h.action,navigator:d,future:i})}const xw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",gw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Re=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=iy(n,uw),{basename:S}=N.useContext(ir),y,b=!1;if(typeof g=="string"&&gw.test(g)&&(y=g,xw))try{let z=new URL(window.location.href),E=g.startsWith("//")?new URL(z.protocol+g):new URL(g),M=Ui(E.pathname,S);E.origin===z.origin&&M!=null?g=M+E.search+E.hash:b=!0}catch{}let k=Db(g,{relative:o}),C=yw(g,{replace:d,state:h,target:m,preventScrollReset:p,relative:o,viewTransition:v});function O(z){i&&i(z),z.defaultPrevented||C(z)}return N.createElement("a",mu({},j,{href:y||k,onClick:b||c?i:O,ref:r,target:m}))}),To=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=iy(n,dw),j=Au(m,{relative:v.relative}),S=An(),y=N.useContext(Yv),{navigator:b,basename:k}=N.useContext(ir),C=y!=null&&jw(j)&&g===!0,O=b.encodeLocation?b.encodeLocation(j).pathname:j.pathname,z=S.pathname,E=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;o||(z=z.toLowerCase(),E=E?E.toLowerCase():null,O=O.toLowerCase()),E&&k&&(E=Ui(E,k)||E);const M=O!=="/"&&O.endsWith("/")?O.length-1:O.length;let T=z===O||!d&&z.startsWith(O)&&z.charAt(M)==="/",$=E!=null&&(E===O||!d&&E.startsWith(O)&&E.charAt(O.length)==="/"),Q={isActive:T,isPending:$,isTransitioning:C},B=T?i:void 0,q;typeof c=="function"?q=c(Q):q=[c,T?"active":null,$?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let V=typeof h=="function"?h(Q):h;return N.createElement(Re,mu({},v,{"aria-current":B,className:q,ref:r,style:V,to:m,viewTransition:g}),typeof p=="function"?p(Q):p)});var tf;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(tf||(tf={}));var Cg;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Cg||(Cg={}));function vw(e){let n=N.useContext(zu);return n||yt(!1),n}function yw(e,n){let{target:r,replace:i,state:o,preventScrollReset:c,relative:d,viewTransition:h}=n===void 0?{}:n,m=ln(),g=An(),p=Au(e,{relative:d});return N.useCallback(v=>{if(ow(v,r)){v.preventDefault();let j=i!==void 0?i:hu(g)===hu(p);m(e,{replace:j,state:o,preventScrollReset:c,relative:d,viewTransition:h})}},[g,m,p,i,o,r,e,c,d,h])}function Yi(e){let n=N.useRef(ef(e)),r=N.useRef(!1),i=An(),o=N.useMemo(()=>cw(i.search,r.current?null:n.current),[i.search]),c=ln(),d=N.useCallback((h,m)=>{const g=ef(typeof h=="function"?h(o):h);r.current=!0,c("?"+g,m)},[c,o]);return[o,d]}function jw(e,n){n===void 0&&(n={});let r=N.useContext(fw);r==null&&yt(!1);let{basename:i}=vw(tf.useViewTransitionState),o=Au(e,{relative:n.relative});if(!r.isTransitioning)return!1;let c=Ui(r.currentLocation.pathname,i)||r.currentLocation.pathname,d=Ui(r.nextLocation.pathname,i)||r.nextLocation.pathname;return fu(o.pathname,d)!=null||fu(o.pathname,c)!=null}const ly=N.createContext(void 0),Ze=e=>{const n=N.useContext(ly);if(!n)throw new Error("No QueryClient set, use QueryClientProvider to set one");return n},bw=({client:e,children:n})=>(N.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),t.jsx(ly.Provider,{value:e,children:n})),ww={setTimeout:(e,n)=>setTimeout(e,n),clearTimeout:e=>clearTimeout(e),setInterval:(e,n)=>setInterval(e,n),clearInterval:e=>clearInterval(e)};var zr,Df,Iv,Nw=(Iv=class{constructor(){ge(this,zr,ww);ge(this,Df,!1)}setTimeoutProvider(e){te(this,zr,e)}setTimeout(e,n){return _(this,zr).setTimeout(e,n)}clearTimeout(e){_(this,zr).clearTimeout(e)}setInterval(e,n){return _(this,zr).setInterval(e,n)}clearInterval(e){_(this,zr).clearInterval(e)}},zr=new WeakMap,Df=new WeakMap,Iv);const ba=new Nw;function kw(e){setTimeout(e,0)}const Sw=typeof window>"u"||"Deno"in globalThis;function rn(){}function Cw(e,n){return typeof e=="function"?e(n):e}function oy(e){return typeof e=="number"&&e>=0&&e!==1/0}function cy(e,n){return Math.max(e+(n||0)-Date.now(),0)}function Ct(e,n){return typeof e=="function"?e(n):e}function _g(e,n){const{type:r="all",exact:i,fetchStatus:o,predicate:c,queryKey:d,stale:h}=e;if(d){if(i){if(n.queryHash!==Vf(d,n.options))return!1}else if(!Qi(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 Pg(e,n){const{exact:r,status:i,predicate:o,mutationKey:c}=e;if(c){if(!n.options.mutationKey)return!1;if(r){if($a(n.options.mutationKey)!==$a(c))return!1}else if(!Qi(n.options.mutationKey,c))return!1}return!(i&&n.state.status!==i||o&&!o(n))}function Vf(e,n){return((n==null?void 0:n.queryKeyHashFn)||$a)(e)}function $a(e){return JSON.stringify(e,(n,r)=>nf(r)?Object.keys(r).sort().reduce((i,o)=>(i[o]=r[o],i),{}):r)}function Qi(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(!Qi(e[i],n[i]))return!1;return!0}const r=Object.keys(n);for(const i of r)if(!Qi(e[i],n[i]))return!1;return!0}return!1}const _w=Object.prototype.hasOwnProperty;function Hf(e,n,r=0){if(e===n)return e;if(r>500)return n;const i=Eg(e)&&Eg(n);if(!i&&!(nf(e)&&nf(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:_w.call(e,p))&&m++;continue}if(v===null||j===null||typeof v!="object"||typeof j!="object"){h[p]=j;continue}const S=Hf(v,j,r+1);h[p]=S,S===v&&m++}return o===d&&m===o?e:h}function io(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 Eg(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function nf(e){if(!Rg(e))return!1;const n=e.constructor;if(n===void 0)return!0;const r=n.prototype;return!(!Rg(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Rg(e){return Object.prototype.toString.call(e)==="[object Object]"}function Pw(e){return new Promise(n=>{ba.setTimeout(n,e)})}function sf(e,n,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,n):r.structuralSharing!==!1?Hf(e,n):n}function _n(e){return e}function Ew(e,n,r=0){const i=[...e,n];return r&&i.length>r?i.slice(1):i}function Rw(e,n,r=0){const i=[n,...e];return r&&i.length>r?i.slice(0,-1):i}const Kf=Symbol();function uy(e,n){return!e.queryFn&&(n!=null&&n.initialPromise)?()=>n.initialPromise:!e.queryFn||e.queryFn===Kf?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Wf(e,n){return typeof e=="function"?e(...n):!!e}function Mw(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 Tw=()=>Sw;const Zf=()=>Tw();var Qa=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(){}},wa,Or,_i,$v,qw=($v=class extends Qa{constructor(){super();ge(this,wa);ge(this,Or);ge(this,_i);te(this,_i,n=>{if(typeof window<"u"&&window.addEventListener){const r=()=>n();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){_(this,Or)||this.setEventListener(_(this,_i))}onUnsubscribe(){var n;this.hasListeners()||((n=_(this,Or))==null||n.call(this),te(this,Or,void 0))}setEventListener(n){var r;te(this,_i,n),(r=_(this,Or))==null||r.call(this),te(this,Or,n(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(n){_(this,wa)!==n&&(te(this,wa,n),this.onFocus())}onFocus(){const n=this.isFocused();this.listeners.forEach(r=>{r(n)})}isFocused(){var n;return typeof _(this,wa)=="boolean"?_(this,wa):((n=globalThis.document)==null?void 0:n.visibilityState)!=="hidden"}},wa=new WeakMap,Or=new WeakMap,_i=new WeakMap,$v);const Gf=new qw,Iw=kw;function $w(){let e=[],n=0,r=h=>{h()},i=h=>{h()},o=Iw;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=$w();var Pi,Ar,Ei,zv,zw=(zv=class extends Qa{constructor(){super();ge(this,Pi,!0);ge(this,Ar);ge(this,Ei);te(this,Ei,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,Ar)||this.setEventListener(_(this,Ei))}onUnsubscribe(){var n;this.hasListeners()||((n=_(this,Ar))==null||n.call(this),te(this,Ar,void 0))}setEventListener(n){var r;te(this,Ei,n),(r=_(this,Ar))==null||r.call(this),te(this,Ar,n(this.setOnline.bind(this)))}setOnline(n){_(this,Pi)!==n&&(te(this,Pi,n),this.listeners.forEach(r=>{r(n)}))}isOnline(){return _(this,Pi)}},Pi=new WeakMap,Ar=new WeakMap,Ei=new WeakMap,zv);const pu=new zw;function Ow(e){return Math.min(1e3*2**e,3e4)}function dy(e){return(e??"online")==="online"?pu.isOnline():!0}var rf=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function hy(e){let n=!1,r=0,i,o="pending",c,d;const h=new Promise((O,z)=>{c=O,d=z});h.catch(rn);const m=()=>o!=="pending",g=O=>{var z;if(!m()){const E=new rf(O);b(E),(z=e.onCancel)==null||z.call(e,E)}},p=()=>{n=!0},v=()=>{n=!1},j=()=>Gf.isFocused()&&(e.networkMode==="always"||pu.isOnline())&&e.canRun(),S=()=>dy(e.networkMode)&&e.canRun(),y=O=>{m()||(i==null||i(),o="resolved",c(O))},b=O=>{m()||(i==null||i(),o="rejected",d(O))},k=()=>new Promise(O=>{var z;i=E=>{(m()||j())&&O(E)},(z=e.onPause)==null||z.call(e)}).then(()=>{var O;i=void 0,m()||(O=e.onContinue)==null||O.call(e)}),C=()=>{if(m())return;let O;const z=r===0?e.initialPromise:void 0;try{O=z??e.fn()}catch(E){O=Promise.reject(E)}Promise.resolve(O).then(y).catch(E=>{var B;if(m())return;const M=e.retry??(Zf()?0:3),T=e.retryDelay??Ow,$=typeof T=="function"?T(r,E):T,Q=M===!0||typeof M=="number"&&r<M||typeof M=="function"&&M(r,E);if(n||!Q){b(E);return}r++,(B=e.onFail)==null||B.call(e,r,E),Pw($).then(()=>j()?void 0:k()).then(()=>{n?b(E):C()})})};return{promise:h,status:()=>o,cancel:g,continue:()=>(i==null||i(),h),cancelRetry:p,continueRetry:v,canStart:S,start:()=>(S()?C():k().then(C),h)}}var Na,Ov,fy=(Ov=class{constructor(){ge(this,Na)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),oy(this.gcTime)&&te(this,Na,ba.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Zf()?1/0:3e5))}clearGcTimeout(){_(this,Na)!==void 0&&(ba.clearTimeout(_(this,Na)),te(this,Na,void 0))}},Na=new WeakMap,Ov);function Aw(e){return{onFetch:(n,r)=>{var p,v,j,S,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=((S=n.state.data)==null?void 0:S.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=>{Mw(z,()=>n.signal,()=>b=!0)},C=uy(n.options,n.fetchOptions),O=async(z,E,M)=>{if(b)return Promise.reject(n.signal.reason);if(E==null&&z.pages.length)return Promise.resolve(z);const $=(()=>{const V={client:n.client,queryKey:n.queryKey,pageParam:E,direction:M?"backward":"forward",meta:n.options.meta};return k(V),V})(),Q=await C($),{maxPages:B}=n.options,q=M?Rw:Ew;return{pages:q(z.pages,Q,B),pageParams:q(z.pageParams,E,B)}};if(o&&c.length){const z=o==="backward",E=z?my:af,M={pages:c,pageParams:d};h=await O(M,E(i,M),z)}else{const z=e??c.length;do{const E=m===0?d[0]??i.initialPageParam:af(i,h);if(m>0&&E==null)break;h=await O(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 af(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 my(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 Lw(e,n){return n?af(e,n)!=null:!1}function Fw(e,n){return!n||!e.getPreviousPageParam?!1:my(e,n)!=null}var Ri,ka,Mi,Kn,Sa,$t,No,Ca,cs,Ws,Av,Dw=(Av=class extends fy{constructor(n){super();ge(this,cs);ge(this,Ri);ge(this,ka);ge(this,Mi);ge(this,Kn);ge(this,Sa);ge(this,$t);ge(this,No);ge(this,Ca);te(this,Ca,!1),te(this,No,n.defaultOptions),this.setOptions(n.options),this.observers=[],te(this,Sa,n.client),te(this,Kn,_(this,Sa).getQueryCache()),this.queryKey=n.queryKey,this.queryHash=n.queryHash,te(this,ka,Tg(this.options)),this.state=n.state??_(this,ka),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return _(this,Ri)}get promise(){var n;return(n=_(this,$t))==null?void 0:n.promise}setOptions(n){if(this.options={..._(this,No),...n},n!=null&&n._type&&te(this,Ri,n._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Tg(this.options);r.data!==void 0&&(this.setState(Mg(r.data,r.dataUpdatedAt)),te(this,ka,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_(this,Kn).remove(this)}setData(n,r){const i=sf(this.state.data,n,this.options);return Pe(this,cs,Ws).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,cs,Ws).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(rn).catch(rn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return _(this,ka)}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===Kf||!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:!cy(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,Kn).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,Ca)||this.state.fetchStatus==="paused"&&this.state.status==="pending"?_(this,$t).cancel({revert:!0}):_(this,$t).cancelRetry()),this.scheduleGc()),_(this,Kn).notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Pe(this,cs,Ws).call(this,{type:"invalidate"})}async fetch(n,r){var g,p,v,j,S,y,b,k,C,O,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 M=this.observers.find(T=>T.options.queryFn);M&&this.setOptions(M.options)}const i=new AbortController,o=M=>{Object.defineProperty(M,"signal",{enumerable:!0,get:()=>(te(this,Ca,!0),i.signal)})},c=()=>{const M=uy(this.options,r),$=(()=>{const Q={client:_(this,Sa),queryKey:this.queryKey,meta:this.meta};return o(Q),Q})();return te(this,Ca,!1),this.options.persister?this.options.persister(M,$,this):M($)},h=(()=>{const M={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:_(this,Sa),state:this.state,fetchFn:c};return o(M),M})();(p=_(this,Ri)==="infinite"?Aw(this.options.pages):this.options.behavior)==null||p.onFetch(h,this),te(this,Mi,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((v=h.fetchOptions)==null?void 0:v.meta))&&Pe(this,cs,Ws).call(this,{type:"fetch",meta:(j=h.fetchOptions)==null?void 0:j.meta});const m=te(this,$t,hy({initialPromise:r==null?void 0:r.initialPromise,fn:h.fetchFn,onCancel:M=>{M instanceof rf&&M.revert&&this.setState({..._(this,Mi),fetchStatus:"idle"}),i.abort()},onFail:(M,T)=>{Pe(this,cs,Ws).call(this,{type:"failed",failureCount:M,error:T})},onPause:()=>{Pe(this,cs,Ws).call(this,{type:"pause"})},onContinue:()=>{Pe(this,cs,Ws).call(this,{type:"continue"})},retry:h.options.retry,retryDelay:h.options.retryDelay,networkMode:h.options.networkMode,canRun:()=>!0}));try{const M=await m.start();if(M===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(M),(y=(S=_(this,Kn).config).onSuccess)==null||y.call(S,M,this),(k=(b=_(this,Kn).config).onSettled)==null||k.call(b,M,this.state.error,this),M}catch(M){if(M instanceof rf){if(M.silent)return _(this,$t).promise;if(M.revert){if(this.state.data===void 0)throw M;return this.state.data}}throw Pe(this,cs,Ws).call(this,{type:"error",error:M}),(O=(C=_(this,Kn).config).onError)==null||O.call(C,M,this),(E=(z=_(this,Kn).config).onSettled)==null||E.call(z,this.state.data,M,this),M}finally{_(this,$t)===m&&te(this,$t,void 0),this.scheduleGc()}}},Ri=new WeakMap,ka=new WeakMap,Mi=new WeakMap,Kn=new WeakMap,Sa=new WeakMap,$t=new WeakMap,No=new WeakMap,Ca=new WeakMap,cs=new WeakSet,Ws=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,...py(i.data,this.options),fetchMeta:n.meta??null};case"success":const o={...i,...Mg(n.data,n.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return te(this,Mi,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,Kn).notify({query:this,type:"updated",action:n})})},Av);function py(e,n){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:dy(n.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Mg(e,n){return{data:e,dataUpdatedAt:n??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Tg(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,Ge,ko,fn,_a,Ti,Gs,So,qi,Ii,Pa,Ea,Lr,$i,nt,so,lf,of,cf,uf,df,hf,ff,mf,Lv,Lu=(Lv=class extends Qa{constructor(n,r){super();ge(this,nt);ge(this,hn);ge(this,Ge);ge(this,ko);ge(this,fn);ge(this,_a);ge(this,Ti);ge(this,Gs);ge(this,So);ge(this,qi);ge(this,Ii);ge(this,Pa);ge(this,Ea);ge(this,Lr);ge(this,$i,new Set);this.options=r,te(this,hn,n),te(this,Gs,null),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(_(this,Ge).addObserver(this),qg(_(this,Ge),this.options)?Pe(this,nt,so).call(this):this.updateResult(),Pe(this,nt,df).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return pf(_(this,Ge),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return pf(_(this,Ge),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Pe(this,nt,hf).call(this),Pe(this,nt,ff).call(this),_(this,Ge).removeObserver(this)}setOptions(n){const r=this.options,i=_(this,Ge);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,Ge))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Pe(this,nt,mf).call(this),_(this,Ge).setOptions(this.options),r._defaulted&&!io(this.options,r)&&_(this,hn).getQueryCache().notify({type:"observerOptionsUpdated",query:_(this,Ge),observer:this});const o=this.hasListeners();o&&Ig(_(this,Ge),i,this.options,r)&&Pe(this,nt,so).call(this),this.updateResult(),o&&(_(this,Ge)!==i||Ct(this.options.enabled,_(this,Ge))!==Ct(r.enabled,_(this,Ge))||Ct(this.options.staleTime,_(this,Ge))!==Ct(r.staleTime,_(this,Ge)))&&Pe(this,nt,of).call(this);const c=Pe(this,nt,cf).call(this);o&&(_(this,Ge)!==i||Ct(this.options.enabled,_(this,Ge))!==Ct(r.enabled,_(this,Ge))||c!==_(this,Lr))&&Pe(this,nt,uf).call(this,c)}getOptimisticResult(n){const r=_(this,hn).getQueryCache().build(_(this,hn),n),i=this.createResult(r,n);return io(this.getCurrentResult(),i)||(te(this,fn,i),te(this,Ti,this.options),te(this,_a,_(this,Ge).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,$i).add(n)}getCurrentQuery(){return _(this,Ge)}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,nt,so).call(this,{...n,cancelRefetch:n.cancelRefetch??!0}).then(()=>(this.updateResult(),_(this,fn)))}createResult(n,r){var T;const i=_(this,Ge),o=this.options,c=_(this,fn),d=_(this,_a),h=_(this,Ti),m=n!==i?n.state:_(this,ko),{state:g}=n;let p={...g},v=!1,j;if(r._optimisticResults){const $=this.hasListeners(),Q=!$&&qg(n,r),B=$&&Ig(n,i,r,o);(Q||B)&&(p={...p,...py(g.data,n.options)}),r._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:S,errorUpdatedAt:y,status:b}=p;j=p.data;let k=!1;if(r.placeholderData!==void 0&&j===void 0&&b==="pending"){let $;c!=null&&c.isPlaceholderData&&r.placeholderData===(h==null?void 0:h.placeholderData)?($=c.data,k=!0):$=typeof r.placeholderData=="function"?r.placeholderData((T=_(this,Ii))==null?void 0:T.state.data,_(this,Ii)):r.placeholderData,$!==void 0&&(b="success",j=sf(c==null?void 0:c.data,$,r),v=!0)}if(r.select&&j!==void 0&&!k)if(c&&j===(d==null?void 0:d.data)&&r.select===_(this,So))j=_(this,qi);else try{te(this,So,r.select),j=r.select(j),j=sf(c==null?void 0:c.data,j,r),te(this,qi,j),te(this,Gs,null)}catch($){te(this,Gs,$)}else j===void 0&&te(this,Gs,null);_(this,Gs)&&(S=_(this,Gs),j=_(this,qi),y=Date.now(),b="error",v=!1);const C=p.fetchStatus==="fetching",O=b==="pending",z=b==="error",E=O&&C,M=j!==void 0;return{status:b,fetchStatus:p.fetchStatus,isPending:O,isSuccess:b==="success",isError:z,isInitialLoading:E,isLoading:E,data:j,dataUpdatedAt:p.dataUpdatedAt,error:S,errorUpdatedAt:y,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:n.isFetched(),isFetchedAfterMount:p.dataUpdateCount>m.dataUpdateCount||p.errorUpdateCount>m.errorUpdateCount,isFetching:C,isRefetching:C&&!O,isLoadingError:z&&!M,isPaused:p.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:z&&M,isStale:Jf(n,r),refetch:this.refetch,isEnabled:Ct(r.enabled,n)!==!1}}updateResult(){const n=_(this,fn),r=this.createResult(_(this,Ge),this.options);if(te(this,_a,_(this,Ge).state),te(this,Ti,this.options),_(this,_a).data!==void 0&&te(this,Ii,_(this,Ge)),io(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,$i).size)return!0;const h=new Set(d??_(this,$i));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,Ge),type:"observerResultsUpdated"})})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Pe(this,nt,df).call(this)}},hn=new WeakMap,Ge=new WeakMap,ko=new WeakMap,fn=new WeakMap,_a=new WeakMap,Ti=new WeakMap,Gs=new WeakMap,So=new WeakMap,qi=new WeakMap,Ii=new WeakMap,Pa=new WeakMap,Ea=new WeakMap,Lr=new WeakMap,$i=new WeakMap,nt=new WeakSet,so=function(n){Pe(this,nt,mf).call(this);let r=_(this,Ge).fetch(this.options,n);return n!=null&&n.throwOnError||(r=r.catch(rn)),r},lf=function(n){return!Zf()&&Ct(this.options.enabled,_(this,Ge))!==!1&&oy(n)},of=function(){Pe(this,nt,hf).call(this);const n=Ct(this.options.staleTime,_(this,Ge));if(_(this,fn).isStale||!Pe(this,nt,lf).call(this,n))return;const r=cy(_(this,fn).dataUpdatedAt,n)+1;te(this,Pa,ba.setTimeout(()=>{_(this,fn).isStale||this.updateResult()},r))},cf=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(_(this,Ge)):this.options.refetchInterval)??!1},uf=function(n){Pe(this,nt,ff).call(this),te(this,Lr,n),!(_(this,Lr)===0||!Pe(this,nt,lf).call(this,_(this,Lr)))&&te(this,Ea,ba.setInterval(()=>{(this.options.refetchIntervalInBackground||Gf.isFocused())&&Pe(this,nt,so).call(this)},_(this,Lr)))},df=function(){Pe(this,nt,of).call(this),Pe(this,nt,uf).call(this,Pe(this,nt,cf).call(this))},hf=function(){_(this,Pa)!==void 0&&(ba.clearTimeout(_(this,Pa)),te(this,Pa,void 0))},ff=function(){_(this,Ea)!==void 0&&(ba.clearInterval(_(this,Ea)),te(this,Ea,void 0))},mf=function(){const n=_(this,hn).getQueryCache().build(_(this,hn),this.options);if(n===_(this,Ge))return;const r=_(this,Ge);te(this,Ge,n),te(this,ko,n.state),this.hasListeners()&&(r==null||r.removeObserver(this),n.addObserver(this))},Lv);function Uw(e,n){return Ct(n.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Ct(n.retryOnMount,e)===!1)}function qg(e,n){return Uw(e,n)||e.state.data!==void 0&&pf(e,n,n.refetchOnMount)}function pf(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&&Jf(e,n)}return!1}function Ig(e,n,r,i){return(e!==n||Ct(i.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Jf(e,r)}function Jf(e,n){return Ct(n.enabled,e)!==!1&&e.isStaleByTime(Ct(n.staleTime,e))}var Qw=class extends Lu{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 S,y;const{state:r}=e,i=super.createResult(e,n),{isFetching:o,isRefetching:c,isError:d,isRefetchError:h}=i,m=(y=(S=r.fetchMeta)==null?void 0:S.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:Lw(n,r.data),hasPreviousPage:Fw(n,r.data),isFetchNextPageError:g,isFetchingNextPage:p,isFetchPreviousPageError:v,isFetchingPreviousPage:j,isRefetchError:h&&!g&&!v,isRefetching:c&&!p&&!j}}},Co,ks,tn,Ra,Ss,Ir,Fv,Bw=(Fv=class extends fy{constructor(n){super();ge(this,Ss);ge(this,Co);ge(this,ks);ge(this,tn);ge(this,Ra);te(this,Co,n.client),this.mutationId=n.mutationId,te(this,tn,n.mutationCache),te(this,ks,[]),this.state=n.state||xy(),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,tn).notify({type:"observerAdded",mutation:this,observer:n}))}removeObserver(n){te(this,ks,_(this,ks).filter(r=>r!==n)),this.scheduleGc(),_(this,tn).notify({type:"observerRemoved",mutation:this,observer:n})}optionalRemove(){_(this,ks).length||(this.state.status==="pending"?this.scheduleGc():_(this,tn).remove(this))}continue(){var n;return((n=_(this,Ra))==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,S,y,b,k,C,O,z,E,M,T,$,Q;const r=()=>{Pe(this,Ss,Ir).call(this,{type:"continue"})},i={client:_(this,Co),meta:this.options.meta,mutationKey:this.options.mutationKey},o=te(this,Ra,hy({fn:()=>this.options.mutationFn?this.options.mutationFn(n,i):Promise.reject(new Error("No mutationFn found")),onFail:(B,q)=>{Pe(this,Ss,Ir).call(this,{type:"failed",failureCount:B,error:q})},onPause:()=>{Pe(this,Ss,Ir).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_(this,tn).canRun(this)})),c=this.state.status==="pending",d=!o.canStart();try{if(c)r();else{Pe(this,Ss,Ir).call(this,{type:"pending",variables:n,isPaused:d}),_(this,tn).config.onMutate&&await _(this,tn).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,Ir).call(this,{type:"pending",context:q,variables:n,isPaused:d})}const B=await o.start();return await((p=(g=_(this,tn).config).onSuccess)==null?void 0:p.call(g,B,n,this.state.context,this,i)),await((j=(v=this.options).onSuccess)==null?void 0:j.call(v,B,n,this.state.context,i)),await((y=(S=_(this,tn).config).onSettled)==null?void 0:y.call(S,B,null,this.state.variables,this.state.context,this,i)),await((k=(b=this.options).onSettled)==null?void 0:k.call(b,B,null,n,this.state.context,i)),Pe(this,Ss,Ir).call(this,{type:"success",data:B}),B}catch(B){try{await((O=(C=_(this,tn).config).onError)==null?void 0:O.call(C,B,n,this.state.context,this,i))}catch(q){Promise.reject(q)}try{await((E=(z=this.options).onError)==null?void 0:E.call(z,B,n,this.state.context,i))}catch(q){Promise.reject(q)}try{await((T=(M=_(this,tn).config).onSettled)==null?void 0:T.call(M,void 0,B,this.state.variables,this.state.context,this,i))}catch(q){Promise.reject(q)}try{await((Q=($=this.options).onSettled)==null?void 0:Q.call($,void 0,B,n,this.state.context,i))}catch(q){Promise.reject(q)}throw Pe(this,Ss,Ir).call(this,{type:"error",error:B}),B}finally{_(this,Ra)===o&&te(this,Ra,void 0),_(this,tn).runNext(this)}}},Co=new WeakMap,ks=new WeakMap,tn=new WeakMap,Ra=new WeakMap,Ss=new WeakSet,Ir=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,tn).notify({mutation:this,type:"updated",action:n})})},Fv);function xy(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Js,us,_o,Dv,Vw=(Dv=class extends Qa{constructor(n={}){super();ge(this,Js);ge(this,us);ge(this,_o);this.config=n,te(this,Js,new Set),te(this,us,new Map),te(this,_o,0)}build(n,r,i){const o=new Bw({client:n,mutationCache:this,mutationId:++Yc(this,_o)._,options:n.defaultMutationOptions(r),state:i});return this.add(o),o}add(n){_(this,Js).add(n);const r=tu(n);if(typeof r=="string"){const i=_(this,us).get(r);i?i.push(n):_(this,us).set(r,[n])}this.notify({type:"added",mutation:n})}remove(n){if(_(this,Js).delete(n)){const r=tu(n);if(typeof r=="string"){const i=_(this,us).get(r);if(i)if(i.length>1){const o=i.indexOf(n);o!==-1&&i.splice(o,1)}else i[0]===n&&_(this,us).delete(r)}}this.notify({type:"removed",mutation:n})}canRun(n){var i;const r=tu(n);if(typeof r=="string"){const o=(i=_(this,us).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=tu(n);return typeof r=="string"?((o=(i=_(this,us).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,Js).forEach(n=>{this.notify({type:"removed",mutation:n})}),_(this,Js).clear(),_(this,us).clear()})}getAll(){return Array.from(_(this,Js))}find(n){const r={exact:!0,...n};return this.getAll().find(i=>Pg(r,i))}findAll(n={}){return this.getAll().filter(r=>Pg(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(rn))))}},Js=new WeakMap,us=new WeakMap,_o=new WeakMap,Dv);function tu(e){var n;return(n=e.options.scope)==null?void 0:n.id}var Xs,Fr,nn,Ys,Ps,ro,xf,Uv,Hw=(Uv=class extends Qa{constructor(r,i){super();ge(this,Ps);ge(this,Xs);ge(this,Fr);ge(this,nn);ge(this,Ys);te(this,Xs,r),this.setOptions(i),this.bindMethods(),Pe(this,Ps,ro).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,Xs).defaultMutationOptions(r),io(this.options,i)||_(this,Xs).getMutationCache().notify({type:"observerOptionsUpdated",mutation:_(this,nn),observer:this}),i!=null&&i.mutationKey&&this.options.mutationKey&&$a(i.mutationKey)!==$a(this.options.mutationKey)?this.reset():((o=_(this,nn))==null?void 0:o.state.status)==="pending"&&_(this,nn).setOptions(this.options)}onSubscribe(){this.listeners.size===1&&_(this,nn)&&(_(this,nn).addObserver(this),Pe(this,Ps,ro).call(this))}onUnsubscribe(){var r;this.hasListeners()||(r=_(this,nn))==null||r.removeObserver(this)}onMutationUpdate(r){Pe(this,Ps,ro).call(this),Pe(this,Ps,xf).call(this,r)}getCurrentResult(){return _(this,Fr)}reset(){var r;(r=_(this,nn))==null||r.removeObserver(this),te(this,nn,void 0),Pe(this,Ps,ro).call(this),Pe(this,Ps,xf).call(this)}mutate(r,i){var o;return te(this,Ys,i),(o=_(this,nn))==null||o.removeObserver(this),te(this,nn,_(this,Xs).getMutationCache().build(_(this,Xs),this.options)),_(this,nn).addObserver(this),_(this,nn).execute(r)}},Xs=new WeakMap,Fr=new WeakMap,nn=new WeakMap,Ys=new WeakMap,Ps=new WeakSet,ro=function(){var i;const r=((i=_(this,nn))==null?void 0:i.state)??xy();te(this,Fr,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},xf=function(r){_t.batch(()=>{var i,o,c,d,h,m,g,p;if(_(this,Ys)&&this.hasListeners()){const v=_(this,Fr).variables,j=_(this,Fr).context,S={client:_(this,Xs),meta:this.options.meta,mutationKey:this.options.mutationKey};if((r==null?void 0:r.type)==="success"){try{(o=(i=_(this,Ys)).onSuccess)==null||o.call(i,r.data,v,j,S)}catch(y){Promise.reject(y)}try{(d=(c=_(this,Ys)).onSettled)==null||d.call(c,r.data,null,v,j,S)}catch(y){Promise.reject(y)}}else if((r==null?void 0:r.type)==="error"){try{(m=(h=_(this,Ys)).onError)==null||m.call(h,r.error,v,j,S)}catch(y){Promise.reject(y)}try{(p=(g=_(this,Ys)).onSettled)==null||p.call(g,void 0,r.error,v,j,S)}catch(y){Promise.reject(y)}}}this.listeners.forEach(v=>{v(_(this,Fr))})})},Uv);function $g(e,n){const r=new Set(n);return e.filter(i=>!r.has(i))}var zi,mn,Oi,Ma,$n,Ta,Po,Eo,Ro,Mo,zt,gf,vf,gy,yf,jf,bf,Qv,Kw=(Qv=class extends Qa{constructor(n,r,i){super();ge(this,zt);ge(this,zi);ge(this,mn);ge(this,Oi);ge(this,Ma);ge(this,$n);ge(this,Ta);ge(this,Po);ge(this,Eo);ge(this,Ro);ge(this,Mo,[]);te(this,zi,n),te(this,Ma,i),te(this,Oi,[]),te(this,$n,[]),te(this,mn,[]),this.setQueries(r)}onSubscribe(){this.listeners.size===1&&_(this,$n).forEach(n=>{n.subscribe(r=>{Pe(this,zt,jf).call(this,n,r)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,_(this,$n).forEach(n=>{n.destroy()})}setQueries(n,r){te(this,Oi,n),te(this,Ma,r),_t.batch(()=>{const i=_(this,$n),o=Pe(this,zt,yf).call(this,_(this,Oi));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 S=_(this,mn)[j];return!S||!io(v,S)});!g&&!p||(g&&(te(this,Mo,o),te(this,$n,c)),te(this,mn,d),this.hasListeners()&&(g&&($g(i,c).forEach(v=>{v.destroy()}),$g(c,i).forEach(v=>{v.subscribe(j=>{Pe(this,zt,jf).call(this,v,j)})})),Pe(this,zt,bf).call(this)))})}getCurrentResult(){return _(this,mn)}getQueries(){return _(this,$n).map(n=>n.getCurrentQuery())}getObservers(){return _(this,$n)}getOptimisticResult(n,r){const i=Pe(this,zt,yf).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,vf).call(this,d??o,r,c),()=>Pe(this,zt,gf).call(this,o,i)]}},zi=new WeakMap,mn=new WeakMap,Oi=new WeakMap,Ma=new WeakMap,$n=new WeakMap,Ta=new WeakMap,Po=new WeakMap,Eo=new WeakMap,Ro=new WeakMap,Mo=new WeakMap,zt=new WeakSet,gf=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)}))})})},vf=function(n,r,i){if(r){const o=_(this,Ro),c=i!==void 0&&o!==void 0&&(o.length!==i.length||i.some((d,h)=>d!==o[h]));return(_(this,mn)!==_(this,Eo)||c||r!==_(this,Po))&&(te(this,Po,r),te(this,Eo,_(this,mn)),i!==void 0&&te(this,Ro,i),te(this,Ta,Hf(_(this,Ta),r(n)))),_(this,Ta)}return n},gy=function(){var n;return!((n=_(this,Ma))!=null&&n.combine)||_(this,$n).some((r,i)=>{var o;return r.options.suspense&&((o=_(this,mn)[i])==null?void 0:o.data)===void 0})},yf=function(n){const r=new Map;_(this,$n).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,zi).defaultQueryOptions(o),d=((h=r.get(c.queryHash))==null?void 0:h.shift())??new Lu(_(this,zi),c);i.push({defaultedQueryOptions:c,observer:d})}),i},jf=function(n,r){const i=_(this,$n).indexOf(n);i!==-1&&(te(this,mn,_(this,mn).slice()),_(this,mn)[i]=r,Pe(this,zt,bf).call(this))},bf=function(){var n;if(this.hasListeners()){const r=Pe(this,zt,gy).call(this),i=_(this,Ta),o=r?i:Pe(this,zt,vf).call(this,Pe(this,zt,gf).call(this,_(this,mn),_(this,Mo)),(n=_(this,Ma))==null?void 0:n.combine);(r||i!==o)&&_t.batch(()=>{this.listeners.forEach(c=>{c(_(this,mn))})})}},Qv),Cs,Bv,Ww=(Bv=class extends Qa{constructor(n={}){super();ge(this,Cs);this.config=n,te(this,Cs,new Map)}build(n,r,i){const o=r.queryKey,c=r.queryHash??Vf(o,r);let d=this.get(c);return d||(d=new Dw({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=>_g(r,i))}findAll(n={}){const r=this.getAll();return Object.keys(n).length>0?r.filter(i=>_g(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,Bv),kt,Dr,Ur,Ai,Li,Qr,Fi,Di,Vv,Zw=(Vv=class{constructor(e={}){ge(this,kt);ge(this,Dr);ge(this,Ur);ge(this,Ai);ge(this,Li);ge(this,Qr);ge(this,Fi);ge(this,Di);te(this,kt,e.queryCache||new Ww),te(this,Dr,e.mutationCache||new Vw),te(this,Ur,e.defaultOptions||{}),te(this,Ai,new Map),te(this,Li,new Map),te(this,Qr,0)}mount(){Yc(this,Qr)._++,_(this,Qr)===1&&(te(this,Fi,Gf.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,kt).onFocus())})),te(this,Di,pu.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,kt).onOnline())})))}unmount(){var e,n;Yc(this,Qr)._--,_(this,Qr)===0&&((e=_(this,Fi))==null||e.call(this),te(this,Fi,void 0),(n=_(this,Di))==null||n.call(this),te(this,Di,void 0))}isFetching(e){return _(this,kt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return _(this,Dr).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=Cw(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(rn).catch(rn)}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(rn)),o.state.fetchStatus==="paused"?Promise.resolve():c}));return Promise.all(i).then(rn)}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(rn).catch(rn)}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(rn).catch(rn)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return pu.isOnline()?_(this,Dr).resumePausedMutations():Promise.resolve()}getQueryCache(){return _(this,kt)}getMutationCache(){return _(this,Dr)}getDefaultOptions(){return _(this,Ur)}setDefaultOptions(e){te(this,Ur,e)}setQueryDefaults(e,n){_(this,Ai).set($a(e),{queryKey:e,defaultOptions:n})}getQueryDefaults(e){const n=[..._(this,Ai).values()],r={};return n.forEach(i=>{Qi(e,i.queryKey)&&Object.assign(r,i.defaultOptions)}),r}setMutationDefaults(e,n){_(this,Li).set($a(e),{mutationKey:e,defaultOptions:n})}getMutationDefaults(e){const n=[..._(this,Li).values()],r={};return n.forEach(i=>{Qi(e,i.mutationKey)&&Object.assign(r,i.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const n={..._(this,Ur).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return n.queryHash||(n.queryHash=Vf(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===Kf&&(n.enabled=!1),n}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{..._(this,Ur).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){_(this,kt).clear(),_(this,Dr).clear()}},kt=new WeakMap,Dr=new WeakMap,Ur=new WeakMap,Ai=new WeakMap,Li=new WeakMap,Qr=new WeakMap,Fi=new WeakMap,Di=new WeakMap,Vv);const vy=N.createContext(!1),yy=()=>N.useContext(vy);vy.Provider;function Gw(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}const Jw=N.createContext(Gw()),jy=()=>N.useContext(Jw),by=(e,n,r)=>{const i=r!=null&&r.state.error&&typeof e.throwOnError=="function"?Wf(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||i)&&(n.isReset()||(e.retryOnMount=!1))},wy=e=>{N.useEffect(()=>{e.clearReset()},[e])},Ny=({result:e,errorResetBoundary:n,throwOnError:r,query:i,suspense:o})=>e.isError&&!n.isReset()&&!e.isFetching&&i&&(o&&e.data===void 0||Wf(r,[e.error,i])),ky=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))}},wf=(e,n)=>(e==null?void 0:e.suspense)&&n.isPending,Sy=(e,n,r)=>n.fetchOptimistic(e).catch(()=>{r.clearReset()});function Cy({queries:e,...n},r){const i=Ze(),o=yy(),c=jy(),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=>{ky(b);const k=i.getQueryCache().get(b.queryHash);by(b,c,k)}),wy(c);const[m]=N.useState(()=>new Kw(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)):rn,[m,j]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),N.useEffect(()=>{m.setQueries(h,n)},[h,n,m]);const S=g.some((b,k)=>wf(h[k],b))?g.flatMap((b,k)=>{const C=h[k];if(C&&wf(C,b)){const O=new Lu(i,C);return Sy(C,O,c)}return[]}):[];if(S.length>0)throw Promise.all(S);const y=g.find((b,k)=>{const C=h[k];return C&&Ny({result:b,errorResetBoundary:c,throwOnError:C.throwOnError,query:i.getQueryCache().get(C.queryHash),suspense:C.suspense})});if(y)throw y.error;return p(v())}function _y(e,n,r){const i=yy(),o=jy(),c=Ze(),d=c.defaultQueryOptions(e),h=c.getQueryCache().get(d.queryHash),m=e.subscribed!==!1;d._optimisticResults=i?"isRestoring":m?"optimistic":void 0,ky(d),by(d,o,h),wy(o);const[g]=N.useState(()=>new n(c,d)),p=g.getOptimisticResult(d),v=!i&&m;if(N.useSyncExternalStore(N.useCallback(j=>{const S=v?g.subscribe(_t.batchCalls(j)):rn;return g.updateResult(),S},[g,v]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),N.useEffect(()=>{g.setOptions(d)},[d,g]),wf(d,p))throw Sy(d,g,o);if(Ny({result:p,errorResetBoundary:o,throwOnError:d.throwOnError,query:h,suspense:d.suspense}))throw p.error;return d.notifyOnChangeProps?p:g.trackResult(p)}function st(e,n){return _y(e,Lu)}function He(e,n){const r=Ze(),[i]=N.useState(()=>new Hw(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(rn)},[i]);if(o.error&&Wf(i.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:c,mutateAsync:o.mutate}}function Py(e,n){return _y(e,Qw)}/**
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 Xw=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ey=(...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 Yw={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 eN=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,...Yw,width:n,height:n,stroke:e,strokeWidth:i?Number(r)*24/Number(n):r,className:Ey("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 ae=(e,n)=>{const r=N.forwardRef(({className:i,...o},c)=>N.createElement(eN,{ref:c,iconNode:n,className:Ey(`lucide-${Xw(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 qo=ae("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 tN=ae("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 nN=ae("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 sN=ae("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 rN=ae("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 Xf=ae("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 aN=ae("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 iN=ae("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 lN=ae("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 Yf=ae("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 el=ae("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 Ry=ae("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 oN=ae("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 My=ae("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 Io=ae("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 em=ae("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 Jr=ae("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 hs=ae("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 xu=ae("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 Fn=ae("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 cN=ae("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 uN=ae("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 tm=ae("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 Ty=ae("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 qy=ae("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 dN=ae("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 Iy=ae("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 hN=ae("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 fN=ae("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 Ba=ae("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 mN=ae("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 pN=ae("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 Hr=ae("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 $o=ae("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 $y=ae("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 xN=ae("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 gN=ae("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 zy=ae("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 zg=ae("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 nr=ae("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 uo=ae("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 vN=ae("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 yN=ae("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 jN=ae("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 bN=ae("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 Va=ae("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 tl=ae("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 wN=ae("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 Fu=ae("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 NN=ae("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 Oy=ae("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 ho=ae("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 kN=ae("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 SN=ae("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 CN=ae("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 Ay=ae("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 _N=ae("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 Ha=ae("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 zo=ae("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 Du=ae("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 Ly=ae("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 Gn=ae("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 nm=ae("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 Fy=ae("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 Uu=ae("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 Oo=ae("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 Zn=ae("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 PN=ae("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 EN=ae("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 Dy=ae("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 Uy=ae("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 sm=ae("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 Qu=ae("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 RN=ae("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 MN=ae("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 Og=ae("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 Qy=ae("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 Jn=ae("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=ae("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 rm=ae("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 TN=ae("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 qN=ae("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 IN=ae("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 Bu=ae("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 Nf=ae("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 $N=ae("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=ae("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 By=ae("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 Vy(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=Vy(e[n]))&&(i&&(i+=" "),i+=r)}else for(r in e)e[r]&&(i&&(i+=" "),i+=r);return i}function zN(){for(var e,n,r=0,i="",o=arguments.length;r<o;r++)(e=arguments[r])&&(n=Vy(e))&&(i&&(i+=" "),i+=n);return i}function F(...e){return zN(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(Oy,{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 gu({className:e}){return t.jsx("span",{className:F("skeleton inline-block h-3 w-16 align-middle",e),"aria-hidden":!0})}class kf extends Error{constructor(r,i){super(i.message||i.error||`Request failed (${r})`);$h(this,"status");$h(this,"body");this.name="ApiRequestError",this.status=r,this.body=i}get code(){return this.body.error}}function sr(e){return e instanceof kf}function be(e,n="Something went wrong"){return sr(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 ON(e){Object.assign(Ns,e)}const Ag="/api";function Hy(e,n){const r=e.startsWith("/")?`${Ag}${e}`:`${Ag}/${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 AN(e){return typeof e=="object"&&e!==null&&typeof e.error=="string"}async function eo(e,n,r,i={}){const o={accept:"application/json"};r!==void 0&&(o["content-type"]="application/json");let c;try{c=await fetch(Hy(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 kf(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=AN(h)?h:{error:`http_${c.status}`,message:typeof h=="string"&&h.slice(0,200)||c.statusText||`Request failed (${c.status})`},g=new kf(c.status,m);throw i.silent===!0||Array.isArray(i.silent)&&i.silent.includes(c.status)||LN(g),g}function LN(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 ie={get:(e,n)=>eo("GET",e,void 0,n),post:(e,n,r)=>eo("POST",e,n??{},r),patch:(e,n,r)=>eo("PATCH",e,n??{},r),put:(e,n,r)=>eo("PUT",e,n??{},r),del:(e,n)=>eo("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 Lg;(function(e){e.mergeShapes=(n,r)=>({...n,...r})})(Lg||(Lg={}));const ye=Ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$r=e=>{switch(typeof e){case"undefined":return ye.undefined;case"string":return ye.string;case"number":return Number.isNaN(e)?ye.nan:ye.number;case"boolean":return ye.boolean;case"function":return ye.function;case"bigint":return ye.bigint;case"symbol":return ye.symbol;case"object":return Array.isArray(e)?ye.array:e===null?ye.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ye.promise:typeof Map<"u"&&e instanceof Map?ye.map:typeof Set<"u"&&e instanceof Set?ye.set:typeof Date<"u"&&e instanceof Date?ye.date:ye.object;default:return ye.unknown}},ee=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 rr 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 rr))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()}}rr.create=e=>new rr(e);const Sf=(e,n)=>{let r;switch(e.code){case ee.invalid_type:e.received===ye.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case ee.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ye.jsonStringifyReplacer)}`;break;case ee.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ye.joinValues(e.keys,", ")}`;break;case ee.invalid_union:r="Invalid input";break;case ee.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ye.joinValues(e.options)}`;break;case ee.invalid_enum_value:r=`Invalid enum value. Expected ${Ye.joinValues(e.options)}, received '${e.received}'`;break;case ee.invalid_arguments:r="Invalid function arguments";break;case ee.invalid_return_type:r="Invalid function return type";break;case ee.invalid_date:r="Invalid date";break;case ee.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 ee.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 ee.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 ee.custom:r="Invalid input";break;case ee.invalid_intersection_types:r="Intersection results could not be merged";break;case ee.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ee.not_finite:r="Number must be finite";break;default:r=n.defaultError,Ye.assertNever(e)}return{message:r}};let FN=Sf;function DN(){return FN}const UN=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 de(e,n){const r=DN(),i=UN({issueData:n,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Sf?void 0:Sf].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"}),ao=e=>({status:"dirty",value:e}),Yn=e=>({status:"valid",value:e}),Fg=e=>e.status==="aborted",Dg=e=>e.status==="dirty",Bi=e=>e.status==="valid",vu=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 Ug=(e,n)=>{if(Bi(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 rr(e.common.issues);return this._error=r,this._error}}};function Ue(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 We{get description(){return this._def.description}_getType(n){return $r(n.data)}_getOrReturnCtx(n,r){return r||{common:n.parent.common,data:n.data,parsedType:$r(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:$r(n.data),schemaErrorMap:this._def.errorMap,path:n.path,parent:n.parent}}}_parseSync(n){const r=this._parse(n);if(vu(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:$r(n)},o=this._parseSync({data:n,path:i.path,parent:i});return Ug(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:$r(n)};if(!this["~standard"].async)try{const c=this._parseSync({data:n,path:[],parent:r});return Bi(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=>Bi(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:$r(n)},o=this._parse({data:n,path:i.path,parent:i}),c=await(vu(o)?o:Promise.resolve(o));return Ug(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:ee.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 Fa({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 tr.create(this,this._def)}nullable(){return Da.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Es.create(this)}promise(){return ku.create(this,this._def)}or(n){return ju.create([this,n],this._def)}and(n){return bu.create(this,n,this._def)}transform(n){return new Fa({...Ue(this._def),schema:this,typeName:ze.ZodEffects,effect:{type:"transform",transform:n}})}default(n){const r=typeof n=="function"?n:()=>n;return new Su({...Ue(this._def),innerType:this,defaultValue:r,typeName:ze.ZodDefault})}brand(){return new Gy({typeName:ze.ZodBranded,type:this,...Ue(this._def)})}catch(n){const r=typeof n=="function"?n:()=>n;return new Cu({...Ue(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 im.create(this,n)}readonly(){return _u.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const QN=/^c[^\s-]{8,}$/i,BN=/^[0-9a-z]+$/,VN=/^[0-9A-HJKMNP-TV-Z]{26}$/i,HN=/^[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,KN=/^[a-z0-9_-]{21}$/i,WN=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ZN=/^[-+]?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)?)??$/,GN=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,JN="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Qh;const 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])$/,YN=/^(?:(?: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])$/,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]))$/,tk=/^(([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])$/,nk=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,sk=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ky="((\\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])))",rk=new RegExp(`^${Ky}$`);function Wy(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 ak(e){return new RegExp(`^${Wy(e)}$`)}function ik(e){let n=`${Ky}T${Wy(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 lk(e,n){return!!((n==="v4"||!n)&&XN.test(e)||(n==="v6"||!n)&&ek.test(e))}function ok(e,n){if(!WN.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 ck(e,n){return!!((n==="v4"||!n)&&YN.test(e)||(n==="v6"||!n)&&tk.test(e))}class _s extends We{_parse(n){if(this._def.coerce&&(n.data=String(n.data)),this._getType(n)!==ye.string){const c=this._getOrReturnCtx(n);return de(c,{code:ee.invalid_type,expected:ye.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),de(o,{code:ee.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),de(o,{code:ee.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?de(o,{code:ee.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):h&&de(o,{code:ee.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),i.dirty())}else if(c.kind==="email")GN.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"email",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="emoji")Qh||(Qh=new RegExp(JN,"u")),Qh.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"emoji",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="uuid")HN.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"uuid",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="nanoid")KN.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"nanoid",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="cuid")QN.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"cuid",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="cuid2")BN.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"cuid2",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="ulid")VN.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"ulid",code:ee.invalid_string,message:c.message}),i.dirty());else if(c.kind==="url")try{new URL(n.data)}catch{o=this._getOrReturnCtx(n,o),de(o,{validation:"url",code:ee.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),de(o,{validation:"regex",code:ee.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),de(o,{code:ee.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),de(o,{code:ee.invalid_string,validation:{startsWith:c.value},message:c.message}),i.dirty()):c.kind==="endsWith"?n.data.endsWith(c.value)||(o=this._getOrReturnCtx(n,o),de(o,{code:ee.invalid_string,validation:{endsWith:c.value},message:c.message}),i.dirty()):c.kind==="datetime"?ik(c).test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{code:ee.invalid_string,validation:"datetime",message:c.message}),i.dirty()):c.kind==="date"?rk.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{code:ee.invalid_string,validation:"date",message:c.message}),i.dirty()):c.kind==="time"?ak(c).test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{code:ee.invalid_string,validation:"time",message:c.message}),i.dirty()):c.kind==="duration"?ZN.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"duration",code:ee.invalid_string,message:c.message}),i.dirty()):c.kind==="ip"?lk(n.data,c.version)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"ip",code:ee.invalid_string,message:c.message}),i.dirty()):c.kind==="jwt"?ok(n.data,c.alg)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"jwt",code:ee.invalid_string,message:c.message}),i.dirty()):c.kind==="cidr"?ck(n.data,c.version)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"cidr",code:ee.invalid_string,message:c.message}),i.dirty()):c.kind==="base64"?nk.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"base64",code:ee.invalid_string,message:c.message}),i.dirty()):c.kind==="base64url"?sk.test(n.data)||(o=this._getOrReturnCtx(n,o),de(o,{validation:"base64url",code:ee.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:ee.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,...Ue(e)});function uk(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 za extends We{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)!==ye.number){const c=this._getOrReturnCtx(n);return de(c,{code:ee.invalid_type,expected:ye.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),de(i,{code:ee.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),de(i,{code:ee.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),de(i,{code:ee.too_big,maximum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),o.dirty()):c.kind==="multipleOf"?uk(n.data,c.value)!==0&&(i=this._getOrReturnCtx(n,i),de(i,{code:ee.not_multiple_of,multipleOf:c.value,message:c.message}),o.dirty()):c.kind==="finite"?Number.isFinite(n.data)||(i=this._getOrReturnCtx(n,i),de(i,{code:ee.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 za({...this._def,checks:[...this._def.checks,{kind:n,value:r,inclusive:i,message:Se.toString(o)}]})}_addCheck(n){return new za({...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)}}za.create=e=>new za({checks:[],typeName:ze.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ue(e)});class Oa extends We{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)!==ye.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),de(i,{code:ee.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),de(i,{code:ee.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),de(i,{code:ee.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 de(r,{code:ee.invalid_type,expected:ye.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 Oa({...this._def,checks:[...this._def.checks,{kind:n,value:r,inclusive:i,message:Se.toString(o)}]})}_addCheck(n){return new Oa({...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}}Oa.create=e=>new Oa({checks:[],typeName:ze.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Ue(e)});class yu extends We{_parse(n){if(this._def.coerce&&(n.data=!!n.data),this._getType(n)!==ye.boolean){const i=this._getOrReturnCtx(n);return de(i,{code:ee.invalid_type,expected:ye.boolean,received:i.parsedType}),$e}return Yn(n.data)}}yu.create=e=>new yu({typeName:ze.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ue(e)});class Vi extends We{_parse(n){if(this._def.coerce&&(n.data=new Date(n.data)),this._getType(n)!==ye.date){const c=this._getOrReturnCtx(n);return de(c,{code:ee.invalid_type,expected:ye.date,received:c.parsedType}),$e}if(Number.isNaN(n.data.getTime())){const c=this._getOrReturnCtx(n);return de(c,{code:ee.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),de(o,{code:ee.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),de(o,{code:ee.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 Vi({...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}}Vi.create=e=>new Vi({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ze.ZodDate,...Ue(e)});class Qg extends We{_parse(n){if(this._getType(n)!==ye.symbol){const i=this._getOrReturnCtx(n);return de(i,{code:ee.invalid_type,expected:ye.symbol,received:i.parsedType}),$e}return Yn(n.data)}}Qg.create=e=>new Qg({typeName:ze.ZodSymbol,...Ue(e)});class Cf extends We{_parse(n){if(this._getType(n)!==ye.undefined){const i=this._getOrReturnCtx(n);return de(i,{code:ee.invalid_type,expected:ye.undefined,received:i.parsedType}),$e}return Yn(n.data)}}Cf.create=e=>new Cf({typeName:ze.ZodUndefined,...Ue(e)});class _f extends We{_parse(n){if(this._getType(n)!==ye.null){const i=this._getOrReturnCtx(n);return de(i,{code:ee.invalid_type,expected:ye.null,received:i.parsedType}),$e}return Yn(n.data)}}_f.create=e=>new _f({typeName:ze.ZodNull,...Ue(e)});class Bg extends We{constructor(){super(...arguments),this._any=!0}_parse(n){return Yn(n.data)}}Bg.create=e=>new Bg({typeName:ze.ZodAny,...Ue(e)});class Pf extends We{constructor(){super(...arguments),this._unknown=!0}_parse(n){return Yn(n.data)}}Pf.create=e=>new Pf({typeName:ze.ZodUnknown,...Ue(e)});class Wr extends We{_parse(n){const r=this._getOrReturnCtx(n);return de(r,{code:ee.invalid_type,expected:ye.never,received:r.parsedType}),$e}}Wr.create=e=>new Wr({typeName:ze.ZodNever,...Ue(e)});class Vg extends We{_parse(n){if(this._getType(n)!==ye.undefined){const i=this._getOrReturnCtx(n);return de(i,{code:ee.invalid_type,expected:ye.void,received:i.parsedType}),$e}return Yn(n.data)}}Vg.create=e=>new Vg({typeName:ze.ZodVoid,...Ue(e)});class Es extends We{_parse(n){const{ctx:r,status:i}=this._processInputParams(n),o=this._def;if(r.parsedType!==ye.array)return de(r,{code:ee.invalid_type,expected:ye.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)&&(de(r,{code:d?ee.too_big:ee.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&&(de(r,{code:ee.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&&(de(r,{code:ee.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,...Ue(n)});function Ci(e){if(e instanceof Mt){const n={};for(const r in e.shape){const i=e.shape[r];n[r]=tr.create(Ci(i))}return new Mt({...e._def,shape:()=>n})}else return e instanceof Es?new Es({...e._def,type:Ci(e.element)}):e instanceof tr?tr.create(Ci(e.unwrap())):e instanceof Da?Da.create(Ci(e.unwrap())):e instanceof Aa?Aa.create(e.items.map(n=>Ci(n))):e}class Mt extends We{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)!==ye.object){const g=this._getOrReturnCtx(n);return de(g,{code:ee.invalid_type,expected:ye.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 Wr&&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 Wr){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&&(de(o,{code:ee.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 Ci(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 tr;)c=c._def.innerType;r[i]=c}return new Mt({...this._def,shape:()=>r})}keyof(){return Zy(Ye.objectKeys(this.shape))}}Mt.create=(e,n)=>new Mt({shape:()=>e,unknownKeys:"strip",catchall:Wr.create(),typeName:ze.ZodObject,...Ue(n)});Mt.strictCreate=(e,n)=>new Mt({shape:()=>e,unknownKeys:"strict",catchall:Wr.create(),typeName:ze.ZodObject,...Ue(n)});Mt.lazycreate=(e,n)=>new Mt({shape:e,unknownKeys:"strip",catchall:Wr.create(),typeName:ze.ZodObject,...Ue(n)});class ju extends We{_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 rr(h.ctx.common.issues));return de(r,{code:ee.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 rr(m));return de(r,{code:ee.invalid_union,unionErrors:h}),$e}}get options(){return this._def.options}}ju.create=(e,n)=>new ju({options:e,typeName:ze.ZodUnion,...Ue(n)});const Zs=e=>e instanceof Rf?Zs(e.schema):e instanceof Fa?Zs(e.innerType()):e instanceof Nu?[e.value]:e instanceof La?e.options:e instanceof Mf?Ye.objectValues(e.enum):e instanceof Su?Zs(e._def.innerType):e instanceof Cf?[void 0]:e instanceof _f?[null]:e instanceof tr?[void 0,...Zs(e.unwrap())]:e instanceof Da?[null,...Zs(e.unwrap())]:e instanceof Gy||e instanceof _u?Zs(e.unwrap()):e instanceof Cu?Zs(e._def.innerType):[];class am extends We{_parse(n){const{ctx:r}=this._processInputParams(n);if(r.parsedType!==ye.object)return de(r,{code:ee.invalid_type,expected:ye.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}):(de(r,{code:ee.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=Zs(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 am({typeName:ze.ZodDiscriminatedUnion,discriminator:n,options:r,optionsMap:o,...Ue(i)})}}function Ef(e,n){const r=$r(e),i=$r(n);if(e===n)return{valid:!0,data:e};if(r===ye.object&&i===ye.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=Ef(e[h],n[h]);if(!m.valid)return{valid:!1};d[h]=m.data}return{valid:!0,data:d}}else if(r===ye.array&&i===ye.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=Ef(d,h);if(!m.valid)return{valid:!1};o.push(m.data)}return{valid:!0,data:o}}else return r===ye.date&&i===ye.date&&+e==+n?{valid:!0,data:e}:{valid:!1}}class bu extends We{_parse(n){const{status:r,ctx:i}=this._processInputParams(n),o=(c,d)=>{if(Fg(c)||Fg(d))return $e;const h=Ef(c.value,d.value);return h.valid?((Dg(c)||Dg(d))&&r.dirty(),{status:r.value,value:h.data}):(de(i,{code:ee.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}))}}bu.create=(e,n,r)=>new bu({left:e,right:n,typeName:ze.ZodIntersection,...Ue(r)});class Aa extends We{_parse(n){const{status:r,ctx:i}=this._processInputParams(n);if(i.parsedType!==ye.array)return de(i,{code:ee.invalid_type,expected:ye.array,received:i.parsedType}),$e;if(i.data.length<this._def.items.length)return de(i,{code:ee.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$e;!this._def.rest&&i.data.length>this._def.items.length&&(de(i,{code:ee.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 Aa({...this._def,rest:n})}}Aa.create=(e,n)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Aa({items:e,typeName:ze.ZodTuple,rest:null,...Ue(n)})};class wu extends We{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!==ye.object)return de(i,{code:ee.invalid_type,expected:ye.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 We?new wu({keyType:n,valueType:r,typeName:ze.ZodRecord,...Ue(i)}):new wu({keyType:_s.create(),valueType:n,typeName:ze.ZodRecord,...Ue(r)})}}class Hg extends We{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!==ye.map)return de(i,{code:ee.invalid_type,expected:ye.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}}}}Hg.create=(e,n,r)=>new Hg({valueType:n,keyType:e,typeName:ze.ZodMap,...Ue(r)});class fo extends We{_parse(n){const{status:r,ctx:i}=this._processInputParams(n);if(i.parsedType!==ye.set)return de(i,{code:ee.invalid_type,expected:ye.set,received:i.parsedType}),$e;const o=this._def;o.minSize!==null&&i.data.size<o.minSize.value&&(de(i,{code:ee.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&&(de(i,{code:ee.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 fo({...this._def,minSize:{value:n,message:Se.toString(r)}})}max(n,r){return new fo({...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)}}fo.create=(e,n)=>new fo({valueType:e,minSize:null,maxSize:null,typeName:ze.ZodSet,...Ue(n)});class Rf extends We{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})}}Rf.create=(e,n)=>new Rf({getter:e,typeName:ze.ZodLazy,...Ue(n)});class Nu extends We{_parse(n){if(n.data!==this._def.value){const r=this._getOrReturnCtx(n);return de(r,{received:r.data,code:ee.invalid_literal,expected:this._def.value}),$e}return{status:"valid",value:n.data}}get value(){return this._def.value}}Nu.create=(e,n)=>new Nu({value:e,typeName:ze.ZodLiteral,...Ue(n)});function Zy(e,n){return new La({values:e,typeName:ze.ZodEnum,...Ue(n)})}class La extends We{_parse(n){if(typeof n.data!="string"){const r=this._getOrReturnCtx(n),i=this._def.values;return de(r,{expected:Ye.joinValues(i),received:r.parsedType,code:ee.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 de(r,{received:r.data,code:ee.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 La.create(n,{...this._def,...r})}exclude(n,r=this._def){return La.create(this.options.filter(i=>!n.includes(i)),{...this._def,...r})}}La.create=Zy;class Mf extends We{_parse(n){const r=Ye.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(n);if(i.parsedType!==ye.string&&i.parsedType!==ye.number){const o=Ye.objectValues(r);return de(i,{expected:Ye.joinValues(o),received:i.parsedType,code:ee.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 de(i,{received:i.data,code:ee.invalid_enum_value,options:o}),$e}return Yn(n.data)}get enum(){return this._def.values}}Mf.create=(e,n)=>new Mf({values:e,typeName:ze.ZodNativeEnum,...Ue(n)});class ku extends We{unwrap(){return this._def.type}_parse(n){const{ctx:r}=this._processInputParams(n);if(r.parsedType!==ye.promise&&r.common.async===!1)return de(r,{code:ee.invalid_type,expected:ye.promise,received:r.parsedType}),$e;const i=r.parsedType===ye.promise?r.data:Promise.resolve(r.data);return Yn(i.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}}ku.create=(e,n)=>new ku({type:e,typeName:ze.ZodPromise,...Ue(n)});class Fa extends We{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=>{de(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"?ao(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"?ao(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(!Bi(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=>Bi(d)?Promise.resolve(o.transform(d.value,c)).then(h=>({status:r.value,value:h})):$e);Ye.assertNever(o)}}Fa.create=(e,n,r)=>new Fa({schema:e,typeName:ze.ZodEffects,effect:n,...Ue(r)});Fa.createWithPreprocess=(e,n,r)=>new Fa({schema:n,effect:{type:"preprocess",transform:e},typeName:ze.ZodEffects,...Ue(r)});class tr extends We{_parse(n){return this._getType(n)===ye.undefined?Yn(void 0):this._def.innerType._parse(n)}unwrap(){return this._def.innerType}}tr.create=(e,n)=>new tr({innerType:e,typeName:ze.ZodOptional,...Ue(n)});class Da extends We{_parse(n){return this._getType(n)===ye.null?Yn(null):this._def.innerType._parse(n)}unwrap(){return this._def.innerType}}Da.create=(e,n)=>new Da({innerType:e,typeName:ze.ZodNullable,...Ue(n)});class Su extends We{_parse(n){const{ctx:r}=this._processInputParams(n);let i=r.data;return r.parsedType===ye.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Su.create=(e,n)=>new Su({innerType:e,typeName:ze.ZodDefault,defaultValue:typeof n.default=="function"?n.default:()=>n.default,...Ue(n)});class Cu extends We{_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 vu(o)?o.then(c=>({status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new rr(i.common.issues)},input:i.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new rr(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}Cu.create=(e,n)=>new Cu({innerType:e,typeName:ze.ZodCatch,catchValue:typeof n.catch=="function"?n.catch:()=>n.catch,...Ue(n)});class Kg extends We{_parse(n){if(this._getType(n)!==ye.nan){const i=this._getOrReturnCtx(n);return de(i,{code:ee.invalid_type,expected:ye.nan,received:i.parsedType}),$e}return{status:"valid",value:n.data}}}Kg.create=e=>new Kg({typeName:ze.ZodNaN,...Ue(e)});class Gy extends We{_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 im extends We{_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(),ao(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 im({in:n,out:r,typeName:ze.ZodPipeline})}}class _u extends We{_parse(n){const r=this._def.innerType._parse(n),i=o=>(Bi(o)&&(o.value=Object.freeze(o.value)),o);return vu(r)?r.then(o=>i(o)):i(r)}unwrap(){return this._def.innerType}}_u.create=(e,n)=>new _u({innerType:e,typeName:ze.ZodReadonly,...Ue(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=za.create;Oa.create;const Ms=yu.create;Vi.create;const Wg=Pf.create;Wr.create;const sl=Es.create,Oe=Mt.create,Jy=ju.create,Vu=am.create;bu.create;Aa.create;const Xy=wu.create,Sn=Nu.create,es=La.create;ku.create;tr.create;Da.create;const ar={string:(e=>_s.create({...e,coerce:!0})),number:(e=>za.create({...e,coerce:!0})),boolean:(e=>yu.create({...e,coerce:!0})),bigint:(e=>Oa.create({...e,coerce:!0})),date:(e=>Vi.create({...e,coerce:!0}))},lm=["alerts","users","folders","flows","audit","sso","mcp"],Yy={monthlyUsd:39,yearlyUsd:390},e0=fe().trim().min(8).max(512);Oe({key:e0,instance:Oe({label:fe().trim().min(1).max(120),version:fe().max(40).optional()})});Oe({key:e0,activationId:fe().trim().min(1).max(120)});const Pu=["admin","operator","viewer"],dk="anonymous";function hk(e){return(e==null?void 0:e.id)===dk}const t0=es(Pu),fk=Oe({email:fe().email(),name:fe().min(1).max(80),password:fe().min(8).max(200)}),mk=Oe({email:fe().email(),password:fe().min(1)}),pk=Oe({email:fe().email(),name:fe().min(1).max(80),role:t0,password:fe().min(8).max(200).optional()});Oe({name:fe().min(1).max(80).optional(),role:t0.optional(),password:fe().min(8).max(200).optional(),disabled:Ms().optional()});const n0=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()}),s0=Oe({entryPoint:fe().url(),issuer:fe().min(1).max(255),idpCert:fe().min(1).max(1e4),emailAttribute:fe().min(1).max(200).optional()}),xk=Vu("kind",[Oe({kind:Sn("oidc"),name:fe().min(1).max(60),enabled:Ms().optional(),config:n0.extend({clientSecret:fe().min(1).max(500)})}),Oe({kind:Sn("saml"),name:fe().min(1).max(60),enabled:Ms().optional(),config:s0})]);Oe({name:fe().min(1).max(60).optional(),enabled:Ms().optional(),config:Jy([n0.partial(),s0.partial()]).optional()});const r0=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(r0).max(50).optional()});const a0=["redis","postgres"],lu={redis:"bull",postgres:"bullmq"},Zg={redis:{test:/^rediss?:\/\//,message:"Must start with redis:// or rediss://"},postgres:{test:/^postgres(ql)?:\/\//,message:"Must start with postgres:// or postgresql://"}},gk=/^[A-Za-z_][A-Za-z0-9_]{0,62}$/;function i0(e){const n=[],r=e.kind??"redis";return e.url!==void 0&&!Zg[r].test.test(e.url)&&n.push({path:"url",message:Zg[r].message}),r==="postgres"&&(e.prefix!==void 0&&!gk.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 l0=Oe({name:fe().min(1).max(80),kind:es(a0).default("redis"),url:fe().min(1),prefix:fe().min(1).max(64).optional(),cluster:Ms().default(!1),queueFilter:fe().max(200).nullable().optional()}),vk=l0.superRefine((e,n)=>{for(const r of i0(e))n.addIssue({code:ee.custom,path:[r.path],message:r.message})}).transform(e=>({...e,prefix:e.prefix??lu[e.kind]}));l0.omit({kind:!0}).partial();Oe({ids:sl(fe().min(1)).min(1)});Oe({kind:es(a0).default("redis"),url:fe().min(1),prefix:fe().optional(),cluster:Ms().optional()}).superRefine((e,n)=>{for(const r of i0(e))n.addIssue({code:ee.custom,path:[r.path],message:r.message})});const mo=["waiting","active","completed","failed","delayed","prioritized","paused","waiting-children"],o0=es(mo),yk=["waiting","limited","maxed","paused"];Oe({page:ar.number().int().min(1).default(1),pageSize:ar.number().int().min(1).max(200).default(25)});Oe({q:fe().max(200).optional(),withinMs:ar.number().int().min(0).optional(),limit:ar.number().int().min(1).max(1e3).default(500)});const jk=Oe({name:fe().min(1).max(200).default("__default__"),data:Wg().default({}),opts:Xy(Wg()).default({})}),c0=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 Eu=500,bk=["run_copy","skip_next"];Oe({scheduler:es(bk).default("run_copy")});Oe({jobIds:sl(fe().min(1).max(200)).min(1,"jobIds must not be empty").max(Eu,`at most ${Eu} job ids per call`)});Oe({state:o0.default("waiting"),groupId:fe().min(1).max(200).optional(),page:ar.number().int().min(1).default(1),pageSize:ar.number().int().min(1).max(200).default(25),order:es(["asc","desc"]).default("desc")});Oe({state:o0.default("failed"),q:fe().max(500).default(""),groupId:fe().min(1).max(200).optional(),cursor:fe().optional(),limit:ar.number().int().min(1).max(200).default(50)}).refine(e=>e.q.length>0||e.groupId!==void 0,{message:"q or groupId is required",path:["q"]});Oe({queueName:fe().min(1).max(255)});const u0=Oe({name:fe().min(1).max(80),color:fe().max(20).nullable().optional(),parentId:fe().nullable().optional()}),wk=u0.partial().extend({position:pn().int().min(0).optional()});Oe({queues:sl(Oe({connectionId:fe(),queueName:fe()}))});const Nk=Oe({waitingAbove:pn().int().min(0).max(1e7).default(0),failedAbove:pn().int().min(0).max(1e7).default(0)}),Ru={waitingAbove:0,failedAbove:0},kk=100,Sk=["waiting_above","failed_above","failed_rate_above","duration_above"],Ck=["failed_above","failed_rate_above"];function _k(e){return Ck.includes(e)}const Pk=Vu("kind",[Oe({kind:Sn("waiting_above"),threshold:pn().int().min(1)}),Oe({kind:Sn("failed_above"),threshold:pn().int().min(1),windowMinutes:pn().int().min(1).max(1440).default(5)}),Oe({kind:Sn("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:Sn("duration_above"),seconds:pn().min(.001).max(86400),percentile:Jy([Sn(50),Sn(95)]).default(95),windowMinutes:pn().int().min(1).max(1440).default(15),minSample:pn().int().min(1).max(kk).default(5)})]),Ek=Vu("type",[Oe({type:Sn("queue"),connectionId:fe().min(1),queueName:fe().min(1)}),Oe({type:Sn("folder"),folderId:fe().min(1)}),Oe({type:Sn("connection"),connectionId:fe().min(1)}),Oe({type:Sn("global")})]),Rk=Vu("type",[Oe({type:Sn("slack"),webhookUrl:fe().url()}),Oe({type:Sn("webhook"),url:fe().url(),headers:Xy(fe()).optional()})]),d0=Oe({name:fe().min(1).max(120),enabled:Ms().default(!0),scope:Ek,condition:Pk,channels:sl(Rk).default([]),cooldownMinutes:pn().int().min(1).max(1440).default(30)});d0.partial();const om=["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","group.pause","group.resume","group.drain","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"],cm={"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","group.pause":"paused a group","group.resume":"resumed a group","group.drain":"drained a group","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"},Mk=["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"],Tk=es(om);Oe({limit:ar.number().int().min(1).max(200).default(50),cursor:fe().max(200).optional(),actorId:fe().max(36).optional(),action:Tk.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:ar.number().int().min(1).max(500).default(200),fromRoot:es(["true","false"]).default("true").transform(e=>e==="true")});const Gg={admin:3,operator:2,viewer:1};function Jg(e,n){return Gg[e]>=Gg[n]}const qk=["off","read","write"];Oe({maxAccess:es(qk)});Oe({request:fe().min(1).max(4096),approve:Ms(),access:es(["read","write"]).default("read")});let Hi={open:!1,feature:"alerts"};const Tf=new Set;function h0(e){Hi=e,Tf.forEach(n=>n())}function po(e){h0({open:!0,feature:e??Hi.feature})}function Bh(){Hi.open&&h0({...Hi,open:!1})}function Ik(){return N.useSyncExternalStore(e=>(Tf.add(e),()=>Tf.delete(e)),()=>Hi,()=>Hi)}let qa=[],$k=0;const qf=new Set;function f0(){qf.forEach(e=>e())}function zk(e){return qf.add(e),()=>qf.delete(e)}function ki(e,n,r={}){const i=qa.find(c=>c.message===n&&c.kind===e);if(i)return i.id;const o=++$k;return qa=[...qa,{id:o,kind:e,message:n,description:r.description,durationMs:r.durationMs??(r.action?8e3:e==="error"?6e3:3500),action:r.action}],f0(),o}function Vh(e){qa=qa.filter(n=>n.id!==e),f0()}const Y=Object.assign((e,n)=>ki((n==null?void 0:n.kind)??"info",e,n),{info:(e,n)=>ki("info",e,{description:n}),success:(e,n)=>ki("success",e,{description:n}),error:(e,n)=>ki("error",e,{description:n}),warning:(e,n)=>ki("warning",e,{description:n}),undoable:(e,n,r)=>ki("success",e,{description:r,action:n})}),Ok={info:Va,success:tm,error:Ty,warning:Xn},Ak={info:"text-info",success:"text-success",error:"text-danger",warning:"text-warning"};function Lk({item:e}){N.useEffect(()=>{const r=setTimeout(()=>Vh(e.id),e.durationMs);return()=>clearTimeout(r)},[e.id,e.durationMs]);const n=Ok[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",Ak[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(),Vh(e.id)},children:e.action.label})]}),t.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>Vh(e.id),className:"-mr-1 rounded p-0.5 text-fg-subtle hover:text-fg",children:t.jsx(gn,{className:"size-3.5"})})]})}function Fk(){const e=N.useSyncExternalStore(zk,()=>qa,()=>qa);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(Lk,{item:n},n.id))})}const m0=N.createContext(null);function Dk({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=ln(),j=An(),S=Ze(),y=N.useRef(j);y.current=j;const b=N.useRef(h);b.current=h;const k=N.useCallback(async()=>{const[$,Q]=await Promise.allSettled([ie.get("/setup/status",{silent:!0}),ie.get("/edition",{silent:!0})]);$.status==="fulfilled"&&(d(!!$.value.needsSetup),m($.value.authRequired!==!1)),Q.status==="fulfilled"&&o(Q.value)},[]),C=N.useCallback(async()=>{try{const $=await ie.get("/auth/me",{silent:!0});r($.user),o($.edition),d(!1),m($.edition.features.users)}catch($){r(null),sr($)&&$.status===401?await k():sr($)&&$.status===0&&Y.error("Could not reach the server")}finally{p(!1)}},[k]),O=N.useRef(C);O.current=C,N.useEffect(()=>{C()},[C]),N.useEffect(()=>{ON({onUnauthenticated:()=>{if(!b.current){O.current();return}r(null),S.clear();const $=y.current.pathname;!$.startsWith("/login")&&!$.startsWith("/setup")&&v("/login",{replace:!0,state:{from:y.current}})},onProRequired:$=>po($),onDemoLocked:()=>Y.warning("This action is locked in the demo")})},[v,S]);const z=N.useCallback(async $=>{const Q=await ie.post("/auth/login",$,{silent:[401]});return r(Q.user),o(Q.edition),d(!1),S.clear(),Q},[S]),E=N.useCallback(async $=>{const Q=await ie.post("/setup",$);return r(Q.user),o(Q.edition),d(!1),Q},[]),M=N.useCallback(async()=>{try{await ie.post("/auth/logout",{},{silent:!0})}finally{r(null),S.clear(),v("/login",{replace:!0})}},[v,S]),T=N.useMemo(()=>({user:n,edition:i,loading:g,needsSetup:c,authRequired:h,isAnonymous:hk(n),refresh:C,login:z,setup:E,logout:M,setEdition:o,can:$=>n?Jg(n.role,$):!1,isAdmin:(n==null?void 0:n.role)==="admin",isOperator:n?Jg(n.role,"operator"):!1}),[n,i,g,c,h,C,z,E,M]);return t.jsx(m0.Provider,{value:T,children:e})}function xt(){const e=N.useContext(m0);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}function an({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 Uk(){const{user:e,loading:n,needsSetup:r}=xt(),i=An();return n?t.jsx(x0,{}):e?t.jsx(ay,{}):r?t.jsx(Kr,{to:"/setup",replace:!0}):t.jsx(Kr,{to:"/login",replace:!0,state:{from:i}})}function Xg({children:e}){const{user:n,loading:r,authRequired:i}=xt();return r?t.jsx(x0,{}):n||!i?t.jsx(Kr,{to:"/",replace:!0}):t.jsx(t.Fragment,{children:e})}function p0({role:e,children:n}){const{can:r}=xt();return r(e)?t.jsx(t.Fragment,{children:n}):t.jsx(an,{icon:t.jsx(sm,{}),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 x0(){return t.jsx("div",{className:"flex h-full min-h-screen w-full items-center justify-center bg-bg",children:t.jsx(nl,{})})}const Qk={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"},Bk={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",Qk[n],Bk[r],d),...p,children:[i?t.jsx(Oy,{className:"animate-spin","aria-hidden":!0}):o,h,!i&&c]})}),Vk={sm:"26rem",md:"32rem",lg:"44rem",xl:"60rem"};function Pn({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 S=y=>{y.target===p.current&&n()};return t.jsx("dialog",{ref:p,className:F("dialog",m),style:{"--dialog-w":Vk[d]},"aria-labelledby":r?v:void 0,"aria-describedby":i?j:void 0,onClose:()=>{e&&n()},onCancel:y=>{y.preventDefault(),n()},onClick:S,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 xo={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"]}},Hk={tier:"free",demo:!1,features:Object.fromEntries(lm.map(e=>[e,!1])),license:null,pricing:Yy,checkoutUrl:""};function bt(){const{edition:e}=xt(),n=e??Hk,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):(po(o),!1),[r]);return N.useMemo(()=>({edition:n,tier:n.tier,isPro:n.tier==="pro",demo:!!n.demo,pricing:n.pricing??Yy,checkoutUrl:n.checkoutUrl??"",has:r,gate:i}),[n,r,i])}function Kk(){const{open:e,feature:n}=Ik(),{pricing:r,checkoutUrl:i,demo:o}=bt(),c=xo[n];return t.jsxs(Pn,{open:e,onClose:Bh,size:"md",title:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(MN,{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:Bh,children:"Not now"}),t.jsxs(Re,{to:"/settings/license",onClick:Bh,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(tl,{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(Hr,{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(Jr,{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 — ",lm.map(d=>xo[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 Wk(e){if(!e)return!1;const n=e.tagName;return n==="INPUT"||n==="TEXTAREA"||n==="SELECT"?!0:e.isContentEditable}function g0(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&&Wk(document.activeElement)||!i&&document.querySelector("dialog[open]")||n(h))};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,n,i,o,c])}const Zk=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform),v0=Zk?"⌘":"Ctrl",ht=encodeURIComponent,oe={home:"/",login:"/login",setup:"/setup",connection:e=>`/c/${ht(e)}`,queue:(e,n,r)=>`/c/${ht(e)}/q/${ht(n)}${r?`?state=${r}`:""}`,queueSearch:(e,n,r)=>`/c/${ht(e)}/q/${ht(n)}?search=1${r?`&state=${r}`:""}`,queueGroup:(e,n,r,i)=>`/c/${ht(e)}/q/${ht(n)}?state=${i}&group=${ht(r)}`,job:(e,n,r)=>`/c/${ht(e)}/q/${ht(n)}/j/${ht(r)}`,jobTree:(e,n,r)=>`/c/${ht(e)}/q/${ht(n)}/j/${ht(r)}/tree`,groups:(e,n)=>`/c/${ht(e)}/q/${ht(n)}/groups`,group:(e,n,r)=>`/c/${ht(e)}/q/${ht(n)}/groups/${ht(r)}`,queueMetrics:(e,n)=>`/c/${ht(e)}/q/${ht(n)}/metrics`,queueSchedulers:(e,n)=>`/c/${ht(e)}/q/${ht(n)}/schedulers`,schedulers:e=>e?`/schedulers/${ht(e)}`:"/schedulers",health:"/health",folders:"/folders",folder:e=>`/folders/${ht(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/${ht(e)}`:"/flows",settings:(e="connections")=>`/settings/${e}`};function Yg(e,n){const r=e.indexOf(":");return r>=0?e.slice(r+1):e}function go(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 y0=new Intl.NumberFormat("en-US"),j0=new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1});function W(e){return e==null||Number.isNaN(e)?"–":y0.format(e)}function ft(e){return e==null||Number.isNaN(e)?"–":Math.abs(e)<1e4?y0.format(e):j0.format(e)}function Cn(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 On(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 vo(e){return e==null?"–":On(e*1e3)}function Ao(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 Zr(e,n=Date.now()){const r=Ao(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 Mu(r);return o?`in ${h}`:`${h} ago`}function lo(e){return e<10?`0${e}`:String(e)}function Mu(e){const n=Ao(e);if(n==null)return"–";const r=new Date(n);return`${r.getFullYear()}-${lo(r.getMonth()+1)}-${lo(r.getDate())}`}function xn(e){const n=Ao(e);if(n==null)return"–";const r=new Date(n);return`${Mu(r)} ${lo(r.getHours())}:${lo(r.getMinutes())}:${lo(r.getSeconds())}`}function If(e){const n=Ao(e);if(n==null)return"–";const r=new Date(n);return`${xn(r)}.${String(r.getMilliseconds()).padStart(3,"0")}`}function Tu(e,n=2){try{return typeof e=="string"?e:JSON.stringify(e,null,n)??String(e)}catch{return String(e)}}function Gk(e){try{const n=JSON.parse(e);return JSON.stringify(n,null,2)}catch{return null}}function b0(e){return e==null||!Number.isFinite(e)?"–":e>=10?`${e.toFixed(1)} cores`:`${e.toFixed(2)} ${e===1?"core":"cores"}`}function Ki(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 Gr(e,n="/s"){return e==null||!Number.isFinite(e)?"–":e>=1e4?`${j0.format(e)}${n}`:e>=100?`${Math.round(e)}${n}`:`${e.toFixed(e<10?2:1)}${n}`}function yo(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 Jk(e){return e==null||!Number.isFinite(e)?"–":`${e.toFixed(2)}×`}const $f="bullpane.";function Hu(e,n,r=Xk){try{const i=localStorage.getItem($f+e);if(i==null)return n;const o=r(i);return o===void 0?n:o}catch{return n}}function jo(e,n){try{n==null?localStorage.removeItem($f+e):localStorage.setItem($f+e,typeof n=="string"?n:JSON.stringify(n))}catch{}}function Xk(e){try{return JSON.parse(e)}catch{return e}}function Ku(e,n){const[r,i]=N.useState(()=>Hu(e,n,Yk)),o=N.useCallback(d=>{i(d),jo(e,d?"1":"0")},[e]),c=N.useCallback(()=>{i(d=>(jo(e,d?"0":"1"),!d))},[e]);return[r,c,o]}function Yk(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},le={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"]},Gt=(e,n)=>`/connections/${Ve(e)}/queues/${Ve(n)}`;function e2(){return st({queryKey:le.health,queryFn:()=>ie.get("/health"),staleTime:6e4})}function fs(){return st({queryKey:le.connections,queryFn:()=>ie.get("/connections"),refetchInterval:Ut(Tt.connections)})}function t2(e){return st({queryKey:le.overview(e??""),queryFn:()=>ie.get(`/connections/${Ve(e)}/overview`),enabled:!!e,refetchInterval:Ut(Tt.queues),placeholderData:_n})}function n2(){const e=fs(),n=e.data??[],r=Cy({queries:n.map(o=>({queryKey:le.overview(o.id),queryFn:()=>ie.get(`/connections/${Ve(o.id)}/overview`),refetchInterval:Ut(Tt.queues),placeholderData:_n}))}),i=n.map((o,c)=>({connection:o,result:r[c]}));return{connections:e,entries:i,isLoading:e.isLoading}}function s2(e,n={}){return st({queryKey:le.queues(e??""),queryFn:()=>ie.get(`/connections/${Ve(e)}/queues`),enabled:!!e&&(n.enabled??!0),refetchInterval:Ut(Tt.queues),placeholderData:_n})}function rl(){const e=fs(),n=e.data??[],r=Cy({queries:n.map(o=>({queryKey:le.queues(o.id),queryFn:()=>ie.get(`/connections/${Ve(o.id)}/queues`),refetchInterval:Ut(Tt.queues),placeholderData:_n}))}),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 r2(e){const n=Ze();return He({mutationFn:()=>ie.get(`/connections/${Ve(e)}/queues`,{query:{refresh:1}}),onSuccess:r=>{e&&n.setQueryData(le.queues(e),r),n.invalidateQueries({queryKey:le.connection(e)})}})}function w0(e,n){return st({queryKey:le.queue(e??"",n??""),queryFn:()=>ie.get(Gt(e,n)),enabled:!!e&&!!n,refetchInterval:Ut(Tt.queue),placeholderData:_n})}function um(e,n,r={}){return st({queryKey:le.queueSetup(e??"",n??""),queryFn:()=>ie.get(`${Gt(e,n)}/setup`),enabled:!!e&&!!n&&(r.enabled??!0),refetchInterval:Ut(Tt.setup),placeholderData:_n})}function N0(e,n,r,i={}){return st({queryKey:le.jobs(e??"",n??"",r),queryFn:()=>ie.get(`${Gt(e,n)}/jobs`,{query:{...r}}),enabled:!!e&&!!n&&(i.enabled??!0),refetchInterval:Ut(Tt.queue),placeholderData:_n})}function a2(e,n,r,i={}){return Py({queryKey:le.jobSearch(e??"",n??"",r),queryFn:({pageParam:o})=>ie.get(`${Gt(e,n)}/jobs/search`,{query:{state:r.state,q:r.q,groupId:r.groupId,limit:r.limit,cursor:o}}),initialPageParam:void 0,getNextPageParam:o=>o.nextCursor??void 0,enabled:!!e&&!!n&&(r.q.trim().length>0||!!r.groupId)&&(i.enabled??!0),staleTime:3e4})}function i2(e,n,r){return st({queryKey:le.job(e??"",n??"",r??""),queryFn:()=>ie.get(`${Gt(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 l2(e,n,r,i={},o=!0){return st({queryKey:le.jobLogs(e??"",n??"",r??"",i),queryFn:()=>ie.get(`${Gt(e,n)}/jobs/${Ve(r)}/logs`,{query:{start:i.start,end:i.end}}),enabled:o&&!!e&&!!n&&!!r,refetchInterval:Ut(Tt.job)})}function dm(e,n){const r=Ze();return He({mutationFn:({jobId:i,action:o,scheduler:c})=>{const d=`${Gt(e,n)}/jobs/${Ve(i)}`;return o==="remove"?ie.del(d):ie.post(`${d}/${o}`,o==="promote"&&c?{scheduler:c}:void 0)},onSuccess:()=>{r.invalidateQueries({queryKey:le.queue(e,n)}),r.invalidateQueries({queryKey:le.queues(e)}),r.invalidateQueries({queryKey:le.overview(e)})}})}function o2(e,n){const r=Ze();return He({mutationFn:({action:i,jobIds:o})=>ie.post(`${Gt(e,n)}/jobs/bulk/${i}`,{jobIds:o}),onSuccess:()=>{r.invalidateQueries({queryKey:le.queue(e,n)}),r.invalidateQueries({queryKey:le.queues(e)}),r.invalidateQueries({queryKey:le.overview(e)})}})}function c2(e,n){const r=Ze();return He({mutationFn:i=>ie.post(`${Gt(e,n)}/jobs`,i),onSuccess:()=>{r.invalidateQueries({queryKey:le.queue(e,n)}),r.invalidateQueries({queryKey:le.queues(e)})}})}function k0(e,n){const r=Ze();return He({mutationFn:i=>{const o=`${Gt(e,n)}/${i.action}`;return"body"in i?ie.post(o,i.body):ie.post(o)},onSuccess:()=>{r.invalidateQueries({queryKey:le.queue(e,n)}),r.invalidateQueries({queryKey:le.queues(e)}),r.invalidateQueries({queryKey:le.overview(e)})}})}function u2(e){const n=Ze();return He({mutationFn:({queue:r,action:i,reason:o})=>ie.post(`${Gt(e,r)}/${i}`,i==="pause"?{...o?{reason:o}:{}}:void 0),onSuccess:()=>{n.invalidateQueries({queryKey:le.connection(e)})}})}function hm(e,n,r){return st({queryKey:le.groups(e??"",n??"",r),queryFn:()=>ie.get(`${Gt(e,n)}/groups`,{query:{...r}}),enabled:!!e&&!!n,refetchInterval:Ut(Tt.queues),placeholderData:_n})}function d2(e,n){const r=Ze();return He({mutationFn:({groupId:i,action:o})=>ie.post(`${Gt(e,n)}/groups/${Ve(i)}/${o}`),onSuccess:()=>r.invalidateQueries({queryKey:le.queue(e,n)})})}function h2(e,n,r,i){return st({queryKey:le.groupJobs(e??"",n??"",r??"",i),queryFn:()=>ie.get(`${Gt(e,n)}/groups/${Ve(r)}/jobs`,{query:{...i}}),enabled:!!e&&!!n&&!!r,refetchInterval:Ut(Tt.queue),placeholderData:_n})}function f2(e,n,r,i={}){return st({queryKey:le.schedulers(e??"",n??"",r),queryFn:()=>ie.get(`${Gt(e,n)}/schedulers`,{query:{...r}}),enabled:!!e&&!!n&&i.enabled!==!1,refetchInterval:Ut(Tt.queues),placeholderData:_n})}function m2(e,n={}){return st({queryKey:le.allSchedulers(e??"",n),queryFn:()=>ie.get(`/connections/${Ve(e)}/schedulers`,{query:{...n}}),enabled:!!e,refetchInterval:Ut(Tt.queues),placeholderData:_n})}function p2(e,n){const r=Ze();return He({mutationFn:i=>ie.del(`${Gt(e,n)}/schedulers/${Ve(i)}`),onSuccess:()=>{r.invalidateQueries({queryKey:["connections",e,"queue",n,"schedulers"]}),r.invalidateQueries({queryKey:le.queue(e,n)}),r.invalidateQueries({queryKey:le.queues(e)})}})}function H3(e,n,r,i=200){return st({queryKey:le.jobTree(e??"",n??"",r??"",i),queryFn:()=>ie.get(`${Gt(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:_n})}function x2(){const e=Ze();return He({mutationFn:n=>ie.post("/connections",n),onSuccess:()=>e.invalidateQueries({queryKey:le.connections})})}function g2(){const e=Ze();return He({mutationFn:({id:n,input:r})=>ie.patch(`/connections/${Ve(n)}`,r),onSuccess:()=>e.invalidateQueries({queryKey:le.connections})})}function v2(){const e=Ze();return He({mutationFn:n=>ie.del(`/connections/${Ve(n)}`),onSuccess:()=>e.invalidateQueries({queryKey:le.connections})})}function y2(){return He({mutationFn:e=>ie.post("/connections/test",e)})}function j2(e={}){const n=e.enabled??!0;return st({queryKey:le.connectionsHealth,queryFn:()=>ie.get("/health/connections"),enabled:n,refetchInterval:n?Ut(Tt.health):!1,placeholderData:_n})}function S0(e,n={}){return st({queryKey:le.hiddenQueues(e??""),queryFn:()=>ie.get(`/connections/${Ve(e)}/hidden-queues`),enabled:!!e&&(n.enabled??!0),staleTime:3e4})}function b2(e){const n=Ze();return He({mutationFn:({queue:r,hidden:i})=>i?ie.post(`/connections/${Ve(e)}/hidden-queues`,{queueName:r}):ie.del(`/connections/${Ve(e)}/hidden-queues/${Ve(r)}`),onSuccess:r=>{n.setQueryData(le.hiddenQueues(e),r),n.invalidateQueries({queryKey:le.queues(e)}),n.invalidateQueries({queryKey:le.overview(e)}),n.invalidateQueries({queryKey:le.connections})}})}function C0(){return st({queryKey:le.attentionThresholds,queryFn:()=>ie.get("/settings/attention"),staleTime:5*6e4})}function w2(){const e=Ze();return He({mutationFn:n=>ie.put("/settings/attention",n),onSuccess:n=>e.setQueryData(le.attentionThresholds,n)})}function Xr(e=!0){return st({queryKey:le.folders,queryFn:()=>ie.get("/folders",{silent:[402]}),enabled:e,staleTime:3e4})}function N2(){const e=Ze();return He({mutationFn:n=>ie.post("/folders",n),onSuccess:()=>e.invalidateQueries({queryKey:le.folders})})}function _0(){const e=Ze();return He({mutationFn:({id:n,input:r})=>ie.patch(`/folders/${Ve(n)}`,r),onSuccess:()=>e.invalidateQueries({queryKey:le.folders})})}function k2(){const e=Ze();return He({mutationFn:n=>ie.del(`/folders/${Ve(n)}`),onSuccess:()=>e.invalidateQueries({queryKey:le.folders})})}function P0(){const e=Ze();return He({mutationFn:({id:n,input:r})=>ie.put(`/folders/${Ve(n)}/queues`,r),onSuccess:()=>e.invalidateQueries({queryKey:le.folders})})}function fm(e=!0){return st({queryKey:le.alerts,queryFn:()=>ie.get("/alerts",{silent:[402]}),enabled:e,refetchInterval:Ut(Tt.connections)})}function S2(e=!0){return st({queryKey:le.attention,queryFn:()=>ie.get("/attention",{silent:[402]}),enabled:e,refetchInterval:Ut(Tt.queues)})}function mm(e){setTimeout(()=>void e.invalidateQueries({queryKey:le.attention}),1500)}function C2(e={},n=!0){return st({queryKey:le.alertEvents(e),queryFn:()=>ie.get("/alerts/events",{query:{...e},silent:[402]}),enabled:n,refetchInterval:Ut(Tt.connections)})}function _2(){const e=Ze();return He({mutationFn:n=>ie.post("/alerts",n),onSuccess:()=>{e.invalidateQueries({queryKey:le.alerts}),mm(e)}})}function E0(){const e=Ze();return He({mutationFn:({id:n,input:r})=>ie.patch(`/alerts/${Ve(n)}`,r),onSuccess:()=>{e.invalidateQueries({queryKey:le.alerts}),mm(e)}})}function P2(){const e=Ze();return He({mutationFn:n=>ie.del(`/alerts/${Ve(n)}`),onSuccess:()=>{e.invalidateQueries({queryKey:le.alerts}),mm(e)}})}function E2(){const e=Ze();return He({mutationFn:n=>ie.post(`/alerts/${Ve(n)}/test`),onSuccess:()=>e.invalidateQueries({queryKey:["alerts","events"]})})}function R2(e=!0){return st({queryKey:le.users,queryFn:()=>ie.get("/users",{silent:[402]}),enabled:e})}function M2(){const e=Ze();return He({mutationFn:n=>ie.post("/users",n),onSuccess:()=>e.invalidateQueries({queryKey:le.users})})}function T2(){const e=Ze();return He({mutationFn:({id:n,input:r})=>ie.patch(`/users/${Ve(n)}`,r),onSuccess:()=>e.invalidateQueries({queryKey:le.users})})}function q2(e={},n=50,r=!0){return Py({queryKey:le.audit({...e,limit:n}),queryFn:({pageParam:i})=>ie.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 I2(e=!0){return st({queryKey:le.auditActors,queryFn:()=>ie.get("/audit/actors",{silent:[402,403]}),enabled:e,staleTime:6e4})}function $2(e={}){return Hy("/audit/export",{...e})}function z2(e,n,r,i=!0){const o={connectionId:e,queueName:n,jobId:r};return st({queryKey:le.audit({...o,limit:20}),queryFn:()=>ie.get("/audit",{query:{...o,limit:20},silent:[402,403]}),enabled:i&&!!e&&!!n&&!!r,staleTime:15e3})}function K3(e,n=200,r=!0){return st({queryKey:le.flows(e??"",n),queryFn:()=>ie.get(`/connections/${Ve(e)}/flows`,{query:{sample:n},silent:[402]}),enabled:r&&!!e,refetchInterval:Ut(Tt.connections),placeholderData:_n})}function W3(){const e=Ze();return He({mutationFn:n=>ie.post("/flow-edges",n),onSuccess:()=>e.invalidateQueries({queryKey:["flows"]})})}function Z3(){const e=Ze();return He({mutationFn:n=>ie.del(`/flow-edges/${Ve(n)}`),onSuccess:()=>e.invalidateQueries({queryKey:["flows"]})})}function O2(){return He({mutationFn:e=>ie.put("/license",{key:e})})}function A2(){return He({mutationFn:()=>ie.post("/license/refresh")})}function L2(){return He({mutationFn:()=>ie.del("/license")})}function F2(){return st({queryKey:le.ssoLoginOptions,queryFn:()=>ie.get("/auth/sso/options",{silent:!0}),staleTime:6e4,retry:!1})}function D2(e=!0){return st({queryKey:le.ssoProviders,queryFn:()=>ie.get("/sso/providers",{silent:[402]}),enabled:e})}function R0(e=!0){return st({queryKey:le.ssoSettings,queryFn:()=>ie.get("/sso/settings",{silent:[402]}),enabled:e})}function U2(){const e=Ze();return He({mutationFn:n=>ie.post("/sso/providers",n),onSuccess:()=>{e.invalidateQueries({queryKey:le.ssoProviders}),e.invalidateQueries({queryKey:le.ssoLoginOptions})}})}function Q2(){const e=Ze();return He({mutationFn:({id:n,input:r})=>ie.patch(`/sso/providers/${Ve(n)}`,r),onSuccess:()=>{e.invalidateQueries({queryKey:le.ssoProviders}),e.invalidateQueries({queryKey:le.ssoLoginOptions})}})}function B2(){const e=Ze();return He({mutationFn:n=>ie.del(`/sso/providers/${Ve(n)}`),onSuccess:()=>{e.invalidateQueries({queryKey:le.ssoProviders}),e.invalidateQueries({queryKey:le.ssoLoginOptions}),e.invalidateQueries({queryKey:le.ssoSettings})}})}function V2(){return He({mutationFn:e=>ie.post(`/sso/providers/${Ve(e)}/test`)})}function M0(){const e=Ze();return He({mutationFn:n=>ie.put("/sso/settings",n),onSuccess:()=>{e.invalidateQueries({queryKey:le.ssoSettings}),e.invalidateQueries({queryKey:le.ssoLoginOptions})}})}function H2(e=!0){return st({queryKey:le.mcpSettings,queryFn:()=>ie.get("/mcp/settings",{silent:[402]}),enabled:e})}function K2(){const e=Ze();return He({mutationFn:n=>ie.put("/mcp/settings",n),onSuccess:()=>void e.invalidateQueries({queryKey:le.mcpSettings})})}function W2(e,n=!0){return st({queryKey:le.mcpGrants(e),queryFn:()=>ie.get(`/mcp/grants${e?"?all=1":""}`,{silent:[402]}),enabled:n})}function Z2(){const e=Ze();return He({mutationFn:n=>ie.del(`/mcp/grants/${Ve(n)}`),onSuccess:()=>void e.invalidateQueries({queryKey:["mcp","grants"]})})}function G3(e){return st({queryKey:le.mcpConsent(e??""),queryFn:()=>ie.get(`/mcp/consent?request=${encodeURIComponent(e??"")}`),enabled:!!e,refetchOnWindowFocus:!1,staleTime:1/0})}function J3(){return He({mutationFn:e=>ie.post("/mcp/consent",e)})}const G2={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 je({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",G2[e],o),...d,children:[n&&t.jsx("span",{className:"status-dot size-1.5 bg-current","aria-hidden":!0}),c]})}function pm({className:e}){const{isPro:n,demo:r}=bt();return r?t.jsx(je,{variant:"warning",size:"xs",className:F("tracking-wider",e),title:"Demo mode: Pro unlocked, settings locked",children:"DEMO"}):n?t.jsx(je,{variant:"pro",size:"xs",className:F("tracking-wider",e),children:"PRO"}):t.jsx(je,{variant:"outline",size:"xs",className:F("tracking-wider",e),children:"FREE"})}function ev({className:e}){return t.jsx(ho,{className:F("size-3 shrink-0 text-pro",e),"aria-label":"Pro feature"})}function Wi({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 _e({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 J2(e){return e?e.ok?"ok":"down":"unknown"}function Wu({status:e,className:n,pulse:r,withLabel:i}){const o=J2(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 ${Zr(e.checkedAt)}`:"";return t.jsx(_e,{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 xm({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 tv({onOpenSwitcher:e,onNavigate:n,className:r}){const{isAdmin:i}=xt(),{has:o}=bt(),{byConnection:c,isLoading:d}=rl(),h=o("folders"),m=Xr(h),g=[{to:oe.alerts,label:"Alerts",icon:el,feature:"alerts"},{to:oe.flows(),label:"Flows",icon:$N,feature:"flows"},{to:oe.users,label:"Users",icon:Bu,feature:"users",adminOnly:!0},{to:oe.audit(),label:"Audit log",icon:Oo,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(xm,{}),t.jsx("span",{className:"truncate text-[13px] font-semibold tracking-tight",children:"Bullpane"}),t.jsx(pm,{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(Zn,{className:"size-3.5","aria-hidden":!0}),t.jsx("span",{className:"flex-1 text-left",children:"Jump to queue…"}),t.jsx(Wi,{children:v0}),t.jsx(Wi,{children:"K"})]})}),t.jsxs("nav",{className:"px-2 pt-2","aria-label":"Primary",children:[t.jsx(to,{to:oe.home,end:!0,icon:NN,label:"Overview",onNavigate:n}),t.jsx(to,{to:oe.schedulers(),icon:Io,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(X2,{children:"Queues"}),h&&m.data&&m.data.length>0&&t.jsx(tS,{folders:m.data,byConnection:c,onNavigate:n}),c.map(({connection:p,queues:v,error:j})=>t.jsx(eS,{connection:p,queues:v,error:j,onNavigate:n,defaultOpen:c.length<=Y2},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(To,{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(to,{to:oe.folders,icon:nr,label:"Manage folders",className:"mt-1 text-xs",onNavigate:n}):t.jsxs("button",{type:"button",onClick:()=>po("folders"),className:"nav-item mt-1 w-full text-left",title:"Custom folders are a Pro feature",children:[t.jsx(gN,{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(ev,{})]})]}),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(to,{to:p.to,icon:p.icon,label:p.label,onNavigate:n},p.to):t.jsxs("button",{type:"button",onClick:()=>po(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(ev,{})]},p.to)),t.jsx(to,{to:oe.settings(),icon:Uy,label:"Settings",onNavigate:n})]})]})}function X2({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 to({to:e,icon:n,label:r,end:i,className:o,onNavigate:c}){return t.jsxs(To,{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 T0(e,n=!0){const[r,i,o]=Ku(`sidebar.${e}`,n);return[r,i,o]}const Y2=3;function eS({connection:e,queues:n,error:r,onNavigate:i,defaultOpen:o}){const c=Ln(),d=c.connectionId===e.id,[h,m,g]=T0(`conn.${e.id}`,o),p=N.useMemo(()=>[...n].sort((S,y)=>S.name.localeCompare(y.name)),[n]),v=n.reduce((S,y)=>S+y.counts.failed,0),j=n.reduce((S,y)=>S+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(hs,{className:"size-3.5"}):t.jsx(Fn,{className:"size-3.5"})}),t.jsxs(To,{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(Ba,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}),t.jsx("span",{className:"truncate",children:e.name})]}),!h&&t.jsx(_e,{content:`${n.length} ${n.length===1?"queue":"queues"} · ${ft(j)} waiting · ${ft(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:ft(v)})]})}),t.jsx(Wu,{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(S=>t.jsx(q0,{connectionId:e.id,queue:S,onNavigate:i},S.name))]})]})}function q0({connectionId:e,queue:n,onNavigate:r,hint:i}){const o=Ln(),c=o.connectionId===e&&o.queue===n.name;return t.jsx("li",{children:t.jsxs(To,{to:oe.queue(e,n.name,go(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:ft(n.counts.waiting+n.counts.prioritized)}),n.counts.failed>0&&t.jsx(_e,{content:`${ft(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:ft(n.counts.failed)})]})})]})})}function tS({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(I0,{folder:d,children:o(d.id),lookup:c,onNavigate:r,depth:0},d.id))})}function I0({folder:e,children:n,lookup:r,onNavigate:i,depth:o}){const[c,d]=T0(`folder.${e.id}`),m=Ln().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(hs,{className:"size-3.5"}):t.jsx(Fn,{className:"size-3.5"})}),t.jsxs(To,{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(nr,{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(I0,{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(q0,{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 nS=.9,sS=.7;function gm(e){if(!(e==null||!Number.isFinite(e))){if(e>=nS)return"danger";if(e>=sS)return"warn"}}function rS(e){return gm(e)??"ok"}function Lo(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=`${b0(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 $0="health.paused";let zf=Hu($0,!1,e=>e==="true"||e==='"true"'||e==="1");const Of=new Set;function aS(e){return Of.add(e),()=>Of.delete(e)}function nv(){return zf}function iS(e){zf!==e&&(zf=e,jo($0,e),Of.forEach(n=>n()))}function lS(){const e=N.useSyncExternalStore(aS,nv,nv),n=N.useCallback(r=>iS(r),[]);return[e,n]}function Zu(){const[e,n]=lS(),r=j2({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 vm(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 oS({className:e}){const{health:n,paused:r}=Zu();if(n.length===0)return null;const i=vm(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…":`${Gr(i.commandsPerSec)} across all connections`,i.memoryPct==null?"no maxmemory set":`peak memory use ${Cn(i.memoryPct)} of maxmemory`,i.cpuCores==null?null:`busiest CPU ${Ki(i.cpuCores)} of one core — ${Lo(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(_e,{content:d,side:"bottom",children:t.jsxs(Re,{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(qo,{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?"—":`${Gr(i.commandsPerSec,"")} cmd/s`,i.cpuCores!=null&&!r&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mx-1 text-fg-subtle",children:"·"}),Ki(i.cpuCores)," cpu"]}),i.memoryPct!=null&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mx-1 text-fg-subtle",children:"·"}),Cn(i.memoryPct,0)," mem"]})]})]})})}const cS={sso:"SSO",mcp:"MCP"};function uS(){var c;const e=Ln(),{pathname:n}=An(),i=(c=fs().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:cS[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 dS({onOpenSwitcher:e,onToggleSidebar:n}){var d,h;const r=uS(),i=Ln(),c=(d=fs().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(SN,{})}),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(Fn,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}),m.to&&!p?t.jsx(Re,{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(Wu,{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(oS,{}),t.jsx(H,{variant:"ghost",size:"icon-sm","aria-label":"Search queues",onClick:e,className:"sm:hidden",children:t.jsx(Zn,{})}),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(Zn,{className:"size-3.5","aria-hidden":!0}),t.jsx(Wi,{children:v0}),t.jsx(Wi,{children:"K"})]}),t.jsx(fS,{})]})}function hS(){return t.jsxs("button",{type:"button",onClick:()=>po("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(sm,{className:"size-3.5","aria-hidden":!0}),t.jsx("span",{className:"hidden md:inline",children:"No login"})]})}function fS(){const{user:e,logout:n,isAdmin:r,authRequired:i}=xt(),{demo:o,has:c}=bt(),[d,h]=N.useState(!1),m=N.useRef(null);if(N.useEffect(()=>{if(!d)return;const p=j=>{var S;(S=m.current)!=null&&S.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(hS,{});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(je,{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(RN,{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(Re,{role:"menuitem",to:oe.audit(),onClick:()=>h(!1),className:"nav-item",children:[t.jsx(Oo,{className:"size-3.5","aria-hidden":!0})," Audit log"]}),t.jsxs(Re,{role:"menuitem",to:oe.settings("license"),onClick:()=>h(!1),className:"nav-item",children:[t.jsx(tl,{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(kN,{className:"size-3.5","aria-hidden":!0})," Log out"]})]})]})}function mS({open:e,onClose:n}){const{byConnection:r}=rl(),i=ln(),[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:go(k.counts)}))),[r]),j=N.useMemo(()=>{const y=o.trim().toLowerCase();return v.map(k=>({it:k,score:pS(y,k)})).filter(k=>k.score>0).sort((k,C)=>C.score-k.score||k.it.queue.localeCompare(C.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 S=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(Zn,{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(),S(j[d]))}}),t.jsx(Wi,{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:()=>S(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(Ba,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}),t.jsx("span",{className:"truncate font-medium text-fg",children:t.jsx(xS,{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:[ft(y.waiting)," waiting"]}),y.failed>0&&t.jsxs("span",{className:"num text-xs text-danger",children:[ft(y.failed)," failed"]}),b===d&&t.jsx(hN,{className:"size-3.5 text-fg-subtle","aria-hidden":!0})]},y.key))]})]})})}function pS(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 xS({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 bo=new Map;let nu=null,sv=Number.POSITIVE_INFINITY,z0=Date.now();function gS(){document.hidden||(z0=Date.now(),bo.forEach((e,n)=>n()))}function rv(){const e=bo.size?Math.min(...bo.values()):Number.POSITIVE_INFINITY;e!==sv&&(nu&&clearInterval(nu),nu=null,sv=e,Number.isFinite(e)&&(nu=setInterval(gS,e)))}function al(e=15e3){const[,n]=N.useState(0);return N.useEffect(()=>{const r=()=>n(i=>i+1);return bo.set(r,e),rv(),()=>{bo.delete(r),rv()}},[e]),z0}function Zt({value:e,className:n,withAbsolute:r,emptyText:i="–"}){const o=al(),c=Ao(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:[Zr(c,o),r&&t.jsx("span",{className:"ml-1.5 text-fg-subtle",children:d})]})}const vS="only leaves the list · jobs untouched · reversible",O0="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.)",A0="Removed from the lists only. No job was deleted.";function ym(e){var o;const n=b2(e),r=(c,d={})=>n.mutate({queue:c,hidden:!1},{onSuccess:()=>{d.silent||Y.success(`${c} is visible again`)},onError:h=>Y.error(be(h))});return{hide:c=>n.mutate({queue:c,hidden:!0},{onSuccess:()=>Y.undoable(`${c} hidden`,{label:"Undo",onClick:()=>r(c,{silent:!0})},A0),onError:d=>Y.error(be(d))}),unhide:r,isPending:n.isPending,pendingQueue:n.isPending?((o=n.variables)==null?void 0:o.queue)??null:null}}function yS(){const e=Ze(),n=async(o,c,d)=>{const h=d?await ie.post(`/connections/${Ve(o)}/hidden-queues`,{queueName:c}):await ie.del(`/connections/${Ve(o)}/hidden-queues/${Ve(c)}`);e.setQueryData(le.hiddenQueues(o),h),e.invalidateQueries({queryKey:le.queues(o)}),e.invalidateQueries({queryKey:le.overview(o)})},r=(o,c,d={})=>n(o,c,!1).then(()=>{d.silent||Y.success(`${c} is visible again`)},h=>Y.error(be(h)));return{hide:(o,c)=>n(o,c,!0).then(()=>Y.undoable(`${c} hidden`,{label:"Undo",onClick:()=>void r(o,c,{silent:!0})},A0),d=>Y.error(be(d))),unhide:r}}function jS({connectionId:e,queueName:n}){var d;const{isOperator:r}=xt(),i=S0(e),o=ym(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($o,{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(Zt,{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($y,{}),loading:o.pendingQueue===n,onClick:()=>o.unhide(n),children:"Show again"})]}):null}function bS(){const[e,n]=N.useState(!1),[r,i]=N.useState(!1),o=An(),c=Ng("/c/:connectionId/q/:queue/*"),d=Ng("/c/:connectionId/q/:queue"),h=c??d,m=N.useCallback(()=>n(!0),[]);return g0("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(tv,{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(tv,{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(dS,{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(jS,{connectionId:h.params.connectionId,queueName:h.params.queue}),t.jsx(ay,{})]})]}),t.jsx(mS,{open:e,onClose:()=>n(!1)})]})}function jt({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 ms({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 Gu({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,S=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?S:t.jsx(Gu,{label:n,hint:r,error:i,htmlFor:j,className:d,children:S})}),Zi=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(Gu,{label:n,hint:r,error:i,htmlFor:v,className:d,children:j})}),ct=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,S=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?S:t.jsx(Gu,{label:n,hint:r,error:i,htmlFor:j,className:c,children:S})}),jm=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 Gi({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 L0({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(xm,{className:"size-8"}),t.jsx("span",{className:"text-base font-semibold tracking-tight",children:"Bullpane"}),t.jsx(pm,{})]}),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 wS(){var re;const{login:e,needsSetup:n}=xt(),{demo:r}=bt(),i=ln(),o=An(),[c,d]=Yi(),[h,m]=N.useState(""),[g,p]=N.useState(""),[v,j]=N.useState(null),[S,y]=N.useState({}),[b,k]=N.useState(!1),C=c.get("sso_error");N.useEffect(()=>{if(!C)return;j(C);const ue=new URLSearchParams(c);ue.delete("sso_error"),d(ue,{replace:!0})},[C,c,d]);const{data:O}=F2(),z=(O==null?void 0:O.providers)??[],E=z.length>0,M=(O==null?void 0:O.requireSso)??!1,[T,$]=N.useState(!1),Q=!M||T;if(n)return t.jsx(Kr,{to:"/setup",replace:!0});const B=(re=o.state)==null?void 0:re.from,q=B!=null&&B.pathname?`${B.pathname}${B.search??""}`:void 0,V=async ue=>{ue.preventDefault(),j(null);const qe=mk.safeParse({email:h.trim(),password:g});if(!qe.success){const Ke={};for(const ut of qe.error.issues)Ke[ut.path[0]]=ut.message;y(Ke);return}y({}),k(!0);try{await e(qe.data),i(q??"/",{replace:!0})}catch(Ke){sr(Ke)&&Ke.status===401?j(be(Ke,"Invalid email or password")):j(be(Ke))}finally{k(!1)}};return t.jsxs(L0,{title:"Sign in",description:r?"Demo playground: Pro features are unlocked, settings are read-only.":M?"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(Re,{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(ue=>t.jsxs(H,{variant:"secondary",className:"w-full",leftIcon:t.jsx(Qu,{className:"size-4"}),onClick:()=>{const qe=`/api/auth/sso/${encodeURIComponent(ue.id)}/start`;window.location.href=q?`${qe}?next=${encodeURIComponent(q)}`:qe},children:["Sign in with ",ue.name]},ue.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:V,className:"space-y-3",noValidate:!0,children:[t.jsx(Ee,{label:"Email",type:"email",autoComplete:"username",autoFocus:!E,value:h,onChange:ue=>m(ue.target.value),error:S.email,required:!0}),t.jsx(Ee,{label:"Password",type:"password",autoComplete:"current-password",value:g,onChange:ue=>p(ue.target.value),error:S.password,required:!0}),M&&t.jsx("p",{className:"text-[11px] text-fg-subtle",children:(O==null?void 0:O.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(tl,{className:"size-3.5"}),onClick:()=>$(!0),children:"Sign in with a password instead"})})]})}function NS(){const{setup:e,needsSetup:n,loading:r}=xt(),i=ln(),[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(Kr,{to:"/login",replace:!0});const j=y=>b=>c(k=>({...k,[y]:b.target.value})),S=async y=>{y.preventDefault(),g(null);const b=fk.safeParse({name:o.name.trim(),email:o.email.trim(),password:o.password}),k={};if(!b.success)for(const C of b.error.issues)k[String(C.path[0])]=C.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(C){sr(C)&&C.status===409?g("Setup was already completed. Sign in instead."):g(be(C))}finally{v(!1)}}};return t.jsx(L0,{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:S,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 Ia=e=>`${e.connection.id}/${e.queue.name}`;function Af(e,n){const r=[];if(n&&n.length>0){const o=new Map(e.map(p=>[Ia(p),p])),c=new Set,d=n.filter(p=>!p.parentId).sort(av),h=p=>n.filter(v=>v.parentId===p).sort(av),m=(p,v)=>{const j=[];for(const S of p.queues){const y=`${S.connectionId}/${S.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:Hh(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(Ia(p)));return g.length>0&&r.push({id:"leftover",title:"Queues without folder",kind:"leftover",items:Hh(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=Hh(o.items);return[...i.values()]}function av(e,n){return e.position-n.position||e.name.localeCompare(n.name)}function Hh(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 bm(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 wm(e,n){const r=n.trim().toLowerCase();return r?e.queue.name.toLowerCase().includes(r)||e.connection.name.toLowerCase().includes(r):!0}const kS={failing:"failing now",paused:"paused",backlog:"backlog, no worker",waiting:"backlog over threshold",failed:"failed jobs"},SS=1;function CS(e,n=Ru){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>=SS&&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 Si(e){return e>0?Math.min(Math.log10(e+1)*1e3,9999):0}const _S={failed_rate_above:1e6,failed_above:1e6,duration_above:7e5,waiting_above:7e5};function PS(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,_S[m.kind]+Si(g*100))}return c+=d,n.includes("failing")&&(c+=1e6+Si(((h=i.rates)==null?void 0:h.failed)??0)),n.includes("paused")&&(c+=5e5+Si(o.waiting+o.active)),n.includes("backlog")&&(c+=1e5+Si(o.waiting+o.prioritized)),n.includes("waiting")&&(c+=5e4+Si(o.waiting+o.prioritized)),n.includes("failed")&&(c+=Si(o.failed)),c}const ES=["paused","backlog"];function iv(e,n){return`${e}\0${n}`}function RS(e,n=Ru,r=8,i){const o=[],c=[],d=new Map;for(const h of i??[]){const m=iv(h.connectionId,h.queueName),g=d.get(m);g?g.push(h):d.set(m,[h])}for(const h of e){const m=CS(h,n),g=i?m.filter(v=>ES.includes(v)):m,p=d.get(iv(h.connection.id,h.queue.name))??[];g.length>0||p.length>0?o.push({entry:h,reasons:g,findings:p,score:PS(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:MS(o,r),hidden:Math.max(0,o.length-r),rest:c}}function MS(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 Nm(e,n,r){const[i,o]=Yi(),c=N.useMemo(()=>{const g=lv(i.get("sort"),i.get("dir"),r);if(g)return g;const p=Hu(`table.${e}.sort`,null);return p&&typeof p=="object"&&lv(p.key,p.dir,r)?p:n},[i,e,n,r]),d=i.get("filter")??"",h=N.useCallback(g=>{jo(`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 lv(e,n,r){return!e||r&&!r.includes(e)?null:{key:e,dir:n==="asc"?"asc":"desc"}}function Hs(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:TS[e],textClass:qS[e],muted:r}}const TS={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"},qS={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"},it={completed:Hs("completed","completed"),active:Hs("active","active"),waiting:Hs("waiting","waiting"),delayed:Hs("delayed","delayed"),failed:Hs("failed","failed"),prioritized:Hs("prioritized","prioritized",!0),paused:Hs("paused","paused",!0),"waiting-children":Hs("waiting-children","waiting-children",!0),unknown:Hs("unknown","unknown",!0)};function Ju(e){return e&&it[e]||it.unknown}function IS(e){const n=Ju(e);return{"--chip-fg":n.fg,"--chip-bg":n.bg,"--chip-border":n.border}}const $S=["completed","active","waiting","delayed","failed"],zS=["prioritized","paused","waiting-children"];function Ji({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),S=h?Math.min(0,...v):Math.min(...v),y=j===S?j+1:j,b=j===S?S-(h?0:1):S,k=1.5,C=p.length>1?(n-k*2)/(p.length-1):0,O=Q=>r-k-(Q-b)/(y-b||1)*(r-k*2),z=[];let E=null;p.forEach((Q,B)=>{if(Q===null){E=null;return}const q=[k+B*C,O(Q)];E?E.pts.push(q):(E={pts:[q]},z.push(E))});const M=Q=>Q.map(([B,q],V)=>`${V===0?"M":"L"}${B.toFixed(1)},${q.toFixed(1)}`).join(" "),T=z[z.length-1],$=T==null?void 0:T.pts[T.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,B)=>{if(Q.pts.length<2){const[ue,qe]=Q.pts[0];return t.jsx("circle",{cx:ue,cy:qe,r:1.4,fill:o},B)}const q=M(Q.pts),V=Q.pts[0][0],re=Q.pts[Q.pts.length-1][0];return t.jsxs("g",{children:[c&&t.jsx("path",{d:`${q} L${re.toFixed(1)},${r} L${V.toFixed(1)},${r} Z`,fill:`url(#g-${g})`}),t.jsx("path",{d:q,fill:"none",stroke:o,strokeWidth:1.4,strokeLinejoin:"round",strokeLinecap:"round"})]},B)}),$&&t.jsx("circle",{cx:$[0],cy:$[1],r:1.8,fill:o})]})}const OS=Object.fromEntries(["waiting","active","completed","failed","delayed","prioritized","paused","waiting-children","unknown"].map(e=>{const n=Ju(e);return[e,{label:n.label,dot:n.dotClass,color:n.fg,text:n.textClass}]}));function F0({state:e,size:n,className:r}){const i=Ju(e);return t.jsx(je,{variant:"custom",size:n,dot:!0,className:F("border",r),style:{color:i.fg,background:i.bg,borderColor:i.border},children:i.label})}function ov({state:e,count:n,hideZero:r,short:i,className:o,title:c,to:d}){if(r&&!n)return null;const h=Ju(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:ft(n)})]}),p=h.muted?void 0:IS(e),v=c??`${ft(n)} ${h.label}`;return d?t.jsx(Re,{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 km="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 }.",AS="From BullMQ's own metrics counters, which are recorded when each job finishes — unaffected by removeOnComplete.",LS="Counted from the completed/failed sorted sets over the trailing window.";function Sm(e){return(e==null?void 0:e.retentionSkewed)===!0}function Cm(e){return e?e.retentionSkewed?km:e.source==="metrics"?AS:LS:""}function D0({rates:e,className:n}){return Sm(e)?t.jsx(_e,{content:km,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 Xu({entry:e,showConnection:n,onHide:r,hidePending:i}){const{connection:o,queue:c}=e,d=c.counts,h=oe.queue(o.id,c.name,go(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(Re,{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(je,{variant:"pro",size:"xs",className:"tracking-wider",title:`BullMQ Pro · ${W(c.groupsCount)} groups`,children:"PRO"}),c.isPaused&&t.jsx(je,{variant:"warning",size:"xs",className:"tracking-wider",children:"PAUSED"}),t.jsx(Re,{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(Zn,{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:O0,"aria-label":`Hide ${c.name} from the lists`,children:t.jsx($o,{className:"size-3.5"})})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[$S.map(m=>t.jsx(ov,{state:m,count:d[m],to:oe.queue(o.id,c.name,m)},m)),zS.map(m=>t.jsx(ov,{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(_m,{rates:c.rates,className:"min-w-0 flex-1"}),c.metrics&&c.metrics.completed.length>1&&t.jsx("span",{className:"shrink-0",style:{color:it.completed.fg},children:t.jsx(Ji,{values:c.metrics.completed,width:56,height:14,title:"Completed per minute"})})]})]})}function U0(e){return e?e%1440===0?`${e/1440}d`:e%60===0?`${e/60}h`:`${e}m`:"1h"}function _m({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=U0(e==null?void 0:e.windowMinutes),d=Sm(e),h=e?`${W(e.completed)} completed · ${W(e.failed)} failed in the last ${c}`:"no rate data",m=e?`${h}
529
-
530
- ${Cm(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}`:`${Cn(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:it.completed.fg}}),t.jsx("span",{className:"h-full flex-1",style:{background:it.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:[Cn(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(D0,{rates:e})]})})]})}function Q0({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(nr,{className:"size-3.5",style:{color:h.color??"var(--fg-subtle)"},"aria-hidden":!0}):h.kind==="connection"?t.jsx(Dy,{className:"size-3.5","aria-hidden":!0}):t.jsx(zy,{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(Xu,{entry:m,showConnection:n,onHide:o,hidePending:c===Ia(m)},`${m.connection.id}/${m.queue.name}`))})]},h.id))})}function Pm({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 FS({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(DS,{section:c,showConnection:n,defaultOpen:r,storagePrefix:i},c.id))})}function DS({section:e,showConnection:n,defaultOpen:r,storagePrefix:i}){const[o,c]=Ku(`${i}.${e.id}`,r),d=bm(e.items),h=e.kind==="folder"?nr:e.kind==="connection"?Dy:zy;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(hs,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}):t.jsx(Fn,{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(Kh,{state:"waiting",value:d.waiting}),t.jsx(Kh,{state:"active",value:d.active}),t.jsx(Kh,{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(Xu,{entry:m,showConnection:n},`${m.connection.id}/${m.queue.name}`))})]})}function Kh({state:e,value:n,dimZero:r}){const i=it[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:ft(n)}),t.jsx("span",{className:"text-[10px] text-fg-subtle",children:i.label})]})}function US({items:e,hidden:n,showConnection:r,filtered:i,rules:o,className:c}){const d=o&&o.unmeasured>0&&t.jsx(_e,{content:"Their Workers keep no BullMQ metrics, so failure rules cannot judge them. Turn on metrics: { maxDataPoints } in the Worker options.",children:t.jsxs(Re,{to:oe.alerts,className:"inline-flex items-center gap-1 text-[11px] text-fg-subtle hover:text-fg",children:[t.jsx(Va,{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(tm,{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(Re,{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(Xu,{entry:h,showConnection:r}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[g.map(p=>t.jsx(VS,{finding:p},p.alertId)),m.map(p=>t.jsx(HS,{reason:p},p))]})]},`${h.connection.id}/${h.queue.name}`))})]})}const ou={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"},QS={failed_rate_above:ou.failing,failed_above:ou.failing,duration_above:"border-state-delayed/40 bg-state-delayed/10 text-state-delayed",waiting_above:ou.waiting};function Wh(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 BS(e){const n=e.windowMinutes?` · ${e.windowMinutes>=60&&e.windowMinutes%60===0?`${e.windowMinutes/60}h`:`${e.windowMinutes}m`}`:"",r=` > ${Wh(e,e.threshold)}`;switch(e.kind){case"failed_rate_above":return`${Wh(e,e.value)} failed${n}${r}`;case"failed_above":return`${W(e.value)} failed${n}${r}`;case"duration_above":return`p${e.percentile??95} ${Wh(e,e.value)}${n}${r}`;case"waiting_above":return`${W(e.value)} waiting${r}`}}function VS({finding:e}){return t.jsx(_e,{content:`Rule "${e.alertName}"${e.notifies?"":" · dashboard only, notifies nobody"}`,children:t.jsxs(Re,{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",QS[e.kind]),children:[!e.notifies&&t.jsx(lN,{className:"size-2.5 opacity-70","aria-hidden":!0}),t.jsx("span",{className:"num",children:BS(e)})]})})}function HS({reason:e}){return t.jsx("span",{className:F("rounded border px-1.5 py-px text-[10px] font-medium",ou[e]),children:kS[e]})}function B0({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(no,{state:"waiting",value:e.waiting}),t.jsx(no,{state:"active",value:e.active}),t.jsx(no,{state:"delayed",value:e.delayed}),t.jsx(no,{state:"failed",value:e.failed,dimZero:!0}),t.jsx(no,{state:"completed",value:e.completed})]}),i&&t.jsx("div",{className:"ml-auto flex items-center gap-2",children:i})]})}function no({state:e,value:n,dimZero:r}){const i=it[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:ft(n)}),t.jsx("span",{className:"text-xs text-fg-subtle",children:i.label})]})}function Em({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(Zn,{}),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 ds({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 pe({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 xe({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 vt({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 KS(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 WS(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=KS(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 ZS({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:WS(n,e,i),[n,e,i,g]),S=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(ds,{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(pe,{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:()=>S(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(aN,{className:"size-3","aria-hidden":!0}):t.jsx(nN,{className:"size-3","aria-hidden":!0}):t.jsx(sN,{className:"size-3 opacity-40","aria-hidden":!0})]}):y.header},y.key)})})}),t.jsxs("tbody",{children:[h!=null&&j.length===0&&t.jsx(vt,{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(xe,{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 Rm=["queue","connection","waiting","active","completed","failed","delayed","prioritized","waiting-children","success","paused","groups","trend","actions"],Mm={key:"failed",dir:"desc"};function Tm({rows:e,showConnection:n,sort:r,onSort:i,message:o,messageClassName:c,onToggle:d,pendingKey:h,onHide:m,hidePendingKey:g}){const p=ln(),v=N.useMemo(()=>{var S,y;const j=[{key:"queue",header:"Queue",sortValue:b=>b.queue.name,render:b=>t.jsx(Re,{to:oe.queue(b.connection.id,b.queue.name,go(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(va("waiting","Waiting",b=>b.queue.counts.waiting),va("active","Active",b=>b.queue.counts.active),va("completed","Completed",b=>b.queue.counts.completed,!0),va("failed","Failed",b=>b.queue.counts.failed),va("delayed","Delayed",b=>b.queue.counts.delayed,!0),va("prioritized","Prioritized",b=>b.queue.counts.prioritized,!0),va("waiting-children","Waiting-children",b=>b.queue.counts["waiting-children"],!0),{key:"success",header:`Success % (${U0((y=(S=e[0])==null?void 0:S.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,C=(k==null?void 0:k.successPct)??null,O=Sm(k);return t.jsxs("span",{className:"inline-flex items-center justify-end gap-1.5",title:Cm(k),children:[t.jsx(_m,{rates:k,compact:!0,className:"w-14"}),t.jsx("span",{className:F("num w-14 text-right",O&&"opacity-50",C==null?"text-fg-subtle":C<90?"font-semibold text-state-failed":"text-fg"),children:C==null?"–":Cn(C)}),t.jsx(D0,{rates:k,className:"w-3"})]})}},{key:"paused",header:"Paused",sortValue:b=>b.queue.isPaused,render:b=>b.queue.isPaused?t.jsx(je,{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(Re,{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(je,{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 C;const k=(C=b.queue.metrics)==null?void 0:C.completed;return k&&k.length?k.reduce((O,z)=>O+z,0):null},render:b=>{var k;return t.jsx("span",{style:{color:it.completed.fg},children:t.jsx(Ji,{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(Zn,{})}),d&&t.jsx(H,{size:"icon-xs",variant:"ghost",loading:h===Ia(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(Du,{}):t.jsx(Ha,{})}),m&&t.jsx(H,{size:"icon-xs",variant:"ghost",loading:g===Ia(b),title:O0,"aria-label":`Hide ${b.queue.name} from the lists`,onClick:()=>m(b),children:t.jsx($o,{})})]})}),j},[n,d,h,m,g,p,e]);return t.jsx(ZS,{columns:v,rows:e,rowKey:Ia,sort:r,onSort:i,onRowActivate:j=>p(oe.queue(j.connection.id,j.queue.name,go(j.queue.counts))),message:o,messageClassName:c,className:"min-w-[1100px]"})}function va(e,n,r,i=!1){var d;const o=(d=it[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(Re,{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 GS=4;function JS({className:e}){const{health:n,paused:r,isLoading:i,error:o}=Zu(),[c,d]=Ku("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>GS;return t.jsxs("section",{"aria-label":"Server health",className:F("space-y-2",e),children:[h.length>0&&t.jsx(YS,{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(qo,{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(XS,{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(cv,{health:p,paused:r},p.connectionId))}),r&&t.jsx(_e,{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(Ha,{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(Re,{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(cv,{health:p,paused:r,className:"min-w-0"},p.connectionId))})]})]})}function XS({health:e,paused:n,expanded:r,onToggle:i}){const o=vm(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(hs,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}):t.jsx(Fn,{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(_e,{content:h.ok?h.warnings.map(m=>m.message).join(" · "):`Unreachable: ${h.error??"unknown error"}`,children:t.jsx(Re,{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(Re,{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(os,{label:"cmd/s",value:o.commandsPerSec==null?"–":Gr(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(os,{label:"cpu",value:Ki(o.cpuCores),tip:`Busiest single Redis — ${Lo(o.cpuCores)}`,tone:gm(o.cpuCores)}),o.memoryPct!=null&&t.jsx(os,{label:"mem",value:Cn(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 cv({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=eC(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(_e,{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(Re,{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(os,{label:"db",value:o?Kt(o.databaseSizeBytes):"–",tip:"pg_database_size of the database BullMQ lives in"}),t.jsx(os,{label:"tx/s",value:e.commandsPerSec==null?"–":Gr(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(os,{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(os,{label:"lat",value:o?yo(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(os,{label:"mem",value:i?`${i.usedMemoryHuman||Kt(i.usedMemoryBytes)}${e.memoryUsedPct!=null?` · ${Cn(e.memoryUsedPct)}`:""}`:"–",tip:e.memoryUsedPct!=null&&(i!=null&&i.maxMemoryBytes)?`${Cn(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(os,{label:"cpu",value:Ki(e.cpuCores),tip:Lo(e.cpuCores),tone:gm(e.cpuCores)}),t.jsx(os,{label:"cmd/s",value:e.commandsPerSec==null?"–":Gr(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(os,{label:"lat",value:i?yo(i.latencyMs):"–",tip:"Round trip of the INFO command itself"})]})]})}function os({label:e,value:n,tip:r,tone:i}){return t.jsx(_e,{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 YS({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(Ay,{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(Re,{to:oe.health,className:"shrink-0 underline underline-offset-2 hover:no-underline",children:"Monitor"})]})}function eC(e){let n=null;for(const r of e){if(r.level==="critical")return"critical";n="warn"}return n}const tC=2;function nC(){var ut,Le;const{isAdmin:e,isOperator:n}=xt(),{has:r}=bt(),{connections:i,entries:o,isLoading:c}=n2(),d=C0(),h=r("alerts"),m=S2(h),g=r("folders"),p=Xr(g),v=ln(),{sort:j,setSort:S,filter:y,setFilter:b}=Nm("overview",Mm,Rm),k=N.useMemo(()=>o.flatMap(K=>{var me;return(((me=K.result.data)==null?void 0:me.queues)??[]).map(ne=>({connection:K.connection,queue:ne}))}),[o]),C=N.useMemo(()=>k.filter(K=>wm(K,y)),[k,y]),O=N.useMemo(()=>bm(k),[k]),z=c||o.some(K=>K.result.isLoading),E=N.useMemo(()=>o.reduce((K,me)=>{var ne;return K+(((ne=me.result.data)==null?void 0:ne.hiddenCount)??0)},0),[o]),M=N.useMemo(()=>o.filter(K=>{var me;return((me=K.result.data)==null?void 0:me.discovery)&&!K.result.data.discovery.complete}).map(K=>{var me,ne;return{name:K.connection.name,keys:((ne=(me=K.result.data)==null?void 0:me.discovery)==null?void 0:ne.totalKeys)??null}}),[o]),T=N.useMemo(()=>{const K=o.filter(me=>{var ne;return(((ne=me.result.data)==null?void 0:ne.hiddenCount)??0)>0});return K.length===1?K[0].connection.id:null},[o]),$=yS(),Q=n?K=>void $.hide(K.connection.id,K.queue.name):void 0,B=((ut=i.data)==null?void 0:ut.length)??0,q=B>tC,V=h?((Le=m.data)==null?void 0:Le.findings)??[]:void 0,re=N.useMemo(()=>RS(C,d.data,8,V),[C,d.data,V]),ue=N.useMemo(()=>{if(!h||!m.data)return;const K=new Set(C.map(ne=>`${ne.connection.id}\0${ne.queue.name}`)),me=m.data.unmeasured.filter(ne=>K.has(`${ne.connectionId}\0${ne.queueName}`)).length;return{rules:m.data.rules,unmeasured:me}},[h,m.data,C]),qe=N.useMemo(()=>Af(re.rest,g?p.data:void 0),[re.rest,g,p.data]),Ke=N.useMemo(()=>Af(C,g?p.data:void 0),[C,g,p.data]);return!c&&B===0?t.jsx(jt,{children:t.jsx(an,{icon:t.jsx(Ba,{}),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(Gn,{}),onClick:()=>v(`${oe.settings("connections")}?new=1`),children:"Add connection"})})}):t.jsxs(jt,{wide:!0,children:[t.jsx(ms,{title:"Overview",description:"Every connection and queue at a glance. Refreshes every 5 seconds."}),t.jsx(JS,{className:"mb-3"}),M.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 ",M.map(K=>`${K.name}${K.keys?` (${W(K.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(B0,{totals:O,hiddenCount:E,onRevealHidden:T?()=>v(`${oe.connection(T)}#hidden-queues`):void 0,children:[t.jsx(Em,{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:[C.length," of ",k.length]})]}),z&&k.length===0?t.jsx(Pm,{}):C.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(US,{items:re.attention,hidden:re.hidden,showConnection:q,filtered:!!y,rules:ue}),q?t.jsx(FS,{sections:qe,showConnection:!0,defaultOpen:!1}):t.jsx(Q0,{sections:Ke,showConnection:!0,onHide:Q})]}),t.jsx("div",{className:"card overflow-hidden",children:t.jsx(Tm,{rows:C,showConnection:!0,sort:j,onSort:S,onHide:Q,message:z&&k.length===0?"Loading queues…":y?"No queue matches the filter":"No queues discovered yet"})})]})]})}function sC({connectionId:e,hidden:n,canUnhide:r,onUnhide:i,pendingQueue:o,className:c,forceOpen:d}){const[h,m]=Ku(`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(hs,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}):t.jsx(Fn,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}),t.jsx($o,{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(Re,{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(Zt,{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($y,{}),loading:o===p.queueName,onClick:()=>i(p.queueName),title:"Put this queue back in the lists",children:"Show again"})]},p.queueName))})]})}function V0({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(Pn,{open:e!==null,onClose:n,size:"sm",title:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ha,{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(Zi,{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 rC(){var me,ne,A,Z,Ae,Fe;const{connectionId:e=""}=Ln(),{isOperator:n,isAdmin:r}=xt(),{has:i}=bt(),o=fs(),c=(me=o.data)==null?void 0:me.find(Ce=>Ce.id===e),d=t2(e),h=r2(e),m=u2(e),g=S0(e),p=ym(e),v=N.useRef(null),[j,S]=N.useState(!1),[y,b]=N.useState(null),k=i("folders"),C=Xr(k),O=ln(),{sort:z,setSort:E,filter:M,setFilter:T}=Nm(`connection.${e}`,Mm,Rm),$=N.useMemo(()=>{var Ce;return c?(((Ce=d.data)==null?void 0:Ce.queues)??[]).map(De=>({connection:c,queue:De})):[]},[c,d.data]),Q=N.useMemo(()=>$.filter(Ce=>wm(Ce,M)),[$,M]),B=N.useMemo(()=>Af(Q,k?C.data:void 0),[Q,k,C.data]),q=N.useMemo(()=>bm($),[$]);if(o.isSuccess&&!c)return t.jsx(jt,{children:t.jsx(an,{icon:t.jsx(Ba,{}),title:"Connection not found",description:"It may have been removed.",action:t.jsx(Re,{to:"/",className:"text-accent hover:underline",children:"Back to overview"})})});const V=(ne=d.data)==null?void 0:ne.info,re=((A=d.data)==null?void 0:A.status)??(c==null?void 0:c.status),ue=n?Ce=>{if(!Ce.queue.isPaused){b(Ce);return}m.mutate({queue:Ce.queue.name,action:"resume"},{onSuccess:()=>Y.success(`${Ce.queue.name} resumed`),onError:De=>Y.error(be(De))})}:void 0,qe=Ce=>{if(!y)return;const De=y.queue.name;m.mutate({queue:De,action:"pause",...Ce?{reason:Ce}:{}},{onSuccess:()=>{b(null),Y.success(`${De} paused`)},onError:Qe=>Y.error(be(Qe))})},Ke=m.isPending&&m.variables?`${e}/${m.variables.queue}`:null,ut=n?Ce=>p.hide(Ce.queue.name):void 0,Le=p.pendingQueue?`${e}/${p.pendingQueue}`:null,K=()=>{S(!0),requestAnimationFrame(()=>{var Ce;return(Ce=v.current)==null?void 0:Ce.scrollIntoView({behavior:"smooth",block:"center"})})};return t.jsxs(jt,{wide:!0,children:[t.jsx(ms,{title:t.jsxs("span",{className:"flex items-center gap-2",children:[(c==null?void 0:c.name)??e,t.jsx(Wu,{status:re,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(nm,{}),loading:h.isPending,onClick:()=>h.mutate(void 0,{onSuccess:()=>Y.success("Queue list refreshed"),onError:Ce=>Y.error(be(Ce))}),title:"Force queue rediscovery (bypasses the 30 s cache)",children:"Rediscover"}),r&&t.jsx(H,{size:"sm",variant:"ghost",leftIcon:t.jsx(Uy,{}),onClick:()=>O(`${oe.settings("connections")}?edit=${encodeURIComponent(e)}`),children:"Edit"})]})}),re&&!re.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: ",re.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:[(V==null?void 0:V.backend)==="postgres"?t.jsxs(t.Fragment,{children:[t.jsx(dn,{label:"Postgres",value:V.serverVersion}),t.jsx(dn,{label:"Schema",value:V.schema}),t.jsx(dn,{label:"Uptime",value:vo(V.uptimeSeconds)}),t.jsx(dn,{label:"Connections",value:`${W(V.connectedClients)} / ${W(V.maxConnections)}`}),t.jsx(dn,{label:"Database",value:Kt(V.databaseSizeBytes)}),t.jsx(dn,{label:"Jobs table",value:Kt(V.jobTableBytes)}),t.jsx(dn,{label:"Events table",value:Kt(V.eventTableBytes)})]}):t.jsxs(t.Fragment,{children:[t.jsx(dn,{label:"Redis",value:V==null?void 0:V.redisVersion}),t.jsx(dn,{label:"Mode",value:V==null?void 0:V.mode}),t.jsx(dn,{label:"Uptime",value:V?vo(V.uptimeSeconds):void 0}),t.jsx(dn,{label:"Clients",value:V?W(V.connectedClients):void 0}),t.jsx(dn,{label:"Memory",value:V?`${Kt(V.usedMemoryBytes)}${V.maxMemoryBytes?` / ${Kt(V.maxMemoryBytes)}`:""}`:void 0}),t.jsx(dn,{label:"Keys",value:V?V.totalKeys!=null?W(V.totalKeys):"–":void 0}),t.jsx(dn,{label:"Ops / s",value:V?V.opsPerSec!=null?W(V.opsPerSec):"–":void 0})]}),t.jsx(dn,{label:"Latency",value:re?re.latencyMs!=null?`${re.latencyMs} ms`:"–":void 0})]}),t.jsxs("section",{className:"space-y-3","aria-label":"Queues",children:[t.jsxs(B0,{totals:q,title:"Queues",hiddenCount:((Z=d.data)==null?void 0:Z.hiddenCount)??((Ae=g.data)==null?void 0:Ae.length)??0,onRevealHidden:K,children:[t.jsx(Em,{value:M,onChange:T,"aria-label":"Filter queues"}),t.jsxs("span",{className:"num whitespace-nowrap text-xs text-fg-subtle",children:[Q.length," of ",$.length]})]}),d.isLoading?t.jsx(Pm,{}):Q.length>0?t.jsx(Q0,{sections:B,hideSingleHeader:!0,onHide:ut,hidePendingKey:Le}):null,t.jsx("div",{className:"card overflow-hidden",children:t.jsx(Tm,{rows:Q,sort:z,onSort:E,onToggle:ue,pendingKey:Ke,onHide:ut,hidePendingKey:Le,message:d.isLoading?t.jsx(Dt,{label:"Loading queues…"}):d.isError&&!d.data?be(d.error):M?"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(sC,{connectionId:e,hidden:g.data??[],canUnhide:n,onUnhide:Ce=>p.unhide(Ce),pendingQueue:p.pendingQueue,forceOpen:j})})]}),t.jsx(V0,{queue:(y==null?void 0:y.queue.name)??null,onClose:()=>b(null),onConfirm:qe,loading:m.isPending&&((Fe=m.variables)==null?void 0:Fe.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 qm({reason:e="Not available yet"}){return t.jsx(_e,{content:e,children:t.jsx("span",{className:"cursor-help text-fg-subtle","aria-label":e,children:"—"})})}function Wn({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:S,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(_e,{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",S?"text-xl":"text-[15px]"),children:i?t.jsx(qm,{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(aC,{pct:g,label:p,tone:v}),d&&t.jsx(Ji,{values:d,width:S?260:112,height:S?44:22,className:"mt-1.5 w-full",stroke:h,title:m??e,dimmed:j})]})}function aC({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 H0({warning:e}){const n=e.level==="critical",r=n?Ay: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 sn({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(_e,{content:i,block:!0,children:o}):o}const iC="No rate yet — needs two samples. Also resets when Postgres restarts. This is not zero.";function lC({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=K0(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(_e,{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(je,{variant:"outline",size:"xs",mono:!0,children:["Postgres ",d.serverVersion]}),t.jsx(je,{variant:"neutral",size:"xs",mono:!0,children:d.schema}),t.jsx(_e,{content:"Postgres server uptime",children:t.jsxs("span",{className:"num cursor-help text-[11px] text-fg-subtle",children:["up ",vo(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(qm,{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,S)=>t.jsx(H0,{warning:j},`${j.code}-${S}`))}),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(Wn,{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(Bu,{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:er(g,"connectedClients"),sparkColor:"var(--info)",sparkTitle:"Connections"}),t.jsx(Wn,{label:"Transactions/sec",big:n,dimmed:h,isUnknown:e.commandsPerSec==null,unknownReason:iC,value:Gr(e.commandsPerSec),secondary:e.commandsPerSec==null?"measuring…":void 0,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(By,{className:"size-3","aria-hidden":!0})," xact_commit + xact_rollback between samples"]}),spark:er(g,"commandsPerSec"),sparkColor:"var(--accent)",sparkTitle:"Transactions per second"}),t.jsx(Wn,{label:"Latency",big:n,dimmed:h,isUnknown:!d,unknownReason:"No sample",value:d?yo(d.latencyMs):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(uo,{className:"size-3","aria-hidden":!0})," round trip of the health query itself"]}),spark:er(g,"latencyMs"),sparkColor:"var(--warning)",sparkTitle:"Latency"}),t.jsx(Wn,{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(Ba,{className:"size-3","aria-hidden":!0})," pg_database_size, the whole database"]}),spark:er(g,"memoryBytes"),sparkColor:"var(--violet)",sparkTitle:"Database size"}),t.jsx(Wn,{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(Og,{className:"size-3","aria-hidden":!0})," BullMQ's job table, with its indexes"]})}),t.jsx(Wn,{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(Og,{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(Fn,{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(sn,{label:"Cache hit rate",value:(d==null?void 0:d.cacheHitRatePct)!=null?Cn(d.cacheHitRatePct):"—",hint:"blks_hit / (blks_hit + blks_read), cumulative"}),t.jsx(sn,{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(sn,{label:"Transactions",value:d?ft(d.totalTransactions):"—",hint:"xact_commit + xact_rollback, cumulative"}),t.jsx(sn,{label:"History points",value:W(g.length),tone:"muted",hint:"Kept in the server's memory, not persisted"})]})]})]})}const uv="No rate yet — needs two INFO samples. Also resets when Redis restarts. This is not zero.";function K0(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 er(e,n){return e.map(r=>{const i=r[n];return typeof i=="number"&&Number.isFinite(i)?i:null})}function oC(e){return e.health.kind==="postgres"?t.jsx(lC,{...e}):t.jsx(cC,{...e})}function cC({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=K0(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(_e,{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(je,{variant:"outline",size:"xs",mono:!0,children:d.redisVersion}),t.jsx(je,{variant:"neutral",size:"xs",children:d.mode}),t.jsx(_e,{content:"Redis process uptime",children:t.jsxs("span",{className:"num cursor-help text-[11px] text-fg-subtle",children:["up ",vo(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(qm,{reason:"No successful sample yet"}):t.jsx(_e,{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(H0,{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(Wn,{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(yN,{className:"size-3","aria-hidden":!0})," used_memory"]}),meterPct:e.memoryUsedPct,meterLabel:e.memoryUsedPct!=null&&(d!=null&&d.maxMemoryBytes)?`${Cn(e.memoryUsedPct)} of ${Kt(d.maxMemoryBytes)}`:"no maxmemory set",meterTone:e.memoryUsedPct==null?"ok":e.memoryUsedPct>=90?"danger":e.memoryUsedPct>=75?"warn":"ok",spark:er(g,"memoryBytes"),sparkColor:"var(--violet)",sparkTitle:"Used memory"}),t.jsx(Wn,{label:"CPU",big:n,dimmed:p,isUnknown:e.cpuCores==null,unknownReason:uv,value:Ki(e.cpuCores),secondary:e.cpuCores==null?"measuring…":t.jsx(_e,{content:Lo(e.cpuCores),children:t.jsx("span",{className:"num cursor-help border-b border-dotted border-border-strong",children:b0(e.cpuCores)})}),hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(fN,{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":rS(e.cpuCores),spark:er(g,"cpuCores"),sparkColor:"var(--teal)",sparkTitle:"CPU (share of one core)"}),t.jsx(Wn,{label:"Commands/sec",big:n,dimmed:p,isUnknown:e.commandsPerSec==null,unknownReason:uv,value:Gr(e.commandsPerSec),secondary:e.commandsPerSec==null?"measuring…":void 0,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(By,{className:"size-3","aria-hidden":!0})," derived from total_commands_processed between samples"]}),spark:er(g,"commandsPerSec"),sparkColor:"var(--accent)",sparkTitle:"Commands per second"}),t.jsx(Wn,{label:"Latency",big:n,dimmed:p,isUnknown:!d,unknownReason:"No sample",value:d?yo(d.latencyMs):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(uo,{className:"size-3","aria-hidden":!0})," round trip of the INFO command itself"]}),spark:er(g,"latencyMs"),sparkColor:"var(--warning)",sparkTitle:"INFO latency"}),t.jsx(Wn,{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(Bu,{className:"size-3","aria-hidden":!0})," connected_clients"]}),secondary:(d==null?void 0:d.blockedClients)!=null?t.jsx(_e,{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:er(g,"connectedClients"),sparkColor:"var(--info)",sparkTitle:"Connected clients"}),t.jsx(Wn,{label:"Keys",big:n,dimmed:p,isUnknown:!d||d.totalKeys==null,unknownReason:"Redis did not report a keyspace (empty db, or cluster)",value:d?ft(d.totalKeys):null,hint:t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(wN,{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(Fn,{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(sn,{label:"RSS",value:d?Kt(d.usedMemoryRssBytes):"—",hint:"used_memory_rss — what the OS actually holds for the Redis process"}),t.jsx(sn,{label:"Peak memory",value:d?Kt(d.usedMemoryPeakBytes):"—",hint:"used_memory_peak"}),t.jsx(sn,{label:"Fragmentation",value:d?Jk(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(sn,{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(sn,{label:"Hit rate",value:(d==null?void 0:d.keyspaceHitRatePct)!=null?Cn(d.keyspaceHitRatePct):"—",hint:"keyspace_hits / (hits + misses), cumulative since start"}),t.jsx(sn,{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(sn,{label:"Expired keys",value:d?W(d.expiredKeys):"—",tone:"muted",hint:"expired_keys, cumulative"}),t.jsx(sn,{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(sn,{label:"Replicas",value:(d==null?void 0:d.connectedReplicas)!=null?W(d.connectedReplicas):"—",hint:"connected_slaves"}),t.jsx(sn,{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(sn,{label:"Commands processed",value:d?ft(d.totalCommandsProcessed):"—",hint:"total_commands_processed, cumulative since start"}),t.jsx(sn,{label:"History points",value:W(g.length),tone:"muted",hint:"Kept in the server's memory, not persisted"})]})]})]})}const uC="redis-health";function dC({big:e,className:n,headless:r}){const{health:i,paused:o,setPaused:c,isLoading:d,error:h}=Zu(),m=vm(i);return t.jsxs("section",{id:uC,"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(qo,{className:"size-4 text-fg-subtle","aria-hidden":!0}),"Server health"]}),m.critical>0&&t.jsxs(je,{variant:"danger",size:"xs",children:[m.critical," critical"]}),m.warn>0&&t.jsxs(je,{variant:"warning",size:"xs",children:[m.warn," warning",m.warn===1?"":"s"]}),m.critical===0&&m.warn===0&&i.length>0&&!o&&t.jsx(je,{variant:"success",size:"xs",dot:!0,children:"all clear"}),t.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[!e&&t.jsxs(Re,{to:oe.health,className:"inline-flex items-center gap-1 text-[11px] text-accent hover:underline",children:["Open monitor",t.jsx(Hr,{className:"size-3","aria-hidden":!0})]}),t.jsx(dv,{paused:o,onChange:c})]})]}),r&&t.jsx("div",{className:"mb-2 flex items-center justify-end",children:t.jsx(dv,{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(Ha,{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(an,{compact:!0,icon:t.jsx(EN,{}),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(oC,{health:g,big:e,paused:o},g.connectionId))}),t.jsx(hC,{})]})}function dv({paused:e,onChange:n}){return t.jsx(_e,{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(Du,{}):t.jsx(Ha,{}),"aria-pressed":e,onClick:()=>n(!e),children:e?"Resume monitoring":"Pause monitoring"})})}function hC(){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 fC(){const{health:e,paused:n,lastSampleAt:r}=Zu();return t.jsxs(jt,{wide:!0,children:[t.jsx(ms,{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(dC,{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(mC,{health:i},i.connectionId))]})]})}const Zh=40;function mC({health:e}){const[n,r]=N.useState(!1),i=N.useMemo(()=>[...e.history??[]].reverse(),[e.history]),o=n?i:i.slice(0,Zh);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(je,{variant:"neutral",size:"xs",children:[W(i.length)," samples"]}),i.length>Zh&&t.jsx("button",{type:"button",className:"ml-auto text-[11px] text-accent hover:underline",onClick:()=>r(c=>!c),children:n?`Show latest ${Zh}`:`Show all ${i.length}`})]}),t.jsxs(ds,{dense:!0,maxHeight:n?420:void 0,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(pe,{children:"Time"}),t.jsx(pe,{align:"right",children:"Latency"}),t.jsx(pe,{align:"right",children:"Memory / DB size"}),t.jsx(pe,{align:"right",children:"Cmd or tx /s"}),t.jsx(pe,{align:"right",children:"CPU"}),t.jsx(pe,{align:"right",children:"Clients"})]})}),t.jsx("tbody",{children:o.length===0?t.jsxs(vt,{colSpan:6,children:["No samples yet",e.ok?"":" — the server is unreachable"]}):o.map(c=>t.jsxs("tr",{children:[t.jsx(xe,{num:!0,mono:!0,children:xn(c.t)}),t.jsx(xe,{align:"right",num:!0,children:yo(c.latencyMs)}),t.jsx(xe,{align:"right",num:!0,children:Kt(c.memoryBytes)}),t.jsx(xe,{align:"right",num:!0,muted:c.commandsPerSec==null,children:c.commandsPerSec==null?t.jsx(hv,{}):Gr(c.commandsPerSec,"")}),t.jsx(xe,{align:"right",num:!0,muted:c.cpuCores==null,children:c.cpuCores==null?t.jsx(hv,{}):t.jsx(_e,{content:Lo(c.cpuCores),children:t.jsx("span",{className:"cursor-help",children:Ki(c.cpuCores)})})}),t.jsx(xe,{align:"right",num:!0,children:W(c.connectedClients)})]},c.t))})]})]})}function hv(){return t.jsx(_e,{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 W0(e,n){const r=new Set(e);return r.has(n)?r.delete(n):r.add(n),r}function pC(e,n,r,i){const o=r?n.indexOf(r):-1,c=n.indexOf(i);if(o<0||c<0)return W0(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 xC(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 gC(e,n){return n.reduce((r,i)=>e.has(i)?r+1:r,0)}function vC(e){const[n,r]=N.useState(()=>new Set),i=N.useRef(null),o=N.useCallback(S=>n.has(S),[n]),c=N.useCallback(S=>{i.current=S,r(y=>W0(y,S))},[]),d=N.useCallback(S=>{const y=i.current;i.current=S,r(b=>pC(b,e,y,S))},[e]),h=N.useMemo(()=>gC(n,e),[e,n]),m=e.length>0&&h===e.length,g=N.useCallback(()=>{r(S=>xC(S,e)),i.current=null},[e]),p=N.useCallback(()=>{r(new Set),i.current=null},[]),v=N.useCallback(S=>{r(y=>{const b=new Set(y);for(const k of S)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 Z0(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 yC={retry:"Retry",promote:"Promote",remove:"Remove"};function fv({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??Z0(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(Uu,{}):p==="promote"?t.jsx(Xf,{}):t.jsx(Jn,{}),loading:c===p,disabled:!!c,onClick:()=>o(p),children:yC[p]},p)),t.jsx(H,{size:"sm",variant:"ghost",leftIcon:t.jsx(gn,{}),onClick:e.clear,disabled:!!c,children:"Clear"})]})}function mv({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(hs,{className:"size-3"}):t.jsx(Fn,{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 Im({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 S=p[j];if(S){r(S.value,S);const b=(y=h.current)==null?void 0:y.querySelector(`[data-value="${S.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:ft(g.count)}),g.locked&&t.jsx(ho,{className:"size-3 text-pro","aria-label":"Pro feature"})]},g.value)})})}function Lf({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:S,selection:y}){const b=ln(),k=8+(g?1:0)+(p?1:0)+(y?1:0),C=(r==null?void 0:r.length)??0,O=C>0&&r.every(z=>z.state==="delayed");return t.jsxs(ds,{dense:S,className:"min-w-[960px]",children:[t.jsx("thead",{children:t.jsxs("tr",{children:[y&&t.jsx(pe,{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:C===0,onChange:y.toggleAllVisible})}),t.jsx(pe,{className:"w-28",children:"ID"}),t.jsx(pe,{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(pe,{children:"State"}),p&&t.jsx(pe,{children:"Group"}),t.jsx(pe,{className:"w-24",children:"Attempts"}),t.jsx(pe,{className:"w-28",children:"Created"}),t.jsx(pe,{className:"w-28",children:O?"Runs at":"Finished"}),t.jsx(pe,{className:"w-24",align:"right",children:"Duration"}),t.jsx(pe,{children:"Data"}),t.jsx(pe,{className:"w-28",align:"right",children:t.jsx("span",{className:"sr-only",children:"Actions"})})]})}),t.jsxs("tbody",{children:[!!o&&!r&&t.jsx(vt,{colSpan:k,className:"text-danger",children:"Could not load jobs"}),i&&!r&&t.jsx(vt,{colSpan:k,children:t.jsx(Dt,{label:"Loading jobs…"})}),r&&r.length===0&&t.jsx(vt,{colSpan:k,children:c}),r==null?void 0:r.map(z=>t.jsx(jC,{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 jC({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,S=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(xe,{"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:C=>{C.stopPropagation(),C.shiftKey?p.toggleRange(e.id):p.toggle(e.id)}})}),t.jsx(xe,{mono:!0,children:t.jsx(Re,{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(xe,{children:t.jsx("span",{className:"block max-w-56 truncate font-medium",title:e.name,children:t.jsx(ja,{text:e.name,needle:g})})}),d&&t.jsx(xe,{children:t.jsx(F0,{state:e.state,size:"xs"})}),h&&t.jsx(xe,{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(Re,{to:oe.group(n,r,e.groupId),className:"text-pro hover:underline",title:"Open group",children:e.groupId}):"–"}),t.jsxs(xe,{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(je,{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(rm,{className:"size-2.5","aria-hidden":!0}),e.stalledCounter]}),e.priority>0&&t.jsxs(je,{variant:"violet",size:"xs",className:"ml-1.5",title:"priority",children:["p",e.priority]})]}),t.jsx(xe,{muted:!0,children:t.jsx(Zt,{value:e.timestamp})}),t.jsx(xe,{muted:!0,children:e.state==="delayed"&&e.delayedUntil?t.jsx(_e,{content:t.jsxs(t.Fragment,{children:["runs at ",xn(e.delayedUntil)]}),side:"left",children:t.jsx("span",{className:"text-state-delayed",children:t.jsx(Zt,{value:e.delayedUntil})})}):t.jsx(Zt,{value:e.finishedOn,emptyText:e.processedOn?"running…":"–"})}),t.jsx(xe,{num:!0,align:"right",muted:!0,children:t.jsx(_e,{content:t.jsxs(t.Fragment,{children:[S!=null&&t.jsxs(t.Fragment,{children:["wait ",On(S)," · "]}),e.processedOn&&t.jsxs(t.Fragment,{children:["started ",xn(e.processedOn)]})]}),side:"left",children:t.jsx("span",{children:j!=null?On(j):e.processedOn?On(Date.now()-e.processedOn):"–"})})}),t.jsx(xe,{className:"max-w-md",children:t.jsx(bC,{job:e,highlight:g})}),t.jsx(xe,{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(Uu,{})}),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(Xf,{})}),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(Jn,{})}),t.jsx(H,{size:"icon-xs",variant:"ghost",title:"Open","aria-label":"Open job",onClick:v,children:t.jsx(Hr,{})})]})})]})}function ja({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 bC({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(ja,{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(ja,{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(ja,{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(ja,{text:o,needle:n}):t.jsx("span",{className:"text-fg-subtle",children:"{}"})});const c=e.dataTruncated?null:Gk(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(ja,{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(ja,{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 wC=[25,50,100,200];function Yu({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(ct,{"aria-label":"Page size",className:"!h-7 !w-auto !py-0 text-xs",value:String(n),onChange:p=>o(Number(p.target.value)),options:wC.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(cN,{})}),t.jsx(H,{size:"icon-sm",variant:"ghost","aria-label":"Previous page",disabled:e<=1,onClick:()=>i(e-1),children:t.jsx(xu,{})}),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(Fn,{})}),t.jsx(H,{size:"icon-sm",variant:"ghost","aria-label":"Last page",disabled:e>=h,onClick:()=>i(h),children:t.jsx(uN,{})})]})]})}function Wt({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(Pn,{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:S=>v(S.target.value),onKeyDown:S=>{S.key==="Enter"&&j&&!m&&r()},autoComplete:"off",spellCheck:!1})]})}async function NC(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 wo({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 NC(typeof e=="function"?e():e)&&g(!0)},...h,children:[m?t.jsx(Jr,{className:"text-success"}):o??t.jsx(Iy,{}),i&&(m?r:n)]})}function $m({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(wo,{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 G0="new Worker(name, fn, { metrics: { maxDataPoints: MetricsTime.ONE_WEEK } })";function J0(e){return e.isLoading?"loading":e.isError||!e.data?"unknown":e.data.metricsEnabled?"on":"off"}function kC({connectionId:e,queueName:n}){const r=um(e||void 0,n||void 0,{enabled:!!e&&!!n}),i=J0(r);return i==="loading"||i==="on"?null:t.jsx(X0,{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 SC({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(CC,{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(X0,{title:`Folder "${e.name}" — ${g.join(" · ")}`})]})}function CC({id:e,queue:n,onState:r}){const i=um(n.connectionId,n.queueName),o=J0(i);return N.useEffect(()=>r(e,o),[e,o,r]),null}function X0({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($m,{code:G0,language:"ts",wrap:!0,maxHeight:80})]})}function _C({measurement:e}){var r;if(!e)return t.jsx(_e,{content:"Not evaluated yet — the server evaluates alerts every few seconds.",children:t.jsx(je,{variant:"neutral",children:"pending"})});if(e.state==="no_metrics")return t.jsx(_e,{content:`This queue collects no BullMQ metrics, so the alert cannot measure and will not fire. Enable it with ${G0}`,children:t.jsxs(je,{variant:"warning",dot:!0,children:[t.jsx(Xn,{className:"size-3"})," can't measure"]})});if(e.state==="warming_up")return t.jsx(_e,{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(je,{variant:"info",dot:!0,children:[t.jsx(qy,{className:"size-3"})," waiting for data"]})});const n=((r=e.queuesWithoutMetrics)==null?void 0:r.length)??0;return n>0?t.jsx(_e,{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(je,{variant:"warning",dot:!0,children:"partial"})}):t.jsx(_e,{content:e.source==="metrics"?"Measured from BullMQ metrics counters.":"Measured from live queue counts.",children:t.jsx(je,{variant:"success",dot:!0,children:"ok"})})}const PC={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 EC(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 RC(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 MC(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 TC(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:MC(c.headersText)});return{name:e.name.trim(),enabled:e.enabled,scope:i,condition:r,channels:o,cooldownMinutes:n(e.cooldownMinutes)}}function ed({open:e,onClose:n,alert:r,initialScope:i}){var O,z,E,M;const o=fs(),c=_2(),d=E0(),h=((z=(O=o.data)==null?void 0:O[0])==null?void 0:z.id)??"",[m,g]=N.useState(()=>r?RC(r):EC(h,i)),[p,v]=N.useState({}),j=s2(m.connectionId||void 0,{enabled:m.scopeType==="queue"}),S=Xr(),y=(T,$)=>g(Q=>({...Q,[T]:$})),b=(T,$)=>g(Q=>({...Q,channels:Q.channels.map((B,q)=>q===T?{...B,...$}:B)})),k=c.isPending||d.isPending,C=()=>{let T;try{T=TC(m)}catch(B){v({channels:B.message});return}const $=d0.safeParse(T);if(!$.success){const B={};for(const q of $.error.issues){const V=q.path[0]==="condition"||q.path[0]==="scope"?String(q.path[1]??q.path[0]):q.path[0]==="channels"?"channels":String(q.path[0]);B[V]=q.path[0]==="channels"?`Channel ${Number(q.path[1])+1}: ${q.message}`:q.message}v(B);return}v({});const Q=()=>{Y.success(r?"Alert updated":"Alert created"),n()};r?d.mutate({id:r.id,input:$.data},{onSuccess:Q,onError:B=>Y.error(be(B))}):c.mutate($.data,{onSuccess:Q,onError:B=>Y.error(be(B))})};return t.jsx(Pn,{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:C,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:T=>y("name",T.target.value),error:p.name,autoFocus:!0,placeholder:"payments: failures spiking"}),t.jsx(Gu,{label:"Enabled",className:"justify-end",children:t.jsx(jm,{checked:m.enabled,onChange:T=>y("enabled",T.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(ct,{label:"Watch",value:m.scopeType,onChange:T=>y("scopeType",T.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(ct,{label:"Connection",value:m.connectionId,onChange:T=>y("connectionId",T.target.value),error:p.connectionId,wrapperClassName:"sm:col-span-2",options:(o.data??[]).map(T=>({value:T.id,label:T.name}))}):m.scopeType==="queue"?t.jsxs(t.Fragment,{children:[t.jsx(ct,{label:"Connection",value:m.connectionId,onChange:T=>g($=>({...$,connectionId:T.target.value,queueName:""})),error:p.connectionId,options:(o.data??[]).map(T=>({value:T.id,label:T.name}))}),t.jsx(ct,{label:"Queue",value:m.queueName,onChange:T=>y("queueName",T.target.value),error:p.queueName,options:[{value:"",label:j.isLoading?"Loading…":"Pick a queue",disabled:!0},...(j.data??[]).map(T=>({value:T.name,label:T.name}))]})]}):t.jsx(ct,{label:"Folder",value:m.folderId,onChange:T=>y("folderId",T.target.value),error:p.folderId,wrapperClassName:"sm:col-span-2",options:[{value:"",label:S.isLoading?"Loading…":(E=S.data)!=null&&E.length?"Pick a folder":"No folders yet",disabled:!0},...(S.data??[]).map(T=>{var $,Q;return{value:T.id,label:T.parentId?`${((Q=($=S.data)==null?void 0:$.find(B=>B.id===T.parentId))==null?void 0:Q.name)??"?"} / ${T.name}`:T.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(ct,{label:"Kind",value:m.kind,onChange:T=>y("kind",T.target.value),options:Sk.map(T=>({value:T,label:PC[T]}))}),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:T=>y("threshold",T.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:T=>y("percent",T.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:T=>y("seconds",T.target.value),error:p.seconds}),t.jsx(ct,{label:"Percentile",value:m.percentile,onChange:T=>y("percentile",T.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:T=>y("windowMinutes",T.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:T=>y("minSample",T.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."]}),_k(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(kC,{connectionId:m.connectionId,queueName:m.queueName}):m.scopeType==="folder"?m.folderId&&t.jsx(SC,{folder:(M=S.data)==null?void 0:M.find(T=>T.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((T,$)=>t.jsxs("div",{className:"grid gap-2 rounded-md bg-surface-2/50 p-2 sm:grid-cols-[130px_1fr_auto]",children:[t.jsx(ct,{"aria-label":"Channel type",value:T.type,onChange:Q=>b($,{type:Q.target.value}),options:[{value:"slack",label:"Slack webhook"},{value:"webhook",label:"Webhook (POST)"}]}),t.jsx(Ee,{"aria-label":"URL",mono:!0,placeholder:T.type==="slack"?"https://hooks.slack.com/services/…":"https://example.com/hooks/bullmq",value:T.url,onChange:Q=>b($,{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((B,q)=>q!==$)})),children:t.jsx(Jn,{})}),T.type==="webhook"&&t.jsx(Zi,{"aria-label":"Headers",mono:!0,rows:2,placeholder:`Authorization: Bearer …
533
- X-Source: bullpane`,value:T.headersText,onChange:Q=>b($,{headersText:Q.target.value}),wrapperClassName:"sm:col-span-3",hint:"One header per line, Name: value"})]},$)),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(Gn,{}),onClick:()=>g(T=>({...T,channels:[...T.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:T=>y("cooldownMinutes",T.target.value),error:p.cooldownMinutes,hint:"Minimum time between notifications while the rule keeps firing.",wrapperClassName:"max-w-xs"})]})})}const qC=[15,30,60,0],IC={15:"15 min",30:"30 min",60:"1 hour",0:"All"};function $C(e){if(!e)return!1;const n=qu(e.completed)+qu(e.failed);return(e.completed.length>0||e.failed.length>0)&&n>0}function zC(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=>OC(m,o).slice(o-d);return{completed:h(r),failed:h(i),minutes:d,available:o,truncated:n!==0&&n>o}}function OC(e,n){return e.length>=n?e:[...Array.from({length:n-e.length},()=>0),...e]}function AC(e){if(e.minutes===0)return{perMinute:null,perHour:null,completed:0,failed:0,successPct:null};const n=qu(e.completed),r=qu(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 LC(e){return e.completed.map((n,r)=>{const i=e.failed[r]??0,o=n+i;return o>0?n/o*100:null})}function pv(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 qu(e){return(e??[]).reduce((n,r)=>n+r,0)}function FC(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:xv(r),process:xv(i),sampled:n.length}}function xv(e){if(e.length===0)return null;const n=[...e].sort((r,i)=>r-i);return{min:n[0],median:gv(n,50),p95:gv(n,95),max:n[n.length-1],count:n.length}}function gv(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 In={top:10,right:8,bottom:20,left:40},vv=4;function yv({series:e,height:n=180,className:r,formatValue:i=ft,formatX:o=BC,maxY:c,ariaLabel:d,emptyText:h="No data"}){const m=N.useId(),g=N.useRef(null),[p,v]=N.useState(null),[j,S]=N.useState(720),y=Math.max(...e.map(q=>q.values.length),0),{max:b,plotW:k,plotH:C,scaleX:O,scaleY:z}=N.useMemo(()=>{const q=e.flatMap(Le=>Le.values.filter(K=>K!=null&&Number.isFinite(K))),V=q.length?Math.max(...q):0,re=c??VC(V),ue=Math.max(1,j-In.left-In.right),qe=Math.max(1,n-In.top-In.bottom);return{max:re,plotW:ue,plotH:qe,scaleX:Le=>In.left+(y>1?Le/(y-1)*ue:ue/2),scaleY:Le=>In.top+qe-(re>0?Le/re*qe:0)}},[e,j,n,c,y]),E=y>0&&e.some(q=>q.values.some(V=>V!=null)),M=q=>{var Ke;const V=(Ke=g.current)==null?void 0:Ke.getBoundingClientRect();if(!V||y===0)return;const ue=((q.clientX-V.left)/V.width*j-In.left)/k,qe=Math.round(ue*(y-1));v(qe>=0&&qe<y?qe:null)},[T,$]=N.useState(null),Q=N.useCallback(q=>{g.current=q,$(q)},[]);N.useEffect(()=>{if(!T||typeof ResizeObserver>"u")return;const q=new ResizeObserver(([V])=>{const re=Math.round(V.contentRect.width);re>0&&S(re)});return q.observe(T),()=>q.disconnect()},[T]);const B=Array.from({length:vv+1},(q,V)=>b/vv*V);return t.jsxs("div",{ref:Q,className:F("relative w-full select-none",r),onPointerMove:M,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))}),B.map((q,V)=>{const re=z(q);return t.jsxs("g",{children:[t.jsx("line",{x1:In.left,x2:j-In.right,y1:re,y2:re,stroke:"var(--border)",strokeWidth:1,shapeRendering:"crispEdges"}),t.jsx("text",{x:In.left-6,y:re+3,textAnchor:"end",className:"fill-[var(--fg-subtle)] text-[9px]",style:{fontVariantNumeric:"tabular-nums"},children:i(q)})]},V)}),E?t.jsxs(t.Fragment,{children:[e.map(q=>t.jsx(DC,{series:q,gradientId:`area-${m}-${q.key}`,scaleX:O,scaleY:z,baseline:In.top+C},q.key)),p!=null&&t.jsxs("g",{pointerEvents:"none",children:[t.jsx("line",{x1:O(p),x2:O(p),y1:In.top,y2:In.top+C,stroke:"var(--fg-subtle)",strokeWidth:1,strokeDasharray:"3 3"}),e.map(q=>{const V=q.values[p];return V==null||!Number.isFinite(V)?null:t.jsx("circle",{cx:O(p),cy:z(V),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,V)=>t.jsx("text",{x:O(q),y:n-6,textAnchor:V===0?"start":V===2?"end":"middle",className:"fill-[var(--fg-subtle)] text-[9px]",children:o(q,y)},q))})]}),p!=null&&E&&t.jsx(UC,{xPct:O(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 DC({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 UC({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 QC({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 BC(e,n){const r=n-1-e;return r===0?"now":`${W(r)} min ago`}function VC(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 HC=50;function KC({connectionId:e,queue:n,summary:r,onOpenState:i}){const[o,c]=N.useState(60),d=r==null?void 0:r.metrics,h=$C(d),m=N.useMemo(()=>zC(d,o),[d,o]),g=N.useMemo(()=>AC(m),[m]),p=N.useMemo(()=>LC(m),[m]);return t.jsxs("div",{className:"space-y-3",children:[t.jsx(ZC,{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(GC,{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(JC,{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(bv,{icon:t.jsx(em,{}),title:"Processed",hint:`Completed and failed per minute over the last ${W(m.minutes)} min, straight from BullMQ's own metrics collection.`,legend:WC,children:t.jsx(yv,{height:190,ariaLabel:"Completed and failed jobs per minute",series:[{key:"completed",label:"Completed",color:it.completed.fg,values:m.completed,area:!0},{key:"failed",label:"Failed",color:it.failed.fg,values:m.failed,area:!0}],formatValue:v=>ft(Math.round(v))})}),t.jsx(bv,{icon:t.jsx(qo,{}),title:"Success rate",hint:"completed / (completed + failed) per minute. A minute where nothing finished is a gap, not 0 %.",children:t.jsx(yv,{height:190,maxY:100,ariaLabel:"Success rate per minute",series:[{key:"success",label:"Success",color:it.completed.fg,values:p,area:!0}],formatValue:v=>`${Math.round(v)}%`})})]})]}):t.jsx(XC,{}),t.jsx(YC,{connectionId:e,queue:n,completedCount:(r==null?void 0:r.counts.completed)??0})]})}const WC=[{key:"completed",label:"Completed",color:it.completed.fg},{key:"failed",label:"Failed",color:it.failed.fg}];function ZC({counts:e,onOpenState:n}){return t.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4 xl:grid-cols-8",children:mo.map(r=>{const i=it[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?"—":ft(o)})]},r)})})}function GC({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:qC.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:IC[i]},i)})})}function JC({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(jv,{icon:t.jsx(uo,{}),label:"Throughput",value:n.perHour==null?"—":`${ft(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(jv,{icon:t.jsx(uo,{}),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:it.completed.fg},children:[ft(n.completed)," ok"]}),t.jsxs("span",{style:{color:it.failed.fg},children:[ft(n.failed)," failed"]}),t.jsx("span",{className:"ml-auto text-fg-muted",children:n.successPct==null?"—":Cn(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(_e,{content:Cm(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(_m,{rates:e})]})]})}function jv({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(_e,{content:o,className:"ml-auto",children:t.jsx(Va,{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 bv({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(QC,{series:i,className:"ml-auto"})]}),o,t.jsx("p",{className:"mt-1.5 text-[11px] leading-relaxed text-fg-subtle",children:r})]})}function XC(){return t.jsxs("div",{className:"card",children:[t.jsx(an,{icon:t.jsx(em,{}),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($m,{className:"mx-auto max-w-2xl",language:"ts",code:"new Worker(name, fn, { metrics: { maxDataPoints: MetricsTime.ONE_WEEK } })"})})]})}function YC({connectionId:e,queue:n,completedCount:r}){var h;const i=N0(e,n,{state:"completed",page:1,pageSize:HC,order:"desc"},{enabled:r>0}),o=N.useMemo(()=>{var m;return FC((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(Qy,{className:"size-3.5","aria-hidden":!0}),"Timings"]}),t.jsx(_e,{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(Va,{className:"size-3","aria-hidden":!0}),"sample of ",W(c)]})})]}),r===0?t.jsx("div",{className:"card",children:t.jsx(an,{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(wv,{title:"Response time",subtitle:"time in queue · processedOn − timestamp",stats:o.wait,loading:i.isLoading,color:it.waiting.fg,note:d}),t.jsx(wv,{title:"Process time",subtitle:"time in workers · finishedOn − processedOn",stats:o.process,loading:i.isLoading,color:it.active.fg,note:d})]})]})}function wv({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?"—":On(h.value)})]},h.label))})]})}function Nv(e,n){const r=e.trim();if(!r)return{value:{}};try{return{value:JSON.parse(r)}}catch(i){return{error:`${n}: ${i.message}`}}}function e_({open:e,onClose:n,connectionId:r,queue:i}){const o=c2(r,i),[c,d]=N.useState(""),[h,m]=N.useState(`{
534
-
535
- }`),[g,p]=N.useState("{}"),[v,j]=N.useState({}),S=()=>{var O;const y=Nv(h,"Data"),b=Nv(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 C=jk.safeParse({name:c.trim()||void 0,data:y.value,opts:b.value});if(!C.success){j({name:(O=C.error.issues[0])==null?void 0:O.message});return}o.mutate(C.data,{onSuccess:z=>{Y.success(`Job ${z.id} added to ${i}`),n()},onError:z=>Y.error(be(z))})};return t.jsx(Pn,{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:S,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(Zi,{label:"Data (JSON)",mono:!0,rows:8,value:h,onChange:y=>m(y.target.value),error:v.data,spellCheck:!1}),t.jsx(Zi,{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 t_=c0.shape.state.options,n_=[{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 s_({open:e,onClose:n,connectionId:r,queue:i,defaultState:o}){const c=k0(r,i),[d,h]=N.useState(o??"completed"),[m,g]=N.useState(0),[p,v]=N.useState("1000"),[j,S]=N.useState(null),y=()=>{var k;const b=c0.safeParse({state:d,grace:m,limit:Number(p)});if(!b.success){S(((k=b.error.issues[0])==null?void 0:k.message)??"Invalid input");return}S(null),c.mutate({action:"clean",body:b.data},{onSuccess:C=>{Y.success(`Cleaned ${W(C.removed??0)} ${d} jobs from ${i}`),n()},onError:C=>Y.error(be(C))})};return t.jsx(Pn,{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(ct,{label:"State",value:d,onChange:b=>h(b.target.value),options:t_.map(b=>({value:b,label:b}))}),t.jsx(ct,{label:"Grace period",value:String(m),onChange:b=>g(Number(b.target.value)),options:n_.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 kv="queueSetup.open";function r_({connectionId:e,queue:n,className:r}){const[i,o]=N.useState(()=>Hu(kv,!0)),c=um(e,n),d=c.data,h=()=>{o(m=>(jo(kv,!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(hs,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}):t.jsx(Fn,{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(a_,{data:d}),(d==null?void 0:d.rateLimitedNow)&&t.jsx(Y0,{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(gu,{className:"h-2.5 w-20"}),t.jsx(gu,{className:"h-3 w-28"})]},g))}),c.isError&&!d&&t.jsx("p",{className:"text-xs text-fg-muted",children:sr(c.error)&&c.error.status===404?"Setup details are not available on this server version.":`Setup unavailable: ${be(c.error)}`}),d&&t.jsx(i_,{data:d,since:c.dataUpdatedAt})]})]})}function a_({data:e}){const n=ej(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 i_({data:e,since:n}){const r=ej(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(Ks,{icon:t.jsx(_N,{}),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(je,{variant:"pro",size:"xs",className:"tracking-wider",children:"PRO"})]}):t.jsx(qr,{children:"unknown"})}),t.jsx(Ks,{icon:t.jsx(Bu,{}),label:"Workers connected",children:e.workers?t.jsx(_e,{content:e.workers.names.length?l_(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(qr,{title:"CLIENT LIST is unavailable on this Redis (ACL or managed service)",children:"unknown"})}),t.jsx(Ks,{icon:t.jsx(uo,{}),label:"Global concurrency",children:e.globalConcurrency!=null?t.jsx("span",{className:"num",children:W(e.globalConcurrency)}):t.jsx(qr,{children:"not set"})}),t.jsx(Ks,{icon:t.jsx(Qy,{}),label:"Global rate limit",children:e.globalRateLimit?t.jsxs("span",{className:"num",children:[W(e.globalRateLimit.max)," / ",tj(e.globalRateLimit.durationMs)]}):t.jsx(qr,{children:"not set"})}),t.jsx(Ks,{icon:t.jsx(bN,{}),label:"Rate limited now",children:e.rateLimitedNow?t.jsx(Y0,{ttlMs:e.rateLimitedNow.ttlMs,since:n}):t.jsx("span",{className:"text-fg-muted",children:"no"})}),t.jsx(Ks,{icon:t.jsx(Fu,{}),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(_e,{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(qr,{title:"No BullMQ Pro group keys found for this queue",children:"none observed"})}),t.jsx(Ks,{icon:t.jsx(oN,{}),label:"Batch",children:t.jsx(_e,{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(qr,{className:"cursor-help underline decoration-dotted underline-offset-2",children:"not stored by BullMQ"})})}),t.jsx(Ks,{icon:t.jsx(qo,{}),label:"Metrics",children:e.metricsEnabled?t.jsx("span",{className:"text-state-completed",children:"enabled"}):t.jsx(qr,{children:"disabled"})}),t.jsx(Ks,{icon:t.jsx(jN,{}),label:"Max events",children:e.maxLenEvents!=null?t.jsx("span",{className:"num",children:W(e.maxLenEvents)}):t.jsx(qr,{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(My,{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 Ks({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 qr({children:e,title:n,className:r}){return t.jsx("span",{className:F("text-fg-subtle",r),title:n,children:e})}function Y0({ttlMs:e,since:n}){const r=al(1e3),i=Math.max(0,e-Math.max(0,r-n));return t.jsxs(je,{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 ",tj(i)]})}function ej(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 tj(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 l_(e){const n=e.slice(0,12);return n.join(", ")+(e.length>n.length?` +${e.length-n.length} more`:"")}function o_({connectionId:e,queue:n}){var b,k;const{isOperator:r}=xt(),[i,o]=N.useState(1),[c,d]=N.useState(25),[h,m]=N.useState(null),g=f2(e,n,{page:i,pageSize:c}),p=p2(e,n),v=((b=g.data)==null?void 0:b.schedulers)??[],j=((k=g.data)==null?void 0:k.total)??0,S=r?6:5,y=C=>p.mutate(C.key,{onSuccess:()=>{Y.success(`Scheduler ${C.key} removed`),m(null)},onError:O=>Y.error(be(O))});return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"card overflow-hidden",children:[t.jsxs(ds,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(pe,{children:"Key"}),t.jsx(pe,{children:"Job name"}),t.jsx(pe,{children:"Repeats"}),t.jsx(pe,{children:"Timezone"}),t.jsx(pe,{align:"right",children:"Next run"}),r&&t.jsx(pe,{align:"right",children:"Actions"})]})}),t.jsxs("tbody",{children:[g.isLoading&&t.jsx(vt,{colSpan:S,children:t.jsx(Dt,{label:"Loading schedulers…"})}),g.isError&&!g.data&&t.jsx(vt,{colSpan:S,className:"text-danger",children:be(g.error)}),g.data&&v.length===0&&t.jsx(vt,{colSpan:S,children:t.jsx(d_,{queue:n})}),v.map(C=>t.jsxs(il,{children:[t.jsxs(xe,{mono:!0,children:[t.jsx("span",{className:"text-fg",title:C.key,children:C.key}),C.template&&t.jsx("span",{className:"ml-1.5 text-[11px] text-fg-subtle",title:u_(C),children:"template"})]}),t.jsx(xe,{mono:!0,muted:!0,children:C.name}),t.jsx(xe,{children:t.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[t.jsx(je,{variant:"outline",size:"xs",className:"font-mono",children:nj(C)}),C.limit!=null&&t.jsxs("span",{className:"text-[11px] text-fg-subtle",title:"Maximum number of jobs this scheduler will ever produce",children:[W(C.iterationCount??0),"/",W(C.limit)," runs"]}),C.limit==null&&C.iterationCount!=null&&t.jsxs("span",{className:"text-[11px] text-fg-subtle",title:"Jobs produced so far",children:[W(C.iterationCount)," runs"]}),C.endDate!=null&&t.jsxs("span",{className:"text-[11px] text-fg-subtle",title:`Stops after ${xn(C.endDate)}`,children:["until ",Zr(C.endDate)]})]})}),t.jsx(xe,{muted:!0,children:C.tz??t.jsx("span",{className:"text-fg-subtle",children:"–"})}),t.jsx(xe,{align:"right",num:!0,children:C.next==null?t.jsx("span",{className:"text-fg-subtle",children:"–"}):t.jsx("span",{className:F(C.next<=Date.now()&&"text-warning"),title:xn(C.next),children:Zr(C.next)})}),r&&t.jsx(xe,{align:"right",children:t.jsx(H,{size:"sm",variant:"ghost",className:"text-fg-subtle hover:text-danger",leftIcon:t.jsx(Jn,{}),"aria-label":`Remove scheduler ${C.key}`,title:"Remove this scheduler",loading:p.isPending&&p.variables===C.key,onClick:()=>m(C),children:"Remove"})})]},C.key))]})]}),j>0&&t.jsx("div",{className:F("border-t border-border px-3 py-2",g.isFetching&&"opacity-80"),children:t.jsx(Yu,{page:i,pageSize:c,total:j,count:v.length,onPage:o,onPageSize:C=>(d(C),o(1))})})]}),t.jsx(Wt,{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 nj(e){return e.every!=null?`every ${c_(e.every)}`:e.pattern?e.pattern:"unknown"}function c_(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 u_(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 d_({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(Io,{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(Fy,{className:"size-3","aria-hidden":!0}),"upsertJobScheduler is idempotent: calling it again updates the schedule instead of adding a second one."]})]})}function Ka({feature:e}){const n=xo[e],{pricing:r,checkoutUrl:i}=bt();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(ho,{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(Jr,{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(Hr,{className:"size-4","aria-hidden":!0})]}),t.jsxs(Re,{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(tl,{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(h_,{feature:e})})]})}function h_({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(f_,{}),e==="users"&&t.jsx(m_,{}),e==="folders"&&t.jsx(p_,{}),e==="flows"&&t.jsx(x_,{}),t.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-t from-surface to-transparent"})]})}function cu({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 zn({w:e,className:n}){return t.jsx("span",{className:F("h-2 rounded bg-surface-3",n),style:{width:e}})}function f_(){return t.jsxs("div",{className:"space-y-2",children:[t.jsxs(cu,{children:[t.jsx("span",{className:"status-dot pulse bg-danger"}),t.jsx(zn,{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(cu,{children:[t.jsx("span",{className:"status-dot bg-success"}),t.jsx(zn,{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(cu,{children:[t.jsx("span",{className:"status-dot bg-success"}),t.jsx(zn,{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(zn,{w:"30%",className:"bg-fg-muted/50"}),t.jsx(zn,{w:"12%",className:"ml-auto"})]}),t.jsx(zn,{w:"80%",className:"mb-1.5"}),t.jsx(zn,{w:"60%"})]})]})}function m_(){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(cu,{children:[t.jsx("span",{className:"size-5 rounded-full bg-surface-3"}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx(zn,{w:`${70+i*12}px`,className:"bg-fg-muted/50"}),t.jsx(zn,{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 p_(){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(zn,{w:"60%"}),t.jsx(zn,{w:"45%"}),t.jsx(zn,{w:"70%"})]})]})}function x_(){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(zn,{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 g_(){const{has:e}=bt();return e("alerts")?t.jsx(y_,{}):t.jsx(Ka,{feature:"alerts"})}function sj(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 v_={fired:"danger",resolved:"success",delivery_failed:"warning",no_metrics:"info"};function y_(){var O,z;const{isOperator:e}=xt(),n=fm(),r=fs(),i=Xr(),o=E0(),c=P2(),d=E2(),[h,m]=N.useState(null),[g,p]=N.useState(null),[v,j]=N.useState(""),S=C2({limit:100,alertId:v||void 0}),y=E=>{var M,T;return E?((T=(M=r.data)==null?void 0:M.find($=>$.id===E))==null?void 0:T.name)??E:"–"},b=E=>{var M,T;return((T=(M=i.data)==null?void 0:M.find($=>$.id===E))==null?void 0:T.name)??E},k=[...n.data??[]].sort((E,M)=>Number(M.firing)-Number(E.firing)||E.name.localeCompare(M.name)),C=k.filter(E=>E.firing).length;return t.jsxs(jt,{children:[t.jsx(ms,{title:t.jsxs("span",{className:"flex items-center gap-2",children:["Alerts",C>0&&t.jsxs(je,{variant:"danger",dot:!0,children:[C," 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(Gn,{}),onClick:()=>m({alert:null}),children:"New alert"})}),t.jsx("div",{className:"card overflow-hidden",children:t.jsxs(ds,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(pe,{className:"w-16",children:"State"}),t.jsx(pe,{children:"Name"}),t.jsx(pe,{children:"Scope"}),t.jsx(pe,{children:"Condition"}),t.jsx(pe,{children:"Channels"}),t.jsx(pe,{children:"Last fired"}),t.jsx(pe,{align:"right",children:t.jsx("span",{className:"sr-only",children:"Actions"})})]})}),t.jsxs("tbody",{children:[n.isLoading&&t.jsx(vt,{colSpan:7,children:t.jsx(Dt,{label:"Loading alerts…"})}),n.isError&&t.jsx(vt,{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(an,{compact:!0,icon:t.jsx(el,{}),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(Gn,{}),onClick:()=>m({alert:null}),children:"New alert"})})})}),k.map(E=>{var M;return t.jsxs(il,{className:F(!E.enabled&&"opacity-60"),children:[t.jsx(xe,{children:E.firing?t.jsxs(je,{variant:"danger",dot:!0,children:[t.jsx(Yf,{className:"size-3"})," firing"]}):E.enabled?t.jsx(_C,{measurement:E.measurement}):t.jsx(je,{variant:"neutral",children:"off"})}),t.jsx(xe,{className:"font-medium",children:E.name}),t.jsx(xe,{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(je,{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(je,{variant:"outline",size:"xs",children:"connection"}),y(E.scope.connectionId)]}):t.jsx(je,{variant:"outline",size:"xs",children:"every queue"})}),t.jsx(xe,{mono:!0,children:sj(E.condition)}),t.jsx(xe,{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((T,$)=>t.jsx(je,{variant:"outline",size:"xs",className:"mr-1",children:T.type},$)),t.jsxs("span",{className:"text-[11px] text-fg-subtle",children:["· cooldown ",E.cooldownMinutes,"m"]})]})}),t.jsx(xe,{muted:!0,children:t.jsx(Zt,{value:E.lastFiredAt,emptyText:"never"})}),t.jsx(xe,{align:"right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e&&t.jsx(Gi,{size:"sm",checked:E.enabled,label:E.enabled?"Disable alert":"Enable alert",disabled:o.isPending&&((M=o.variables)==null?void 0:M.id)===E.id,onChange:T=>o.mutate({id:E.id,input:{enabled:T}},{onError:$=>Y.error(be($))})}),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:T=>{var Q,B;const $=((Q=T.results)==null?void 0:Q.filter(q=>!q.ok))??[];T.ok&&$.length===0?Y.success("Test notification sent",`${((B=T.results)==null?void 0:B.length)??0} channel(s) delivered`):Y.error("Some channels failed",$.map(q=>`${q.channel}: ${q.error??"error"}`).join("; "))},onError:T=>Y.error(be(T))}),children:t.jsx(PN,{})}),e&&t.jsx(H,{size:"icon-xs",variant:"ghost",title:"Edit","aria-label":"Edit alert",onClick:()=>m({alert:E}),children:t.jsx(zo,{})}),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(Jn,{})})]})})]},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(ct,{"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(ds,{dense:!0,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(pe,{className:"w-28",children:"When"}),t.jsx(pe,{className:"w-28",children:"Status"}),t.jsx(pe,{children:"Alert"}),t.jsx(pe,{children:"Queue"}),t.jsx(pe,{children:"Message"}),t.jsx(pe,{align:"right",children:"Value"})]})}),t.jsxs("tbody",{children:[S.isLoading&&t.jsx(vt,{colSpan:6,children:t.jsx(Dt,{})}),S.data&&S.data.length===0&&t.jsx(vt,{colSpan:6,children:"No events yet"}),(O=S.data)==null?void 0:O.map(E=>t.jsxs("tr",{children:[t.jsx(xe,{muted:!0,children:t.jsx(Zt,{value:E.createdAt})}),t.jsx(xe,{children:t.jsx(je,{variant:v_[E.status],size:"xs",dot:!0,children:E.status.replace("_"," ")})}),t.jsx(xe,{className:"font-medium",children:E.alertName}),t.jsxs(xe,{muted:!0,children:[y(E.connectionId),E.queueName&&t.jsxs("span",{className:"text-fg-subtle",children:[" / ",E.queueName]})]}),t.jsx(xe,{className:"max-w-lg truncate",title:E.message,children:E.message}),t.jsx(xe,{num:!0,align:"right",muted:!0,children:E.value!=null?W(E.value):"–"})]},E.id))]})]})})]}),h&&t.jsx(ed,{open:!0,onClose:()=>m(null),alert:h.alert},((z=h.alert)==null?void 0:z.id)??"new"),t.jsx(Wt,{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),Y.success("Alert deleted")),onError:E=>Y.error(be(E))})})]})}function j_(e,n){const{has:r}=bt(),i=r("alerts"),o=fm(i),c=Xr(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 S=p.filter(y=>!y.alert.enabled||v(y)===j.get(y.alert.condition.kind));return p.length=0,p.push(...S),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 b_({matches:e,firing:n}){if(e.length===0)return null;const r=`${e.length} alert${e.length===1?"":"s"}`;return t.jsx(_e,{content:n>0?`${n} of ${e.length} firing right now`:"Watching this queue",children:t.jsxs(Re,{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(Yf,{className:"size-3"}):t.jsx(el,{className:"size-3"}),n>0?`${n} firing`:r]})})}function w_({connectionId:e,queueName:n,matches:r,onCreate:i}){const{isOperator:o}=xt(),[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(el,{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(Re,{to:oe.alerts,className:"text-[11px] text-accent hover:underline",children:"Manage all"}),o&&t.jsx(H,{size:"xs",variant:"ghost",leftIcon:t.jsx(Gn,{}),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(je,{variant:"danger",className:"gap-1",children:[t.jsx(Yf,{className:"size-3"})," firing"]}):h.enabled?t.jsx(je,{variant:"success",children:"ok"}):t.jsx(je,{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:sj(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(_e,{content:"This alert watches every queue in the folder",children:t.jsxs(Re,{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(Zt,{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(zo,{className:"size-3.5"})})]})]},h.id))}),c&&t.jsx(ed,{open:!0,onClose:()=>d(null),alert:c}),t.jsx("span",{className:"sr-only",children:`Alerts watching ${n} on connection ${e}`})]})}function N_({connectionId:e,queue:n,value:r,onChange:i,disabled:o,className:c}){var z;const d=hm(e,n,{page:1,pageSize:200}),[h,m]=N.useState(!1),[g,p]=N.useState(""),[v,j]=N.useState(0),S=N.useRef(null),y=N.useRef(null),b=N.useId(),k=((z=d.data)==null?void 0:z.groups)??[],C=N.useMemo(()=>{const E=g.trim().toLowerCase(),M=k.filter(Q=>!E||Q.id.toLowerCase().includes(E)).slice(0,100),T=E&&k.some(Q=>Q.id.toLowerCase()===E),$=[];return E||$.push({id:"",label:"All groups"}),$.push(...M.map(Q=>({id:Q.id,label:Q.id,waiting:Q.waiting}))),E&&!T&&$.push({id:g.trim(),label:`Use "${g.trim()}"`,custom:!0}),$},[k,g]);N.useEffect(()=>j(0),[g,h]),N.useEffect(()=>{if(!h)return;const E=M=>{var T;(T=y.current)!=null&&T.contains(M.target)||m(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[h]);const O=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(Fu,{className:"size-3.5 shrink-0 text-pro","aria-hidden":!0}),h?t.jsx("input",{ref:S,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(M=>Math.min(C.length-1,M+1))):E.key==="ArrowUp"?(E.preventDefault(),j(M=>Math.max(0,M-1))):E.key==="Enter"?(E.preventDefault(),C[v]&&O(C[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:[" · ",ft(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:()=>O(""),children:t.jsx(gn,{className:"size-3"})}):t.jsx(hs,{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&&C.length===0&&t.jsx("li",{className:"px-2 py-1.5 text-fg-subtle",children:"No groups"}),C.map((E,M)=>{const T=E.id===r;return t.jsxs("li",{role:"option","aria-selected":T,className:F("flex cursor-pointer items-center gap-2 rounded px-2 py-1",M===v?"bg-surface-3 text-fg":"text-fg-muted hover:bg-surface-2 hover:text-fg"),onMouseEnter:()=>j(M),onMouseDown:$=>$.preventDefault(),onClick:()=>O(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:[ft(E.waiting)," waiting"]}),T&&t.jsx(Jr,{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 ",ft(d.data.total)," groups — type an id to filter or use it directly."]})]})]})}const k_={retry:"retried",promote:"promoted",remove:"removed",discard:"discarded"};function rj(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} ${k_[n]}`}const S_=[{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 aj({job:e,onClose:n,onPick:r,pending:i}){const o=e!=null&&e.delayedUntil?xn(e.delayedUntil):"its scheduled time";return t.jsx(Pn,{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:S_.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))})})}const C_=10;function __(e){return!!e&&mo.includes(e)}function Gh({view:e="jobs"}={}){var Ga,Ja,zs,Os,hl,fl,ml,pl,xl,Xa,gl,dr,Ya,hr,Bo,fr,ra,aa,ei,Vo,Ho,Ko,gs,vl,yl;const{connectionId:n="",queue:r=""}=Ln(),[i,o]=Yi(),c=ln(),{isOperator:d,isAdmin:h}=xt(),m=__(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")??"",S=i.get("group")??"",[y,b]=N.useState(j),k=N.useCallback(ce=>{o(rt=>{const et=new URLSearchParams(rt);for(const[Bt,ti]of Object.entries(ce))ti==null||ti===""?et.delete(Bt):et.set(Bt,ti);return et},{replace:!0})},[o]),C=w0(n,r),O=j_(n,r),z=ym(n),E=!!C.data&&(C.data.isPro||C.data.groupsCount>0),M=j.trim().length>0,T=!M&&!!S&&m!=="waiting"&&m!=="prioritized",$=!M&&!!S&&!T,Q=M||T,B=e==="metrics",q=e==="schedulers",V=B||q,re=N0(n,r,{state:m,page:g,pageSize:p,order:v,groupId:$?S:void 0},{enabled:!Q&&!V}),ue=a2(n,r,{state:m,q:j.trim(),groupId:T?S:void 0,limit:50},{enabled:Q&&!V}),qe=dm(n,r),Ke=k0(n,r),ut=o2(n,r),Le=((Ga=ue.data)==null?void 0:Ga.pages)??[],K=Le.flatMap(ce=>ce.jobs),me=Le.reduce((ce,rt)=>ce+(rt.scanned??0),0),ne=Le.reduce((ce,rt)=>ce+(rt.skippedLargePayloads??0),0),A=Le.length?Le[Le.length-1].total:((zs=(Ja=C.data)==null?void 0:Ja.counts)==null?void 0:zs[m])??0,[Z,Ae]=N.useState(0);N.useEffect(()=>Ae(0),[S,m]),N.useEffect(()=>{!T||!ue.hasNextPage||ue.isFetching||K.length>=50||Le.length-Z>=C_||ue.fetchNextPage()},[T,ue,K.length,Le.length,Z]);const Fe=()=>{Ae(Le.length),ue.fetchNextPage()},Ce=Q?K:((Os=re.data)==null?void 0:Os.jobs)??[],De=N.useMemo(()=>Ce.map(ce=>ce.id),[Ce]),Qe=vC(De),[Je,lt]=N.useState(null),[Qt,Yr]=N.useState(null),[Fo,lr]=N.useState(null),[or,Wa]=N.useState(null),[Za,ea]=N.useState(null),[qs,Ot]=N.useState(null),[ta,ps]=N.useState(!1),En=i.get("confirm");N.useEffect(()=>{if(En!=="drain"&&En!=="clean"&&En!=="obliterate")return;(En==="clean"?d:h)?Ot(En):Y.error(`${En==="clean"?"Cleaning":En==="drain"?"Draining":"Obliterating"} a queue needs the ${En==="clean"?"operator":"admin"} role`),o(rt=>{const et=new URLSearchParams(rt);return et.delete("confirm"),et},{replace:!0})},[En,h,d,o]);const{has:Do,gate:ll}=bt(),[ol,xs]=N.useState(!1),na=N.useRef(null),cr=N.useCallback(()=>{var ce,rt;(ce=na.current)==null||ce.focus(),(rt=na.current)==null||rt.select()},[]);g0("/",ce=>{ce.preventDefault(),cr()}),N.useEffect(()=>{if(i.get("search")!=="1")return;const ce=window.setTimeout(cr,0);return k({search:null}),()=>window.clearTimeout(ce)},[i,k,cr]),N.useEffect(()=>b(j),[j]);const on=(hl=C.data)==null?void 0:hl.counts,sa=N.useMemo(()=>{var rt,et;const ce=[{value:"metrics",label:"Metrics",icon:t.jsx(em,{className:"size-3.5"})},{value:"schedulers",label:"Schedulers",count:((rt=C.data)==null?void 0:rt.schedulersCount)??null,icon:t.jsx(Io,{className:"size-3.5"})},...mo.map(Bt=>({value:Bt,label:it[Bt].label,count:(on==null?void 0:on[Bt])??null,tone:it[Bt].dotClass}))];return(et=C.data)!=null&&et.isPro&&ce.push({value:"groups",label:"Groups",count:C.data.groupsCount,icon:t.jsx(Fu,{className:"size-3.5 text-pro"})}),ce},[on,(fl=C.data)==null?void 0:fl.isPro,(ml=C.data)==null?void 0:ml.groupsCount,(pl=C.data)==null?void 0:pl.schedulersCount]),Is=(ce,rt,et)=>{qe.mutate({jobId:ce,action:rt,scheduler:et},{onSuccess:Bt=>{Y.success(rj(ce,rt,Bt)),ea(null)},onError:Bt=>Y.error(be(Bt))})},Uo=(ce,rt,et)=>{if(rt==="remove"){Wa(ce);return}if(rt==="promote"&&(et!=null&&et.repeatJobKey)){ea({id:et.id,repeatJobKey:et.repeatJobKey,delayedUntil:et.delayedUntil});return}Is(ce,rt)},cl=N.useMemo(()=>Z0(M?"mixed":m),[M,m]),ul=ce=>{const rt=Qe.selectedIds;if(rt.length!==0){if(rt.length>Eu){Y.error(`Select at most ${W(Eu)} jobs per action (${W(rt.length)} selected).`);return}Yr(ce),ut.mutate({action:ce,jobIds:rt},{onSuccess:et=>{lt(et),Qe.deselect(et.ok);const Bt=ce==="retry"?"retried":ce==="promote"?"promoted":"removed";et.failed.length===0?Y.success(`${W(et.ok.length)} ${Bt}`):Y.error(`${W(et.ok.length)} ${Bt} · ${W(et.failed.length)} failed`)},onError:et=>Y.error(be(et)),onSettled:()=>{Yr(null),lr(null)}})}},Qo=ce=>{ce==="remove"?lr("remove"):ul(ce)},$s=(ce,rt)=>Ke.mutate(ce,{onSuccess:()=>{Y.success(rt),Ot(null),ce.action==="obliterate"&&c(oe.connection(n))},onError:et=>Y.error(be(et))}),dl=()=>k({q:y.trim()||null,page:null}),ur=()=>{b(""),k({q:null,page:null})};return t.jsxs(jt,{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}),((xl=C.data)==null?void 0:xl.isPaused)&&t.jsx(je,{variant:"warning",dot:!0,className:"tracking-wider",children:"PAUSED"}),((Xa=C.data)==null?void 0:Xa.isPro)&&t.jsx(je,{variant:"pro",title:"BullMQ Pro groups detected",className:"tracking-wider",children:"PRO"}),C.isError&&t.jsx(je,{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:[((gl=C.data)==null?void 0:gl.prefix)??"bull",":",r]}),((dr=C.data)==null?void 0:dr.metrics)&&C.data.metrics.completed.length>1&&t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{style:{color:it.completed.fg},children:t.jsx(Ji,{values:C.data.metrics.completed,width:72,height:16,title:"Completed per minute"})}),t.jsx("span",{style:{color:it.failed.fg},children:t.jsx(Ji,{values:C.data.metrics.failed,width:72,height:16,title:"Failed per minute"})})]}),t.jsx(b_,{matches:O.matches,firing:O.firing})]})]}),d&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx(H,{size:"sm",variant:"primary",leftIcon:t.jsx(Gn,{}),onClick:()=>Ot("add"),children:"Add job"}),t.jsx(H,{size:"sm",leftIcon:t.jsx(el,{}),onClick:()=>ll("alerts",()=>ps(!0)),title:"Alert on this queue",children:"Create alert"}),t.jsx(H,{size:"sm",leftIcon:(Ya=C.data)!=null&&Ya.isPaused?t.jsx(Du,{}):t.jsx(Ha,{}),loading:Ke.isPending&&(((hr=Ke.variables)==null?void 0:hr.action)==="pause"||((Bo=Ke.variables)==null?void 0:Bo.action)==="resume"),onClick:()=>{var ce;return(ce=C.data)!=null&&ce.isPaused?$s({action:"resume"},"Queue resumed"):Ot("pause")},children:(fr=C.data)!=null&&fr.isPaused?"Resume":"Pause"}),t.jsx(H,{size:"sm",leftIcon:t.jsx(Uu,{}),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(hs,{}),"aria-haspopup":"menu","aria-expanded":ol,onClick:()=>xs(ce=>!ce),children:"More"}),ol&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"fixed inset-0 z-30",onClick:()=>xs(!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(su,{icon:t.jsx(pN,{}),label:"Clean…",hint:"remove by state and age",onClick:()=>(xs(!1),Ot("clean"))}),h&&t.jsxs(Re,{role:"menuitem",to:oe.audit({connectionId:n,queueName:r}),onClick:()=>xs(!1),className:"nav-item w-full text-left",children:[t.jsx(Oo,{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(su,{icon:t.jsx($o,{}),label:"Hide from the lists",hint:vS,onClick:()=>(xs(!1),z.hide(r))}),h&&t.jsx(su,{icon:t.jsx(Jn,{}),label:"Drain",hint:"remove all waiting jobs",onClick:()=>(xs(!1),Ot("drain"))}),h&&t.jsx(su,{icon:t.jsx(xN,{}),label:"Obliterate…",hint:"deletes the queue and every job · permanent",danger:!0,onClick:()=>(xs(!1),Ot("obliterate"))})]})]})]})]})]}),t.jsx(r_,{connectionId:n,queue:r,className:"mb-3"}),t.jsx("div",{className:"mb-3",children:t.jsx(w_,{connectionId:n,queueName:r,matches:O.matches,onCreate:()=>ll("alerts",()=>ps(!0))})}),!V&&t.jsxs("form",{className:"mb-3 flex flex-wrap items-center gap-2",role:"search",onSubmit:ce=>{ce.preventDefault(),dl()},children:[t.jsxs("div",{className:"relative min-w-72 flex-1",children:[t.jsx(Ee,{ref:na,leftIcon:t.jsx(Zn,{}),placeholder:`Search job data, name, id or error in ${m}…`,"aria-label":"Search jobs",value:y,onChange:ce=>b(ce.target.value),onKeyDown:ce=>{ce.key==="Escape"&&(ce.preventDefault(),ur(),ce.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||M?t.jsx("button",{type:"button",className:"rounded p-0.5 text-fg-subtle hover:text-fg","aria-label":"Clear search",onClick:ur,children:t.jsx(gn,{className:"size-3.5"})}):t.jsx("span",{className:"hidden items-center gap-1 sm:flex",children:t.jsx(Wi,{children:"/"})})})]}),t.jsx(ct,{"aria-label":"State to search",className:"!h-9 !w-auto",value:m,onChange:ce=>k({state:ce.target.value,page:null,group:null}),options:mo.map(ce=>({value:ce,label:`in ${it[ce].label}`}))}),t.jsx(H,{type:"submit",size:"md",variant:M?"secondary":"primary",leftIcon:t.jsx(Zn,{}),disabled:!y.trim()&&!M,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&&"opacity-50"),children:t.jsx(Im,{"aria-label":"Job state",items:sa,value:B?"metrics":q?"schedulers":m,onChange:ce=>{ce==="groups"?c(oe.groups(n,r)):ce==="metrics"?c(oe.queueMetrics(n,r)):ce==="schedulers"?c(`/c/${encodeURIComponent(n)}/q/${encodeURIComponent(r)}/schedulers`):V?c(oe.queue(n,r,ce)):k({state:ce,page:null})},className:"!border-b-0",size:"sm"})}),E&&!M&&!V&&t.jsxs("div",{className:"flex items-center gap-2 pb-1.5",children:[($||T)&&t.jsxs("span",{className:"text-[11px] text-fg-muted",children:["showing group ",t.jsx("span",{className:"font-mono text-fg",children:S}),"'s ",T?m:"waiting"," jobs"]}),t.jsx(N_,{connectionId:n,queue:r,value:S,onChange:ce=>k({group:ce||null,page:null})})]}),!Q&&!V&&t.jsx(H,{size:"sm",variant:"ghost",className:"mb-1",leftIcon:t.jsx(tN,{}),onClick:()=>k({order:v==="desc"?"asc":"desc"}),title:"Toggle order",children:v==="desc"?"Newest first":"Oldest first"})]}),q?t.jsx(o_,{connectionId:n,queue:r}):B?t.jsx(KC,{connectionId:n,queue:r,summary:C.data,onOpenState:ce=>c(oe.queue(n,r,ce))}):t.jsx("div",{className:"card overflow-hidden",children:Q?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(Zn,{className:"size-3.5 text-fg-subtle","aria-hidden":!0}),ue.isFetching&&!ue.isFetchingNextPage?t.jsx(Dt,{label:M?`Scanning ${m} jobs for "${j}"…`:`Scanning ${m} jobs for group ${S}…`}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"num font-semibold text-fg",children:W(K.length)})," ",M?K.length===1?"match":"matches":`${K.length===1?"job":"jobs"} of group ${S}`," · scanned ",t.jsx("span",{className:"num text-fg",children:W(Math.min(me,A))})," of"," ",t.jsx("span",{className:"num text-fg",children:W(A)})," jobs in ",t.jsx("span",{className:it[m].textClass,children:m}),!ue.hasNextPage&&ue.data&&t.jsx("span",{className:"text-fg-subtle",children:" · whole state scanned"}),ne>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(ne)," ",ne===1?"payload":"payloads"," too large to search inside"]})]})]}),t.jsxs("span",{className:"flex items-center gap-2",children:[ue.hasNextPage&&t.jsx(H,{size:"sm",onClick:Fe,loading:ue.isFetchingNextPage,children:"Scan more"}),t.jsx(H,{size:"sm",variant:"ghost",leftIcon:t.jsx(gn,{}),onClick:M?ur:()=>k({group:null,page:null}),children:"Clear"})]})]}),Je&&t.jsx(mv,{result:Je,onDismiss:()=>lt(null)}),d&&t.jsx(fv,{selection:Qe,state:M?"mixed":m,queue:r,actions:cl,onRun:Qo,pending:Qt,searching:!0}),t.jsx(Lf,{connectionId:n,queue:r,jobs:ue.data?K:void 0,loading:ue.isLoading,error:ue.error,emptyText:ue.hasNextPage?"No matches yet — scan more to keep looking":M?`No ${m} job contains "${j}"`:`No ${m} jobs in group ${S}`,canOperate:d,onAction:Uo,pendingId:qe.isPending?(ra=qe.variables)==null?void 0:ra.jobId:null,showState:!1,showGroup:E,onGroupClick:ce=>{ur(),k({group:ce,page:null})},highlight:M?j:void 0,selection:d?Qe: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."}),ue.hasNextPage&&t.jsx(H,{size:"sm",onClick:Fe,loading:ue.isFetchingNextPage,children:"Scan more"})]})]}):t.jsxs(t.Fragment,{children:[m==="active"&&(((aa=C.data)==null?void 0:aa.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(rm,{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(((ei=C.data)==null?void 0:ei.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."})]})]}),Je&&t.jsx(mv,{result:Je,onDismiss:()=>lt(null)}),d&&t.jsx(fv,{selection:Qe,state:m,queue:r,actions:cl,onRun:Qo,pending:Qt}),t.jsx(Lf,{connectionId:n,queue:r,jobs:(Vo=re.data)==null?void 0:Vo.jobs,loading:re.isLoading,error:re.error,emptyText:$?`No waiting jobs in group ${S}`:"No jobs in this state",canOperate:d,onAction:Uo,pendingId:qe.isPending?(Ho=qe.variables)==null?void 0:Ho.jobId:null,showState:!1,showGroup:E,onGroupClick:ce=>k({group:ce,page:null}),selection:d?Qe:void 0}),t.jsx("div",{className:F("border-t border-border px-3 py-2",re.isFetching&&"opacity-80"),children:t.jsx(Yu,{page:g,pageSize:p,total:((Ko=re.data)==null?void 0:Ko.total)??($?0:(on==null?void 0:on[m])??0),count:(gs=re.data)==null?void 0:gs.jobs.length,onPage:ce=>k({page:String(ce)}),onPageSize:ce=>k({pageSize:String(ce),page:null})})})]})}),d&&t.jsx(e_,{open:qs==="add",onClose:()=>Ot(null),connectionId:n,queue:r}),d&&Do("alerts")&&ta&&t.jsx(ed,{open:!0,onClose:()=>ps(!1),alert:null,initialScope:{type:"queue",connectionId:n,queueName:r}}),d&&t.jsx(s_,{open:qs==="clean",onClose:()=>Ot(null),connectionId:n,queue:r,defaultState:m==="waiting"?"wait":m==="waiting-children"?"completed":m}),t.jsx(Wt,{open:Fo==="remove",onClose:()=>lr(null),title:"Remove selected jobs",description:`Remove ${W(Qe.selectedIds.length)} ${Qe.selectedIds.length===1?"job":"jobs"} from ${r}? This cannot be undone.`,confirmText:`Remove ${W(Qe.selectedIds.length)}`,danger:!0,loading:Qt==="remove",onConfirm:()=>ul("remove")}),t.jsx(Wt,{open:or!==null,onClose:()=>Wa(null),title:"Remove job",description:`Remove job ${or??""} from ${r}? This cannot be undone.`,confirmText:"Remove",danger:!0,loading:qe.isPending,onConfirm:()=>{or&&Is(or,"remove"),Wa(null)}}),t.jsx(aj,{job:Za,onClose:()=>ea(null),onPick:ce=>Za&&Is(Za.id,"promote",ce),pending:qe.isPending&&((vl=qe.variables)==null?void 0:vl.action)==="promote"?qe.variables.scheduler??null:null}),t.jsx(V0,{queue:qs==="pause"?r:null,onClose:()=>Ot(null),loading:Ke.isPending&&((yl=Ke.variables)==null?void 0:yl.action)==="pause",onConfirm:ce=>$s({action:"pause",body:ce?{reason:ce}:{}},"Queue paused")}),t.jsx(Wt,{open:qs==="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:Ke.isPending,onConfirm:()=>$s({action:"retry-all",body:{state:"failed"}},"Retrying all failed jobs")}),t.jsx(Wt,{open:qs==="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:Ke.isPending,onConfirm:()=>$s({action:"drain",body:{includeDelayed:!1}},"Queue drained")}),t.jsx(Wt,{open:qs==="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:Ke.isPending,onConfirm:()=>$s({action:"obliterate"},`${r} obliterated`)})]})}function su({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 ij({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(oj,{name:i,value:e,depth:0,expandDepth:n,last:!0})})}function lj(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 ru=200;function P_({value:e}){const[n,r]=N.useState(!1);switch(lj(e)){case"string":{const o=e,d=!n&&o.length>ru?`${o.slice(0,ru)}…`:o;return t.jsxs("span",{className:"text-success break-all",children:['"',d,'"',o.length>ru&&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-ru} 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 oj({name:e,value:n,depth:r,expandDepth:i,last:o}){const c=lj(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:E_(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(P_,{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"?["[","]"]:["{","}"],S=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(hs,{className:"size-3"}):t.jsx(Fn,{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:S}),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(oj,{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 E_(e){return/^[A-Za-z_$][\w$]*$/.test(e)}function R_(){var E,M,T,$,Q;const{connectionId:e="",queue:n="",jobId:r=""}=Ln(),i=ln(),{has:o}=bt(),{isOperator:c,isAdmin:d}=xt(),h=i2(e,n,r),m=dm(e,n),[g,p]=N.useState("data"),[v,j]=N.useState(null),[S,y]=N.useState(!1),b=(B,q)=>m.mutate({jobId:r,action:B,scheduler:q},{onSuccess:V=>{Y.success(rj(r,B,V)),j(null),y(!1),B==="remove"&&i(oe.queue(e,n))},onError:V=>Y.error(be(V))});if(h.isLoading)return t.jsx(jt,{children:t.jsx(nl,{label:"Loading job…"})});if(h.isError||!h.data){const B=sr(h.error)&&h.error.status===404;return t.jsx(jt,{children:t.jsx(an,{title:B?"Job not found":"Could not load job",description:B?"It may have been removed or cleaned since you opened it.":be(h.error),action:t.jsxs(H,{variant:"secondary",leftIcon:t.jsx(xu,{}),onClick:()=>i(oe.queue(e,n)),children:["Back to ",n]})})})}const k=h.data,C=k.state==="failed"||k.state==="completed",O=k.state==="delayed",z=!!k.failedReason||(((E=k.stacktrace)==null?void 0:E.length)??0)>0;return t.jsxs(jt,{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(Re,{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(xu,{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(F0,{state:k.state}),k.groupId&&t.jsx(Re,{to:oe.group(e,n,k.groupId),children:t.jsxs(je,{variant:"pro",mono:!0,title:"BullMQ Pro group",children:["group ",k.groupId]})}),k.priority>0&&t.jsxs(je,{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(wo,{value:k.id,label:"Copy id",size:"icon-xs"}),t.jsx(wo,{value:()=>Tu(k),label:"Copy JSON",copiedLabel:"Copied JSON",showLabel:!0,size:"xs",icon:t.jsx(My,{}),className:"ml-1 font-sans"})]})]}),c&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[C&&t.jsx(H,{size:"sm",leftIcon:t.jsx(Uu,{}),onClick:()=>b("retry"),loading:m.isPending&&((M=m.variables)==null?void 0:M.action)==="retry",children:"Retry"}),O&&t.jsx(H,{size:"sm",leftIcon:t.jsx(Xf,{}),onClick:()=>k.repeatJobKey?y(!0):b("promote"),loading:m.isPending&&((T=m.variables)==null?void 0:T.action)==="promote",children:"Promote"}),t.jsx(H,{size:"sm",variant:"ghost",leftIcon:t.jsx(iN,{}),onClick:()=>j("discard"),title:"Mark as not retryable",children:"Discard"}),t.jsx(H,{size:"sm",variant:"ghost",className:"hover:text-danger",leftIcon:t.jsx(Jn,{}),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(q_,{job:k})}),t.jsxs("dl",{className:"card grid grid-cols-2 gap-x-4 gap-y-3 p-4 text-xs",children:[t.jsx(ya,{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(ya,{label:"Runs at",children:t.jsx(M_,{at:k.delayedUntil})}):t.jsx(ya,{label:"Delay",children:k.delay?On(k.delay):"–"}),t.jsx(ya,{label:"Priority",children:k.priority||"–"}),t.jsx(ya,{label:"Progress",children:t.jsx(T_,{value:k.progress})}),t.jsx(ya,{label:"Parent",children:k.parent?t.jsxs(Re,{to:oe.job(e,Yg(k.parent.queueKey),k.parent.id),className:"inline-flex items-center gap-1 font-mono text-accent hover:underline",children:[t.jsx(vN,{className:"size-3"}),k.parent.queue||Yg(k.parent.queueKey),"/",k.parent.id]}):"–"}),t.jsx(ya,{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(Re,{to:oe.jobTree(e,n,k.id),className:"inline-flex items-center gap-1.5 text-[13px] text-accent hover:underline",children:[t.jsx(CN,{className:"size-3.5","aria-hidden":!0}),"View flow tree"]})})]}),t.jsx(Im,{"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??(($=k.logs)==null?void 0:$.length)??0},...d&&o("audit")?[{value:"audit",label:"Audit"}]:[]]}),g==="data"&&t.jsx(Jh,{value:k.data,empty:"No data"}),g==="opts"&&t.jsx(Jh,{value:k.opts,empty:"No options"}),g==="returnvalue"&&t.jsx(Jh,{value:k.returnvalue,empty:"No return value (job has not completed)"}),g==="error"&&t.jsx(I_,{job:k}),g==="logs"&&t.jsx($_,{connectionId:e,queue:n,jobId:r,initial:k.logs,total:k.logsCount}),g==="audit"&&t.jsx(z_,{connectionId:e,queue:n,jobId:r}),t.jsx(aj,{job:S&&k.repeatJobKey?{id:k.id,repeatJobKey:k.repeatJobKey,delayedUntil:k.delayedUntil}:null,onClose:()=>y(!1),onPick:B=>b("promote",B),pending:m.isPending&&((Q=m.variables)==null?void 0:Q.action)==="promote"?m.variables.scheduler??null:null}),t.jsx(Wt,{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(Wt,{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 ya({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 M_({at:e}){return e?t.jsxs("span",{className:"flex flex-col leading-tight",children:[t.jsx(Zt,{value:e}),t.jsx("span",{className:"font-mono text-[10px] text-fg-subtle",children:If(e)})]}):t.jsx(t.Fragment,{children:"–"})}function T_({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:Tu(e),children:Tu(e,0).slice(0,40)})}function q_({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(Zt,{value:p.ts}):e.state==="active"&&v===2?"running…":e.state==="delayed"&&v===1&&e.delayedUntil?t.jsxs(t.Fragment,{children:["runs ",t.jsx(Zt,{value:e.delayedUntil})]}):"–"}),p.ts&&t.jsx("span",{className:"font-mono text-[10px] text-fg-subtle",children:If(p.ts)}),!p.ts&&e.state==="delayed"&&v===1&&e.delayedUntil&&t.jsx("span",{className:"font-mono text-[10px] text-fg-subtle",children:If(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?On(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?On(h):"–"})]}),t.jsxs("span",{children:[t.jsx("span",{className:"text-fg-subtle",children:"Total "}),t.jsx("span",{className:"num text-fg",children:o?On(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=OS[e.state])==null?void 0:g.dot)??"bg-fg-subtle")})," ",e.state]})]})]})}function Jh({value:e,empty:n}){const[r,i]=N.useState(!1),o=N.useMemo(()=>Tu(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(wo,{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(ij,{value:e,defaultExpandDepth:3})})]})}function I_({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($m,{code:r,header:`Stacktrace · attempt ${i+1} of ${e.stacktrace.length}`,wrap:!0,maxHeight:360},i))]})}function $_({connectionId:e,queue:n,jobId:r,initial:i,total:o}){var p,v;const[c,d]=N.useState(!1),h=l2(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(wo,{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,S)=>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:S+1}),t.jsx("span",{className:"whitespace-pre-wrap break-all",children:j})]},S))})]})}function z_({connectionId:e,queue:n,jobId:r}){var c;const i=z2(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(Zt,{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:cm[d.action]}),d.result==="error"&&t.jsx(je,{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(Re,{to:oe.audit({connectionId:e,queueName:n}),className:"inline-flex items-center gap-1.5 text-xs text-accent hover:underline",children:[t.jsx(Oo,{className:"size-3.5","aria-hidden":!0})," Full audit log for this queue"]})})]})}const cj={waiting:"info",limited:"violet",maxed:"danger",paused:"warning"},uj={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."},Sv="No per-group override in Redis. The worker's own group option applies (a worker option, not stored in Redis).";function O_(){var v,j,S;const{connectionId:e="",queue:n=""}=Ln(),r=ln(),[i,o]=N.useState(1),[c,d]=N.useState(50),h=w0(e,n),m=hm(e,n,{page:i,pageSize:c}),g=al(1e3),p=6;return t.jsxs(jt,{wide:!0,children:[t.jsx(ms,{title:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Re,{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(je,{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 waiting or running.`:""} A group whose jobs are all delayed is not listed until one becomes due: Pro keeps delayed jobs in the queue's delayed state, not under the group. Filter the queue's Delayed tab by group to see them.`}),m.data&&t.jsx(L_,{byStatus:m.data.byStatus,total:m.data.total}),m.data&&!m.data.bullmqProApi&&t.jsx(dj,{}),t.jsxs("div",{className:"card overflow-hidden",children:[t.jsxs(ds,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(pe,{children:"Group"}),t.jsx(pe,{children:"Status"}),t.jsx(pe,{align:"right",children:"Waiting"}),t.jsx(pe,{align:"right",children:"Active / concurrency"}),t.jsx(pe,{align:"right",children:"Rate limit"}),t.jsx(pe,{align:"right",children:"Next"})]})}),t.jsxs("tbody",{children:[m.isLoading&&t.jsx(vt,{colSpan:p,children:t.jsx(Dt,{label:"Loading groups…"})}),m.isError&&!m.data&&t.jsx(vt,{colSpan:p,className:"text-danger",children:be(m.error)}),m.data&&m.data.groups.length===0&&t.jsx(vt,{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(F_,{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(Yu,{page:i,pageSize:c,total:((j=m.data)==null?void 0:j.total)??0,count:(S=m.data)==null?void 0:S.groups.length,onPage:o,onPageSize:y=>(d(y),o(1))})})]})]})}const A_="https://github.com/madmorett/bullpane/blob/main/docs/BULLMQ-PRO.md";function dj(){return t.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border bg-surface-2/50 px-3 py-2 text-xs text-fg-muted",role:"note",children:[t.jsx(Va,{className:"mt-0.5 size-3.5 shrink-0 text-pro","aria-hidden":!0}),t.jsxs("span",{children:["Pausing, resuming and draining a group, and promoting, retrying or removing a grouped job, need BullMQ Pro's own package installed next to Bullpane: core bullmq would run those jobs outside their group."," ",t.jsx("a",{href:A_,target:"_blank",rel:"noreferrer",className:"text-accent hover:underline",children:"How to install it"})]})]})}function L_({byStatus:e,total:n}){return t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[yk.map(r=>t.jsx(_e,{content:uj[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(je,{variant:cj[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 F_({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(xe,{mono:!0,children:t.jsx(Re,{to:i,className:"text-accent hover:underline",children:e.id})}),t.jsx(xe,{className:"whitespace-nowrap",children:t.jsx(je,{variant:cj[e.status],dot:!0,size:"xs",title:uj[e.status],children:e.status})}),t.jsxs(xe,{num:!0,align:"right",children:[W(e.waiting),e.prioritized>0&&t.jsx(_e,{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(xe,{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(_e,{content:"Per-group override set with queue.setGroupConcurrency().",side:"bottom",children:t.jsx("span",{className:"cursor-help",children:W(e.concurrency)})}):t.jsx(_e,{content:Sv,side:"bottom",children:t.jsx("span",{className:"cursor-help text-fg-subtle",children:"worker default"})})]})]})}),t.jsx(xe,{num:!0,align:"right",children:e.rateLimit?t.jsx(_e,{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:" / "}),On(e.rateLimit.durationMs)]})}):t.jsx(_e,{content:Sv,side:"bottom",children:t.jsx("span",{className:"cursor-help text-fg-subtle",children:"worker default"})})}),t.jsx(xe,{num:!0,align:"right",muted:!0,children:t.jsx(D_,{g:e,now:n})})]})}function D_({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 ${On(r)}`:"resuming…"})}return e.status==="maxed"&&e.since!==null?t.jsxs("span",{title:new Date(e.since).toLocaleTimeString(),children:["at cap for ",On(n-e.since)]}):e.status==="paused"&&e.since!==null?t.jsxs("span",{title:new Date(e.since).toLocaleTimeString(),children:["paused for ",On(n-e.since)]}):e.status==="waiting"?t.jsx("span",{children:"in rotation"}):t.jsx("span",{children:"–"})}function U_(){var $,Q,B,q,V;const{connectionId:e="",queue:n="",groupId:r=""}=Ln(),{isOperator:i}=xt(),[o,c]=N.useState(1),[d,h]=N.useState(25),m=h2(e,n,r,{page:o,pageSize:d}),g=dm(e,n),{isAdmin:p}=xt(),v=(($=hm(e,n,{page:1,pageSize:1}).data)==null?void 0:$.bullmqProApi)??!1,j=d2(e,n),[S,y]=Yi(),[b,k]=N.useState(S.get("confirm")==="drain"),C=re=>j.mutate({groupId:r,action:re},{onSuccess:()=>Y.success(`Group ${r} ${re==="pause"?"paused":re==="resume"?"resumed":"drained"}`),onError:ue=>Y.error(be(ue)),onSettled:()=>{re==="drain"&&(k(!1),S.has("confirm")&&y(ue=>(ue.delete("confirm"),ue),{replace:!0}))}}),O=v?void 0:"Needs BullMQ Pro's package installed next to Bullpane",[z,E]=N.useState(null),M=(re,ue)=>g.mutate({jobId:re,action:ue},{onSuccess:()=>Y.success(`Job ${re} ${ue==="remove"?"removed":ue}`),onError:qe=>Y.error(be(qe))}),T=(re,ue)=>ue==="remove"?E(re):M(re,ue);return t.jsxs(jt,{wide:!0,children:[t.jsx(ms,{title:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsxs(Re,{to:oe.groups(e,n),className:"inline-flex items-center gap-1 text-fg-muted hover:text-fg",children:[t.jsx(xu,{className:"size-4"})," Groups"]}),t.jsx("span",{className:"text-fg-subtle",children:"/"}),t.jsx(Fu,{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.`,actions:i&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(H,{size:"sm",variant:"secondary",leftIcon:t.jsx(Ha,{}),disabled:!v||j.isPending,title:O,onClick:()=>C("pause"),children:"Pause group"}),t.jsx(H,{size:"sm",variant:"secondary",leftIcon:t.jsx(Du,{}),disabled:!v||j.isPending,title:O,onClick:()=>C("resume"),children:"Resume group"}),p&&t.jsx(H,{size:"sm",variant:"danger",leftIcon:t.jsx(Jn,{}),disabled:!v||j.isPending,title:O,onClick:()=>k(!0),children:"Drain group"})]})}),t.jsxs("p",{className:"mb-3 text-xs text-fg-muted",children:["Pro keeps the group's delayed, failed and completed jobs in the queue's own states, not here:"," ",["delayed","failed","completed"].map((re,ue)=>t.jsxs("span",{children:[ue>0&&" · ",t.jsx(Re,{to:oe.queueGroup(e,n,r,re),className:"text-accent hover:underline",children:re})]},re))]}),m.data&&!v&&t.jsx(dj,{}),t.jsxs("div",{className:"card overflow-hidden",children:[t.jsx(Lf,{connectionId:e,queue:n,jobs:(Q=m.data)==null?void 0:Q.jobs,loading:m.isLoading,error:m.error,canOperate:i,onAction:T,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(Yu,{page:o,pageSize:d,total:((q=m.data)==null?void 0:q.total)??0,count:(V=m.data)==null?void 0:V.jobs.length,onPage:c,onPageSize:re=>(h(re),c(1))})})]}),t.jsx(Wt,{open:b&&v&&p,onClose:()=>k(!1),title:"Drain group",description:`Remove every waiting job of group ${r} in ${n} (BullMQ Pro's deleteGroup)? Its delayed jobs stay in the queue's delayed state. This cannot be undone.`,confirmText:"Drain group",danger:!0,loading:j.isPending,onConfirm:()=>C("drain")}),t.jsx(Wt,{open:z!==null,onClose:()=>E(null),title:"Remove job",description:`Remove job ${z??""} from ${n}? This cannot be undone.`,confirmText:"Remove",danger:!0,loading:g.isPending,onConfirm:()=>{z&&M(z,"remove"),E(null)}})]})}function hj({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),S=k=>`${k.connectionId} ${k.queueName}`;N.useEffect(()=>{e&&j(new Set(r.map(S)))},[e,r]);const y=k=>j(C=>{const O=new Set(C),z=S(k);return O.has(z)?O.delete(z):O.add(z),O}),b=g.trim().toLowerCase();return t.jsxs(Pn,{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[C,O]=k.split(" ");return{connectionId:C,queueName:O}})),children:"Save"})]}),children:[t.jsx(Ee,{leftIcon:t.jsx(Zn,{}),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:C})=>{const O=C.filter(z=>!b||z.name.toLowerCase().includes(b)).sort((z,E)=>z.name.localeCompare(E.name));return O.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),M=O.every(T=>E.has(S({connectionId:k.id,queueName:T.name})));return O.forEach(T=>M?E.delete(S({connectionId:k.id,queueName:T.name})):E.add(S({connectionId:k.id,queueName:T.name}))),E}),children:"toggle all"})]}),t.jsx("div",{className:"grid gap-1 sm:grid-cols-2",children:O.map(z=>{const E={connectionId:k.id,queueName:z.name};return t.jsx(jm,{label:z.name,checked:v.has(S(E)),onChange:()=>y(E),className:"rounded px-1.5 py-1 hover:bg-surface-2"},z.name)})})]},k.id)})]})]})}const Iu=["#5b8def","#3fb950","#d29922","#f85149","#a371f7","#39c5bb","#f778ba","#9aa3ad"];function Q_(){const{has:e}=bt();return e("folders")?t.jsx(B_,{}):t.jsx(Ka,{feature:"folders"})}function B_(){const{isOperator:e}=xt(),n=Xr(),[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(jt,{children:t.jsx(nl,{})}):t.jsxs(jt,{children:[t.jsx(ms,{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(zg,{}),onClick:()=>c({parentId:null}),children:"New folder"})}),d.length===0?t.jsx(an,{icon:t.jsx(nr,{}),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(zg,{}),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(Cv,{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(Cv,{folder:v,depth:1,selected:r===v.id,onSelect:()=>i(v.id)},v.id))]},p.id))}),t.jsx("div",{children:g?t.jsx(V_,{folder:g,allFolders:d,canEdit:e,onDeleted:()=>i(null)},g.id):t.jsx(an,{compact:!0,title:"Select a folder"})})]}),t.jsx(H_,{open:!!o,parentId:(o==null?void 0:o.parentId)??null,roots:h,onClose:()=>c(null),onCreated:p=>i(p.id)})]})}function Cv({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(nr,{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(Gn,{})})]})}function V_({folder:e,allFolders:n,canEdit:r,onDeleted:i}){var E;const o=_0(),c=k2(),d=P0(),{byConnection:h}=rl(),[m,g]=N.useState(!1),[p,v]=N.useState(e.name),[j,S]=N.useState(!1),[y,b]=N.useState(!1),k=n.filter(M=>M.parentId===e.id),C=()=>{const M=p.trim();if(!M||M===e.name){g(!1),v(e.name);return}o.mutate({id:e.id,input:{name:M}},{onSuccess:()=>g(!1),onError:T=>Y.error(be(T))})},O=M=>d.mutate({id:e.id,input:{queues:e.queues.filter(T=>!(T.connectionId===M.connectionId&&T.queueName===M.queueName))}},{onError:T=>Y.error(be(T))}),z=M=>{var T;return((T=h.find($=>$.connection.id===M))==null?void 0:T.connection.name)??M};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(nr,{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:M=>{M.preventDefault(),C()},children:[t.jsx(Ee,{autoFocus:!0,value:p,onChange:M=>v(M.target.value),className:"!h-8 max-w-xs","aria-label":"Folder name",onKeyDown:M=>M.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(Jr,{})}),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(zo,{})})]}),t.jsxs("p",{className:"text-xs text-fg-muted",children:[e.parentId?`Subfolder of ${((E=n.find(M=>M.id===e.parentId))==null?void 0:E.name)??"?"}`:"Top-level folder"," · ",e.queues.length," queues",k.length>0&&` · ${k.length} subfolders`]})]}),t.jsxs(Re,{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(rN,{className:"size-3.5","aria-hidden":!0})]}),r&&t.jsx(H,{size:"sm",variant:"ghost",className:"hover:text-danger",leftIcon:t.jsx(Jn,{}),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:[Iu.map(M=>t.jsx("button",{type:"button",role:"radio","aria-checked":e.color===M,"aria-label":M,className:F("size-5 rounded-full ring-offset-2 ring-offset-surface transition-shadow",e.color===M&&"ring-2 ring-fg"),style:{background:M},onClick:()=>o.mutate({id:e.id,input:{color:M}},{onError:T=>Y.error(be(T))})},M)),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:M=>Y.error(be(M))})})]})]}),!k.length&&t.jsx(ct,{label:"Parent",className:"!h-8 w-56",value:e.parentId??"",onChange:M=>o.mutate({id:e.id,input:{parentId:M.target.value||null}},{onError:T=>Y.error(be(T))}),options:[{value:"",label:"None (top level)"},...n.filter(M=>!M.parentId&&M.id!==e.id).map(M=>({value:M.id,label:M.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(Gn,{}),onClick:()=>S(!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(M=>t.jsxs("li",{className:"flex items-center gap-3 px-4 py-2 text-[13px]",children:[t.jsx(Re,{to:oe.queue(M.connectionId,M.queueName),className:"font-medium hover:underline",children:M.queueName}),t.jsx(je,{variant:"outline",size:"xs",children:z(M.connectionId)}),r&&t.jsx(H,{size:"icon-xs",variant:"ghost",className:"ml-auto hover:text-danger","aria-label":"Remove from folder",onClick:()=>O(M),children:t.jsx(gn,{})})]},`${M.connectionId}/${M.queueName}`))})]}),t.jsx(hj,{open:j,onClose:()=>S(!1),initial:e.queues,onSave:M=>d.mutate({id:e.id,input:{queues:M}},{onSuccess:()=>(S(!1),Y.success("Folder updated")),onError:T=>Y.error(be(T))}),saving:d.isPending}),t.jsx(Wt,{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(),Y.success("Folder deleted")),onError:M=>Y.error(be(M))})})]})}function H_({open:e,parentId:n,roots:r,onClose:i,onCreated:o}){const c=N2(),[d,h]=N.useState(""),[m,g]=N.useState(Iu[0]),[p,v]=N.useState(n??""),[j,S]=N.useState(null);N.useEffect(()=>v(n??""),[n,e]);const y=()=>{var k;const b=u0.safeParse({name:d.trim(),color:m,parentId:p||null});if(!b.success){S(((k=b.error.issues[0])==null?void 0:k.message)??"Invalid");return}c.mutate(b.data,{onSuccess:C=>{Y.success(`Folder "${C.name}" created`),o(C),i()},onError:C=>Y.error(be(C))})};return t.jsx(Pn,{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:Iu.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(ct,{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 K_=["waiting","active","completed","failed","delayed"];function W_(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 S of Object.keys(n))n[S]+=j.counts[S]??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:pv(e.map(j=>{var S;return(S=j.queue.metrics)==null?void 0:S.completed})),failedSeries:pv(e.map(j=>{var S;return(S=j.queue.metrics)==null?void 0:S.failed})),withMetrics:o,windowMinutes:c,skewedQueues:d}}function Z_({entries:e,className:n}){const r=N.useMemo(()=>W_(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. ${km}`:"";return t.jsxs("div",{className:F("grid gap-2 sm:grid-cols-3 xl:grid-cols-7",n),children:[K_.map(h=>{const m=it[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:ft(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(_e,{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(_e,{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?"—":Cn(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":`${Cn(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:it.completed.fg}}),t.jsx("span",{className:"h-full flex-1",style:{background:it.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:it.completed.fg},children:t.jsx(Ji,{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 G_(e){let n="";for(const r of e)r==="*"?n+=".*":r==="?"?n+=".":n+=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^${n}$`,"i")}function J_(e,n){const r=e.trim();if(!r)return!1;try{return G_(r).test(n)}catch{return!1}}const au="__any__";function X_({open:e,onClose:n,existing:r,onImport:i,saving:o}){const{byConnection:c}=rl(),[d,h]=N.useState(""),[m,g]=N.useState(au),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:C}of c)if(!(m!==au&&k.id!==m))for(const O of C){if(!J_(y,O.name))continue;const z={connectionId:k.id,queueName:O.name};b.push({ref:z,connectionName:k.name,already:p.has(`${k.id} ${O.name}`)})}return b.sort((k,C)=>k.ref.queueName.localeCompare(C.ref.queueName))},[d,m,c,p]),j=v.filter(y=>!y.already),S=()=>{i([...r,...j.map(y=>y.ref)])};return t.jsx(Pn,{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(Nf,{}),loading:o,disabled:j.length===0,onClick:S,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(ct,{label:"Connection",value:m,onChange:y=>g(y.target.value),options:[{value:au,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!==au&&" 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(je,{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(Va,{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 Y_({open:e,onClose:n,folder:r,allFolders:i}){const o=_0(),[c,d]=N.useState(r.name),[h,m]=N.useState(r.color),[g,p]=N.useState(r.parentId??""),[v,j]=N.useState(null),S=i.some(k=>k.parentId===r.id),y=i.filter(k=>!k.parentId&&k.id!==r.id),b=()=>{var C;const k=wk.safeParse({name:c.trim(),color:h,parentId:g||null});if(!k.success){j(((C=k.error.issues[0])==null?void 0:C.message)??"Invalid");return}o.mutate({id:r.id,input:k.data},{onSuccess:()=>{Y.success("Folder updated"),n()},onError:O=>Y.error(be(O))})};return t.jsx(Pn,{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:[Iu.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(ct,{label:"Parent folder",value:g,disabled:S,onChange:k=>p(k.target.value),options:[{value:"",label:"None (top level)"},...y.map(k=>({value:k.id,label:k.name}))],hint:S?"This folder has subfolders, so it must stay top-level.":"Folders nest one level deep."})]})})}function e3(){const{has:e}=bt();return e("folders")?t.jsx(t3,{}):t.jsx(Ka,{feature:"folders"})}function t3(){const{folderId:e=""}=Ln(),{isOperator:n}=xt(),{has:r,gate:i}=bt(),o=Xr(),{byConnection:c,isLoading:d}=rl(),h=P0(),[m,g]=N.useState(null),{sort:p,setSort:v,filter:j,setFilter:S}=Nm(`folder.${e}`,Mm,Rm),y=o.data??[],b=y.find($=>$.id===e)??null,{entries:k,missing:C}=N.useMemo(()=>{const $=[],Q=[];for(const B of(b==null?void 0:b.queues)??[]){const q=c.find(re=>re.connection.id===B.connectionId),V=q==null?void 0:q.queues.find(re=>re.name===B.queueName);q&&V?$.push({connection:q.connection,queue:V}):Q.push(B)}return{entries:$,missing:Q}},[b,c]),O=N.useMemo(()=>k.filter($=>wm($,j)),[k,j]),z=($,Q,B=!0)=>{b&&h.mutate({id:b.id,input:{queues:$}},{onSuccess:()=>{Y.success(Q),B&&g(null)},onError:q=>Y.error(be(q))})},E=$=>z(((b==null?void 0:b.queues)??[]).filter(Q=>!(Q.connectionId===$.connectionId&&Q.queueName===$.queueName)),`${$.queueName} removed from ${(b==null?void 0:b.name)??"folder"}`,!1);if(o.isLoading)return t.jsx(jt,{wide:!0,children:t.jsx(nl,{})});if(!b)return t.jsx(jt,{wide:!0,children:t.jsx(an,{icon:t.jsx(nr,{}),title:"Folder not found",description:"It may have been deleted.",action:t.jsx(Re,{to:oe.folders,className:"text-accent hover:underline",children:"Back to folders"})})});const M=b.parentId?y.find($=>$.id===b.parentId):null,T=b.queues.length===0;return t.jsxs(jt,{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:[M&&t.jsxs(t.Fragment,{children:[t.jsx(Re,{to:`/folders/${encodeURIComponent(M.id)}`,className:"hover:underline",children:M.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"]}),C.length>0&&t.jsxs("span",{className:"text-state-waiting",title:C.map($=>$.queueName).join(", "),children:["· ",W(C.length)," not found"]}),t.jsx("span",{className:"text-fg-subtle",children:"·"}),t.jsx(Re,{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(zo,{}),onClick:()=>g("edit"),children:"Edit"}),n&&t.jsx(H,{size:"sm",variant:"secondary",leftIcon:t.jsx(Nf,{}),onClick:()=>g("import"),title:"Import queues matching a pattern",children:"Import matching"}),n&&t.jsx(H,{size:"sm",variant:"primary",leftIcon:t.jsx(Gn,{}),onClick:()=>g("add"),children:"Add queue"}),t.jsx(H,{size:"sm",leftIcon:t.jsx(el,{}),onClick:()=>i("alerts",()=>g("alert")),title:"Alert on every queue in this folder",children:"Create alert"})]})]}),t.jsx(Z_,{entries:k,className:"mb-4"}),T?t.jsx("div",{className:"card",children:t.jsx(an,{icon:t.jsx(nr,{}),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(Gn,{}),onClick:()=>g("add"),children:"Add queue"}),t.jsx(H,{leftIcon:t.jsx(Nf,{}),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(Em,{value:j,onChange:S,"aria-label":"Filter queues in this folder"}),t.jsxs("span",{className:"num whitespace-nowrap text-xs text-fg-subtle",children:[O.length," of ",k.length]})]})]}),d&&k.length===0?t.jsx(Pm,{}):O.length>0?t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:"repeat(auto-fill, minmax(230px, 1fr))"},children:O.map($=>t.jsx(n3,{entry:$,onRemove:n?()=>E({connectionId:$.connection.id,queueName:$.queue.name}):void 0,removing:h.isPending},Ia($)))}):null,t.jsx("div",{className:"card overflow-hidden",children:t.jsx(Tm,{rows:O,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."})}),C.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:C.map($=>{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:$.queueName}),t.jsx(je,{variant:"outline",size:"xs",children:((Q=c.find(B=>B.connection.id===$.connectionId))==null?void 0:Q.connection.name)??$.connectionId}),n&&t.jsx(H,{size:"icon-xs",variant:"ghost",className:"hover:text-danger","aria-label":`Remove ${$.queueName}`,onClick:()=>E($),children:t.jsx(gn,{})})]},`${$.connectionId}/${$.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(Y_,{open:!0,onClose:()=>g(null),folder:b,allFolders:y}),n&&t.jsx(hj,{open:m==="add",onClose:()=>g(null),initial:b.queues,saving:h.isPending,onSave:$=>z($,"Folder updated"),title:`Add queues to ${b.name}`}),n&&t.jsx(X_,{open:m==="import",onClose:()=>g(null),existing:b.queues,saving:h.isPending,onImport:$=>z($,`Imported into ${b.name}`)}),m==="alert"&&r("alerts")&&t.jsx(ed,{open:!0,onClose:()=>g(null),alert:null,initialScope:{type:"folder",folderId:b.id}})]})}function n3({entry:e,onRemove:n,removing:r}){return t.jsxs("div",{className:"group/card relative",children:[t.jsx(Xu,{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 Ff={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 s3(){const{has:e}=bt();return e("users")?t.jsx(p0,{role:"admin",children:t.jsx(r3,{})}):t.jsx(Ka,{feature:"users"})}function r3(){const{user:e}=xt(),n=R2(),r=T2(),[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),Y.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=>Y.error(be(j))});return t.jsxs(jt,{children:[t.jsx(ms,{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(qN,{}),onClick:()=>o(!0),children:"Invite user"})}),t.jsx("div",{className:"card overflow-hidden",children:t.jsxs(ds,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(pe,{children:"Name"}),t.jsx(pe,{children:"Email"}),t.jsx(pe,{className:"w-40",children:"Role"}),t.jsx(pe,{children:"Created"}),t.jsx(pe,{children:"Last login"}),t.jsx(pe,{align:"right",children:t.jsx("span",{className:"sr-only",children:"Actions"})})]})}),t.jsxs("tbody",{children:[n.isLoading&&t.jsx(vt,{colSpan:6,children:t.jsx(Dt,{label:"Loading users…"})}),n.isError&&t.jsx(vt,{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,S=p.role==="admin"&&!j&&m<=1,y=v?"You cannot disable your own account":S?"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(xe,{className:"font-medium",children:[t.jsx("span",{className:F(j&&"line-through decoration-fg-subtle"),children:p.name}),v&&t.jsx(je,{variant:"outline",size:"xs",className:"ml-1.5",children:"you"}),j&&t.jsx(_e,{content:t.jsxs(t.Fragment,{children:["Disabled ",t.jsx(Zt,{value:p.disabledAt,withAbsolute:!0}),". Cannot sign in; sessions revoked."]}),side:"bottom",children:t.jsx(je,{variant:"neutral",size:"xs",className:"ml-1.5",children:"disabled"})})]}),t.jsx(xe,{muted:!0,children:p.email}),t.jsx(xe,{children:t.jsx(_e,{content:v?"Ask another admin to change your role":S?"Promote someone else to admin first":Ff[p.role],block:!0,children:t.jsx(ct,{"aria-label":`Role of ${p.name}`,className:"!h-7 text-xs",value:p.role,disabled:v||S||j||b,onChange:C=>r.mutate({id:p.id,input:{role:C.target.value}},{onSuccess:()=>Y.success(`${p.name} is now ${C.target.value}`),onError:O=>Y.error(be(O))}),options:Pu.map(C=>({value:C,label:C}))})})}),t.jsx(xe,{muted:!0,children:t.jsx(Zt,{value:p.createdAt})}),t.jsx(xe,{muted:!0,children:t.jsx(Zt,{value:p.lastLoginAt,emptyText:"never"})}),t.jsx(xe,{align:"right",children:j?t.jsx(_e,{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(TN,{}),"aria-label":`Re-enable ${p.name}`,loading:b,onClick:()=>g(p,!1),children:"Enable"})}):t.jsx(_e,{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(IN,{})})})})]},p.id)})]})]})}),t.jsx("div",{className:"mt-4 grid gap-2 text-xs text-fg-muted sm:grid-cols-3",children:Pu.map(p=>t.jsxs("div",{className:"card p-3",children:[t.jsx(je,{variant:p==="admin"?"pro":p==="operator"?"info":"neutral",className:"mb-1.5",children:p}),t.jsx("p",{children:Ff[p]})]},p))}),t.jsx(a3,{open:i,onClose:()=>o(!1)}),t.jsx(Wt,{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 _v(){const e="ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789",n=new Uint8Array(16);return crypto.getRandomValues(n),Array.from(n,r=>e[r%e.length]).join("")}function a3({open:e,onClose:n}){const r=M2(),{has:i}=bt(),o=i("sso"),[c,d]=N.useState({name:"",email:"",role:"viewer",password:_v()}),[h,m]=N.useState(!1),[g,p]=N.useState({}),v=S=>y=>d(b=>({...b,[S]:y.target.value})),j=()=>{const S={name:c.name.trim(),email:c.email.trim(),role:c.role,...h?{}:{password:c.password}},y=pk.safeParse(S);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=>{Y.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=>Y.error(be(b))})};return t.jsx(Pn,{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:S=>{S.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(ct,{label:"Role",value:c.role,onChange:v("role"),options:Pu.map(S=>({value:S,label:S})),hint:Ff[c.role]}),o&&t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx(Gi,{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(S=>({...S,password:_v()})),children:t.jsx(nm,{})})]})]})})}const i3=50,l3=new Set(Mk);function o3(){const{has:e}=bt();return e("audit")?t.jsx(p0,{role:"admin",children:t.jsx(u3,{})}):t.jsx(Ka,{feature:"audit"})}function c3(){const[e,n]=Yi();return[N.useMemo(()=>{const c=e.get("action"),d=e.get("result");return{actorId:e.get("actorId")||void 0,action:c&&om.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 Pv=(e,n)=>e?new Date(`${e}T${n?"23:59:59.999":"00:00:00.000"}Z`).toISOString():void 0,Ev=e=>e?e.slice(0,10):"";function u3(){var v;const[e,n,r]=c3(),i=fs(),o=I2(),c=q2(e,i3),[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 S,y;return((y=(S=i.data)==null?void 0:S.find(b=>b.id===j))==null?void 0:y.name)??null};return t.jsxs(jt,{wide:!0,children:[t.jsx(ms,{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:$2(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(mN,{"aria-hidden":!0}),"Export CSV"]})]})}),t.jsxs("div",{className:"card mb-3 flex flex-wrap items-end gap-2 p-3",children:[t.jsx(ct,{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(ct,{label:"Action",className:"!h-7 w-52 text-xs",value:e.action??"",onChange:j=>n({action:j.target.value}),options:[{value:"",label:"Any action"},...om.map(j=>({value:j,label:`${cm[j]} (${j})`}))]}),t.jsx(ct,{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(ct,{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:Ev(e.from),onChange:j=>n({from:Pv(j.target.value,!1)})}),t.jsx(Ee,{label:"To",type:"date",className:"!h-7 w-36 text-xs",value:Ev(e.to),onChange:j=>n({to:Pv(j.target.value,!0)})}),e.jobId&&t.jsxs(je,{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(ds,{dense:!0,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(pe,{className:"w-8"}),t.jsx(pe,{className:"w-32",children:"When"}),t.jsx(pe,{className:"w-56",children:"Who"}),t.jsx(pe,{className:"w-56",children:"Action"}),t.jsx(pe,{children:"Target"}),t.jsx(pe,{className:"w-28",children:"Result"}),t.jsx(pe,{className:"w-32",children:"IP"})]})}),t.jsxs("tbody",{children:[c.isLoading&&t.jsx(vt,{colSpan:7,children:t.jsx(Dt,{label:"Loading the audit log…"})}),c.isError&&t.jsx(vt,{colSpan:7,className:"text-danger",children:be(c.error)}),!c.isLoading&&!c.isError&&m.length===0&&t.jsx(vt,{colSpan:7,children:t.jsx(an,{compact:!0,icon:t.jsx(Oo,{}),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(d3,{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 d3({entry:e,open:n,onToggle:r,connectionStillExists:i}){var h;const o=l3.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(xe,{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(hs,{className:"size-3.5"}):t.jsx(Fn,{className:"size-3.5"})}):null}),t.jsx(xe,{muted:!0,children:t.jsx(Zt,{value:e.createdAt})}),t.jsx(xe,{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(je,{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(_e,{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(xe,{children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[o&&t.jsx(sm,{className:"size-3.5 shrink-0 text-warning","aria-label":"High-risk action"}),t.jsx("span",{className:F(o&&"font-medium"),children:cm[e.action]}),t.jsx(_e,{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(xe,{children:t.jsx(h3,{entry:e,connectionStillExists:i})}),t.jsx(xe,{children:c?t.jsx(_e,{content:e.errorMessage??"The action was refused or failed",children:t.jsx(je,{variant:"danger",size:"xs",className:"cursor-help",children:"refused"})}):t.jsx(je,{variant:"success",size:"xs",children:"ok"})}),t.jsx(xe,{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(ij,{value:e.detail,defaultExpandDepth:3}):t.jsx("span",{className:"text-fg-subtle",children:"no parameters recorded"})})]})})})]})}function h3({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(Re,{to:oe.connection(e.connectionId),className:"text-accent hover:underline",children:r}):t.jsx(_e,{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(Re,{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(Re,{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 f3(){const{has:e}=bt();return e("alerts")?t.jsx(m3,{}):t.jsx(p3,{})}function m3(){const r=(fm().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(Re,{to:oe.alerts,className:"inline-flex text-xs text-accent hover:underline",children:"Manage rules →"})]})}function p3(){const{isAdmin:e}=xt(),n=C0(),r=w2(),[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=Nk.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:()=>Y.success("Attention thresholds saved"),onError:v=>Y.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(Re,{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)??Ru.waitingAbove)),d(String((h==null?void 0:h.failedAbove)??Ru.failedAbove))},children:"Cancel"})]}):t.jsx("p",{className:"text-xs text-fg-subtle",children:"Only an administrator can change these."})]})}const uu={host:"localhost",port:"6379",username:"",password:"",db:"0",tls:!1};function x3(e){try{const n=new URL(e);if(n.protocol!=="redis:"&&n.protocol!=="rediss:")return{...uu};const r=Mv(n.password);return{host:n.hostname||uu.host,port:n.port||(n.protocol==="rediss:"?"6380":"6379"),username:Mv(n.username),password:r==="****"?"":r,db:n.pathname.replace(/^\//,"")||"0",tls:n.protocol==="rediss:"}}catch{return{...uu}}}function Rv(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 g3(e,n){return e.host!==n.host||e.port!==n.port||e.username!==n.username||e.db!==n.db||e.tls!==n.tls}function Mv(e){try{return decodeURIComponent(e)}catch{return e}}function v3(){var v;const{isAdmin:e}=xt(),{demo:n}=bt(),r=fs(),i=v2(),[o,c]=Yi(),[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(S=>S.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(Gn,{}),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(ds,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(pe,{children:"Name"}),t.jsx(pe,{children:"URL"}),t.jsx(pe,{children:"Prefix / schema"}),t.jsx(pe,{children:"Filter"}),t.jsx(pe,{children:"Status"}),t.jsx(pe,{children:"Added"}),t.jsx(pe,{align:"right",children:t.jsx("span",{className:"sr-only",children:"Actions"})})]})}),t.jsxs("tbody",{children:[r.isLoading&&t.jsx(vt,{colSpan:7,children:t.jsx(Dt,{})}),r.data&&p.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:7,children:t.jsx(an,{compact:!0,icon:t.jsx(Ba,{}),title:"No connections",description:e?"Add your first Redis or Postgres connection.":"Ask an admin to add one."})})}),p.map(j=>{var S;return t.jsxs("tr",{children:[t.jsxs(xe,{className:"font-medium",children:[t.jsx(Re,{to:oe.connection(j.id),className:"hover:underline",children:j.name}),j.kind==="postgres"&&t.jsx(je,{variant:"outline",size:"xs",className:"ml-1.5",children:"postgres"}),j.cluster&&t.jsx(je,{variant:"outline",size:"xs",className:"ml-1.5",children:"cluster"})]}),t.jsx(xe,{mono:!0,muted:!0,className:"max-w-xs truncate",title:j.url,children:j.url}),t.jsx(xe,{mono:!0,children:j.prefix}),t.jsx(xe,{mono:!0,muted:!0,children:j.queueFilter??"–"}),t.jsxs(xe,{children:[t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Wu,{status:j.status,withLabel:!0,pulse:!0}),((S=j.status)==null?void 0:S.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(xe,{muted:!0,children:t.jsx(Zt,{value:j.createdAt})}),t.jsx(xe,{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(zo,{})}),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(Jn,{})})]})})]},j.id)})]})]})}),d&&t.jsx(y3,{open:!0,onClose:()=>h(null),connection:d.connection},((v=d.connection)==null?void 0:v.id)??"new"),t.jsx(Wt,{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),Y.success("Connection removed")),onError:j=>Y.error(be(j))})})]})}function y3({open:e,onClose:n,connection:r}){const i=x2(),o=g2(),c=y2(),[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,S]=N.useState("fields"),y=r?x3(r.url):uu,[b,k]=N.useState(y),C=(q,V)=>{h(re=>({...re,[q]:V})),v(null)},O=d.kind==="postgres",z=q=>{h(V=>({...V,kind:q,url:q==="postgres"?V.url.startsWith("redis")?"":V.url:V.url||"redis://localhost:6379",prefix:V.prefix===lu[V.kind]||!V.prefix?lu[q]:V.prefix,cluster:q==="postgres"?!1:V.cluster})),g({}),v(null)},E=(q,V)=>{k(re=>({...re,[q]:V})),v(null)},M=()=>j==="url"||O?d.url.trim():r&&!b.password&&!g3(b,y)?"":Rv(b),T=()=>{const q=M(),V={name:d.name.trim(),kind:d.kind,url:q,prefix:d.prefix.trim()||lu[d.kind],cluster:d.cluster,queueFilter:d.queueFilter.trim()||null};r&&!V.url&&(V.url=r.url);const re=vk.safeParse(V);if(!re.success){const ue={};for(const qe of re.error.issues)ue[String(qe.path[0])]=qe.message;return g(ue),null}return g({}),re.data},$=()=>{const q=T();if(!q)return;const V=re=>{Y.success(`Connection "${re.name}" saved`),n()};if(r){const re={name:q.name,prefix:q.prefix,cluster:q.cluster,queueFilter:q.queueFilter};M()&&(re.url=q.url),o.mutate({id:r.id,input:re},{onSuccess:V,onError:ue=>Y.error(be(ue))})}else i.mutate(q,{onSuccess:V,onError:re=>Y.error(be(re))})},Q=()=>{const q=M();if(!q){g({url:r?j==="url"||O?"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:V=>v({ok:!1,error:be(V)})})},B=i.isPending||o.isPending;return t.jsx(Pn,{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(Ly,{}),onClick:Q,loading:c.isPending,children:"Test connection"}),t.jsx(H,{variant:"primary",size:"sm",onClick:$,loading:B,children:r?"Save":"Add connection"})]}),children:t.jsxs("form",{className:"space-y-3",onSubmit:q=>{q.preventDefault(),$()},children:[t.jsx(Ee,{label:"Name",autoFocus:!0,value:d.name,onChange:q=>C("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:O?"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))})]}),O?t.jsx(Ee,{label:"Postgres URL",mono:!0,value:d.url,onChange:q=>C("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:()=>(S(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=>C("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(Gi,{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:M()?Rv({...b,password:b.password?"****":""}):`${(r==null?void 0:r.url)??""} (unchanged)`})]})]}),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[O?t.jsx(Ee,{label:"Schema",mono:!0,value:d.prefix,onChange:q=>C("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=>C("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=>C("queueFilter",q.target.value),error:m.queueFilter,placeholder:"payments-*",hint:"Glob over queue names; limits discovery."})]}),!O&&t.jsx(jm,{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=>C("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(tm,{className:"mt-px size-4 shrink-0"}):t.jsx(Ty,{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&&` · ${O?"Postgres":"Redis"} ${p.redisVersion}`,p.queuesFound!=null&&` · ${p.queuesFound} queues found`]}):t.jsxs(t.Fragment,{children:["Failed: ",p.error??"unknown error"]})})]})]})})}const Tv={active:{label:"active",variant:"success"},grace:{label:"grace period",variant:"warning"},expired:{label:"expired",variant:"danger"},invalid:{label:"invalid",variant:"danger"}};function j3(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 b3(){const{isAdmin:e,setEdition:n}=xt(),{edition:r,isPro:i,demo:o,pricing:c,checkoutUrl:d,has:h}=bt(),m=O2(),g=L2(),p=A2(),[v,j]=N.useState(""),[S,y]=N.useState(null),[b,k]=N.useState(!1),C=()=>{const T=v.trim();if(!T){y("Paste the license key");return}y(null),m.mutate(T,{onSuccess:$=>{n($),j(""),Y.success("Pro unlocked",$.license?`Licensed to ${$.license.licensee}`:void 0)},onError:$=>{sr($)&&($.body.error==="invalid_license"||$.body.error==="license_already_activated"||$.body.error==="license_server_unavailable")?y($.body.message||"This key is not valid"):y(be($))}})},O=()=>p.mutate(void 0,{onSuccess:T=>{var Q,B,q,V;n(T);const $=(Q=T.license)==null?void 0:Q.status;$==="active"?Y.success("License verified",`Lease renewed until ${xn((B=T.license)==null?void 0:B.leaseExpiresAt)}`):$==="grace"?Y.error("Could not reach bullpane.com",((q=T.license)==null?void 0:q.lastCheckError)??void 0):Y.error("License not valid",((V=T.license)==null?void 0:V.lastCheckError)??void 0)},onError:T=>Y.error(be(T))}),z=r.license,E=z?j3(z):null,M=(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(Qu,{className:"size-5 text-pro"}):t.jsx(ho,{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(pm,{})]}),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."})]}),M&&e&&!o&&t.jsx(H,{variant:"outline",size:"sm",leftIcon:t.jsx(nm,{}),onClick:O,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:M?"Plan":"Issued"}),t.jsx("dd",{className:"text-fg",children:M?"Subscription":Mu(z.issuedAt)})]}),t.jsxs("div",{children:[t.jsx("dt",{className:"text-[10px] tracking-wide text-fg-subtle uppercase",children:M?"Paid until":"Expires"}),t.jsxs("dd",{className:"text-fg",children:[z.expiresAt?Mu(z.expiresAt):M?"Renews automatically":"Never"," ",t.jsx(je,{variant:Tv[z.status].variant,size:"xs",className:"ml-1",children:Tv[z.status].label})]})]}),M&&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?Zr(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:lm.map(T=>t.jsxs("li",{className:"flex items-start gap-2 rounded-md border border-border p-2.5 text-xs",children:[h(T)?t.jsx(Jr,{className:"mt-px size-4 shrink-0 text-success"}):t.jsx(ho,{className:"mt-px size-4 shrink-0 text-fg-subtle"}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-fg",children:xo[T].title}),t.jsx("p",{className:"text-fg-muted",children:xo[T].tagline})]})]},T))})]})]}),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(tl,{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(Zi,{mono:!0,rows:3,value:v,onChange:T=>j(T.target.value),placeholder:"BULLPANE-XXXX-XXXX-XXXX",error:S,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:C,loading:m.isPending,disabled:o,children:"Activate"}),z&&!o&&t.jsx(H,{variant:"ghost",size:"sm",className:"hover:text-danger",leftIcon:t.jsx(Jn,{}),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(Hr,{className:"size-3.5"})]})]})]}),t.jsx(Wt,{open:b,onClose:()=>k(!1),title:"Remove license",description:M?"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:T=>{n(T),k(!1),Y.success("License removed")},onError:T=>Y.error(be(T))})})]})}function w3(){const e=e2(),{edition:n,checkoutUrl:r}=bt();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(xm,{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(gu,{})})]}),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?vo(e.data.uptime):e.isError?"unknown":t.jsx(gu,{})})]}),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(Hr,{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(Hr,{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(Hr,{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 N3={oidc:"OIDC",saml:"SAML 2.0"};function k3(){const{has:e}=bt();return e("sso")?t.jsx(S3,{}):t.jsx(Ka,{feature:"sso"})}function du({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)},()=>Y.error("Could not copy to the clipboard"))},children:r?t.jsx(Jr,{className:"size-3 text-success"}):t.jsx(Iy,{className:"size-3"})})]})}function S3(){var k;const e=D2(),n=R0(),r=M0(),i=Q2(),o=B2(),c=V2(),[d,h]=N.useState(!1),[m,g]=N.useState(null),[p,v]=N.useState({}),j=e.data??[],S=j.filter(C=>C.enabled).length,y=((k=n.data)==null?void 0:k.requireSso)??!1,b=async C=>{try{const O=await c.mutateAsync(C.id);v(z=>({...z,[C.id]:O}))}catch(O){v(z=>({...z,[C.id]:{ok:!1,message:be(O)}}))}};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(Gn,{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(Qu,{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(C=>{const O=p[C.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:C.name}),t.jsx(je,{variant:"neutral",children:N3[C.kind]}),!C.enabled&&t.jsx(je,{variant:"warning",children:"disabled"}),C.kind==="oidc"&&!C.hasSecret&&t.jsx(je,{variant:"danger",children:"no client secret"})]}),t.jsx("p",{className:"mt-1 truncate text-xs text-fg-muted",children:C.kind==="oidc"?String(C.config.issuer??""):String(C.config.entryPoint??"")})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(Gi,{checked:C.enabled,label:"Enabled",onChange:z=>{i.mutate({id:C.id,input:{enabled:z}},{onError:E=>Y.error(be(E))})}}),t.jsx(H,{size:"sm",variant:"secondary",leftIcon:t.jsx(Ly,{className:"size-3.5"}),loading:c.isPending&&c.variables===C.id,onClick:()=>void b(C),children:"Test"}),t.jsx(H,{size:"icon-sm",variant:"ghost","aria-label":"Delete provider",onClick:()=>g(C),children:t.jsx(Jn,{className:"size-3.5"})})]})]}),t.jsx("div",{className:"mt-3 space-y-1.5 border-t border-border pt-3",children:C.kind==="oidc"?t.jsx(du,{label:"Redirect URI",value:C.callbackUrl}):t.jsxs(t.Fragment,{children:[t.jsx(du,{label:"ACS URL",value:C.callbackUrl}),C.entityId&&t.jsx(du,{label:"Entity ID",value:C.entityId})]})}),O&&t.jsxs("div",{className:`mt-3 rounded-md border px-3 py-2 text-xs ${O.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:[O.ok?t.jsx(Jr,{className:"size-3.5"}):t.jsx(gn,{className:"size-3.5"}),O.message]}),O.details&&t.jsx("dl",{className:"mt-2 space-y-0.5 text-fg-muted",children:Object.entries(O.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))})]})]},C.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(Gi,{checked:y,disabled:n.isLoading||r.isPending,onChange:C=>{r.mutate({requireSso:C},{onSuccess:()=>Y.success(C?"SSO is now required":"Password sign-in is available again"),onError:O=>Y.error(be(O))})}})]}),y&&S===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(C3,{}),d&&t.jsx(_3,{onClose:()=>h(!1)}),t.jsx(Wt,{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:()=>{Y.success(`Deleted ${m.name}`),g(null)},onError:C=>{Y.error(be(C)),g(null)}})}})]})}function C3(){var p,v;const e=R0(),n=M0(),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!==""),S=[];for(const y of j){const b=r0.safeParse(y);if(!b.success){h(`"${y}" is not a domain. Use something like example.com.`);return}S.push(b.data)}n.mutate({autoProvisionDomains:S},{onSuccess:()=>{c(null),Y.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(Gi,{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:()=>Y.success(j?"New SSO users from your domains now get a viewer account":"SSO accounts must be invited again"),onError:S=>Y.error(be(S))})}})]}),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 _3({onClose:e}){const n=U2(),[r,i]=N.useState("oidc"),[o,c]=N.useState(""),[d,h]=N.useState(""),[m,g]=N.useState(""),[p,v]=N.useState(""),[j,S]=N.useState(""),[y,b]=N.useState(""),[k,C]=N.useState(""),[O,z]=N.useState(""),[E,M]=N.useState(""),[T,$]=N.useState(null),Q=()=>{var V;$(null);const B=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:O.trim(),...E.trim()?{emailAttribute:E.trim()}:{}}},q=xk.safeParse(B);if(!q.success){$(((V=q.error.issues[0])==null?void 0:V.message)??"Check the fields above");return}n.mutate(q.data,{onSuccess:re=>{Y.success(`Added ${re.name}. Enter the redirect URI at your IdP, then use Test.`),e()},onError:re=>$(be(re))})};return t.jsx(Pn,{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(ct,{label:"Protocol",value:r,onChange:B=>i(B.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:B=>c(B.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:B=>h(B.target.value),required:!0}),t.jsx(Ee,{label:"Client ID",value:m,onChange:B=>g(B.target.value),required:!0}),t.jsx(Ee,{label:"Client secret",type:"password",hint:"Stored encrypted and never shown again.",value:p,onChange:B=>v(B.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:B=>S(B.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:B=>b(B.target.value),required:!0}),t.jsx(Ee,{label:"IdP entity ID",placeholder:"https://idp.example.com/metadata",value:k,onChange:B=>C(B.target.value),required:!0}),t.jsx(Zi,{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:O,onChange:B=>z(B.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:B=>M(B.target.value)})]}),T&&t.jsx("p",{role:"alert",className:"rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-xs text-danger",children:T})]})})}const qv=[{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 P3(){const{has:e}=bt();return e("mcp")?t.jsx(E3,{}):t.jsx(Ka,{feature:"mcp"})}function E3(){var S;const{isAdmin:e}=xt(),n=H2(),r=K2(),[i,o]=N.useState(!1),c=W2(e&&i),d=Z2(),[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(ct,{label:"Most a client can do on this install",value:g,disabled:!e||r.isPending,onChange:y=>r.mutate({maxAccess:y.target.value},{onSuccess:()=>Y.success("MCP access updated. It applies to connected clients on their next call."),onError:b=>Y.error(be(b))}),options:qv.map(y=>({value:y.value,label:y.label})),hint:e?(S=qv.find(y=>y.value===g))==null?void 0:S.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(du,{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(Ry,{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(je,{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 ",Zr(y.createdAt)," · ",y.lastUsedAt?`last used ${Zr(y.lastUsedAt)}`:"not used yet"]})]}),t.jsx(H,{size:"sm",variant:"ghost",leftIcon:t.jsx(rm,{className:"size-3.5"}),onClick:()=>m(y),children:"Disconnect"})]},y.id))})]}),t.jsx(Wt,{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:()=>{Y.success(`${h.clientName} disconnected`),m(null)},onError:y=>Y.error(be(y))})})]})}const R3=["connections","attention","sso","mcp","license","about"];function M3(){const{tab:e}=Ln(),n=ln();if(!e||!R3.includes(e))return t.jsx(Kr,{to:"/settings/connections",replace:!0});const r=e;return t.jsxs(jt,{children:[t.jsx(ms,{title:"Settings"}),t.jsx(Im,{"aria-label":"Settings sections",className:"mb-5",value:r,onChange:i=>n(`/settings/${i}`),items:[{value:"connections",label:"Connections",icon:t.jsx(Ba,{className:"size-3.5"})},{value:"attention",label:"Attention",icon:t.jsx(Xn,{className:"size-3.5"})},{value:"sso",label:"SSO",icon:t.jsx(Qu,{className:"size-3.5"})},{value:"mcp",label:"MCP",icon:t.jsx(Ry,{className:"size-3.5"})},{value:"license",label:"License",icon:t.jsx(tl,{className:"size-3.5"})},{value:"about",label:"About",icon:t.jsx(Va,{className:"size-3.5"})}]}),r==="connections"&&t.jsx(v3,{}),r==="attention"&&t.jsx(f3,{}),r==="sso"&&t.jsx(k3,{}),r==="mcp"&&t.jsx(P3,{}),r==="license"&&t.jsx(b3,{}),r==="about"&&t.jsx(w3,{})]})}const T3=[{label:"Any time",ms:0},{label:"Next hour",ms:36e5},{label:"Next 24 hours",ms:864e5},{label:"Next 7 days",ms:6048e5}];function q3(){var r;const e=fs();if(e.isLoading)return t.jsx(jt,{children:t.jsx(Dt,{label:"Loading…"})});const n=(r=e.data)==null?void 0:r[0];return n?t.jsx(Kr,{to:oe.schedulers(n.id),replace:!0}):t.jsx(jt,{children:t.jsx(an,{icon:t.jsx(Io,{}),title:"No connections",description:"Add a Redis connection first; schedulers are listed per connection."})})}function I3(){var p;const{connectionId:e}=Ln(),n=fs(),r=ln(),[i,o]=N.useState(""),[c,d]=N.useState(0),h=m2(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(jt,{children:[t.jsx(ms,{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(ct,{"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(Zn,{className:"size-3.5"}),className:"w-full sm:w-80"}),t.jsx(ct,{"aria-label":"Next run within",value:String(c),onChange:v=>d(Number(v.target.value)),children:T3.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(ds,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(pe,{children:"Queue"}),t.jsx(pe,{children:"Scheduler"}),t.jsx(pe,{children:"Job name"}),t.jsx(pe,{children:"Repeats"}),t.jsx(pe,{align:"right",children:"Next run"})]})}),t.jsxs("tbody",{children:[h.isLoading&&t.jsx(vt,{colSpan:5,children:t.jsx(Dt,{label:"Reading schedulers…"})}),h.isError&&!g&&t.jsx(vt,{colSpan:5,className:"text-danger",children:be(h.error)}),g&&m.length===0&&t.jsx(vt,{colSpan:5,children:t.jsx(z3,{filtered:!!i.trim()||c>0,total:g.total})}),m.map(v=>t.jsx($3,{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 $3({s:e,connectionId:n}){const r=e.next!=null&&e.next<=Date.now();return t.jsxs(il,{children:[t.jsx(xe,{children:t.jsx(Re,{to:oe.queueSchedulers(n,e.queueName),className:"text-accent hover:underline",children:e.queueName})}),t.jsx(xe,{mono:!0,children:t.jsx("span",{className:"text-fg",title:e.key,children:e.key})}),t.jsx(xe,{mono:!0,muted:!0,children:e.name}),t.jsx(xe,{children:t.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[t.jsx(je,{variant:"outline",size:"xs",className:"font-mono",children:nj(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(xe,{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(qy,{className:"size-3","aria-hidden":!0}),Zr(e.next)]})})]})}function z3({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(Io,{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(Fy,{className:"size-3","aria-hidden":!0}),"Create one with ",t.jsx("span",{className:"font-mono",children:"queue.upsertJobScheduler()"}),"."]})]})}function O3(){return t.jsx(jt,{children:t.jsx(an,{icon:t.jsx(dN,{}),title:"Page not found",description:"The link may be stale, or the queue or connection was removed.",action:t.jsx(Re,{to:"/",className:"text-accent hover:underline",children:"Back to overview"})})})}const A3=N.lazy(()=>$u(()=>import("./FlowsPage-CE4Fl11b.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.FlowsPage}))),L3=N.lazy(()=>$u(()=>import("./FlowsPage-CE4Fl11b.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.FlowsIndexPage}))),F3=N.lazy(()=>$u(()=>import("./McpConsentPage-CmZMfyo4.js"),[]).then(e=>({default:e.McpConsentPage}))),D3=N.lazy(()=>$u(()=>import("./JobTreePage-CxJzFwh9.js"),__vite__mapDeps([3,1,2])).then(e=>({default:e.JobTreePage})));function iu({children:e}){return t.jsx(N.Suspense,{fallback:t.jsx(nl,{}),children:e})}const U3=new Zw({defaultOptions:{queries:{retry:(e,n)=>sr(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 Q3(){return t.jsx(bw,{client:U3,children:t.jsx(pw,{children:t.jsxs(Dk,{children:[t.jsxs(iw,{children:[t.jsx(ot,{path:"/login",element:t.jsx(Xg,{children:t.jsx(wS,{})})}),t.jsx(ot,{path:"/setup",element:t.jsx(Xg,{children:t.jsx(NS,{})})}),t.jsx(ot,{path:"/oauth/consent",element:t.jsx(iu,{children:t.jsx(F3,{})})}),t.jsx(ot,{element:t.jsx(Uk,{}),children:t.jsxs(ot,{element:t.jsx(bS,{}),children:[t.jsx(ot,{index:!0,element:t.jsx(nC,{})}),t.jsx(ot,{path:"c/:connectionId",element:t.jsx(rC,{})}),t.jsx(ot,{path:"c/:connectionId/q/:queue",element:t.jsx(Gh,{})}),t.jsx(ot,{path:"c/:connectionId/q/:queue/metrics",element:t.jsx(Gh,{view:"metrics"})}),t.jsx(ot,{path:"c/:connectionId/q/:queue/schedulers",element:t.jsx(Gh,{view:"schedulers"})}),t.jsx(ot,{path:"c/:connectionId/q/:queue/groups",element:t.jsx(O_,{})}),t.jsx(ot,{path:"c/:connectionId/q/:queue/groups/:groupId",element:t.jsx(U_,{})}),t.jsx(ot,{path:"c/:connectionId/q/:queue/j/:jobId",element:t.jsx(R_,{})}),t.jsx(ot,{path:"c/:connectionId/q/:queue/j/:jobId/tree",element:t.jsx(iu,{children:t.jsx(D3,{})})}),t.jsx(ot,{path:"health",element:t.jsx(fC,{})}),t.jsx(ot,{path:"schedulers",element:t.jsx(q3,{})}),t.jsx(ot,{path:"schedulers/:connectionId",element:t.jsx(I3,{})}),t.jsx(ot,{path:"folders",element:t.jsx(Q_,{})}),t.jsx(ot,{path:"folders/:folderId",element:t.jsx(e3,{})}),t.jsx(ot,{path:"alerts",element:t.jsx(g_,{})}),t.jsx(ot,{path:"users",element:t.jsx(s3,{})}),t.jsx(ot,{path:"audit",element:t.jsx(o3,{})}),t.jsxs(t.Fragment,{children:[t.jsx(ot,{path:"flows",element:t.jsx(iu,{children:t.jsx(L3,{})})}),t.jsx(ot,{path:"flows/:connectionId",element:t.jsx(iu,{children:t.jsx(A3,{})})})]}),t.jsx(ot,{path:"settings",element:t.jsx(Kr,{to:"/settings/connections",replace:!0})}),t.jsx(ot,{path:"settings/:tab",element:t.jsx(M3,{})}),t.jsx(ot,{path:"*",element:t.jsx(O3,{})})]})})]}),t.jsx(Kk,{}),t.jsx(Fk,{})]})})})}pb.createRoot(document.getElementById("root")).render(t.jsx(N.StrictMode,{children:t.jsx(Q3,{})}));export{L0 as A,H as B,Xn as C,Pn as D,an as E,G3 as F,J3 as G,Ry as H,Va as I,H3 as J,ms as K,Ka as L,vN as M,Kr as N,Ju as O,jt as P,Oy as Q,nm as R,Dt as S,Jn as T,IS as U,Zr as V,$N as W,Uf as X,ab as Y,cb as Z,fs as a,Ln as b,ae as c,ln as d,xt as e,N as f,K3 as g,W3 as h,Z3 as i,t as j,ct as k,W as l,Gn as m,be as n,je as o,Re as p,Hr as q,oe as r,it as s,Y as t,bt as u,F as v,Ee as w,ft as x,Yi as y,An as z};