@agent-deck/backend 1.2.10 → 1.3.1
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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/cli-runtime.d.ts +62 -0
- package/dist/cli-runtime.d.ts.map +1 -1
- package/dist/cli-runtime.js +120 -0
- package/dist/cli-runtime.js.map +1 -1
- package/dist/export-import/export-bundle.d.ts +9 -0
- package/dist/export-import/export-bundle.d.ts.map +1 -0
- package/dist/export-import/export-bundle.js +78 -0
- package/dist/export-import/export-bundle.js.map +1 -0
- package/dist/export-import/import-bundle.d.ts +8 -0
- package/dist/export-import/import-bundle.d.ts.map +1 -0
- package/dist/export-import/import-bundle.js +267 -0
- package/dist/export-import/import-bundle.js.map +1 -0
- package/dist/export-import/index.d.ts +4 -0
- package/dist/export-import/index.d.ts.map +1 -0
- package/dist/export-import/index.js +15 -0
- package/dist/export-import/index.js.map +1 -0
- package/dist/export-import/sanitize-for-export.d.ts +8 -0
- package/dist/export-import/sanitize-for-export.d.ts.map +1 -0
- package/dist/export-import/sanitize-for-export.js +75 -0
- package/dist/export-import/sanitize-for-export.js.map +1 -0
- package/dist/mcp-server.d.ts +3 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +22 -644
- package/dist/mcp-server.js.map +1 -1
- package/dist/mcp-tools/deck-card-ops.d.ts +21 -0
- package/dist/mcp-tools/deck-card-ops.d.ts.map +1 -0
- package/dist/mcp-tools/deck-card-ops.js +94 -0
- package/dist/mcp-tools/deck-card-ops.js.map +1 -0
- package/dist/mcp-tools/profile.d.ts +17 -0
- package/dist/mcp-tools/profile.d.ts.map +1 -0
- package/dist/mcp-tools/profile.js +25 -0
- package/dist/mcp-tools/profile.js.map +1 -0
- package/dist/mcp-tools/register.d.ts +49 -0
- package/dist/mcp-tools/register.d.ts.map +1 -0
- package/dist/mcp-tools/register.js +635 -0
- package/dist/mcp-tools/register.js.map +1 -0
- package/dist/mcp-tools/test-harness.d.ts +31 -0
- package/dist/mcp-tools/test-harness.d.ts.map +1 -0
- package/dist/mcp-tools/test-harness.js +108 -0
- package/dist/mcp-tools/test-harness.js.map +1 -0
- package/dist/models/database.d.ts +8 -0
- package/dist/models/database.d.ts.map +1 -1
- package/dist/models/database.js +151 -67
- package/dist/models/database.js.map +1 -1
- package/dist/routes/export-import.d.ts +3 -0
- package/dist/routes/export-import.d.ts.map +1 -0
- package/dist/routes/export-import.js +52 -0
- package/dist/routes/export-import.js.map +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -0
- package/dist/server/index.js.map +1 -1
- package/package.json +2 -2
- package/static-ui/assets/index-BkYGH65z.js +420 -0
- package/static-ui/assets/index-DMYIwycS.css +1 -0
- package/static-ui/index.html +2 -2
- package/static-ui/assets/index-CQoBRW1p.js +0 -409
- package/static-ui/assets/index-wleyGzod.css +0 -1
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
var Xj=Object.defineProperty;var n0=e=>{throw TypeError(e)};var e$=(e,t,r)=>t in e?Xj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Dn=(e,t,r)=>e$(e,typeof t!="symbol"?t+"":t,r),Kf=(e,t,r)=>t.has(e)||n0("Cannot "+r);var R=(e,t,r)=>(Kf(e,t,"read from private field"),r?r.call(e):t.get(e)),ge=(e,t,r)=>t.has(e)?n0("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),re=(e,t,r,n)=>(Kf(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ne=(e,t,r)=>(Kf(e,t,"access private method"),r);var Pc=(e,t,r,n)=>({set _(s){re(e,t,s,r)},get _(){return R(e,t,n)}});function t$(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(n,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function r(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(s){if(s.ep)return;s.ep=!0;const o=r(s);fetch(s.href,o)}})();function Bd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kb={exports:{}},Wd={},Cb={exports:{}},Re={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var nc=Symbol.for("react.element"),r$=Symbol.for("react.portal"),n$=Symbol.for("react.fragment"),s$=Symbol.for("react.strict_mode"),o$=Symbol.for("react.profiler"),i$=Symbol.for("react.provider"),a$=Symbol.for("react.context"),l$=Symbol.for("react.forward_ref"),c$=Symbol.for("react.suspense"),u$=Symbol.for("react.memo"),d$=Symbol.for("react.lazy"),s0=Symbol.iterator;function f$(e){return e===null||typeof e!="object"?null:(e=s0&&e[s0]||e["@@iterator"],typeof e=="function"?e:null)}var Eb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Nb=Object.assign,jb={};function ba(e,t,r){this.props=e,this.context=t,this.refs=jb,this.updater=r||Eb}ba.prototype.isReactComponent={};ba.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};ba.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function $b(){}$b.prototype=ba.prototype;function rg(e,t,r){this.props=e,this.context=t,this.refs=jb,this.updater=r||Eb}var ng=rg.prototype=new $b;ng.constructor=rg;Nb(ng,ba.prototype);ng.isPureReactComponent=!0;var o0=Array.isArray,Pb=Object.prototype.hasOwnProperty,sg={current:null},Tb={key:!0,ref:!0,__self:!0,__source:!0};function Rb(e,t,r){var n,s={},o=null,i=null;if(t!=null)for(n in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)Pb.call(t,n)&&!Tb.hasOwnProperty(n)&&(s[n]=t[n]);var l=arguments.length-2;if(l===1)s.children=r;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}if(e&&e.defaultProps)for(n in l=e.defaultProps,l)s[n]===void 0&&(s[n]=l[n]);return{$$typeof:nc,type:e,key:o,ref:i,props:s,_owner:sg.current}}function h$(e,t){return{$$typeof:nc,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function og(e){return typeof e=="object"&&e!==null&&e.$$typeof===nc}function p$(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var i0=/\/+/g;function Bf(e,t){return typeof e=="object"&&e!==null&&e.key!=null?p$(""+e.key):t.toString(36)}function gu(e,t,r,n,s){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(o){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case nc:case r$:i=!0}}if(i)return i=e,s=s(i),e=n===""?"."+Bf(i,0):n,o0(s)?(r="",e!=null&&(r=e.replace(i0,"$&/")+"/"),gu(s,t,r,"",function(u){return u})):s!=null&&(og(s)&&(s=h$(s,r+(!s.key||i&&i.key===s.key?"":(""+s.key).replace(i0,"$&/")+"/")+e)),t.push(s)),1;if(i=0,n=n===""?".":n+":",o0(e))for(var l=0;l<e.length;l++){o=e[l];var c=n+Bf(o,l);i+=gu(o,t,r,c,s)}else if(c=f$(e),typeof c=="function")for(e=c.call(e),l=0;!(o=e.next()).done;)o=o.value,c=n+Bf(o,l++),i+=gu(o,t,r,c,s);else if(o==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return i}function Tc(e,t,r){if(e==null)return e;var n=[],s=0;return gu(e,n,"","",function(o){return t.call(r,o,s++)}),n}function m$(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var sr={current:null},vu={transition:null},g$={ReactCurrentDispatcher:sr,ReactCurrentBatchConfig:vu,ReactCurrentOwner:sg};function Ib(){throw Error("act(...) is not supported in production builds of React.")}Re.Children={map:Tc,forEach:function(e,t,r){Tc(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return Tc(e,function(){t++}),t},toArray:function(e){return Tc(e,function(t){return t})||[]},only:function(e){if(!og(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Re.Component=ba;Re.Fragment=n$;Re.Profiler=o$;Re.PureComponent=rg;Re.StrictMode=s$;Re.Suspense=c$;Re.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=g$;Re.act=Ib;Re.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=Nb({},e.props),s=e.key,o=e.ref,i=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,i=sg.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)Pb.call(t,c)&&!Tb.hasOwnProperty(c)&&(n[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)n.children=r;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];n.children=l}return{$$typeof:nc,type:e.type,key:s,ref:o,props:n,_owner:i}};Re.createContext=function(e){return e={$$typeof:a$,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:i$,_context:e},e.Consumer=e};Re.createElement=Rb;Re.createFactory=function(e){var t=Rb.bind(null,e);return t.type=e,t};Re.createRef=function(){return{current:null}};Re.forwardRef=function(e){return{$$typeof:l$,render:e}};Re.isValidElement=og;Re.lazy=function(e){return{$$typeof:d$,_payload:{_status:-1,_result:e},_init:m$}};Re.memo=function(e,t){return{$$typeof:u$,type:e,compare:t===void 0?null:t}};Re.startTransition=function(e){var t=vu.transition;vu.transition={};try{e()}finally{vu.transition=t}};Re.unstable_act=Ib;Re.useCallback=function(e,t){return sr.current.useCallback(e,t)};Re.useContext=function(e){return sr.current.useContext(e)};Re.useDebugValue=function(){};Re.useDeferredValue=function(e){return sr.current.useDeferredValue(e)};Re.useEffect=function(e,t){return sr.current.useEffect(e,t)};Re.useId=function(){return sr.current.useId()};Re.useImperativeHandle=function(e,t,r){return sr.current.useImperativeHandle(e,t,r)};Re.useInsertionEffect=function(e,t){return sr.current.useInsertionEffect(e,t)};Re.useLayoutEffect=function(e,t){return sr.current.useLayoutEffect(e,t)};Re.useMemo=function(e,t){return sr.current.useMemo(e,t)};Re.useReducer=function(e,t,r){return sr.current.useReducer(e,t,r)};Re.useRef=function(e){return sr.current.useRef(e)};Re.useState=function(e){return sr.current.useState(e)};Re.useSyncExternalStore=function(e,t,r){return sr.current.useSyncExternalStore(e,t,r)};Re.useTransition=function(){return sr.current.useTransition()};Re.version="18.3.1";Cb.exports=Re;var y=Cb.exports;const vn=Bd(y),ig=t$({__proto__:null,default:vn},[y]);/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var v$=y,y$=Symbol.for("react.element"),w$=Symbol.for("react.fragment"),x$=Object.prototype.hasOwnProperty,b$=v$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,_$={key:!0,ref:!0,__self:!0,__source:!0};function Ab(e,t,r){var n,s={},o=null,i=null;r!==void 0&&(o=""+r),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(i=t.ref);for(n in t)x$.call(t,n)&&!_$.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)s[n]===void 0&&(s[n]=t[n]);return{$$typeof:y$,type:e,key:o,ref:i,props:s,_owner:b$.current}}Wd.Fragment=w$;Wd.jsx=Ab;Wd.jsxs=Ab;kb.exports=Wd;var a=kb.exports,Ob={exports:{}},Er={},Mb={exports:{}},Db={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/(function(e){function t(F,V){var D=F.length;F.push(V);e:for(;0<D;){var T=D-1>>>1,q=F[T];if(0<s(q,V))F[T]=V,F[D]=q,D=T;else break e}}function r(F){return F.length===0?null:F[0]}function n(F){if(F.length===0)return null;var V=F[0],D=F.pop();if(D!==V){F[0]=D;e:for(var T=0,q=F.length,j=q>>>1;T<j;){var S=2*(T+1)-1,N=F[S],M=S+1,H=F[M];if(0>s(N,D))M<q&&0>s(H,N)?(F[T]=H,F[M]=D,T=M):(F[T]=N,F[S]=D,T=S);else if(M<q&&0>s(H,D))F[T]=H,F[M]=D,T=M;else break e}}return V}function s(F,V){var D=F.sortIndex-V.sortIndex;return D!==0?D:F.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var c=[],u=[],d=1,f=null,g=3,v=!1,b=!1,h=!1,w=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(F){for(var V=r(u);V!==null;){if(V.callback===null)n(u);else if(V.startTime<=F)n(u),V.sortIndex=V.expirationTime,t(c,V);else break;V=r(u)}}function _(F){if(h=!1,x(F),!b)if(r(c)!==null)b=!0,Z(C);else{var V=r(u);V!==null&&W(_,V.startTime-F)}}function C(F,V){b=!1,h&&(h=!1,p(I),I=-1),v=!0;var D=g;try{for(x(V),f=r(c);f!==null&&(!(f.expirationTime>V)||F&&!P());){var T=f.callback;if(typeof T=="function"){f.callback=null,g=f.priorityLevel;var q=T(f.expirationTime<=V);V=e.unstable_now(),typeof q=="function"?f.callback=q:f===r(c)&&n(c),x(V)}else n(c);f=r(c)}if(f!==null)var j=!0;else{var S=r(u);S!==null&&W(_,S.startTime-V),j=!1}return j}finally{f=null,g=D,v=!1}}var $=!1,k=null,I=-1,E=5,U=-1;function P(){return!(e.unstable_now()-U<E)}function O(){if(k!==null){var F=e.unstable_now();U=F;var V=!0;try{V=k(!0,F)}finally{V?L():($=!1,k=null)}}else $=!1}var L;if(typeof m=="function")L=function(){m(O)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,K=z.port2;z.port1.onmessage=O,L=function(){K.postMessage(null)}}else L=function(){w(O,0)};function Z(F){k=F,$||($=!0,L())}function W(F,V){I=w(function(){F(e.unstable_now())},V)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(F){F.callback=null},e.unstable_continueExecution=function(){b||v||(b=!0,Z(C))},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):E=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return r(c)},e.unstable_next=function(F){switch(g){case 1:case 2:case 3:var V=3;break;default:V=g}var D=g;g=V;try{return F()}finally{g=D}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(F,V){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var D=g;g=F;try{return V()}finally{g=D}},e.unstable_scheduleCallback=function(F,V,D){var T=e.unstable_now();switch(typeof D=="object"&&D!==null?(D=D.delay,D=typeof D=="number"&&0<D?T+D:T):D=T,F){case 1:var q=-1;break;case 2:q=250;break;case 5:q=1073741823;break;case 4:q=1e4;break;default:q=5e3}return q=D+q,F={id:d++,callback:V,priorityLevel:F,startTime:D,expirationTime:q,sortIndex:-1},D>T?(F.sortIndex=D,t(u,F),r(c)===null&&F===r(u)&&(h?(p(I),I=-1):h=!0,W(_,D-T))):(F.sortIndex=q,t(c,F),b||v||(b=!0,Z(C))),F},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(F){var V=g;return function(){var D=g;g=V;try{return F.apply(this,arguments)}finally{g=D}}}})(Db);Mb.exports=Db;var S$=Mb.exports;/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var k$=y,Cr=S$;function J(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var zb=new Set,$l={};function Xo(e,t){oa(e,t),oa(e+"Capture",t)}function oa(e,t){for($l[e]=t,e=0;e<t.length;e++)zb.add(t[e])}var ts=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Jh=Object.prototype.hasOwnProperty,C$=/^[: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]*$/,a0={},l0={};function E$(e){return Jh.call(l0,e)?!0:Jh.call(a0,e)?!1:C$.test(e)?l0[e]=!0:(a0[e]=!0,!1)}function N$(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function j$(e,t,r,n){if(t===null||typeof t>"u"||N$(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function or(e,t,r,n,s,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=s,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var Lt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Lt[e]=new or(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Lt[t]=new or(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Lt[e]=new or(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Lt[e]=new or(e,2,!1,e,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(e){Lt[e]=new or(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Lt[e]=new or(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Lt[e]=new or(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Lt[e]=new or(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Lt[e]=new or(e,5,!1,e.toLowerCase(),null,!1,!1)});var ag=/[\-:]([a-z])/g;function lg(e){return e[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(e){var t=e.replace(ag,lg);Lt[t]=new or(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ag,lg);Lt[t]=new or(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ag,lg);Lt[t]=new or(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Lt[e]=new or(e,1,!1,e.toLowerCase(),null,!1,!1)});Lt.xlinkHref=new or("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Lt[e]=new or(e,1,!1,e.toLowerCase(),null,!0,!0)});function cg(e,t,r,n){var s=Lt.hasOwnProperty(t)?Lt[t]:null;(s!==null?s.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(j$(t,r,s,n)&&(r=null),n||s===null?E$(t)&&(r===null?e.removeAttribute(t):e.setAttribute(t,""+r)):s.mustUseProperty?e[s.propertyName]=r===null?s.type===3?!1:"":r:(t=s.attributeName,n=s.attributeNamespace,r===null?e.removeAttribute(t):(s=s.type,r=s===3||s===4&&r===!0?"":""+r,n?e.setAttributeNS(n,t,r):e.setAttribute(t,r))))}var ls=k$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Rc=Symbol.for("react.element"),yi=Symbol.for("react.portal"),wi=Symbol.for("react.fragment"),ug=Symbol.for("react.strict_mode"),Yh=Symbol.for("react.profiler"),Lb=Symbol.for("react.provider"),Fb=Symbol.for("react.context"),dg=Symbol.for("react.forward_ref"),Xh=Symbol.for("react.suspense"),ep=Symbol.for("react.suspense_list"),fg=Symbol.for("react.memo"),xs=Symbol.for("react.lazy"),Ub=Symbol.for("react.offscreen"),c0=Symbol.iterator;function za(e){return e===null||typeof e!="object"?null:(e=c0&&e[c0]||e["@@iterator"],typeof e=="function"?e:null)}var ft=Object.assign,Wf;function Ya(e){if(Wf===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);Wf=t&&t[1]||""}return`
|
|
34
|
+
`+Wf+e}var Zf=!1;function Gf(e,t){if(!e||Zf)return"";Zf=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var n=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){n=u}e.call(t.prototype)}else{try{throw Error()}catch(u){n=u}e()}}catch(u){if(u&&n&&typeof u.stack=="string"){for(var s=u.stack.split(`
|
|
35
|
+
`),o=n.stack.split(`
|
|
36
|
+
`),i=s.length-1,l=o.length-1;1<=i&&0<=l&&s[i]!==o[l];)l--;for(;1<=i&&0<=l;i--,l--)if(s[i]!==o[l]){if(i!==1||l!==1)do if(i--,l--,0>l||s[i]!==o[l]){var c=`
|
|
37
|
+
`+s[i].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=i&&0<=l);break}}}finally{Zf=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Ya(e):""}function $$(e){switch(e.tag){case 5:return Ya(e.type);case 16:return Ya("Lazy");case 13:return Ya("Suspense");case 19:return Ya("SuspenseList");case 0:case 2:case 15:return e=Gf(e.type,!1),e;case 11:return e=Gf(e.type.render,!1),e;case 1:return e=Gf(e.type,!0),e;default:return""}}function tp(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case wi:return"Fragment";case yi:return"Portal";case Yh:return"Profiler";case ug:return"StrictMode";case Xh:return"Suspense";case ep:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Fb:return(e.displayName||"Context")+".Consumer";case Lb:return(e._context.displayName||"Context")+".Provider";case dg:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case fg:return t=e.displayName||null,t!==null?t:tp(e.type)||"Memo";case xs:t=e._payload,e=e._init;try{return tp(e(t))}catch{}}return null}function P$(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return tp(t);case 8:return t===ug?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ys(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function qb(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function T$(e){var t=qb(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,o=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(i){n=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(i){n=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ic(e){e._valueTracker||(e._valueTracker=T$(e))}function Vb(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=qb(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Ku(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function rp(e,t){var r=t.checked;return ft({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function u0(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=Ys(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Hb(e,t){t=t.checked,t!=null&&cg(e,"checked",t,!1)}function np(e,t){Hb(e,t);var r=Ys(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?sp(e,t.type,r):t.hasOwnProperty("defaultValue")&&sp(e,t.type,Ys(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function d0(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function sp(e,t,r){(t!=="number"||Ku(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Xa=Array.isArray;function Ii(e,t,r,n){if(e=e.options,t){t={};for(var s=0;s<r.length;s++)t["$"+r[s]]=!0;for(r=0;r<e.length;r++)s=t.hasOwnProperty("$"+e[r].value),e[r].selected!==s&&(e[r].selected=s),s&&n&&(e[r].defaultSelected=!0)}else{for(r=""+Ys(r),t=null,s=0;s<e.length;s++){if(e[s].value===r){e[s].selected=!0,n&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function op(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(J(91));return ft({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function f0(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(J(92));if(Xa(r)){if(1<r.length)throw Error(J(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:Ys(r)}}function Kb(e,t){var r=Ys(t.value),n=Ys(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),n!=null&&(e.defaultValue=""+n)}function h0(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Bb(e){switch(e){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 ip(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Bb(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Ac,Wb=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,n,s){MSApp.execUnsafeLocalFunction(function(){return e(t,r,n,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Ac=Ac||document.createElement("div"),Ac.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Ac.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Pl(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var ul={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},R$=["Webkit","ms","Moz","O"];Object.keys(ul).forEach(function(e){R$.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ul[t]=ul[e]})});function Zb(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||ul.hasOwnProperty(e)&&ul[e]?(""+t).trim():t+"px"}function Gb(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,s=Zb(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,s):e[r]=s}}var I$=ft({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 ap(e,t){if(t){if(I$[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(J(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(J(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(J(61))}if(t.style!=null&&typeof t.style!="object")throw Error(J(62))}}function lp(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 cp=null;function hg(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var up=null,Ai=null,Oi=null;function p0(e){if(e=ic(e)){if(typeof up!="function")throw Error(J(280));var t=e.stateNode;t&&(t=Yd(t),up(e.stateNode,e.type,t))}}function Qb(e){Ai?Oi?Oi.push(e):Oi=[e]:Ai=e}function Jb(){if(Ai){var e=Ai,t=Oi;if(Oi=Ai=null,p0(e),t)for(e=0;e<t.length;e++)p0(t[e])}}function Yb(e,t){return e(t)}function Xb(){}var Qf=!1;function e_(e,t,r){if(Qf)return e(t,r);Qf=!0;try{return Yb(e,t,r)}finally{Qf=!1,(Ai!==null||Oi!==null)&&(Xb(),Jb())}}function Tl(e,t){var r=e.stateNode;if(r===null)return null;var n=Yd(r);if(n===null)return null;r=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(J(231,t,typeof r));return r}var dp=!1;if(ts)try{var La={};Object.defineProperty(La,"passive",{get:function(){dp=!0}}),window.addEventListener("test",La,La),window.removeEventListener("test",La,La)}catch{dp=!1}function A$(e,t,r,n,s,o,i,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(r,u)}catch(d){this.onError(d)}}var dl=!1,Bu=null,Wu=!1,fp=null,O$={onError:function(e){dl=!0,Bu=e}};function M$(e,t,r,n,s,o,i,l,c){dl=!1,Bu=null,A$.apply(O$,arguments)}function D$(e,t,r,n,s,o,i,l,c){if(M$.apply(this,arguments),dl){if(dl){var u=Bu;dl=!1,Bu=null}else throw Error(J(198));Wu||(Wu=!0,fp=u)}}function ei(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function t_(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m0(e){if(ei(e)!==e)throw Error(J(188))}function z$(e){var t=e.alternate;if(!t){if(t=ei(e),t===null)throw Error(J(188));return t!==e?null:e}for(var r=e,n=t;;){var s=r.return;if(s===null)break;var o=s.alternate;if(o===null){if(n=s.return,n!==null){r=n;continue}break}if(s.child===o.child){for(o=s.child;o;){if(o===r)return m0(s),e;if(o===n)return m0(s),t;o=o.sibling}throw Error(J(188))}if(r.return!==n.return)r=s,n=o;else{for(var i=!1,l=s.child;l;){if(l===r){i=!0,r=s,n=o;break}if(l===n){i=!0,n=s,r=o;break}l=l.sibling}if(!i){for(l=o.child;l;){if(l===r){i=!0,r=o,n=s;break}if(l===n){i=!0,n=o,r=s;break}l=l.sibling}if(!i)throw Error(J(189))}}if(r.alternate!==n)throw Error(J(190))}if(r.tag!==3)throw Error(J(188));return r.stateNode.current===r?e:t}function r_(e){return e=z$(e),e!==null?n_(e):null}function n_(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=n_(e);if(t!==null)return t;e=e.sibling}return null}var s_=Cr.unstable_scheduleCallback,g0=Cr.unstable_cancelCallback,L$=Cr.unstable_shouldYield,F$=Cr.unstable_requestPaint,xt=Cr.unstable_now,U$=Cr.unstable_getCurrentPriorityLevel,pg=Cr.unstable_ImmediatePriority,o_=Cr.unstable_UserBlockingPriority,Zu=Cr.unstable_NormalPriority,q$=Cr.unstable_LowPriority,i_=Cr.unstable_IdlePriority,Zd=null,$n=null;function V$(e){if($n&&typeof $n.onCommitFiberRoot=="function")try{$n.onCommitFiberRoot(Zd,e,void 0,(e.current.flags&128)===128)}catch{}}var on=Math.clz32?Math.clz32:B$,H$=Math.log,K$=Math.LN2;function B$(e){return e>>>=0,e===0?32:31-(H$(e)/K$|0)|0}var Oc=64,Mc=4194304;function el(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Gu(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,s=e.suspendedLanes,o=e.pingedLanes,i=r&268435455;if(i!==0){var l=i&~s;l!==0?n=el(l):(o&=i,o!==0&&(n=el(o)))}else i=r&~s,i!==0?n=el(i):o!==0&&(n=el(o));if(n===0)return 0;if(t!==0&&t!==n&&!(t&s)&&(s=n&-n,o=t&-t,s>=o||s===16&&(o&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0<t;)r=31-on(t),s=1<<r,n|=e[r],t&=~s;return n}function W$(e,t){switch(e){case 1:case 2:case 4:return t+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 t+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 Z$(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,s=e.expirationTimes,o=e.pendingLanes;0<o;){var i=31-on(o),l=1<<i,c=s[i];c===-1?(!(l&r)||l&n)&&(s[i]=W$(l,t)):c<=t&&(e.expiredLanes|=l),o&=~l}}function hp(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function a_(){var e=Oc;return Oc<<=1,!(Oc&4194240)&&(Oc=64),e}function Jf(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function sc(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-on(t),e[t]=r}function G$(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0<r;){var s=31-on(r),o=1<<s;t[s]=0,n[s]=-1,e[s]=-1,r&=~o}}function mg(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-on(r),s=1<<n;s&t|e[n]&t&&(e[n]|=t),r&=~s}}var Ke=0;function l_(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var c_,gg,u_,d_,f_,pp=!1,Dc=[],Us=null,qs=null,Vs=null,Rl=new Map,Il=new Map,Cs=[],Q$="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 v0(e,t){switch(e){case"focusin":case"focusout":Us=null;break;case"dragenter":case"dragleave":qs=null;break;case"mouseover":case"mouseout":Vs=null;break;case"pointerover":case"pointerout":Rl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Il.delete(t.pointerId)}}function Fa(e,t,r,n,s,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:o,targetContainers:[s]},t!==null&&(t=ic(t),t!==null&&gg(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function J$(e,t,r,n,s){switch(t){case"focusin":return Us=Fa(Us,e,t,r,n,s),!0;case"dragenter":return qs=Fa(qs,e,t,r,n,s),!0;case"mouseover":return Vs=Fa(Vs,e,t,r,n,s),!0;case"pointerover":var o=s.pointerId;return Rl.set(o,Fa(Rl.get(o)||null,e,t,r,n,s)),!0;case"gotpointercapture":return o=s.pointerId,Il.set(o,Fa(Il.get(o)||null,e,t,r,n,s)),!0}return!1}function h_(e){var t=Co(e.target);if(t!==null){var r=ei(t);if(r!==null){if(t=r.tag,t===13){if(t=t_(r),t!==null){e.blockedOn=t,f_(e.priority,function(){u_(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function yu(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=mp(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);cp=n,r.target.dispatchEvent(n),cp=null}else return t=ic(r),t!==null&&gg(t),e.blockedOn=r,!1;t.shift()}return!0}function y0(e,t,r){yu(e)&&r.delete(t)}function Y$(){pp=!1,Us!==null&&yu(Us)&&(Us=null),qs!==null&&yu(qs)&&(qs=null),Vs!==null&&yu(Vs)&&(Vs=null),Rl.forEach(y0),Il.forEach(y0)}function Ua(e,t){e.blockedOn===t&&(e.blockedOn=null,pp||(pp=!0,Cr.unstable_scheduleCallback(Cr.unstable_NormalPriority,Y$)))}function Al(e){function t(s){return Ua(s,e)}if(0<Dc.length){Ua(Dc[0],e);for(var r=1;r<Dc.length;r++){var n=Dc[r];n.blockedOn===e&&(n.blockedOn=null)}}for(Us!==null&&Ua(Us,e),qs!==null&&Ua(qs,e),Vs!==null&&Ua(Vs,e),Rl.forEach(t),Il.forEach(t),r=0;r<Cs.length;r++)n=Cs[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<Cs.length&&(r=Cs[0],r.blockedOn===null);)h_(r),r.blockedOn===null&&Cs.shift()}var Mi=ls.ReactCurrentBatchConfig,Qu=!0;function X$(e,t,r,n){var s=Ke,o=Mi.transition;Mi.transition=null;try{Ke=1,vg(e,t,r,n)}finally{Ke=s,Mi.transition=o}}function eP(e,t,r,n){var s=Ke,o=Mi.transition;Mi.transition=null;try{Ke=4,vg(e,t,r,n)}finally{Ke=s,Mi.transition=o}}function vg(e,t,r,n){if(Qu){var s=mp(e,t,r,n);if(s===null)ah(e,t,n,Ju,r),v0(e,n);else if(J$(s,e,t,r,n))n.stopPropagation();else if(v0(e,n),t&4&&-1<Q$.indexOf(e)){for(;s!==null;){var o=ic(s);if(o!==null&&c_(o),o=mp(e,t,r,n),o===null&&ah(e,t,n,Ju,r),o===s)break;s=o}s!==null&&n.stopPropagation()}else ah(e,t,n,null,r)}}var Ju=null;function mp(e,t,r,n){if(Ju=null,e=hg(n),e=Co(e),e!==null)if(t=ei(e),t===null)e=null;else if(r=t.tag,r===13){if(e=t_(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Ju=e,null}function p_(e){switch(e){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(U$()){case pg:return 1;case o_:return 4;case Zu:case q$:return 16;case i_:return 536870912;default:return 16}default:return 16}}var Ds=null,yg=null,wu=null;function m_(){if(wu)return wu;var e,t=yg,r=t.length,n,s="value"in Ds?Ds.value:Ds.textContent,o=s.length;for(e=0;e<r&&t[e]===s[e];e++);var i=r-e;for(n=1;n<=i&&t[r-n]===s[o-n];n++);return wu=s.slice(e,1<n?1-n:void 0)}function xu(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function zc(){return!0}function w0(){return!1}function Nr(e){function t(r,n,s,o,i){this._reactName=r,this._targetInst=s,this.type=n,this.nativeEvent=o,this.target=i,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(r=e[l],this[l]=r?r(o):o[l]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?zc:w0,this.isPropagationStopped=w0,this}return ft(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=zc)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=zc)},persist:function(){},isPersistent:zc}),t}var _a={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wg=Nr(_a),oc=ft({},_a,{view:0,detail:0}),tP=Nr(oc),Yf,Xf,qa,Gd=ft({},oc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xg,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==qa&&(qa&&e.type==="mousemove"?(Yf=e.screenX-qa.screenX,Xf=e.screenY-qa.screenY):Xf=Yf=0,qa=e),Yf)},movementY:function(e){return"movementY"in e?e.movementY:Xf}}),x0=Nr(Gd),rP=ft({},Gd,{dataTransfer:0}),nP=Nr(rP),sP=ft({},oc,{relatedTarget:0}),eh=Nr(sP),oP=ft({},_a,{animationName:0,elapsedTime:0,pseudoElement:0}),iP=Nr(oP),aP=ft({},_a,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),lP=Nr(aP),cP=ft({},_a,{data:0}),b0=Nr(cP),uP={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},dP={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"},fP={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function hP(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=fP[e])?!!t[e]:!1}function xg(){return hP}var pP=ft({},oc,{key:function(e){if(e.key){var t=uP[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=xu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?dP[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xg,charCode:function(e){return e.type==="keypress"?xu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?xu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),mP=Nr(pP),gP=ft({},Gd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_0=Nr(gP),vP=ft({},oc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xg}),yP=Nr(vP),wP=ft({},_a,{propertyName:0,elapsedTime:0,pseudoElement:0}),xP=Nr(wP),bP=ft({},Gd,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),_P=Nr(bP),SP=[9,13,27,32],bg=ts&&"CompositionEvent"in window,fl=null;ts&&"documentMode"in document&&(fl=document.documentMode);var kP=ts&&"TextEvent"in window&&!fl,g_=ts&&(!bg||fl&&8<fl&&11>=fl),S0=" ",k0=!1;function v_(e,t){switch(e){case"keyup":return SP.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function y_(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var xi=!1;function CP(e,t){switch(e){case"compositionend":return y_(t);case"keypress":return t.which!==32?null:(k0=!0,S0);case"textInput":return e=t.data,e===S0&&k0?null:e;default:return null}}function EP(e,t){if(xi)return e==="compositionend"||!bg&&v_(e,t)?(e=m_(),wu=yg=Ds=null,xi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return g_&&t.locale!=="ko"?null:t.data;default:return null}}var NP={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 C0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!NP[e.type]:t==="textarea"}function w_(e,t,r,n){Qb(n),t=Yu(t,"onChange"),0<t.length&&(r=new wg("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var hl=null,Ol=null;function jP(e){P_(e,0)}function Qd(e){var t=Si(e);if(Vb(t))return e}function $P(e,t){if(e==="change")return t}var x_=!1;if(ts){var th;if(ts){var rh="oninput"in document;if(!rh){var E0=document.createElement("div");E0.setAttribute("oninput","return;"),rh=typeof E0.oninput=="function"}th=rh}else th=!1;x_=th&&(!document.documentMode||9<document.documentMode)}function N0(){hl&&(hl.detachEvent("onpropertychange",b_),Ol=hl=null)}function b_(e){if(e.propertyName==="value"&&Qd(Ol)){var t=[];w_(t,Ol,e,hg(e)),e_(jP,t)}}function PP(e,t,r){e==="focusin"?(N0(),hl=t,Ol=r,hl.attachEvent("onpropertychange",b_)):e==="focusout"&&N0()}function TP(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Qd(Ol)}function RP(e,t){if(e==="click")return Qd(t)}function IP(e,t){if(e==="input"||e==="change")return Qd(t)}function AP(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var cn=typeof Object.is=="function"?Object.is:AP;function Ml(e,t){if(cn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var s=r[n];if(!Jh.call(t,s)||!cn(e[s],t[s]))return!1}return!0}function j0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function $0(e,t){var r=j0(e);e=0;for(var n;r;){if(r.nodeType===3){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=j0(r)}}function __(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?__(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function S_(){for(var e=window,t=Ku();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Ku(e.document)}return t}function _g(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function OP(e){var t=S_(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&__(r.ownerDocument.documentElement,r)){if(n!==null&&_g(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=r.textContent.length,o=Math.min(n.start,s);n=n.end===void 0?o:Math.min(n.end,s),!e.extend&&o>n&&(s=n,n=o,o=s),s=$0(r,o);var i=$0(r,n);s&&i&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),o>n?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var MP=ts&&"documentMode"in document&&11>=document.documentMode,bi=null,gp=null,pl=null,vp=!1;function P0(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;vp||bi==null||bi!==Ku(n)||(n=bi,"selectionStart"in n&&_g(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),pl&&Ml(pl,n)||(pl=n,n=Yu(gp,"onSelect"),0<n.length&&(t=new wg("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=bi)))}function Lc(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var _i={animationend:Lc("Animation","AnimationEnd"),animationiteration:Lc("Animation","AnimationIteration"),animationstart:Lc("Animation","AnimationStart"),transitionend:Lc("Transition","TransitionEnd")},nh={},k_={};ts&&(k_=document.createElement("div").style,"AnimationEvent"in window||(delete _i.animationend.animation,delete _i.animationiteration.animation,delete _i.animationstart.animation),"TransitionEvent"in window||delete _i.transitionend.transition);function Jd(e){if(nh[e])return nh[e];if(!_i[e])return e;var t=_i[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in k_)return nh[e]=t[r];return e}var C_=Jd("animationend"),E_=Jd("animationiteration"),N_=Jd("animationstart"),j_=Jd("transitionend"),$_=new Map,T0="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 oo(e,t){$_.set(e,t),Xo(t,[e])}for(var sh=0;sh<T0.length;sh++){var oh=T0[sh],DP=oh.toLowerCase(),zP=oh[0].toUpperCase()+oh.slice(1);oo(DP,"on"+zP)}oo(C_,"onAnimationEnd");oo(E_,"onAnimationIteration");oo(N_,"onAnimationStart");oo("dblclick","onDoubleClick");oo("focusin","onFocus");oo("focusout","onBlur");oo(j_,"onTransitionEnd");oa("onMouseEnter",["mouseout","mouseover"]);oa("onMouseLeave",["mouseout","mouseover"]);oa("onPointerEnter",["pointerout","pointerover"]);oa("onPointerLeave",["pointerout","pointerover"]);Xo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Xo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Xo("onBeforeInput",["compositionend","keypress","textInput","paste"]);Xo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Xo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Xo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var tl="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(" "),LP=new Set("cancel close invalid load scroll toggle".split(" ").concat(tl));function R0(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,D$(n,t,void 0,e),e.currentTarget=null}function P_(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var n=e[r],s=n.event;n=n.listeners;e:{var o=void 0;if(t)for(var i=n.length-1;0<=i;i--){var l=n[i],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==o&&s.isPropagationStopped())break e;R0(s,l,u),o=c}else for(i=0;i<n.length;i++){if(l=n[i],c=l.instance,u=l.currentTarget,l=l.listener,c!==o&&s.isPropagationStopped())break e;R0(s,l,u),o=c}}}if(Wu)throw e=fp,Wu=!1,fp=null,e}function Je(e,t){var r=t[_p];r===void 0&&(r=t[_p]=new Set);var n=e+"__bubble";r.has(n)||(T_(t,e,2,!1),r.add(n))}function ih(e,t,r){var n=0;t&&(n|=4),T_(r,e,n,t)}var Fc="_reactListening"+Math.random().toString(36).slice(2);function Dl(e){if(!e[Fc]){e[Fc]=!0,zb.forEach(function(r){r!=="selectionchange"&&(LP.has(r)||ih(r,!1,e),ih(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Fc]||(t[Fc]=!0,ih("selectionchange",!1,t))}}function T_(e,t,r,n){switch(p_(t)){case 1:var s=X$;break;case 4:s=eP;break;default:s=vg}r=s.bind(null,t,r,e),s=void 0,!dp||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),n?s!==void 0?e.addEventListener(t,r,{capture:!0,passive:s}):e.addEventListener(t,r,!0):s!==void 0?e.addEventListener(t,r,{passive:s}):e.addEventListener(t,r,!1)}function ah(e,t,r,n,s){var o=n;if(!(t&1)&&!(t&2)&&n!==null)e:for(;;){if(n===null)return;var i=n.tag;if(i===3||i===4){var l=n.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(i===4)for(i=n.return;i!==null;){var c=i.tag;if((c===3||c===4)&&(c=i.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;i=i.return}for(;l!==null;){if(i=Co(l),i===null)return;if(c=i.tag,c===5||c===6){n=o=i;continue e}l=l.parentNode}}n=n.return}e_(function(){var u=o,d=hg(r),f=[];e:{var g=$_.get(e);if(g!==void 0){var v=wg,b=e;switch(e){case"keypress":if(xu(r)===0)break e;case"keydown":case"keyup":v=mP;break;case"focusin":b="focus",v=eh;break;case"focusout":b="blur",v=eh;break;case"beforeblur":case"afterblur":v=eh;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":v=x0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":v=nP;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":v=yP;break;case C_:case E_:case N_:v=iP;break;case j_:v=xP;break;case"scroll":v=tP;break;case"wheel":v=_P;break;case"copy":case"cut":case"paste":v=lP;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":v=_0}var h=(t&4)!==0,w=!h&&e==="scroll",p=h?g!==null?g+"Capture":null:g;h=[];for(var m=u,x;m!==null;){x=m;var _=x.stateNode;if(x.tag===5&&_!==null&&(x=_,p!==null&&(_=Tl(m,p),_!=null&&h.push(zl(m,_,x)))),w)break;m=m.return}0<h.length&&(g=new v(g,b,null,r,d),f.push({event:g,listeners:h}))}}if(!(t&7)){e:{if(g=e==="mouseover"||e==="pointerover",v=e==="mouseout"||e==="pointerout",g&&r!==cp&&(b=r.relatedTarget||r.fromElement)&&(Co(b)||b[rs]))break e;if((v||g)&&(g=d.window===d?d:(g=d.ownerDocument)?g.defaultView||g.parentWindow:window,v?(b=r.relatedTarget||r.toElement,v=u,b=b?Co(b):null,b!==null&&(w=ei(b),b!==w||b.tag!==5&&b.tag!==6)&&(b=null)):(v=null,b=u),v!==b)){if(h=x0,_="onMouseLeave",p="onMouseEnter",m="mouse",(e==="pointerout"||e==="pointerover")&&(h=_0,_="onPointerLeave",p="onPointerEnter",m="pointer"),w=v==null?g:Si(v),x=b==null?g:Si(b),g=new h(_,m+"leave",v,r,d),g.target=w,g.relatedTarget=x,_=null,Co(d)===u&&(h=new h(p,m+"enter",b,r,d),h.target=x,h.relatedTarget=w,_=h),w=_,v&&b)t:{for(h=v,p=b,m=0,x=h;x;x=oi(x))m++;for(x=0,_=p;_;_=oi(_))x++;for(;0<m-x;)h=oi(h),m--;for(;0<x-m;)p=oi(p),x--;for(;m--;){if(h===p||p!==null&&h===p.alternate)break t;h=oi(h),p=oi(p)}h=null}else h=null;v!==null&&I0(f,g,v,h,!1),b!==null&&w!==null&&I0(f,w,b,h,!0)}}e:{if(g=u?Si(u):window,v=g.nodeName&&g.nodeName.toLowerCase(),v==="select"||v==="input"&&g.type==="file")var C=$P;else if(C0(g))if(x_)C=IP;else{C=TP;var $=PP}else(v=g.nodeName)&&v.toLowerCase()==="input"&&(g.type==="checkbox"||g.type==="radio")&&(C=RP);if(C&&(C=C(e,u))){w_(f,C,r,d);break e}$&&$(e,g,u),e==="focusout"&&($=g._wrapperState)&&$.controlled&&g.type==="number"&&sp(g,"number",g.value)}switch($=u?Si(u):window,e){case"focusin":(C0($)||$.contentEditable==="true")&&(bi=$,gp=u,pl=null);break;case"focusout":pl=gp=bi=null;break;case"mousedown":vp=!0;break;case"contextmenu":case"mouseup":case"dragend":vp=!1,P0(f,r,d);break;case"selectionchange":if(MP)break;case"keydown":case"keyup":P0(f,r,d)}var k;if(bg)e:{switch(e){case"compositionstart":var I="onCompositionStart";break e;case"compositionend":I="onCompositionEnd";break e;case"compositionupdate":I="onCompositionUpdate";break e}I=void 0}else xi?v_(e,r)&&(I="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(I="onCompositionStart");I&&(g_&&r.locale!=="ko"&&(xi||I!=="onCompositionStart"?I==="onCompositionEnd"&&xi&&(k=m_()):(Ds=d,yg="value"in Ds?Ds.value:Ds.textContent,xi=!0)),$=Yu(u,I),0<$.length&&(I=new b0(I,e,null,r,d),f.push({event:I,listeners:$}),k?I.data=k:(k=y_(r),k!==null&&(I.data=k)))),(k=kP?CP(e,r):EP(e,r))&&(u=Yu(u,"onBeforeInput"),0<u.length&&(d=new b0("onBeforeInput","beforeinput",null,r,d),f.push({event:d,listeners:u}),d.data=k))}P_(f,t)})}function zl(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Yu(e,t){for(var r=t+"Capture",n=[];e!==null;){var s=e,o=s.stateNode;s.tag===5&&o!==null&&(s=o,o=Tl(e,r),o!=null&&n.unshift(zl(e,o,s)),o=Tl(e,t),o!=null&&n.push(zl(e,o,s))),e=e.return}return n}function oi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function I0(e,t,r,n,s){for(var o=t._reactName,i=[];r!==null&&r!==n;){var l=r,c=l.alternate,u=l.stateNode;if(c!==null&&c===n)break;l.tag===5&&u!==null&&(l=u,s?(c=Tl(r,o),c!=null&&i.unshift(zl(r,c,l))):s||(c=Tl(r,o),c!=null&&i.push(zl(r,c,l)))),r=r.return}i.length!==0&&e.push({event:t,listeners:i})}var FP=/\r\n?/g,UP=/\u0000|\uFFFD/g;function A0(e){return(typeof e=="string"?e:""+e).replace(FP,`
|
|
38
|
+
`).replace(UP,"")}function Uc(e,t,r){if(t=A0(t),A0(e)!==t&&r)throw Error(J(425))}function Xu(){}var yp=null,wp=null;function xp(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var bp=typeof setTimeout=="function"?setTimeout:void 0,qP=typeof clearTimeout=="function"?clearTimeout:void 0,O0=typeof Promise=="function"?Promise:void 0,VP=typeof queueMicrotask=="function"?queueMicrotask:typeof O0<"u"?function(e){return O0.resolve(null).then(e).catch(HP)}:bp;function HP(e){setTimeout(function(){throw e})}function lh(e,t){var r=t,n=0;do{var s=r.nextSibling;if(e.removeChild(r),s&&s.nodeType===8)if(r=s.data,r==="/$"){if(n===0){e.removeChild(s),Al(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=s}while(r);Al(t)}function Hs(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function M0(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var Sa=Math.random().toString(36).slice(2),bn="__reactFiber$"+Sa,Ll="__reactProps$"+Sa,rs="__reactContainer$"+Sa,_p="__reactEvents$"+Sa,KP="__reactListeners$"+Sa,BP="__reactHandles$"+Sa;function Co(e){var t=e[bn];if(t)return t;for(var r=e.parentNode;r;){if(t=r[rs]||r[bn]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=M0(e);e!==null;){if(r=e[bn])return r;e=M0(e)}return t}e=r,r=e.parentNode}return null}function ic(e){return e=e[bn]||e[rs],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Si(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(J(33))}function Yd(e){return e[Ll]||null}var Sp=[],ki=-1;function io(e){return{current:e}}function et(e){0>ki||(e.current=Sp[ki],Sp[ki]=null,ki--)}function Ze(e,t){ki++,Sp[ki]=e.current,e.current=t}var Xs={},Gt=io(Xs),mr=io(!1),Lo=Xs;function ia(e,t){var r=e.type.contextTypes;if(!r)return Xs;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var s={},o;for(o in r)s[o]=t[o];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function gr(e){return e=e.childContextTypes,e!=null}function ed(){et(mr),et(Gt)}function D0(e,t,r){if(Gt.current!==Xs)throw Error(J(168));Ze(Gt,t),Ze(mr,r)}function R_(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var s in n)if(!(s in t))throw Error(J(108,P$(e)||"Unknown",s));return ft({},r,n)}function td(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Xs,Lo=Gt.current,Ze(Gt,e),Ze(mr,mr.current),!0}function z0(e,t,r){var n=e.stateNode;if(!n)throw Error(J(169));r?(e=R_(e,t,Lo),n.__reactInternalMemoizedMergedChildContext=e,et(mr),et(Gt),Ze(Gt,e)):et(mr),Ze(mr,r)}var qn=null,Xd=!1,ch=!1;function I_(e){qn===null?qn=[e]:qn.push(e)}function WP(e){Xd=!0,I_(e)}function ao(){if(!ch&&qn!==null){ch=!0;var e=0,t=Ke;try{var r=qn;for(Ke=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}qn=null,Xd=!1}catch(s){throw qn!==null&&(qn=qn.slice(e+1)),s_(pg,ao),s}finally{Ke=t,ch=!1}}return null}var Ci=[],Ei=0,rd=null,nd=0,Mr=[],Dr=0,Fo=null,Wn=1,Zn="";function go(e,t){Ci[Ei++]=nd,Ci[Ei++]=rd,rd=e,nd=t}function A_(e,t,r){Mr[Dr++]=Wn,Mr[Dr++]=Zn,Mr[Dr++]=Fo,Fo=e;var n=Wn;e=Zn;var s=32-on(n)-1;n&=~(1<<s),r+=1;var o=32-on(t)+s;if(30<o){var i=s-s%5;o=(n&(1<<i)-1).toString(32),n>>=i,s-=i,Wn=1<<32-on(t)+s|r<<s|n,Zn=o+e}else Wn=1<<o|r<<s|n,Zn=e}function Sg(e){e.return!==null&&(go(e,1),A_(e,1,0))}function kg(e){for(;e===rd;)rd=Ci[--Ei],Ci[Ei]=null,nd=Ci[--Ei],Ci[Ei]=null;for(;e===Fo;)Fo=Mr[--Dr],Mr[Dr]=null,Zn=Mr[--Dr],Mr[Dr]=null,Wn=Mr[--Dr],Mr[Dr]=null}var Sr=null,_r=null,st=!1,tn=null;function O_(e,t){var r=zr(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function L0(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Sr=e,_r=Hs(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Sr=e,_r=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=Fo!==null?{id:Wn,overflow:Zn}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=zr(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,Sr=e,_r=null,!0):!1;default:return!1}}function kp(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Cp(e){if(st){var t=_r;if(t){var r=t;if(!L0(e,t)){if(kp(e))throw Error(J(418));t=Hs(r.nextSibling);var n=Sr;t&&L0(e,t)?O_(n,r):(e.flags=e.flags&-4097|2,st=!1,Sr=e)}}else{if(kp(e))throw Error(J(418));e.flags=e.flags&-4097|2,st=!1,Sr=e}}}function F0(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Sr=e}function qc(e){if(e!==Sr)return!1;if(!st)return F0(e),st=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!xp(e.type,e.memoizedProps)),t&&(t=_r)){if(kp(e))throw M_(),Error(J(418));for(;t;)O_(e,t),t=Hs(t.nextSibling)}if(F0(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(J(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){_r=Hs(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}_r=null}}else _r=Sr?Hs(e.stateNode.nextSibling):null;return!0}function M_(){for(var e=_r;e;)e=Hs(e.nextSibling)}function aa(){_r=Sr=null,st=!1}function Cg(e){tn===null?tn=[e]:tn.push(e)}var ZP=ls.ReactCurrentBatchConfig;function Va(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(J(309));var n=r.stateNode}if(!n)throw Error(J(147,e));var s=n,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(i){var l=s.refs;i===null?delete l[o]:l[o]=i},t._stringRef=o,t)}if(typeof e!="string")throw Error(J(284));if(!r._owner)throw Error(J(290,e))}return e}function Vc(e,t){throw e=Object.prototype.toString.call(t),Error(J(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function U0(e){var t=e._init;return t(e._payload)}function D_(e){function t(p,m){if(e){var x=p.deletions;x===null?(p.deletions=[m],p.flags|=16):x.push(m)}}function r(p,m){if(!e)return null;for(;m!==null;)t(p,m),m=m.sibling;return null}function n(p,m){for(p=new Map;m!==null;)m.key!==null?p.set(m.key,m):p.set(m.index,m),m=m.sibling;return p}function s(p,m){return p=Zs(p,m),p.index=0,p.sibling=null,p}function o(p,m,x){return p.index=x,e?(x=p.alternate,x!==null?(x=x.index,x<m?(p.flags|=2,m):x):(p.flags|=2,m)):(p.flags|=1048576,m)}function i(p){return e&&p.alternate===null&&(p.flags|=2),p}function l(p,m,x,_){return m===null||m.tag!==6?(m=gh(x,p.mode,_),m.return=p,m):(m=s(m,x),m.return=p,m)}function c(p,m,x,_){var C=x.type;return C===wi?d(p,m,x.props.children,_,x.key):m!==null&&(m.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===xs&&U0(C)===m.type)?(_=s(m,x.props),_.ref=Va(p,m,x),_.return=p,_):(_=Nu(x.type,x.key,x.props,null,p.mode,_),_.ref=Va(p,m,x),_.return=p,_)}function u(p,m,x,_){return m===null||m.tag!==4||m.stateNode.containerInfo!==x.containerInfo||m.stateNode.implementation!==x.implementation?(m=vh(x,p.mode,_),m.return=p,m):(m=s(m,x.children||[]),m.return=p,m)}function d(p,m,x,_,C){return m===null||m.tag!==7?(m=zo(x,p.mode,_,C),m.return=p,m):(m=s(m,x),m.return=p,m)}function f(p,m,x){if(typeof m=="string"&&m!==""||typeof m=="number")return m=gh(""+m,p.mode,x),m.return=p,m;if(typeof m=="object"&&m!==null){switch(m.$$typeof){case Rc:return x=Nu(m.type,m.key,m.props,null,p.mode,x),x.ref=Va(p,null,m),x.return=p,x;case yi:return m=vh(m,p.mode,x),m.return=p,m;case xs:var _=m._init;return f(p,_(m._payload),x)}if(Xa(m)||za(m))return m=zo(m,p.mode,x,null),m.return=p,m;Vc(p,m)}return null}function g(p,m,x,_){var C=m!==null?m.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return C!==null?null:l(p,m,""+x,_);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Rc:return x.key===C?c(p,m,x,_):null;case yi:return x.key===C?u(p,m,x,_):null;case xs:return C=x._init,g(p,m,C(x._payload),_)}if(Xa(x)||za(x))return C!==null?null:d(p,m,x,_,null);Vc(p,x)}return null}function v(p,m,x,_,C){if(typeof _=="string"&&_!==""||typeof _=="number")return p=p.get(x)||null,l(m,p,""+_,C);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Rc:return p=p.get(_.key===null?x:_.key)||null,c(m,p,_,C);case yi:return p=p.get(_.key===null?x:_.key)||null,u(m,p,_,C);case xs:var $=_._init;return v(p,m,x,$(_._payload),C)}if(Xa(_)||za(_))return p=p.get(x)||null,d(m,p,_,C,null);Vc(m,_)}return null}function b(p,m,x,_){for(var C=null,$=null,k=m,I=m=0,E=null;k!==null&&I<x.length;I++){k.index>I?(E=k,k=null):E=k.sibling;var U=g(p,k,x[I],_);if(U===null){k===null&&(k=E);break}e&&k&&U.alternate===null&&t(p,k),m=o(U,m,I),$===null?C=U:$.sibling=U,$=U,k=E}if(I===x.length)return r(p,k),st&&go(p,I),C;if(k===null){for(;I<x.length;I++)k=f(p,x[I],_),k!==null&&(m=o(k,m,I),$===null?C=k:$.sibling=k,$=k);return st&&go(p,I),C}for(k=n(p,k);I<x.length;I++)E=v(k,p,I,x[I],_),E!==null&&(e&&E.alternate!==null&&k.delete(E.key===null?I:E.key),m=o(E,m,I),$===null?C=E:$.sibling=E,$=E);return e&&k.forEach(function(P){return t(p,P)}),st&&go(p,I),C}function h(p,m,x,_){var C=za(x);if(typeof C!="function")throw Error(J(150));if(x=C.call(x),x==null)throw Error(J(151));for(var $=C=null,k=m,I=m=0,E=null,U=x.next();k!==null&&!U.done;I++,U=x.next()){k.index>I?(E=k,k=null):E=k.sibling;var P=g(p,k,U.value,_);if(P===null){k===null&&(k=E);break}e&&k&&P.alternate===null&&t(p,k),m=o(P,m,I),$===null?C=P:$.sibling=P,$=P,k=E}if(U.done)return r(p,k),st&&go(p,I),C;if(k===null){for(;!U.done;I++,U=x.next())U=f(p,U.value,_),U!==null&&(m=o(U,m,I),$===null?C=U:$.sibling=U,$=U);return st&&go(p,I),C}for(k=n(p,k);!U.done;I++,U=x.next())U=v(k,p,I,U.value,_),U!==null&&(e&&U.alternate!==null&&k.delete(U.key===null?I:U.key),m=o(U,m,I),$===null?C=U:$.sibling=U,$=U);return e&&k.forEach(function(O){return t(p,O)}),st&&go(p,I),C}function w(p,m,x,_){if(typeof x=="object"&&x!==null&&x.type===wi&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Rc:e:{for(var C=x.key,$=m;$!==null;){if($.key===C){if(C=x.type,C===wi){if($.tag===7){r(p,$.sibling),m=s($,x.props.children),m.return=p,p=m;break e}}else if($.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===xs&&U0(C)===$.type){r(p,$.sibling),m=s($,x.props),m.ref=Va(p,$,x),m.return=p,p=m;break e}r(p,$);break}else t(p,$);$=$.sibling}x.type===wi?(m=zo(x.props.children,p.mode,_,x.key),m.return=p,p=m):(_=Nu(x.type,x.key,x.props,null,p.mode,_),_.ref=Va(p,m,x),_.return=p,p=_)}return i(p);case yi:e:{for($=x.key;m!==null;){if(m.key===$)if(m.tag===4&&m.stateNode.containerInfo===x.containerInfo&&m.stateNode.implementation===x.implementation){r(p,m.sibling),m=s(m,x.children||[]),m.return=p,p=m;break e}else{r(p,m);break}else t(p,m);m=m.sibling}m=vh(x,p.mode,_),m.return=p,p=m}return i(p);case xs:return $=x._init,w(p,m,$(x._payload),_)}if(Xa(x))return b(p,m,x,_);if(za(x))return h(p,m,x,_);Vc(p,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,m!==null&&m.tag===6?(r(p,m.sibling),m=s(m,x),m.return=p,p=m):(r(p,m),m=gh(x,p.mode,_),m.return=p,p=m),i(p)):r(p,m)}return w}var la=D_(!0),z_=D_(!1),sd=io(null),od=null,Ni=null,Eg=null;function Ng(){Eg=Ni=od=null}function jg(e){var t=sd.current;et(sd),e._currentValue=t}function Ep(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function Di(e,t){od=e,Eg=Ni=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(pr=!0),e.firstContext=null)}function Fr(e){var t=e._currentValue;if(Eg!==e)if(e={context:e,memoizedValue:t,next:null},Ni===null){if(od===null)throw Error(J(308));Ni=e,od.dependencies={lanes:0,firstContext:e}}else Ni=Ni.next=e;return t}var Eo=null;function $g(e){Eo===null?Eo=[e]:Eo.push(e)}function L_(e,t,r,n){var s=t.interleaved;return s===null?(r.next=r,$g(t)):(r.next=s.next,s.next=r),t.interleaved=r,ns(e,n)}function ns(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var bs=!1;function Pg(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function F_(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Qn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ks(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Le&2){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,ns(e,r)}return s=n.interleaved,s===null?(t.next=t,$g(n)):(t.next=s.next,s.next=t),n.interleaved=t,ns(e,r)}function bu(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,mg(e,r)}}function q0(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var s=null,o=null;if(r=r.firstBaseUpdate,r!==null){do{var i={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};o===null?s=o=i:o=o.next=i,r=r.next}while(r!==null);o===null?s=o=t:o=o.next=t}else s=o=t;r={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:o,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function id(e,t,r,n){var s=e.updateQueue;bs=!1;var o=s.firstBaseUpdate,i=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,i===null?o=u:i.next=u,i=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==i&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(o!==null){var f=s.baseState;i=0,d=u=c=null,l=o;do{var g=l.lane,v=l.eventTime;if((n&g)===g){d!==null&&(d=d.next={eventTime:v,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var b=e,h=l;switch(g=t,v=r,h.tag){case 1:if(b=h.payload,typeof b=="function"){f=b.call(v,f,g);break e}f=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=h.payload,g=typeof b=="function"?b.call(v,f,g):b,g==null)break e;f=ft({},f,g);break e;case 2:bs=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,g=s.effects,g===null?s.effects=[l]:g.push(l))}else v={eventTime:v,lane:g,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=v,c=f):d=d.next=v,i|=g;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;g=l,l=g.next,g.next=null,s.lastBaseUpdate=g,s.shared.pending=null}}while(!0);if(d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do i|=s.lane,s=s.next;while(s!==t)}else o===null&&(s.shared.lanes=0);qo|=i,e.lanes=i,e.memoizedState=f}}function V0(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],s=n.callback;if(s!==null){if(n.callback=null,n=r,typeof s!="function")throw Error(J(191,s));s.call(n)}}}var ac={},Pn=io(ac),Fl=io(ac),Ul=io(ac);function No(e){if(e===ac)throw Error(J(174));return e}function Tg(e,t){switch(Ze(Ul,t),Ze(Fl,e),Ze(Pn,ac),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ip(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ip(t,e)}et(Pn),Ze(Pn,t)}function ca(){et(Pn),et(Fl),et(Ul)}function U_(e){No(Ul.current);var t=No(Pn.current),r=ip(t,e.type);t!==r&&(Ze(Fl,e),Ze(Pn,r))}function Rg(e){Fl.current===e&&(et(Pn),et(Fl))}var lt=io(0);function ad(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var uh=[];function Ig(){for(var e=0;e<uh.length;e++)uh[e]._workInProgressVersionPrimary=null;uh.length=0}var _u=ls.ReactCurrentDispatcher,dh=ls.ReactCurrentBatchConfig,Uo=0,ut=null,kt=null,Pt=null,ld=!1,ml=!1,ql=0,GP=0;function Ht(){throw Error(J(321))}function Ag(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!cn(e[r],t[r]))return!1;return!0}function Og(e,t,r,n,s,o){if(Uo=o,ut=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,_u.current=e===null||e.memoizedState===null?XP:eT,e=r(n,s),ml){o=0;do{if(ml=!1,ql=0,25<=o)throw Error(J(301));o+=1,Pt=kt=null,t.updateQueue=null,_u.current=tT,e=r(n,s)}while(ml)}if(_u.current=cd,t=kt!==null&&kt.next!==null,Uo=0,Pt=kt=ut=null,ld=!1,t)throw Error(J(300));return e}function Mg(){var e=ql!==0;return ql=0,e}function mn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pt===null?ut.memoizedState=Pt=e:Pt=Pt.next=e,Pt}function Ur(){if(kt===null){var e=ut.alternate;e=e!==null?e.memoizedState:null}else e=kt.next;var t=Pt===null?ut.memoizedState:Pt.next;if(t!==null)Pt=t,kt=e;else{if(e===null)throw Error(J(310));kt=e,e={memoizedState:kt.memoizedState,baseState:kt.baseState,baseQueue:kt.baseQueue,queue:kt.queue,next:null},Pt===null?ut.memoizedState=Pt=e:Pt=Pt.next=e}return Pt}function Vl(e,t){return typeof t=="function"?t(e):t}function fh(e){var t=Ur(),r=t.queue;if(r===null)throw Error(J(311));r.lastRenderedReducer=e;var n=kt,s=n.baseQueue,o=r.pending;if(o!==null){if(s!==null){var i=s.next;s.next=o.next,o.next=i}n.baseQueue=s=o,r.pending=null}if(s!==null){o=s.next,n=n.baseState;var l=i=null,c=null,u=o;do{var d=u.lane;if((Uo&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),n=u.hasEagerState?u.eagerState:e(n,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,i=n):c=c.next=f,ut.lanes|=d,qo|=d}u=u.next}while(u!==null&&u!==o);c===null?i=n:c.next=l,cn(n,t.memoizedState)||(pr=!0),t.memoizedState=n,t.baseState=i,t.baseQueue=c,r.lastRenderedState=n}if(e=r.interleaved,e!==null){s=e;do o=s.lane,ut.lanes|=o,qo|=o,s=s.next;while(s!==e)}else s===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function hh(e){var t=Ur(),r=t.queue;if(r===null)throw Error(J(311));r.lastRenderedReducer=e;var n=r.dispatch,s=r.pending,o=t.memoizedState;if(s!==null){r.pending=null;var i=s=s.next;do o=e(o,i.action),i=i.next;while(i!==s);cn(o,t.memoizedState)||(pr=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),r.lastRenderedState=o}return[o,n]}function q_(){}function V_(e,t){var r=ut,n=Ur(),s=t(),o=!cn(n.memoizedState,s);if(o&&(n.memoizedState=s,pr=!0),n=n.queue,Dg(B_.bind(null,r,n,e),[e]),n.getSnapshot!==t||o||Pt!==null&&Pt.memoizedState.tag&1){if(r.flags|=2048,Hl(9,K_.bind(null,r,n,s,t),void 0,null),Tt===null)throw Error(J(349));Uo&30||H_(r,t,s)}return s}function H_(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=ut.updateQueue,t===null?(t={lastEffect:null,stores:null},ut.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function K_(e,t,r,n){t.value=r,t.getSnapshot=n,W_(t)&&Z_(e)}function B_(e,t,r){return r(function(){W_(t)&&Z_(e)})}function W_(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!cn(e,r)}catch{return!0}}function Z_(e){var t=ns(e,1);t!==null&&an(t,e,1,-1)}function H0(e){var t=mn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Vl,lastRenderedState:e},t.queue=e,e=e.dispatch=YP.bind(null,ut,e),[t.memoizedState,e]}function Hl(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=ut.updateQueue,t===null?(t={lastEffect:null,stores:null},ut.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e)),e}function G_(){return Ur().memoizedState}function Su(e,t,r,n){var s=mn();ut.flags|=e,s.memoizedState=Hl(1|t,r,void 0,n===void 0?null:n)}function ef(e,t,r,n){var s=Ur();n=n===void 0?null:n;var o=void 0;if(kt!==null){var i=kt.memoizedState;if(o=i.destroy,n!==null&&Ag(n,i.deps)){s.memoizedState=Hl(t,r,o,n);return}}ut.flags|=e,s.memoizedState=Hl(1|t,r,o,n)}function K0(e,t){return Su(8390656,8,e,t)}function Dg(e,t){return ef(2048,8,e,t)}function Q_(e,t){return ef(4,2,e,t)}function J_(e,t){return ef(4,4,e,t)}function Y_(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function X_(e,t,r){return r=r!=null?r.concat([e]):null,ef(4,4,Y_.bind(null,t,e),r)}function zg(){}function eS(e,t){var r=Ur();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Ag(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function tS(e,t){var r=Ur();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Ag(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function rS(e,t,r){return Uo&21?(cn(r,t)||(r=a_(),ut.lanes|=r,qo|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,pr=!0),e.memoizedState=r)}function QP(e,t){var r=Ke;Ke=r!==0&&4>r?r:4,e(!0);var n=dh.transition;dh.transition={};try{e(!1),t()}finally{Ke=r,dh.transition=n}}function nS(){return Ur().memoizedState}function JP(e,t,r){var n=Ws(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},sS(e))oS(t,r);else if(r=L_(e,t,r,n),r!==null){var s=nr();an(r,e,n,s),iS(r,t,n)}}function YP(e,t,r){var n=Ws(e),s={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(sS(e))oS(t,s);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,l=o(i,r);if(s.hasEagerState=!0,s.eagerState=l,cn(l,i)){var c=t.interleaved;c===null?(s.next=s,$g(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}r=L_(e,t,s,n),r!==null&&(s=nr(),an(r,e,n,s),iS(r,t,n))}}function sS(e){var t=e.alternate;return e===ut||t!==null&&t===ut}function oS(e,t){ml=ld=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function iS(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,mg(e,r)}}var cd={readContext:Fr,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useInsertionEffect:Ht,useLayoutEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useMutableSource:Ht,useSyncExternalStore:Ht,useId:Ht,unstable_isNewReconciler:!1},XP={readContext:Fr,useCallback:function(e,t){return mn().memoizedState=[e,t===void 0?null:t],e},useContext:Fr,useEffect:K0,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,Su(4194308,4,Y_.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Su(4194308,4,e,t)},useInsertionEffect:function(e,t){return Su(4,2,e,t)},useMemo:function(e,t){var r=mn();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=mn();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=JP.bind(null,ut,e),[n.memoizedState,e]},useRef:function(e){var t=mn();return e={current:e},t.memoizedState=e},useState:H0,useDebugValue:zg,useDeferredValue:function(e){return mn().memoizedState=e},useTransition:function(){var e=H0(!1),t=e[0];return e=QP.bind(null,e[1]),mn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=ut,s=mn();if(st){if(r===void 0)throw Error(J(407));r=r()}else{if(r=t(),Tt===null)throw Error(J(349));Uo&30||H_(n,t,r)}s.memoizedState=r;var o={value:r,getSnapshot:t};return s.queue=o,K0(B_.bind(null,n,o,e),[e]),n.flags|=2048,Hl(9,K_.bind(null,n,o,r,t),void 0,null),r},useId:function(){var e=mn(),t=Tt.identifierPrefix;if(st){var r=Zn,n=Wn;r=(n&~(1<<32-on(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=ql++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=GP++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},eT={readContext:Fr,useCallback:eS,useContext:Fr,useEffect:Dg,useImperativeHandle:X_,useInsertionEffect:Q_,useLayoutEffect:J_,useMemo:tS,useReducer:fh,useRef:G_,useState:function(){return fh(Vl)},useDebugValue:zg,useDeferredValue:function(e){var t=Ur();return rS(t,kt.memoizedState,e)},useTransition:function(){var e=fh(Vl)[0],t=Ur().memoizedState;return[e,t]},useMutableSource:q_,useSyncExternalStore:V_,useId:nS,unstable_isNewReconciler:!1},tT={readContext:Fr,useCallback:eS,useContext:Fr,useEffect:Dg,useImperativeHandle:X_,useInsertionEffect:Q_,useLayoutEffect:J_,useMemo:tS,useReducer:hh,useRef:G_,useState:function(){return hh(Vl)},useDebugValue:zg,useDeferredValue:function(e){var t=Ur();return kt===null?t.memoizedState=e:rS(t,kt.memoizedState,e)},useTransition:function(){var e=hh(Vl)[0],t=Ur().memoizedState;return[e,t]},useMutableSource:q_,useSyncExternalStore:V_,useId:nS,unstable_isNewReconciler:!1};function Qr(e,t){if(e&&e.defaultProps){t=ft({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function Np(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:ft({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var tf={isMounted:function(e){return(e=e._reactInternals)?ei(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=nr(),s=Ws(e),o=Qn(n,s);o.payload=t,r!=null&&(o.callback=r),t=Ks(e,o,s),t!==null&&(an(t,e,s,n),bu(t,e,s))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=nr(),s=Ws(e),o=Qn(n,s);o.tag=1,o.payload=t,r!=null&&(o.callback=r),t=Ks(e,o,s),t!==null&&(an(t,e,s,n),bu(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=nr(),n=Ws(e),s=Qn(r,n);s.tag=2,t!=null&&(s.callback=t),t=Ks(e,s,n),t!==null&&(an(t,e,n,r),bu(t,e,n))}};function B0(e,t,r,n,s,o,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,o,i):t.prototype&&t.prototype.isPureReactComponent?!Ml(r,n)||!Ml(s,o):!0}function aS(e,t,r){var n=!1,s=Xs,o=t.contextType;return typeof o=="object"&&o!==null?o=Fr(o):(s=gr(t)?Lo:Gt.current,n=t.contextTypes,o=(n=n!=null)?ia(e,s):Xs),t=new t(r,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=tf,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=o),t}function W0(e,t,r,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&tf.enqueueReplaceState(t,t.state,null)}function jp(e,t,r,n){var s=e.stateNode;s.props=r,s.state=e.memoizedState,s.refs={},Pg(e);var o=t.contextType;typeof o=="object"&&o!==null?s.context=Fr(o):(o=gr(t)?Lo:Gt.current,s.context=ia(e,o)),s.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(Np(e,t,o,r),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&tf.enqueueReplaceState(s,s.state,null),id(e,r,s,n),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function ua(e,t){try{var r="",n=t;do r+=$$(n),n=n.return;while(n);var s=r}catch(o){s=`
|
|
39
|
+
Error generating stack: `+o.message+`
|
|
40
|
+
`+o.stack}return{value:e,source:t,stack:s,digest:null}}function ph(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function $p(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var rT=typeof WeakMap=="function"?WeakMap:Map;function lS(e,t,r){r=Qn(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){dd||(dd=!0,Lp=n),$p(e,t)},r}function cS(e,t,r){r=Qn(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var s=t.value;r.payload=function(){return n(s)},r.callback=function(){$p(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(r.callback=function(){$p(e,t),typeof n!="function"&&(Bs===null?Bs=new Set([this]):Bs.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),r}function Z0(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new rT;var s=new Set;n.set(t,s)}else s=n.get(t),s===void 0&&(s=new Set,n.set(t,s));s.has(r)||(s.add(r),e=gT.bind(null,e,t,r),t.then(e,e))}function G0(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Q0(e,t,r,n,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=Qn(-1,1),t.tag=2,Ks(r,t,1))),r.lanes|=1),e)}var nT=ls.ReactCurrentOwner,pr=!1;function Xt(e,t,r,n){t.child=e===null?z_(t,null,r,n):la(t,e.child,r,n)}function J0(e,t,r,n,s){r=r.render;var o=t.ref;return Di(t,s),n=Og(e,t,r,n,o,s),r=Mg(),e!==null&&!pr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ss(e,t,s)):(st&&r&&Sg(t),t.flags|=1,Xt(e,t,n,s),t.child)}function Y0(e,t,r,n,s){if(e===null){var o=r.type;return typeof o=="function"&&!Bg(o)&&o.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=o,uS(e,t,o,n,s)):(e=Nu(r.type,null,n,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&s)){var i=o.memoizedProps;if(r=r.compare,r=r!==null?r:Ml,r(i,n)&&e.ref===t.ref)return ss(e,t,s)}return t.flags|=1,e=Zs(o,n),e.ref=t.ref,e.return=t,t.child=e}function uS(e,t,r,n,s){if(e!==null){var o=e.memoizedProps;if(Ml(o,n)&&e.ref===t.ref)if(pr=!1,t.pendingProps=n=o,(e.lanes&s)!==0)e.flags&131072&&(pr=!0);else return t.lanes=e.lanes,ss(e,t,s)}return Pp(e,t,r,n,s)}function dS(e,t,r){var n=t.pendingProps,s=n.children,o=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ze($i,wr),wr|=r;else{if(!(r&1073741824))return e=o!==null?o.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ze($i,wr),wr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=o!==null?o.baseLanes:r,Ze($i,wr),wr|=n}else o!==null?(n=o.baseLanes|r,t.memoizedState=null):n=r,Ze($i,wr),wr|=n;return Xt(e,t,s,r),t.child}function fS(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Pp(e,t,r,n,s){var o=gr(r)?Lo:Gt.current;return o=ia(t,o),Di(t,s),r=Og(e,t,r,n,o,s),n=Mg(),e!==null&&!pr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ss(e,t,s)):(st&&n&&Sg(t),t.flags|=1,Xt(e,t,r,s),t.child)}function X0(e,t,r,n,s){if(gr(r)){var o=!0;td(t)}else o=!1;if(Di(t,s),t.stateNode===null)ku(e,t),aS(t,r,n),jp(t,r,n,s),n=!0;else if(e===null){var i=t.stateNode,l=t.memoizedProps;i.props=l;var c=i.context,u=r.contextType;typeof u=="object"&&u!==null?u=Fr(u):(u=gr(r)?Lo:Gt.current,u=ia(t,u));var d=r.getDerivedStateFromProps,f=typeof d=="function"||typeof i.getSnapshotBeforeUpdate=="function";f||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==n||c!==u)&&W0(t,i,n,u),bs=!1;var g=t.memoizedState;i.state=g,id(t,n,i,s),c=t.memoizedState,l!==n||g!==c||mr.current||bs?(typeof d=="function"&&(Np(t,r,d,n),c=t.memoizedState),(l=bs||B0(t,r,l,n,g,c,u))?(f||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=c),i.props=n,i.state=c,i.context=u,n=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{i=t.stateNode,F_(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Qr(t.type,l),i.props=u,f=t.pendingProps,g=i.context,c=r.contextType,typeof c=="object"&&c!==null?c=Fr(c):(c=gr(r)?Lo:Gt.current,c=ia(t,c));var v=r.getDerivedStateFromProps;(d=typeof v=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==f||g!==c)&&W0(t,i,n,c),bs=!1,g=t.memoizedState,i.state=g,id(t,n,i,s);var b=t.memoizedState;l!==f||g!==b||mr.current||bs?(typeof v=="function"&&(Np(t,r,v,n),b=t.memoizedState),(u=bs||B0(t,r,u,n,g,b,c)||!1)?(d||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(n,b,c),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(n,b,c)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=b),i.props=n,i.state=b,i.context=c,n=u):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=1024),n=!1)}return Tp(e,t,r,n,o,s)}function Tp(e,t,r,n,s,o){fS(e,t);var i=(t.flags&128)!==0;if(!n&&!i)return s&&z0(t,r,!1),ss(e,t,o);n=t.stateNode,nT.current=t;var l=i&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&i?(t.child=la(t,e.child,null,o),t.child=la(t,null,l,o)):Xt(e,t,l,o),t.memoizedState=n.state,s&&z0(t,r,!0),t.child}function hS(e){var t=e.stateNode;t.pendingContext?D0(e,t.pendingContext,t.pendingContext!==t.context):t.context&&D0(e,t.context,!1),Tg(e,t.containerInfo)}function ew(e,t,r,n,s){return aa(),Cg(s),t.flags|=256,Xt(e,t,r,n),t.child}var Rp={dehydrated:null,treeContext:null,retryLane:0};function Ip(e){return{baseLanes:e,cachePool:null,transitions:null}}function pS(e,t,r){var n=t.pendingProps,s=lt.current,o=!1,i=(t.flags&128)!==0,l;if((l=i)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),Ze(lt,s&1),e===null)return Cp(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(i=n.children,e=n.fallback,o?(n=t.mode,o=t.child,i={mode:"hidden",children:i},!(n&1)&&o!==null?(o.childLanes=0,o.pendingProps=i):o=sf(i,n,0,null),e=zo(e,n,r,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Ip(r),t.memoizedState=Rp,e):Lg(t,i));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return sT(e,t,i,n,l,s,r);if(o){o=n.fallback,i=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:n.children};return!(i&1)&&t.child!==s?(n=t.child,n.childLanes=0,n.pendingProps=c,t.deletions=null):(n=Zs(s,c),n.subtreeFlags=s.subtreeFlags&14680064),l!==null?o=Zs(l,o):(o=zo(o,i,r,null),o.flags|=2),o.return=t,n.return=t,n.sibling=o,t.child=n,n=o,o=t.child,i=e.child.memoizedState,i=i===null?Ip(r):{baseLanes:i.baseLanes|r,cachePool:null,transitions:i.transitions},o.memoizedState=i,o.childLanes=e.childLanes&~r,t.memoizedState=Rp,n}return o=e.child,e=o.sibling,n=Zs(o,{mode:"visible",children:n.children}),!(t.mode&1)&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function Lg(e,t){return t=sf({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Hc(e,t,r,n){return n!==null&&Cg(n),la(t,e.child,null,r),e=Lg(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function sT(e,t,r,n,s,o,i){if(r)return t.flags&256?(t.flags&=-257,n=ph(Error(J(422))),Hc(e,t,i,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=n.fallback,s=t.mode,n=sf({mode:"visible",children:n.children},s,0,null),o=zo(o,s,i,null),o.flags|=2,n.return=t,o.return=t,n.sibling=o,t.child=n,t.mode&1&&la(t,e.child,null,i),t.child.memoizedState=Ip(i),t.memoizedState=Rp,o);if(!(t.mode&1))return Hc(e,t,i,null);if(s.data==="$!"){if(n=s.nextSibling&&s.nextSibling.dataset,n)var l=n.dgst;return n=l,o=Error(J(419)),n=ph(o,n,void 0),Hc(e,t,i,n)}if(l=(i&e.childLanes)!==0,pr||l){if(n=Tt,n!==null){switch(i&-i){case 4:s=2;break;case 16:s=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:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(n.suspendedLanes|i)?0:s,s!==0&&s!==o.retryLane&&(o.retryLane=s,ns(e,s),an(n,e,s,-1))}return Kg(),n=ph(Error(J(421))),Hc(e,t,i,n)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=vT.bind(null,e),s._reactRetry=t,null):(e=o.treeContext,_r=Hs(s.nextSibling),Sr=t,st=!0,tn=null,e!==null&&(Mr[Dr++]=Wn,Mr[Dr++]=Zn,Mr[Dr++]=Fo,Wn=e.id,Zn=e.overflow,Fo=t),t=Lg(t,n.children),t.flags|=4096,t)}function tw(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),Ep(e.return,t,r)}function mh(e,t,r,n,s){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:s}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=n,o.tail=r,o.tailMode=s)}function mS(e,t,r){var n=t.pendingProps,s=n.revealOrder,o=n.tail;if(Xt(e,t,n.children,r),n=lt.current,n&2)n=n&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&tw(e,r,t);else if(e.tag===19)tw(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(Ze(lt,n),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(r=t.child,s=null;r!==null;)e=r.alternate,e!==null&&ad(e)===null&&(s=r),r=r.sibling;r=s,r===null?(s=t.child,t.child=null):(s=r.sibling,r.sibling=null),mh(t,!1,s,r,o);break;case"backwards":for(r=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&ad(e)===null){t.child=s;break}e=s.sibling,s.sibling=r,r=s,s=e}mh(t,!0,r,null,o);break;case"together":mh(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ku(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ss(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),qo|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(J(153));if(t.child!==null){for(e=t.child,r=Zs(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=Zs(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function oT(e,t,r){switch(t.tag){case 3:hS(t),aa();break;case 5:U_(t);break;case 1:gr(t.type)&&td(t);break;case 4:Tg(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,s=t.memoizedProps.value;Ze(sd,n._currentValue),n._currentValue=s;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(Ze(lt,lt.current&1),t.flags|=128,null):r&t.child.childLanes?pS(e,t,r):(Ze(lt,lt.current&1),e=ss(e,t,r),e!==null?e.sibling:null);Ze(lt,lt.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return mS(e,t,r);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Ze(lt,lt.current),n)break;return null;case 22:case 23:return t.lanes=0,dS(e,t,r)}return ss(e,t,r)}var gS,Ap,vS,yS;gS=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};Ap=function(){};vS=function(e,t,r,n){var s=e.memoizedProps;if(s!==n){e=t.stateNode,No(Pn.current);var o=null;switch(r){case"input":s=rp(e,s),n=rp(e,n),o=[];break;case"select":s=ft({},s,{value:void 0}),n=ft({},n,{value:void 0}),o=[];break;case"textarea":s=op(e,s),n=op(e,n),o=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=Xu)}ap(r,n);var i;r=null;for(u in s)if(!n.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(i in l)l.hasOwnProperty(i)&&(r||(r={}),r[i]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&($l.hasOwnProperty(u)?o||(o=[]):(o=o||[]).push(u,null));for(u in n){var c=n[u];if(l=s!=null?s[u]:void 0,n.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(i in l)!l.hasOwnProperty(i)||c&&c.hasOwnProperty(i)||(r||(r={}),r[i]="");for(i in c)c.hasOwnProperty(i)&&l[i]!==c[i]&&(r||(r={}),r[i]=c[i])}else r||(o||(o=[]),o.push(u,r)),r=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(o=o||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(o=o||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&($l.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&Je("scroll",e),o||l===c||(o=[])):(o=o||[]).push(u,c))}r&&(o=o||[]).push("style",r);var u=o;(t.updateQueue=u)&&(t.flags|=4)}};yS=function(e,t,r,n){r!==n&&(t.flags|=4)};function Ha(e,t){if(!st)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function Kt(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var s=e.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags&14680064,n|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function iT(e,t,r){var n=t.pendingProps;switch(kg(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(t),null;case 1:return gr(t.type)&&ed(),Kt(t),null;case 3:return n=t.stateNode,ca(),et(mr),et(Gt),Ig(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(qc(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,tn!==null&&(qp(tn),tn=null))),Ap(e,t),Kt(t),null;case 5:Rg(t);var s=No(Ul.current);if(r=t.type,e!==null&&t.stateNode!=null)vS(e,t,r,n,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(J(166));return Kt(t),null}if(e=No(Pn.current),qc(t)){n=t.stateNode,r=t.type;var o=t.memoizedProps;switch(n[bn]=t,n[Ll]=o,e=(t.mode&1)!==0,r){case"dialog":Je("cancel",n),Je("close",n);break;case"iframe":case"object":case"embed":Je("load",n);break;case"video":case"audio":for(s=0;s<tl.length;s++)Je(tl[s],n);break;case"source":Je("error",n);break;case"img":case"image":case"link":Je("error",n),Je("load",n);break;case"details":Je("toggle",n);break;case"input":u0(n,o),Je("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!o.multiple},Je("invalid",n);break;case"textarea":f0(n,o),Je("invalid",n)}ap(r,o),s=null;for(var i in o)if(o.hasOwnProperty(i)){var l=o[i];i==="children"?typeof l=="string"?n.textContent!==l&&(o.suppressHydrationWarning!==!0&&Uc(n.textContent,l,e),s=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(o.suppressHydrationWarning!==!0&&Uc(n.textContent,l,e),s=["children",""+l]):$l.hasOwnProperty(i)&&l!=null&&i==="onScroll"&&Je("scroll",n)}switch(r){case"input":Ic(n),d0(n,o,!0);break;case"textarea":Ic(n),h0(n);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(n.onclick=Xu)}n=s,t.updateQueue=n,n!==null&&(t.flags|=4)}else{i=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Bb(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=i.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=i.createElement(r,{is:n.is}):(e=i.createElement(r),r==="select"&&(i=e,n.multiple?i.multiple=!0:n.size&&(i.size=n.size))):e=i.createElementNS(e,r),e[bn]=t,e[Ll]=n,gS(e,t,!1,!1),t.stateNode=e;e:{switch(i=lp(r,n),r){case"dialog":Je("cancel",e),Je("close",e),s=n;break;case"iframe":case"object":case"embed":Je("load",e),s=n;break;case"video":case"audio":for(s=0;s<tl.length;s++)Je(tl[s],e);s=n;break;case"source":Je("error",e),s=n;break;case"img":case"image":case"link":Je("error",e),Je("load",e),s=n;break;case"details":Je("toggle",e),s=n;break;case"input":u0(e,n),s=rp(e,n),Je("invalid",e);break;case"option":s=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},s=ft({},n,{value:void 0}),Je("invalid",e);break;case"textarea":f0(e,n),s=op(e,n),Je("invalid",e);break;default:s=n}ap(r,s),l=s;for(o in l)if(l.hasOwnProperty(o)){var c=l[o];o==="style"?Gb(e,c):o==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Wb(e,c)):o==="children"?typeof c=="string"?(r!=="textarea"||c!=="")&&Pl(e,c):typeof c=="number"&&Pl(e,""+c):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&($l.hasOwnProperty(o)?c!=null&&o==="onScroll"&&Je("scroll",e):c!=null&&cg(e,o,c,i))}switch(r){case"input":Ic(e),d0(e,n,!1);break;case"textarea":Ic(e),h0(e);break;case"option":n.value!=null&&e.setAttribute("value",""+Ys(n.value));break;case"select":e.multiple=!!n.multiple,o=n.value,o!=null?Ii(e,!!n.multiple,o,!1):n.defaultValue!=null&&Ii(e,!!n.multiple,n.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Xu)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Kt(t),null;case 6:if(e&&t.stateNode!=null)yS(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(J(166));if(r=No(Ul.current),No(Pn.current),qc(t)){if(n=t.stateNode,r=t.memoizedProps,n[bn]=t,(o=n.nodeValue!==r)&&(e=Sr,e!==null))switch(e.tag){case 3:Uc(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Uc(n.nodeValue,r,(e.mode&1)!==0)}o&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[bn]=t,t.stateNode=n}return Kt(t),null;case 13:if(et(lt),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(st&&_r!==null&&t.mode&1&&!(t.flags&128))M_(),aa(),t.flags|=98560,o=!1;else if(o=qc(t),n!==null&&n.dehydrated!==null){if(e===null){if(!o)throw Error(J(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(J(317));o[bn]=t}else aa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Kt(t),o=!1}else tn!==null&&(qp(tn),tn=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=r,t):(n=n!==null,n!==(e!==null&&e.memoizedState!==null)&&n&&(t.child.flags|=8192,t.mode&1&&(e===null||lt.current&1?Nt===0&&(Nt=3):Kg())),t.updateQueue!==null&&(t.flags|=4),Kt(t),null);case 4:return ca(),Ap(e,t),e===null&&Dl(t.stateNode.containerInfo),Kt(t),null;case 10:return jg(t.type._context),Kt(t),null;case 17:return gr(t.type)&&ed(),Kt(t),null;case 19:if(et(lt),o=t.memoizedState,o===null)return Kt(t),null;if(n=(t.flags&128)!==0,i=o.rendering,i===null)if(n)Ha(o,!1);else{if(Nt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=ad(e),i!==null){for(t.flags|=128,Ha(o,!1),n=i.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;r!==null;)o=r,e=n,o.flags&=14680066,i=o.alternate,i===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,o.type=i.type,e=i.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return Ze(lt,lt.current&1|2),t.child}e=e.sibling}o.tail!==null&&xt()>da&&(t.flags|=128,n=!0,Ha(o,!1),t.lanes=4194304)}else{if(!n)if(e=ad(i),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Ha(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!st)return Kt(t),null}else 2*xt()-o.renderingStartTime>da&&r!==1073741824&&(t.flags|=128,n=!0,Ha(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(r=o.last,r!==null?r.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=xt(),t.sibling=null,r=lt.current,Ze(lt,n?r&1|2:r&1),t):(Kt(t),null);case 22:case 23:return Hg(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?wr&1073741824&&(Kt(t),t.subtreeFlags&6&&(t.flags|=8192)):Kt(t),null;case 24:return null;case 25:return null}throw Error(J(156,t.tag))}function aT(e,t){switch(kg(t),t.tag){case 1:return gr(t.type)&&ed(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ca(),et(mr),et(Gt),Ig(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Rg(t),null;case 13:if(et(lt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(J(340));aa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return et(lt),null;case 4:return ca(),null;case 10:return jg(t.type._context),null;case 22:case 23:return Hg(),null;case 24:return null;default:return null}}var Kc=!1,Wt=!1,lT=typeof WeakSet=="function"?WeakSet:Set,ae=null;function ji(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){vt(e,t,n)}else r.current=null}function Op(e,t,r){try{r()}catch(n){vt(e,t,n)}}var rw=!1;function cT(e,t){if(yp=Qu,e=S_(),_g(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var s=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break e}var i=0,l=-1,c=-1,u=0,d=0,f=e,g=null;t:for(;;){for(var v;f!==r||s!==0&&f.nodeType!==3||(l=i+s),f!==o||n!==0&&f.nodeType!==3||(c=i+n),f.nodeType===3&&(i+=f.nodeValue.length),(v=f.firstChild)!==null;)g=f,f=v;for(;;){if(f===e)break t;if(g===r&&++u===s&&(l=i),g===o&&++d===n&&(c=i),(v=f.nextSibling)!==null)break;f=g,g=f.parentNode}f=v}r=l===-1||c===-1?null:{start:l,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(wp={focusedElem:e,selectionRange:r},Qu=!1,ae=t;ae!==null;)if(t=ae,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ae=e;else for(;ae!==null;){t=ae;try{var b=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(b!==null){var h=b.memoizedProps,w=b.memoizedState,p=t.stateNode,m=p.getSnapshotBeforeUpdate(t.elementType===t.type?h:Qr(t.type,h),w);p.__reactInternalSnapshotBeforeUpdate=m}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(J(163))}}catch(_){vt(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,ae=e;break}ae=t.return}return b=rw,rw=!1,b}function gl(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var o=s.destroy;s.destroy=void 0,o!==void 0&&Op(t,r,o)}s=s.next}while(s!==n)}}function rf(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function Mp(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function wS(e){var t=e.alternate;t!==null&&(e.alternate=null,wS(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[bn],delete t[Ll],delete t[_p],delete t[KP],delete t[BP])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function xS(e){return e.tag===5||e.tag===3||e.tag===4}function nw(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||xS(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Dp(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Xu));else if(n!==4&&(e=e.child,e!==null))for(Dp(e,t,r),e=e.sibling;e!==null;)Dp(e,t,r),e=e.sibling}function zp(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(zp(e,t,r),e=e.sibling;e!==null;)zp(e,t,r),e=e.sibling}var At=null,en=!1;function hs(e,t,r){for(r=r.child;r!==null;)bS(e,t,r),r=r.sibling}function bS(e,t,r){if($n&&typeof $n.onCommitFiberUnmount=="function")try{$n.onCommitFiberUnmount(Zd,r)}catch{}switch(r.tag){case 5:Wt||ji(r,t);case 6:var n=At,s=en;At=null,hs(e,t,r),At=n,en=s,At!==null&&(en?(e=At,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):At.removeChild(r.stateNode));break;case 18:At!==null&&(en?(e=At,r=r.stateNode,e.nodeType===8?lh(e.parentNode,r):e.nodeType===1&&lh(e,r),Al(e)):lh(At,r.stateNode));break;case 4:n=At,s=en,At=r.stateNode.containerInfo,en=!0,hs(e,t,r),At=n,en=s;break;case 0:case 11:case 14:case 15:if(!Wt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){s=n=n.next;do{var o=s,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&Op(r,t,i),s=s.next}while(s!==n)}hs(e,t,r);break;case 1:if(!Wt&&(ji(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){vt(r,t,l)}hs(e,t,r);break;case 21:hs(e,t,r);break;case 22:r.mode&1?(Wt=(n=Wt)||r.memoizedState!==null,hs(e,t,r),Wt=n):hs(e,t,r);break;default:hs(e,t,r)}}function sw(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new lT),t.forEach(function(n){var s=yT.bind(null,e,n);r.has(n)||(r.add(n),n.then(s,s))})}}function Kr(e,t){var r=t.deletions;if(r!==null)for(var n=0;n<r.length;n++){var s=r[n];try{var o=e,i=t,l=i;e:for(;l!==null;){switch(l.tag){case 5:At=l.stateNode,en=!1;break e;case 3:At=l.stateNode.containerInfo,en=!0;break e;case 4:At=l.stateNode.containerInfo,en=!0;break e}l=l.return}if(At===null)throw Error(J(160));bS(o,i,s),At=null,en=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){vt(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)_S(t,e),t=t.sibling}function _S(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Kr(t,e),hn(e),n&4){try{gl(3,e,e.return),rf(3,e)}catch(h){vt(e,e.return,h)}try{gl(5,e,e.return)}catch(h){vt(e,e.return,h)}}break;case 1:Kr(t,e),hn(e),n&512&&r!==null&&ji(r,r.return);break;case 5:if(Kr(t,e),hn(e),n&512&&r!==null&&ji(r,r.return),e.flags&32){var s=e.stateNode;try{Pl(s,"")}catch(h){vt(e,e.return,h)}}if(n&4&&(s=e.stateNode,s!=null)){var o=e.memoizedProps,i=r!==null?r.memoizedProps:o,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&o.type==="radio"&&o.name!=null&&Hb(s,o),lp(l,i);var u=lp(l,o);for(i=0;i<c.length;i+=2){var d=c[i],f=c[i+1];d==="style"?Gb(s,f):d==="dangerouslySetInnerHTML"?Wb(s,f):d==="children"?Pl(s,f):cg(s,d,f,u)}switch(l){case"input":np(s,o);break;case"textarea":Kb(s,o);break;case"select":var g=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!o.multiple;var v=o.value;v!=null?Ii(s,!!o.multiple,v,!1):g!==!!o.multiple&&(o.defaultValue!=null?Ii(s,!!o.multiple,o.defaultValue,!0):Ii(s,!!o.multiple,o.multiple?[]:"",!1))}s[Ll]=o}catch(h){vt(e,e.return,h)}}break;case 6:if(Kr(t,e),hn(e),n&4){if(e.stateNode===null)throw Error(J(162));s=e.stateNode,o=e.memoizedProps;try{s.nodeValue=o}catch(h){vt(e,e.return,h)}}break;case 3:if(Kr(t,e),hn(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{Al(t.containerInfo)}catch(h){vt(e,e.return,h)}break;case 4:Kr(t,e),hn(e);break;case 13:Kr(t,e),hn(e),s=e.child,s.flags&8192&&(o=s.memoizedState!==null,s.stateNode.isHidden=o,!o||s.alternate!==null&&s.alternate.memoizedState!==null||(qg=xt())),n&4&&sw(e);break;case 22:if(d=r!==null&&r.memoizedState!==null,e.mode&1?(Wt=(u=Wt)||d,Kr(t,e),Wt=u):Kr(t,e),hn(e),n&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(ae=e,d=e.child;d!==null;){for(f=ae=d;ae!==null;){switch(g=ae,v=g.child,g.tag){case 0:case 11:case 14:case 15:gl(4,g,g.return);break;case 1:ji(g,g.return);var b=g.stateNode;if(typeof b.componentWillUnmount=="function"){n=g,r=g.return;try{t=n,b.props=t.memoizedProps,b.state=t.memoizedState,b.componentWillUnmount()}catch(h){vt(n,r,h)}}break;case 5:ji(g,g.return);break;case 22:if(g.memoizedState!==null){iw(f);continue}}v!==null?(v.return=g,ae=v):iw(f)}d=d.sibling}e:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{s=f.stateNode,u?(o=s.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(l=f.stateNode,c=f.memoizedProps.style,i=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=Zb("display",i))}catch(h){vt(e,e.return,h)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(h){vt(e,e.return,h)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Kr(t,e),hn(e),n&4&&sw(e);break;case 21:break;default:Kr(t,e),hn(e)}}function hn(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(xS(r)){var n=r;break e}r=r.return}throw Error(J(160))}switch(n.tag){case 5:var s=n.stateNode;n.flags&32&&(Pl(s,""),n.flags&=-33);var o=nw(e);zp(e,o,s);break;case 3:case 4:var i=n.stateNode.containerInfo,l=nw(e);Dp(e,l,i);break;default:throw Error(J(161))}}catch(c){vt(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function uT(e,t,r){ae=e,SS(e)}function SS(e,t,r){for(var n=(e.mode&1)!==0;ae!==null;){var s=ae,o=s.child;if(s.tag===22&&n){var i=s.memoizedState!==null||Kc;if(!i){var l=s.alternate,c=l!==null&&l.memoizedState!==null||Wt;l=Kc;var u=Wt;if(Kc=i,(Wt=c)&&!u)for(ae=s;ae!==null;)i=ae,c=i.child,i.tag===22&&i.memoizedState!==null?aw(s):c!==null?(c.return=i,ae=c):aw(s);for(;o!==null;)ae=o,SS(o),o=o.sibling;ae=s,Kc=l,Wt=u}ow(e)}else s.subtreeFlags&8772&&o!==null?(o.return=s,ae=o):ow(e)}}function ow(e){for(;ae!==null;){var t=ae;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Wt||rf(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!Wt)if(r===null)n.componentDidMount();else{var s=t.elementType===t.type?r.memoizedProps:Qr(t.type,r.memoizedProps);n.componentDidUpdate(s,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&V0(t,o,n);break;case 3:var i=t.updateQueue;if(i!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}V0(t,i,r)}break;case 5:var l=t.stateNode;if(r===null&&t.flags&4){r=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&r.focus();break;case"img":c.src&&(r.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&Al(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(J(163))}Wt||t.flags&512&&Mp(t)}catch(g){vt(t,t.return,g)}}if(t===e){ae=null;break}if(r=t.sibling,r!==null){r.return=t.return,ae=r;break}ae=t.return}}function iw(e){for(;ae!==null;){var t=ae;if(t===e){ae=null;break}var r=t.sibling;if(r!==null){r.return=t.return,ae=r;break}ae=t.return}}function aw(e){for(;ae!==null;){var t=ae;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{rf(4,t)}catch(c){vt(t,r,c)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var s=t.return;try{n.componentDidMount()}catch(c){vt(t,s,c)}}var o=t.return;try{Mp(t)}catch(c){vt(t,o,c)}break;case 5:var i=t.return;try{Mp(t)}catch(c){vt(t,i,c)}}}catch(c){vt(t,t.return,c)}if(t===e){ae=null;break}var l=t.sibling;if(l!==null){l.return=t.return,ae=l;break}ae=t.return}}var dT=Math.ceil,ud=ls.ReactCurrentDispatcher,Fg=ls.ReactCurrentOwner,Lr=ls.ReactCurrentBatchConfig,Le=0,Tt=null,_t=null,zt=0,wr=0,$i=io(0),Nt=0,Kl=null,qo=0,nf=0,Ug=0,vl=null,fr=null,qg=0,da=1/0,Un=null,dd=!1,Lp=null,Bs=null,Bc=!1,zs=null,fd=0,yl=0,Fp=null,Cu=-1,Eu=0;function nr(){return Le&6?xt():Cu!==-1?Cu:Cu=xt()}function Ws(e){return e.mode&1?Le&2&&zt!==0?zt&-zt:ZP.transition!==null?(Eu===0&&(Eu=a_()),Eu):(e=Ke,e!==0||(e=window.event,e=e===void 0?16:p_(e.type)),e):1}function an(e,t,r,n){if(50<yl)throw yl=0,Fp=null,Error(J(185));sc(e,r,n),(!(Le&2)||e!==Tt)&&(e===Tt&&(!(Le&2)&&(nf|=r),Nt===4&&Es(e,zt)),vr(e,n),r===1&&Le===0&&!(t.mode&1)&&(da=xt()+500,Xd&&ao()))}function vr(e,t){var r=e.callbackNode;Z$(e,t);var n=Gu(e,e===Tt?zt:0);if(n===0)r!==null&&g0(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&g0(r),t===1)e.tag===0?WP(lw.bind(null,e)):I_(lw.bind(null,e)),VP(function(){!(Le&6)&&ao()}),r=null;else{switch(l_(n)){case 1:r=pg;break;case 4:r=o_;break;case 16:r=Zu;break;case 536870912:r=i_;break;default:r=Zu}r=TS(r,kS.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function kS(e,t){if(Cu=-1,Eu=0,Le&6)throw Error(J(327));var r=e.callbackNode;if(zi()&&e.callbackNode!==r)return null;var n=Gu(e,e===Tt?zt:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=hd(e,n);else{t=n;var s=Le;Le|=2;var o=ES();(Tt!==e||zt!==t)&&(Un=null,da=xt()+500,Do(e,t));do try{pT();break}catch(l){CS(e,l)}while(!0);Ng(),ud.current=o,Le=s,_t!==null?t=0:(Tt=null,zt=0,t=Nt)}if(t!==0){if(t===2&&(s=hp(e),s!==0&&(n=s,t=Up(e,s))),t===1)throw r=Kl,Do(e,0),Es(e,n),vr(e,xt()),r;if(t===6)Es(e,n);else{if(s=e.current.alternate,!(n&30)&&!fT(s)&&(t=hd(e,n),t===2&&(o=hp(e),o!==0&&(n=o,t=Up(e,o))),t===1))throw r=Kl,Do(e,0),Es(e,n),vr(e,xt()),r;switch(e.finishedWork=s,e.finishedLanes=n,t){case 0:case 1:throw Error(J(345));case 2:vo(e,fr,Un);break;case 3:if(Es(e,n),(n&130023424)===n&&(t=qg+500-xt(),10<t)){if(Gu(e,0)!==0)break;if(s=e.suspendedLanes,(s&n)!==n){nr(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=bp(vo.bind(null,e,fr,Un),t);break}vo(e,fr,Un);break;case 4:if(Es(e,n),(n&4194240)===n)break;for(t=e.eventTimes,s=-1;0<n;){var i=31-on(n);o=1<<i,i=t[i],i>s&&(s=i),n&=~o}if(n=s,n=xt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*dT(n/1960))-n,10<n){e.timeoutHandle=bp(vo.bind(null,e,fr,Un),n);break}vo(e,fr,Un);break;case 5:vo(e,fr,Un);break;default:throw Error(J(329))}}}return vr(e,xt()),e.callbackNode===r?kS.bind(null,e):null}function Up(e,t){var r=vl;return e.current.memoizedState.isDehydrated&&(Do(e,t).flags|=256),e=hd(e,t),e!==2&&(t=fr,fr=r,t!==null&&qp(t)),e}function qp(e){fr===null?fr=e:fr.push.apply(fr,e)}function fT(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var s=r[n],o=s.getSnapshot;s=s.value;try{if(!cn(o(),s))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Es(e,t){for(t&=~Ug,t&=~nf,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-on(t),n=1<<r;e[r]=-1,t&=~n}}function lw(e){if(Le&6)throw Error(J(327));zi();var t=Gu(e,0);if(!(t&1))return vr(e,xt()),null;var r=hd(e,t);if(e.tag!==0&&r===2){var n=hp(e);n!==0&&(t=n,r=Up(e,n))}if(r===1)throw r=Kl,Do(e,0),Es(e,t),vr(e,xt()),r;if(r===6)throw Error(J(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,vo(e,fr,Un),vr(e,xt()),null}function Vg(e,t){var r=Le;Le|=1;try{return e(t)}finally{Le=r,Le===0&&(da=xt()+500,Xd&&ao())}}function Vo(e){zs!==null&&zs.tag===0&&!(Le&6)&&zi();var t=Le;Le|=1;var r=Lr.transition,n=Ke;try{if(Lr.transition=null,Ke=1,e)return e()}finally{Ke=n,Lr.transition=r,Le=t,!(Le&6)&&ao()}}function Hg(){wr=$i.current,et($i)}function Do(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,qP(r)),_t!==null)for(r=_t.return;r!==null;){var n=r;switch(kg(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&ed();break;case 3:ca(),et(mr),et(Gt),Ig();break;case 5:Rg(n);break;case 4:ca();break;case 13:et(lt);break;case 19:et(lt);break;case 10:jg(n.type._context);break;case 22:case 23:Hg()}r=r.return}if(Tt=e,_t=e=Zs(e.current,null),zt=wr=t,Nt=0,Kl=null,Ug=nf=qo=0,fr=vl=null,Eo!==null){for(t=0;t<Eo.length;t++)if(r=Eo[t],n=r.interleaved,n!==null){r.interleaved=null;var s=n.next,o=r.pending;if(o!==null){var i=o.next;o.next=s,n.next=i}r.pending=n}Eo=null}return e}function CS(e,t){do{var r=_t;try{if(Ng(),_u.current=cd,ld){for(var n=ut.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}ld=!1}if(Uo=0,Pt=kt=ut=null,ml=!1,ql=0,Fg.current=null,r===null||r.return===null){Nt=1,Kl=t,_t=null;break}e:{var o=e,i=r.return,l=r,c=t;if(t=zt,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var g=d.alternate;g?(d.updateQueue=g.updateQueue,d.memoizedState=g.memoizedState,d.lanes=g.lanes):(d.updateQueue=null,d.memoizedState=null)}var v=G0(i);if(v!==null){v.flags&=-257,Q0(v,i,l,o,t),v.mode&1&&Z0(o,u,t),t=v,c=u;var b=t.updateQueue;if(b===null){var h=new Set;h.add(c),t.updateQueue=h}else b.add(c);break e}else{if(!(t&1)){Z0(o,u,t),Kg();break e}c=Error(J(426))}}else if(st&&l.mode&1){var w=G0(i);if(w!==null){!(w.flags&65536)&&(w.flags|=256),Q0(w,i,l,o,t),Cg(ua(c,l));break e}}o=c=ua(c,l),Nt!==4&&(Nt=2),vl===null?vl=[o]:vl.push(o),o=i;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var p=lS(o,c,t);q0(o,p);break e;case 1:l=c;var m=o.type,x=o.stateNode;if(!(o.flags&128)&&(typeof m.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Bs===null||!Bs.has(x)))){o.flags|=65536,t&=-t,o.lanes|=t;var _=cS(o,l,t);q0(o,_);break e}}o=o.return}while(o!==null)}jS(r)}catch(C){t=C,_t===r&&r!==null&&(_t=r=r.return);continue}break}while(!0)}function ES(){var e=ud.current;return ud.current=cd,e===null?cd:e}function Kg(){(Nt===0||Nt===3||Nt===2)&&(Nt=4),Tt===null||!(qo&268435455)&&!(nf&268435455)||Es(Tt,zt)}function hd(e,t){var r=Le;Le|=2;var n=ES();(Tt!==e||zt!==t)&&(Un=null,Do(e,t));do try{hT();break}catch(s){CS(e,s)}while(!0);if(Ng(),Le=r,ud.current=n,_t!==null)throw Error(J(261));return Tt=null,zt=0,Nt}function hT(){for(;_t!==null;)NS(_t)}function pT(){for(;_t!==null&&!L$();)NS(_t)}function NS(e){var t=PS(e.alternate,e,wr);e.memoizedProps=e.pendingProps,t===null?jS(e):_t=t,Fg.current=null}function jS(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=aT(r,t),r!==null){r.flags&=32767,_t=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Nt=6,_t=null;return}}else if(r=iT(r,t,wr),r!==null){_t=r;return}if(t=t.sibling,t!==null){_t=t;return}_t=t=e}while(t!==null);Nt===0&&(Nt=5)}function vo(e,t,r){var n=Ke,s=Lr.transition;try{Lr.transition=null,Ke=1,mT(e,t,r,n)}finally{Lr.transition=s,Ke=n}return null}function mT(e,t,r,n){do zi();while(zs!==null);if(Le&6)throw Error(J(327));r=e.finishedWork;var s=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(J(177));e.callbackNode=null,e.callbackPriority=0;var o=r.lanes|r.childLanes;if(G$(e,o),e===Tt&&(_t=Tt=null,zt=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||Bc||(Bc=!0,TS(Zu,function(){return zi(),null})),o=(r.flags&15990)!==0,r.subtreeFlags&15990||o){o=Lr.transition,Lr.transition=null;var i=Ke;Ke=1;var l=Le;Le|=4,Fg.current=null,cT(e,r),_S(r,e),OP(wp),Qu=!!yp,wp=yp=null,e.current=r,uT(r),F$(),Le=l,Ke=i,Lr.transition=o}else e.current=r;if(Bc&&(Bc=!1,zs=e,fd=s),o=e.pendingLanes,o===0&&(Bs=null),V$(r.stateNode),vr(e,xt()),t!==null)for(n=e.onRecoverableError,r=0;r<t.length;r++)s=t[r],n(s.value,{componentStack:s.stack,digest:s.digest});if(dd)throw dd=!1,e=Lp,Lp=null,e;return fd&1&&e.tag!==0&&zi(),o=e.pendingLanes,o&1?e===Fp?yl++:(yl=0,Fp=e):yl=0,ao(),null}function zi(){if(zs!==null){var e=l_(fd),t=Lr.transition,r=Ke;try{if(Lr.transition=null,Ke=16>e?16:e,zs===null)var n=!1;else{if(e=zs,zs=null,fd=0,Le&6)throw Error(J(331));var s=Le;for(Le|=4,ae=e.current;ae!==null;){var o=ae,i=o.child;if(ae.flags&16){var l=o.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(ae=u;ae!==null;){var d=ae;switch(d.tag){case 0:case 11:case 15:gl(8,d,o)}var f=d.child;if(f!==null)f.return=d,ae=f;else for(;ae!==null;){d=ae;var g=d.sibling,v=d.return;if(wS(d),d===u){ae=null;break}if(g!==null){g.return=v,ae=g;break}ae=v}}}var b=o.alternate;if(b!==null){var h=b.child;if(h!==null){b.child=null;do{var w=h.sibling;h.sibling=null,h=w}while(h!==null)}}ae=o}}if(o.subtreeFlags&2064&&i!==null)i.return=o,ae=i;else e:for(;ae!==null;){if(o=ae,o.flags&2048)switch(o.tag){case 0:case 11:case 15:gl(9,o,o.return)}var p=o.sibling;if(p!==null){p.return=o.return,ae=p;break e}ae=o.return}}var m=e.current;for(ae=m;ae!==null;){i=ae;var x=i.child;if(i.subtreeFlags&2064&&x!==null)x.return=i,ae=x;else e:for(i=m;ae!==null;){if(l=ae,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:rf(9,l)}}catch(C){vt(l,l.return,C)}if(l===i){ae=null;break e}var _=l.sibling;if(_!==null){_.return=l.return,ae=_;break e}ae=l.return}}if(Le=s,ao(),$n&&typeof $n.onPostCommitFiberRoot=="function")try{$n.onPostCommitFiberRoot(Zd,e)}catch{}n=!0}return n}finally{Ke=r,Lr.transition=t}}return!1}function cw(e,t,r){t=ua(r,t),t=lS(e,t,1),e=Ks(e,t,1),t=nr(),e!==null&&(sc(e,1,t),vr(e,t))}function vt(e,t,r){if(e.tag===3)cw(e,e,r);else for(;t!==null;){if(t.tag===3){cw(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Bs===null||!Bs.has(n))){e=ua(r,e),e=cS(t,e,1),t=Ks(t,e,1),e=nr(),t!==null&&(sc(t,1,e),vr(t,e));break}}t=t.return}}function gT(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=nr(),e.pingedLanes|=e.suspendedLanes&r,Tt===e&&(zt&r)===r&&(Nt===4||Nt===3&&(zt&130023424)===zt&&500>xt()-qg?Do(e,0):Ug|=r),vr(e,t)}function $S(e,t){t===0&&(e.mode&1?(t=Mc,Mc<<=1,!(Mc&130023424)&&(Mc=4194304)):t=1);var r=nr();e=ns(e,t),e!==null&&(sc(e,t,r),vr(e,r))}function vT(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),$S(e,r)}function yT(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,s=e.memoizedState;s!==null&&(r=s.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(J(314))}n!==null&&n.delete(t),$S(e,r)}var PS;PS=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||mr.current)pr=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return pr=!1,oT(e,t,r);pr=!!(e.flags&131072)}else pr=!1,st&&t.flags&1048576&&A_(t,nd,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;ku(e,t),e=t.pendingProps;var s=ia(t,Gt.current);Di(t,r),s=Og(null,t,n,e,s,r);var o=Mg();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,gr(n)?(o=!0,td(t)):o=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Pg(t),s.updater=tf,t.stateNode=s,s._reactInternals=t,jp(t,n,e,r),t=Tp(null,t,n,!0,o,r)):(t.tag=0,st&&o&&Sg(t),Xt(null,t,s,r),t=t.child),t;case 16:n=t.elementType;e:{switch(ku(e,t),e=t.pendingProps,s=n._init,n=s(n._payload),t.type=n,s=t.tag=xT(n),e=Qr(n,e),s){case 0:t=Pp(null,t,n,e,r);break e;case 1:t=X0(null,t,n,e,r);break e;case 11:t=J0(null,t,n,e,r);break e;case 14:t=Y0(null,t,n,Qr(n.type,e),r);break e}throw Error(J(306,n,""))}return t;case 0:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Qr(n,s),Pp(e,t,n,s,r);case 1:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Qr(n,s),X0(e,t,n,s,r);case 3:e:{if(hS(t),e===null)throw Error(J(387));n=t.pendingProps,o=t.memoizedState,s=o.element,F_(e,t),id(t,n,null,r);var i=t.memoizedState;if(n=i.element,o.isDehydrated)if(o={element:n,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){s=ua(Error(J(423)),t),t=ew(e,t,n,r,s);break e}else if(n!==s){s=ua(Error(J(424)),t),t=ew(e,t,n,r,s);break e}else for(_r=Hs(t.stateNode.containerInfo.firstChild),Sr=t,st=!0,tn=null,r=z_(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(aa(),n===s){t=ss(e,t,r);break e}Xt(e,t,n,r)}t=t.child}return t;case 5:return U_(t),e===null&&Cp(t),n=t.type,s=t.pendingProps,o=e!==null?e.memoizedProps:null,i=s.children,xp(n,s)?i=null:o!==null&&xp(n,o)&&(t.flags|=32),fS(e,t),Xt(e,t,i,r),t.child;case 6:return e===null&&Cp(t),null;case 13:return pS(e,t,r);case 4:return Tg(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=la(t,null,n,r):Xt(e,t,n,r),t.child;case 11:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Qr(n,s),J0(e,t,n,s,r);case 7:return Xt(e,t,t.pendingProps,r),t.child;case 8:return Xt(e,t,t.pendingProps.children,r),t.child;case 12:return Xt(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,s=t.pendingProps,o=t.memoizedProps,i=s.value,Ze(sd,n._currentValue),n._currentValue=i,o!==null)if(cn(o.value,i)){if(o.children===s.children&&!mr.current){t=ss(e,t,r);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var l=o.dependencies;if(l!==null){i=o.child;for(var c=l.firstContext;c!==null;){if(c.context===n){if(o.tag===1){c=Qn(-1,r&-r),c.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}o.lanes|=r,c=o.alternate,c!==null&&(c.lanes|=r),Ep(o.return,r,t),l.lanes|=r;break}c=c.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(J(341));i.lanes|=r,l=i.alternate,l!==null&&(l.lanes|=r),Ep(i,r,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}Xt(e,t,s.children,r),t=t.child}return t;case 9:return s=t.type,n=t.pendingProps.children,Di(t,r),s=Fr(s),n=n(s),t.flags|=1,Xt(e,t,n,r),t.child;case 14:return n=t.type,s=Qr(n,t.pendingProps),s=Qr(n.type,s),Y0(e,t,n,s,r);case 15:return uS(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Qr(n,s),ku(e,t),t.tag=1,gr(n)?(e=!0,td(t)):e=!1,Di(t,r),aS(t,n,s),jp(t,n,s,r),Tp(null,t,n,!0,e,r);case 19:return mS(e,t,r);case 22:return dS(e,t,r)}throw Error(J(156,t.tag))};function TS(e,t){return s_(e,t)}function wT(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zr(e,t,r,n){return new wT(e,t,r,n)}function Bg(e){return e=e.prototype,!(!e||!e.isReactComponent)}function xT(e){if(typeof e=="function")return Bg(e)?1:0;if(e!=null){if(e=e.$$typeof,e===dg)return 11;if(e===fg)return 14}return 2}function Zs(e,t){var r=e.alternate;return r===null?(r=zr(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Nu(e,t,r,n,s,o){var i=2;if(n=e,typeof e=="function")Bg(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case wi:return zo(r.children,s,o,t);case ug:i=8,s|=8;break;case Yh:return e=zr(12,r,t,s|2),e.elementType=Yh,e.lanes=o,e;case Xh:return e=zr(13,r,t,s),e.elementType=Xh,e.lanes=o,e;case ep:return e=zr(19,r,t,s),e.elementType=ep,e.lanes=o,e;case Ub:return sf(r,s,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Lb:i=10;break e;case Fb:i=9;break e;case dg:i=11;break e;case fg:i=14;break e;case xs:i=16,n=null;break e}throw Error(J(130,e==null?e:typeof e,""))}return t=zr(i,r,t,s),t.elementType=e,t.type=n,t.lanes=o,t}function zo(e,t,r,n){return e=zr(7,e,n,t),e.lanes=r,e}function sf(e,t,r,n){return e=zr(22,e,n,t),e.elementType=Ub,e.lanes=r,e.stateNode={isHidden:!1},e}function gh(e,t,r){return e=zr(6,e,null,t),e.lanes=r,e}function vh(e,t,r){return t=zr(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function bT(e,t,r,n,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Jf(0),this.expirationTimes=Jf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jf(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Wg(e,t,r,n,s,o,i,l,c){return e=new bT(e,t,r,l,c),t===1?(t=1,o===!0&&(t|=8)):t=0,o=zr(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Pg(o),e}function _T(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:yi,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function RS(e){if(!e)return Xs;e=e._reactInternals;e:{if(ei(e)!==e||e.tag!==1)throw Error(J(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(gr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(J(171))}if(e.tag===1){var r=e.type;if(gr(r))return R_(e,r,t)}return t}function IS(e,t,r,n,s,o,i,l,c){return e=Wg(r,n,!0,e,s,o,i,l,c),e.context=RS(null),r=e.current,n=nr(),s=Ws(r),o=Qn(n,s),o.callback=t??null,Ks(r,o,s),e.current.lanes=s,sc(e,s,n),vr(e,n),e}function of(e,t,r,n){var s=t.current,o=nr(),i=Ws(s);return r=RS(r),t.context===null?t.context=r:t.pendingContext=r,t=Qn(o,i),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=Ks(s,t,i),e!==null&&(an(e,s,i,o),bu(e,s,i)),i}function pd(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function uw(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function Zg(e,t){uw(e,t),(e=e.alternate)&&uw(e,t)}function ST(){return null}var AS=typeof reportError=="function"?reportError:function(e){console.error(e)};function Gg(e){this._internalRoot=e}af.prototype.render=Gg.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(J(409));of(e,t,null,null)};af.prototype.unmount=Gg.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Vo(function(){of(null,e,null,null)}),t[rs]=null}};function af(e){this._internalRoot=e}af.prototype.unstable_scheduleHydration=function(e){if(e){var t=d_();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Cs.length&&t!==0&&t<Cs[r].priority;r++);Cs.splice(r,0,e),r===0&&h_(e)}};function Qg(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function lf(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function dw(){}function kT(e,t,r,n,s){if(s){if(typeof n=="function"){var o=n;n=function(){var u=pd(i);o.call(u)}}var i=IS(t,n,e,0,null,!1,!1,"",dw);return e._reactRootContainer=i,e[rs]=i.current,Dl(e.nodeType===8?e.parentNode:e),Vo(),i}for(;s=e.lastChild;)e.removeChild(s);if(typeof n=="function"){var l=n;n=function(){var u=pd(c);l.call(u)}}var c=Wg(e,0,!1,null,null,!1,!1,"",dw);return e._reactRootContainer=c,e[rs]=c.current,Dl(e.nodeType===8?e.parentNode:e),Vo(function(){of(t,c,r,n)}),c}function cf(e,t,r,n,s){var o=r._reactRootContainer;if(o){var i=o;if(typeof s=="function"){var l=s;s=function(){var c=pd(i);l.call(c)}}of(t,i,e,s)}else i=kT(r,t,e,s,n);return pd(i)}c_=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=el(t.pendingLanes);r!==0&&(mg(t,r|1),vr(t,xt()),!(Le&6)&&(da=xt()+500,ao()))}break;case 13:Vo(function(){var n=ns(e,1);if(n!==null){var s=nr();an(n,e,1,s)}}),Zg(e,1)}};gg=function(e){if(e.tag===13){var t=ns(e,134217728);if(t!==null){var r=nr();an(t,e,134217728,r)}Zg(e,134217728)}};u_=function(e){if(e.tag===13){var t=Ws(e),r=ns(e,t);if(r!==null){var n=nr();an(r,e,t,n)}Zg(e,t)}};d_=function(){return Ke};f_=function(e,t){var r=Ke;try{return Ke=e,t()}finally{Ke=r}};up=function(e,t,r){switch(t){case"input":if(np(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var s=Yd(n);if(!s)throw Error(J(90));Vb(n),np(n,s)}}}break;case"textarea":Kb(e,r);break;case"select":t=r.value,t!=null&&Ii(e,!!r.multiple,t,!1)}};Yb=Vg;Xb=Vo;var CT={usingClientEntryPoint:!1,Events:[ic,Si,Yd,Qb,Jb,Vg]},Ka={findFiberByHostInstance:Co,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},ET={bundleType:Ka.bundleType,version:Ka.version,rendererPackageName:Ka.rendererPackageName,rendererConfig:Ka.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ls.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=r_(e),e===null?null:e.stateNode},findFiberByHostInstance:Ka.findFiberByHostInstance||ST,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 Wc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wc.isDisabled&&Wc.supportsFiber)try{Zd=Wc.inject(ET),$n=Wc}catch{}}Er.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=CT;Er.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Qg(t))throw Error(J(200));return _T(e,t,null,r)};Er.createRoot=function(e,t){if(!Qg(e))throw Error(J(299));var r=!1,n="",s=AS;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=Wg(e,1,!1,null,null,r,!1,n,s),e[rs]=t.current,Dl(e.nodeType===8?e.parentNode:e),new Gg(t)};Er.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(J(188)):(e=Object.keys(e).join(","),Error(J(268,e)));return e=r_(t),e=e===null?null:e.stateNode,e};Er.flushSync=function(e){return Vo(e)};Er.hydrate=function(e,t,r){if(!lf(t))throw Error(J(200));return cf(null,e,t,!0,r)};Er.hydrateRoot=function(e,t,r){if(!Qg(e))throw Error(J(405));var n=r!=null&&r.hydratedSources||null,s=!1,o="",i=AS;if(r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(o=r.identifierPrefix),r.onRecoverableError!==void 0&&(i=r.onRecoverableError)),t=IS(t,null,e,1,r??null,s,!1,o,i),e[rs]=t.current,Dl(e),n)for(e=0;e<n.length;e++)r=n[e],s=r._getVersion,s=s(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,s]:t.mutableSourceEagerHydrationData.push(r,s);return new af(t)};Er.render=function(e,t,r){if(!lf(t))throw Error(J(200));return cf(null,e,t,!1,r)};Er.unmountComponentAtNode=function(e){if(!lf(e))throw Error(J(40));return e._reactRootContainer?(Vo(function(){cf(null,null,e,!1,function(){e._reactRootContainer=null,e[rs]=null})}),!0):!1};Er.unstable_batchedUpdates=Vg;Er.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!lf(r))throw Error(J(200));if(e==null||e._reactInternals===void 0)throw Error(J(38));return cf(e,t,r,!1,n)};Er.version="18.3.1-next-f1338f8080-20240426";function OS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(OS)}catch(e){console.error(e)}}OS(),Ob.exports=Er;var ti=Ob.exports;const NT=Bd(ti);var MS,fw=ti;MS=fw.createRoot,fw.hydrateRoot;function jT(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var r,n,s,o,i=[],l="",c=e.split("/");for(c[0]||c.shift();s=c.shift();)r=s[0],r==="*"?(i.push(r),l+=s[1]==="?"?"(?:/(.*))?":"/(.*)"):r===":"?(n=s.indexOf("?",1),o=s.indexOf(".",1),i.push(s.substring(1,~n?n:~o?o:s.length)),l+=~n&&!~o?"(?:/([^/]+?))?":"/([^/]+?)",~o&&(l+=(~n?"?":"")+"\\"+s.substring(o))):l+="/"+s;return{keys:i,pattern:new RegExp("^"+l+(t?"(?=$|/)":"/?$"),"i")}}var DS={exports:{}},zS={};/**
|
|
41
|
+
* @license React
|
|
42
|
+
* use-sync-external-store-shim.production.js
|
|
43
|
+
*
|
|
44
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
45
|
+
*
|
|
46
|
+
* This source code is licensed under the MIT license found in the
|
|
47
|
+
* LICENSE file in the root directory of this source tree.
|
|
48
|
+
*/var fa=y;function $T(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var PT=typeof Object.is=="function"?Object.is:$T,TT=fa.useState,RT=fa.useEffect,IT=fa.useLayoutEffect,AT=fa.useDebugValue;function OT(e,t){var r=t(),n=TT({inst:{value:r,getSnapshot:t}}),s=n[0].inst,o=n[1];return IT(function(){s.value=r,s.getSnapshot=t,yh(s)&&o({inst:s})},[e,r,t]),RT(function(){return yh(s)&&o({inst:s}),e(function(){yh(s)&&o({inst:s})})},[e]),AT(r),r}function yh(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!PT(e,r)}catch{return!0}}function MT(e,t){return t()}var DT=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?MT:OT;zS.useSyncExternalStore=fa.useSyncExternalStore!==void 0?fa.useSyncExternalStore:DT;DS.exports=zS;var zT=DS.exports;const LT=ig.useInsertionEffect,FT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",UT=FT?y.useLayoutEffect:y.useEffect,qT=LT||UT,LS=e=>{const t=y.useRef([e,(...r)=>t[0](...r)]).current;return qT(()=>{t[0]=e}),t[1]},VT="popstate",Jg="pushState",Yg="replaceState",HT="hashchange",hw=[VT,Jg,Yg,HT],KT=e=>{for(const t of hw)addEventListener(t,e);return()=>{for(const t of hw)removeEventListener(t,e)}},FS=(e,t)=>zT.useSyncExternalStore(KT,e,t),BT=()=>location.search,WT=({ssrSearch:e=""}={})=>FS(BT,()=>e),pw=()=>location.pathname,ZT=({ssrPath:e}={})=>FS(pw,e?()=>e:pw),GT=(e,{replace:t=!1,state:r=null}={})=>history[t?Yg:Jg](r,"",e),QT=(e={})=>[ZT(e),GT],mw=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[mw]>"u"){for(const e of[Jg,Yg]){const t=history[e];history[e]=function(){const r=t.apply(this,arguments),n=new Event(e);return n.arguments=arguments,dispatchEvent(n),r}}Object.defineProperty(window,mw,{value:!0})}const JT=(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())?"~"+t:t.slice(e.length)||"/",US=(e="")=>e==="/"?"":e,YT=(e,t)=>e[0]==="~"?e.slice(1):US(t)+e,XT=(e="",t)=>JT(gw(US(e)),gw(t)),gw=e=>{try{return decodeURI(e)}catch{return e}},qS={hook:QT,searchHook:WT,parser:jT,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e},VS=y.createContext(qS),lc=()=>y.useContext(VS),HS={},KS=y.createContext(HS),e2=()=>y.useContext(KS),uf=e=>{const[t,r]=e.hook(e);return[XT(e.base,t),LS((n,s)=>r(YT(n,e.base),s))]},t2=()=>uf(lc()),BS=(e,t,r,n)=>{const{pattern:s,keys:o}=t instanceof RegExp?{keys:!1,pattern:t}:e(t||"*",n),i=s.exec(r)||[],[l,...c]=i;return l!==void 0?[!0,(()=>{const u=o!==!1?Object.fromEntries(o.map((f,g)=>[f,c[g]])):i.groups;let d={...c};return u&&Object.assign(d,u),d})(),...n?[l]:[]]:[!1,null]},r2=({children:e,...t})=>{var d,f;const r=lc(),n=t.hook?qS:r;let s=n;const[o,i]=((d=t.ssrPath)==null?void 0:d.split("?"))??[];i&&(t.ssrSearch=i,t.ssrPath=o),t.hrefs=t.hrefs??((f=t.hook)==null?void 0:f.hrefs);let l=y.useRef({}),c=l.current,u=c;for(let g in n){const v=g==="base"?n[g]+(t[g]||""):t[g]||n[g];c===u&&v!==u[g]&&(l.current=u={...u}),u[g]=v,(v!==n[g]||v!==s[g])&&(s=u)}return y.createElement(VS.Provider,{value:s,children:e})},vw=({children:e,component:t},r)=>t?y.createElement(t,{params:r}):typeof e=="function"?e(r):e,n2=e=>{let t=y.useRef(HS);const r=t.current;return t.current=Object.keys(e).length!==Object.keys(r).length||Object.entries(e).some(([n,s])=>s!==r[n])?e:r},Zc=({path:e,nest:t,match:r,...n})=>{const s=lc(),[o]=uf(s),[i,l,c]=r??BS(s.parser,e,o,t),u=n2({...e2(),...l});if(!i)return null;const d=c?y.createElement(r2,{base:c},vw(n,u)):vw(n,u);return y.createElement(KS.Provider,{value:u,children:d})};y.forwardRef((e,t)=>{const r=lc(),[n,s]=uf(r),{to:o="",href:i=o,onClick:l,asChild:c,children:u,className:d,replace:f,state:g,...v}=e,b=LS(w=>{w.ctrlKey||w.metaKey||w.altKey||w.shiftKey||w.button!==0||(l==null||l(w),w.defaultPrevented||(w.preventDefault(),s(i,e)))}),h=r.hrefs(i[0]==="~"?i.slice(1):r.base+i,r);return c&&y.isValidElement(u)?y.cloneElement(u,{onClick:b,href:h}):y.createElement("a",{...v,onClick:b,href:h,className:d!=null&&d.call?d(n===i):d,children:u,ref:t})});const WS=e=>Array.isArray(e)?e.flatMap(t=>WS(t&&t.type===y.Fragment?t.props.children:t)):[e],s2=({children:e,location:t})=>{const r=lc(),[n]=uf(r);for(const s of WS(e)){let o=0;if(y.isValidElement(s)&&(o=BS(r.parser,s.props.path,t||n,s.props.nest))[0])return y.cloneElement(s,{match:o})}return null};var ka=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(){}},Ho=typeof window>"u"||"Deno"in globalThis;function rr(){}function o2(e,t){return typeof e=="function"?e(t):e}function Vp(e){return typeof e=="number"&&e>=0&&e!==1/0}function ZS(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Gs(e,t){return typeof e=="function"?e(t):e}function Or(e,t){return typeof e=="function"?e(t):e}function yw(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:o,queryKey:i,stale:l}=e;if(i){if(n){if(t.queryHash!==Xg(i,t.options))return!1}else if(!Bl(t.queryKey,i))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||s&&s!==t.state.fetchStatus||o&&!o(t))}function ww(e,t){const{exact:r,status:n,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(r){if(Ko(t.options.mutationKey)!==Ko(o))return!1}else if(!Bl(t.options.mutationKey,o))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function Xg(e,t){return((t==null?void 0:t.queryKeyHashFn)||Ko)(e)}function Ko(e){return JSON.stringify(e,(t,r)=>Hp(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Bl(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Bl(e[r],t[r])):!1}function GS(e,t){if(e===t)return e;const r=xw(e)&&xw(t);if(r||Hp(e)&&Hp(t)){const n=r?e:Object.keys(e),s=n.length,o=r?t:Object.keys(t),i=o.length,l=r?[]:{},c=new Set(n);let u=0;for(let d=0;d<i;d++){const f=r?d:o[d];(!r&&c.has(f)||r)&&e[f]===void 0&&t[f]===void 0?(l[f]=void 0,u++):(l[f]=GS(e[f],t[f]),l[f]===e[f]&&e[f]!==void 0&&u++)}return s===i&&u===s?e:l}return t}function md(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function xw(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Hp(e){if(!bw(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!bw(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function bw(e){return Object.prototype.toString.call(e)==="[object Object]"}function i2(e){return new Promise(t=>{setTimeout(t,e)})}function Kp(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?GS(e,t):t}function a2(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function l2(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var ev=Symbol();function QS(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===ev?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function JS(e,t){return typeof e=="function"?e(...t):!!e}var $o,js,Bi,pb,c2=(pb=class extends ka{constructor(){super();ge(this,$o);ge(this,js);ge(this,Bi);re(this,Bi,t=>{if(!Ho&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){R(this,js)||this.setEventListener(R(this,Bi))}onUnsubscribe(){var t;this.hasListeners()||((t=R(this,js))==null||t.call(this),re(this,js,void 0))}setEventListener(t){var r;re(this,Bi,t),(r=R(this,js))==null||r.call(this),re(this,js,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){R(this,$o)!==t&&(re(this,$o,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof R(this,$o)=="boolean"?R(this,$o):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},$o=new WeakMap,js=new WeakMap,Bi=new WeakMap,pb),tv=new c2,Wi,$s,Zi,mb,u2=(mb=class extends ka{constructor(){super();ge(this,Wi,!0);ge(this,$s);ge(this,Zi);re(this,Zi,t=>{if(!Ho&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){R(this,$s)||this.setEventListener(R(this,Zi))}onUnsubscribe(){var t;this.hasListeners()||((t=R(this,$s))==null||t.call(this),re(this,$s,void 0))}setEventListener(t){var r;re(this,Zi,t),(r=R(this,$s))==null||r.call(this),re(this,$s,t(this.setOnline.bind(this)))}setOnline(t){R(this,Wi)!==t&&(re(this,Wi,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return R(this,Wi)}},Wi=new WeakMap,$s=new WeakMap,Zi=new WeakMap,mb),gd=new u2;function Bp(){let e,t;const r=new Promise((s,o)=>{e=s,t=o});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}function d2(e){return Math.min(1e3*2**e,3e4)}function YS(e){return(e??"online")==="online"?gd.isOnline():!0}var XS=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ek(e){let t=!1,r=0,n;const s=Bp(),o=()=>s.status!=="pending",i=h=>{var w;o()||(g(new XS(h)),(w=e.abort)==null||w.call(e))},l=()=>{t=!0},c=()=>{t=!1},u=()=>tv.isFocused()&&(e.networkMode==="always"||gd.isOnline())&&e.canRun(),d=()=>YS(e.networkMode)&&e.canRun(),f=h=>{o()||(n==null||n(),s.resolve(h))},g=h=>{o()||(n==null||n(),s.reject(h))},v=()=>new Promise(h=>{var w;n=p=>{(o()||u())&&h(p)},(w=e.onPause)==null||w.call(e)}).then(()=>{var h;n=void 0,o()||(h=e.onContinue)==null||h.call(e)}),b=()=>{if(o())return;let h;const w=r===0?e.initialPromise:void 0;try{h=w??e.fn()}catch(p){h=Promise.reject(p)}Promise.resolve(h).then(f).catch(p=>{var $;if(o())return;const m=e.retry??(Ho?0:3),x=e.retryDelay??d2,_=typeof x=="function"?x(r,p):x,C=m===!0||typeof m=="number"&&r<m||typeof m=="function"&&m(r,p);if(t||!C){g(p);return}r++,($=e.onFail)==null||$.call(e,r,p),i2(_).then(()=>u()?void 0:v()).then(()=>{t?g(p):b()})})};return{promise:s,status:()=>s.status,cancel:i,continue:()=>(n==null||n(),s),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?b():v().then(b),s)}}var f2=e=>setTimeout(e,0);function h2(){let e=[],t=0,r=l=>{l()},n=l=>{l()},s=f2;const o=l=>{t?e.push(l):s(()=>{r(l)})},i=()=>{const l=e;e=[],l.length&&s(()=>{n(()=>{l.forEach(c=>{r(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||i()}return c},batchCalls:l=>(...c)=>{o(()=>{l(...c)})},schedule:o,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{s=l}}}var Et=h2(),Po,gb,tk=(gb=class{constructor(){ge(this,Po)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Vp(this.gcTime)&&re(this,Po,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ho?1/0:5*60*1e3))}clearGcTimeout(){R(this,Po)&&(clearTimeout(R(this,Po)),re(this,Po,void 0))}},Po=new WeakMap,gb),Gi,Qi,Ir,To,$t,Xl,Ro,Yr,Ln,vb,p2=(vb=class extends tk{constructor(t){super();ge(this,Yr);ge(this,Gi);ge(this,Qi);ge(this,Ir);ge(this,To);ge(this,$t);ge(this,Xl);ge(this,Ro);re(this,Ro,!1),re(this,Xl,t.defaultOptions),this.setOptions(t.options),this.observers=[],re(this,To,t.client),re(this,Ir,R(this,To).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,re(this,Gi,m2(this.options)),this.state=t.state??R(this,Gi),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=R(this,$t))==null?void 0:t.promise}setOptions(t){this.options={...R(this,Xl),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&R(this,Ir).remove(this)}setData(t,r){const n=Kp(this.state.data,t,this.options);return Ne(this,Yr,Ln).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){Ne(this,Yr,Ln).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,s;const r=(n=R(this,$t))==null?void 0:n.promise;return(s=R(this,$t))==null||s.cancel(t),r?r.then(rr).catch(rr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(R(this,Gi))}isActive(){return this.observers.some(t=>Or(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ev||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Gs(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!ZS(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=R(this,$t))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=R(this,$t))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),R(this,Ir).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(R(this,$t)&&(R(this,Ro)?R(this,$t).cancel({revert:!0}):R(this,$t).cancelRetry()),this.scheduleGc()),R(this,Ir).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ne(this,Yr,Ln).call(this,{type:"invalidate"})}async fetch(t,r){var c,u,d,f,g,v,b,h,w,p,m,x;if(this.state.fetchStatus!=="idle"&&((c=R(this,$t))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(R(this,$t))return R(this,$t).continueRetry(),R(this,$t).promise}if(t&&this.setOptions(t),!this.options.queryFn){const _=this.observers.find(C=>C.options.queryFn);_&&this.setOptions(_.options)}const n=new AbortController,s=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(re(this,Ro,!0),n.signal)})},o=()=>{const _=QS(this.options,r),$=(()=>{const k={client:R(this,To),queryKey:this.queryKey,meta:this.meta};return s(k),k})();return re(this,Ro,!1),this.options.persister?this.options.persister(_,$,this):_($)},l=(()=>{const _={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:R(this,To),state:this.state,fetchFn:o};return s(_),_})();(u=this.options.behavior)==null||u.onFetch(l,this),re(this,Qi,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=l.fetchOptions)==null?void 0:d.meta))&&Ne(this,Yr,Ln).call(this,{type:"fetch",meta:(f=l.fetchOptions)==null?void 0:f.meta}),re(this,$t,ek({initialPromise:r==null?void 0:r.initialPromise,fn:l.fetchFn,abort:n.abort.bind(n),onFail:(_,C)=>{Ne(this,Yr,Ln).call(this,{type:"failed",failureCount:_,error:C})},onPause:()=>{Ne(this,Yr,Ln).call(this,{type:"pause"})},onContinue:()=>{Ne(this,Yr,Ln).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const _=await R(this,$t).start();if(_===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(_),(v=(g=R(this,Ir).config).onSuccess)==null||v.call(g,_,this),(h=(b=R(this,Ir).config).onSettled)==null||h.call(b,_,this.state.error,this),_}catch(_){if(_ instanceof XS){if(_.silent)return R(this,$t).promise;if(_.revert){if(this.setState({...R(this,Qi),fetchStatus:"idle"}),this.state.data===void 0)throw _;return this.state.data}}throw Ne(this,Yr,Ln).call(this,{type:"error",error:_}),(p=(w=R(this,Ir).config).onError)==null||p.call(w,_,this),(x=(m=R(this,Ir).config).onSettled)==null||x.call(m,this.state.data,_,this),_}finally{this.scheduleGc()}}},Gi=new WeakMap,Qi=new WeakMap,Ir=new WeakMap,To=new WeakMap,$t=new WeakMap,Xl=new WeakMap,Ro=new WeakMap,Yr=new WeakSet,Ln=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...rk(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,data:t.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return re(this,Qi,t.manual?s:void 0),s;case"error":const o=t.error;return{...n,error:o,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),Et.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),R(this,Ir).notify({query:this,type:"updated",action:t})})},vb);function rk(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:YS(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function m2(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var yn,yb,g2=(yb=class extends ka{constructor(t={}){super();ge(this,yn);this.config=t,re(this,yn,new Map)}build(t,r,n){const s=r.queryKey,o=r.queryHash??Xg(s,r);let i=this.get(o);return i||(i=new p2({client:t,queryKey:s,queryHash:o,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(i)),i}add(t){R(this,yn).has(t.queryHash)||(R(this,yn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=R(this,yn).get(t.queryHash);r&&(t.destroy(),r===t&&R(this,yn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Et.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return R(this,yn).get(t)}getAll(){return[...R(this,yn).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>yw(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>yw(t,n)):r}notify(t){Et.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){Et.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Et.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},yn=new WeakMap,yb),wn,Jt,Io,xn,ys,wb,v2=(wb=class extends tk{constructor(t){super();ge(this,xn);ge(this,wn);ge(this,Jt);ge(this,Io);this.mutationId=t.mutationId,re(this,Jt,t.mutationCache),re(this,wn,[]),this.state=t.state||nk(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){R(this,wn).includes(t)||(R(this,wn).push(t),this.clearGcTimeout(),R(this,Jt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){re(this,wn,R(this,wn).filter(r=>r!==t)),this.scheduleGc(),R(this,Jt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){R(this,wn).length||(this.state.status==="pending"?this.scheduleGc():R(this,Jt).remove(this))}continue(){var t;return((t=R(this,Io))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,l,c,u,d,f,g,v,b,h,w,p,m,x,_,C,$,k,I;const r=()=>{Ne(this,xn,ys).call(this,{type:"continue"})};re(this,Io,ek({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(E,U)=>{Ne(this,xn,ys).call(this,{type:"failed",failureCount:E,error:U})},onPause:()=>{Ne(this,xn,ys).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>R(this,Jt).canRun(this)}));const n=this.state.status==="pending",s=!R(this,Io).canStart();try{if(n)r();else{Ne(this,xn,ys).call(this,{type:"pending",variables:t,isPaused:s}),await((i=(o=R(this,Jt).config).onMutate)==null?void 0:i.call(o,t,this));const U=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,t));U!==this.state.context&&Ne(this,xn,ys).call(this,{type:"pending",context:U,variables:t,isPaused:s})}const E=await R(this,Io).start();return await((d=(u=R(this,Jt).config).onSuccess)==null?void 0:d.call(u,E,t,this.state.context,this)),await((g=(f=this.options).onSuccess)==null?void 0:g.call(f,E,t,this.state.context)),await((b=(v=R(this,Jt).config).onSettled)==null?void 0:b.call(v,E,null,this.state.variables,this.state.context,this)),await((w=(h=this.options).onSettled)==null?void 0:w.call(h,E,null,t,this.state.context)),Ne(this,xn,ys).call(this,{type:"success",data:E}),E}catch(E){try{throw await((m=(p=R(this,Jt).config).onError)==null?void 0:m.call(p,E,t,this.state.context,this)),await((_=(x=this.options).onError)==null?void 0:_.call(x,E,t,this.state.context)),await(($=(C=R(this,Jt).config).onSettled)==null?void 0:$.call(C,void 0,E,this.state.variables,this.state.context,this)),await((I=(k=this.options).onSettled)==null?void 0:I.call(k,void 0,E,t,this.state.context)),E}finally{Ne(this,xn,ys).call(this,{type:"error",error:E})}}finally{R(this,Jt).runNext(this)}}},wn=new WeakMap,Jt=new WeakMap,Io=new WeakMap,xn=new WeakSet,ys=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),Et.batch(()=>{R(this,wn).forEach(n=>{n.onMutationUpdate(t)}),R(this,Jt).notify({mutation:this,type:"updated",action:t})})},wb);function nk(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Vn,Xr,ec,xb,y2=(xb=class extends ka{constructor(t={}){super();ge(this,Vn);ge(this,Xr);ge(this,ec);this.config=t,re(this,Vn,new Set),re(this,Xr,new Map),re(this,ec,0)}build(t,r,n){const s=new v2({mutationCache:this,mutationId:++Pc(this,ec)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){R(this,Vn).add(t);const r=Gc(t);if(typeof r=="string"){const n=R(this,Xr).get(r);n?n.push(t):R(this,Xr).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(R(this,Vn).delete(t)){const r=Gc(t);if(typeof r=="string"){const n=R(this,Xr).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&R(this,Xr).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Gc(t);if(typeof r=="string"){const n=R(this,Xr).get(r),s=n==null?void 0:n.find(o=>o.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=Gc(t);if(typeof r=="string"){const s=(n=R(this,Xr).get(r))==null?void 0:n.find(o=>o!==t&&o.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Et.batch(()=>{R(this,Vn).forEach(t=>{this.notify({type:"removed",mutation:t})}),R(this,Vn).clear(),R(this,Xr).clear()})}getAll(){return Array.from(R(this,Vn))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>ww(r,n))}findAll(t={}){return this.getAll().filter(r=>ww(t,r))}notify(t){Et.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return Et.batch(()=>Promise.all(t.map(r=>r.continue().catch(rr))))}},Vn=new WeakMap,Xr=new WeakMap,ec=new WeakMap,xb);function Gc(e){var t;return(t=e.options.scope)==null?void 0:t.id}function _w(e){return{onFetch:(t,r)=>{var d,f,g,v,b;const n=t.options,s=(g=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:g.direction,o=((v=t.state.data)==null?void 0:v.pages)||[],i=((b=t.state.data)==null?void 0:b.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let h=!1;const w=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(t.signal.aborted?h=!0:t.signal.addEventListener("abort",()=>{h=!0}),t.signal)})},p=QS(t.options,t.fetchOptions),m=async(x,_,C)=>{if(h)return Promise.reject();if(_==null&&x.pages.length)return Promise.resolve(x);const k=(()=>{const P={client:t.client,queryKey:t.queryKey,pageParam:_,direction:C?"backward":"forward",meta:t.options.meta};return w(P),P})(),I=await p(k),{maxPages:E}=t.options,U=C?l2:a2;return{pages:U(x.pages,I,E),pageParams:U(x.pageParams,_,E)}};if(s&&o.length){const x=s==="backward",_=x?w2:Sw,C={pages:o,pageParams:i},$=_(n,C);l=await m(C,$,x)}else{const x=e??o.length;do{const _=c===0?i[0]??n.initialPageParam:Sw(n,l);if(c>0&&_==null)break;l=await m(l,_),c++}while(c<x)}return l};t.options.persister?t.fetchFn=()=>{var h,w;return(w=(h=t.options).persister)==null?void 0:w.call(h,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=u}}}function Sw(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function w2(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var gt,Ps,Ts,Ji,Yi,Rs,Xi,ea,bb,x2=(bb=class{constructor(e={}){ge(this,gt);ge(this,Ps);ge(this,Ts);ge(this,Ji);ge(this,Yi);ge(this,Rs);ge(this,Xi);ge(this,ea);re(this,gt,e.queryCache||new g2),re(this,Ps,e.mutationCache||new y2),re(this,Ts,e.defaultOptions||{}),re(this,Ji,new Map),re(this,Yi,new Map),re(this,Rs,0)}mount(){Pc(this,Rs)._++,R(this,Rs)===1&&(re(this,Xi,tv.subscribe(async e=>{e&&(await this.resumePausedMutations(),R(this,gt).onFocus())})),re(this,ea,gd.subscribe(async e=>{e&&(await this.resumePausedMutations(),R(this,gt).onOnline())})))}unmount(){var e,t;Pc(this,Rs)._--,R(this,Rs)===0&&((e=R(this,Xi))==null||e.call(this),re(this,Xi,void 0),(t=R(this,ea))==null||t.call(this),re(this,ea,void 0))}isFetching(e){return R(this,gt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return R(this,Ps).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=R(this,gt).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=R(this,gt).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Gs(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return R(this,gt).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),s=R(this,gt).get(n.queryHash),o=s==null?void 0:s.state.data,i=o2(t,o);if(i!==void 0)return R(this,gt).build(this,n).setData(i,{...r,manual:!0})}setQueriesData(e,t,r){return Et.batch(()=>R(this,gt).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=R(this,gt).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=R(this,gt);Et.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=R(this,gt);return Et.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=Et.batch(()=>R(this,gt).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(rr).catch(rr)}invalidateQueries(e,t={}){return Et.batch(()=>(R(this,gt).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"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=Et.batch(()=>R(this,gt).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,r);return r.throwOnError||(o=o.catch(rr)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(n).then(rr)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=R(this,gt).build(this,t);return r.isStaleByTime(Gs(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(rr).catch(rr)}fetchInfiniteQuery(e){return e.behavior=_w(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(rr).catch(rr)}ensureInfiniteQueryData(e){return e.behavior=_w(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return gd.isOnline()?R(this,Ps).resumePausedMutations():Promise.resolve()}getQueryCache(){return R(this,gt)}getMutationCache(){return R(this,Ps)}getDefaultOptions(){return R(this,Ts)}setDefaultOptions(e){re(this,Ts,e)}setQueryDefaults(e,t){R(this,Ji).set(Ko(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...R(this,Ji).values()],r={};return t.forEach(n=>{Bl(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){R(this,Yi).set(Ko(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...R(this,Yi).values()],r={};return t.forEach(n=>{Bl(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...R(this,Ts).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Xg(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ev&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...R(this,Ts).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){R(this,gt).clear(),R(this,Ps).clear()}},gt=new WeakMap,Ps=new WeakMap,Ts=new WeakMap,Ji=new WeakMap,Yi=new WeakMap,Rs=new WeakMap,Xi=new WeakMap,ea=new WeakMap,bb),ar,ze,tc,Yt,Ao,ta,Hn,Is,rc,ra,na,Oo,Mo,As,sa,qe,rl,Wp,Zp,Gp,Qp,Jp,Yp,Xp,sk,_b,b2=(_b=class extends ka{constructor(t,r){super();ge(this,qe);ge(this,ar);ge(this,ze);ge(this,tc);ge(this,Yt);ge(this,Ao);ge(this,ta);ge(this,Hn);ge(this,Is);ge(this,rc);ge(this,ra);ge(this,na);ge(this,Oo);ge(this,Mo);ge(this,As);ge(this,sa,new Set);this.options=r,re(this,ar,t),re(this,Is,null),re(this,Hn,Bp()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(R(this,ze).addObserver(this),kw(R(this,ze),this.options)?Ne(this,qe,rl).call(this):this.updateResult(),Ne(this,qe,Qp).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return em(R(this,ze),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return em(R(this,ze),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ne(this,qe,Jp).call(this),Ne(this,qe,Yp).call(this),R(this,ze).removeObserver(this)}setOptions(t){const r=this.options,n=R(this,ze);if(this.options=R(this,ar).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Or(this.options.enabled,R(this,ze))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ne(this,qe,Xp).call(this),R(this,ze).setOptions(this.options),r._defaulted&&!md(this.options,r)&&R(this,ar).getQueryCache().notify({type:"observerOptionsUpdated",query:R(this,ze),observer:this});const s=this.hasListeners();s&&Cw(R(this,ze),n,this.options,r)&&Ne(this,qe,rl).call(this),this.updateResult(),s&&(R(this,ze)!==n||Or(this.options.enabled,R(this,ze))!==Or(r.enabled,R(this,ze))||Gs(this.options.staleTime,R(this,ze))!==Gs(r.staleTime,R(this,ze)))&&Ne(this,qe,Wp).call(this);const o=Ne(this,qe,Zp).call(this);s&&(R(this,ze)!==n||Or(this.options.enabled,R(this,ze))!==Or(r.enabled,R(this,ze))||o!==R(this,As))&&Ne(this,qe,Gp).call(this,o)}getOptimisticResult(t){const r=R(this,ar).getQueryCache().build(R(this,ar),t),n=this.createResult(r,t);return S2(this,n)&&(re(this,Yt,n),re(this,ta,this.options),re(this,Ao,R(this,ze).state)),n}getCurrentResult(){return R(this,Yt)}trackResult(t,r){return new Proxy(t,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&!this.options.experimental_prefetchInRender&&R(this,Hn).status==="pending"&&R(this,Hn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(n,s))})}trackProp(t){R(this,sa).add(t)}getCurrentQuery(){return R(this,ze)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=R(this,ar).defaultQueryOptions(t),n=R(this,ar).getQueryCache().build(R(this,ar),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return Ne(this,qe,rl).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),R(this,Yt)))}createResult(t,r){var E;const n=R(this,ze),s=this.options,o=R(this,Yt),i=R(this,Ao),l=R(this,ta),u=t!==n?t.state:R(this,tc),{state:d}=t;let f={...d},g=!1,v;if(r._optimisticResults){const U=this.hasListeners(),P=!U&&kw(t,r),O=U&&Cw(t,n,r,s);(P||O)&&(f={...f,...rk(d.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:b,errorUpdatedAt:h,status:w}=f;v=f.data;let p=!1;if(r.placeholderData!==void 0&&v===void 0&&w==="pending"){let U;o!=null&&o.isPlaceholderData&&r.placeholderData===(l==null?void 0:l.placeholderData)?(U=o.data,p=!0):U=typeof r.placeholderData=="function"?r.placeholderData((E=R(this,na))==null?void 0:E.state.data,R(this,na)):r.placeholderData,U!==void 0&&(w="success",v=Kp(o==null?void 0:o.data,U,r),g=!0)}if(r.select&&v!==void 0&&!p)if(o&&v===(i==null?void 0:i.data)&&r.select===R(this,rc))v=R(this,ra);else try{re(this,rc,r.select),v=r.select(v),v=Kp(o==null?void 0:o.data,v,r),re(this,ra,v),re(this,Is,null)}catch(U){re(this,Is,U)}R(this,Is)&&(b=R(this,Is),v=R(this,ra),h=Date.now(),w="error");const m=f.fetchStatus==="fetching",x=w==="pending",_=w==="error",C=x&&m,$=v!==void 0,I={status:w,fetchStatus:f.fetchStatus,isPending:x,isSuccess:w==="success",isError:_,isInitialLoading:C,isLoading:C,data:v,dataUpdatedAt:f.dataUpdatedAt,error:b,errorUpdatedAt:h,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:m,isRefetching:m&&!x,isLoadingError:_&&!$,isPaused:f.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:_&&$,isStale:rv(t,r),refetch:this.refetch,promise:R(this,Hn),isEnabled:Or(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const U=L=>{I.status==="error"?L.reject(I.error):I.data!==void 0&&L.resolve(I.data)},P=()=>{const L=re(this,Hn,I.promise=Bp());U(L)},O=R(this,Hn);switch(O.status){case"pending":t.queryHash===n.queryHash&&U(O);break;case"fulfilled":(I.status==="error"||I.data!==O.value)&&P();break;case"rejected":(I.status!=="error"||I.error!==O.reason)&&P();break}}return I}updateResult(){const t=R(this,Yt),r=this.createResult(R(this,ze),this.options);if(re(this,Ao,R(this,ze).state),re(this,ta,this.options),R(this,Ao).data!==void 0&&re(this,na,R(this,ze)),md(r,t))return;re(this,Yt,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,o=typeof s=="function"?s():s;if(o==="all"||!o&&!R(this,sa).size)return!0;const i=new Set(o??R(this,sa));return this.options.throwOnError&&i.add("error"),Object.keys(R(this,Yt)).some(l=>{const c=l;return R(this,Yt)[c]!==t[c]&&i.has(c)})};Ne(this,qe,sk).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ne(this,qe,Qp).call(this)}},ar=new WeakMap,ze=new WeakMap,tc=new WeakMap,Yt=new WeakMap,Ao=new WeakMap,ta=new WeakMap,Hn=new WeakMap,Is=new WeakMap,rc=new WeakMap,ra=new WeakMap,na=new WeakMap,Oo=new WeakMap,Mo=new WeakMap,As=new WeakMap,sa=new WeakMap,qe=new WeakSet,rl=function(t){Ne(this,qe,Xp).call(this);let r=R(this,ze).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(rr)),r},Wp=function(){Ne(this,qe,Jp).call(this);const t=Gs(this.options.staleTime,R(this,ze));if(Ho||R(this,Yt).isStale||!Vp(t))return;const n=ZS(R(this,Yt).dataUpdatedAt,t)+1;re(this,Oo,setTimeout(()=>{R(this,Yt).isStale||this.updateResult()},n))},Zp=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(R(this,ze)):this.options.refetchInterval)??!1},Gp=function(t){Ne(this,qe,Yp).call(this),re(this,As,t),!(Ho||Or(this.options.enabled,R(this,ze))===!1||!Vp(R(this,As))||R(this,As)===0)&&re(this,Mo,setInterval(()=>{(this.options.refetchIntervalInBackground||tv.isFocused())&&Ne(this,qe,rl).call(this)},R(this,As)))},Qp=function(){Ne(this,qe,Wp).call(this),Ne(this,qe,Gp).call(this,Ne(this,qe,Zp).call(this))},Jp=function(){R(this,Oo)&&(clearTimeout(R(this,Oo)),re(this,Oo,void 0))},Yp=function(){R(this,Mo)&&(clearInterval(R(this,Mo)),re(this,Mo,void 0))},Xp=function(){const t=R(this,ar).getQueryCache().build(R(this,ar),this.options);if(t===R(this,ze))return;const r=R(this,ze);re(this,ze,t),re(this,tc,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},sk=function(t){Et.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(R(this,Yt))}),R(this,ar).getQueryCache().notify({query:R(this,ze),type:"observerResultsUpdated"})})},_b);function _2(e,t){return Or(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function kw(e,t){return _2(e,t)||e.state.data!==void 0&&em(e,t,t.refetchOnMount)}function em(e,t,r){if(Or(t.enabled,e)!==!1&&Gs(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&rv(e,t)}return!1}function Cw(e,t,r,n){return(e!==t||Or(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&rv(e,r)}function rv(e,t){return Or(t.enabled,e)!==!1&&e.isStaleByTime(Gs(t.staleTime,e))}function S2(e,t){return!md(e.getCurrentResult(),t)}var Os,Ms,lr,Kn,es,ju,tm,Sb,k2=(Sb=class extends ka{constructor(r,n){super();ge(this,es);ge(this,Os);ge(this,Ms);ge(this,lr);ge(this,Kn);re(this,Os,r),this.setOptions(n),this.bindMethods(),Ne(this,es,ju).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var s;const n=this.options;this.options=R(this,Os).defaultMutationOptions(r),md(this.options,n)||R(this,Os).getMutationCache().notify({type:"observerOptionsUpdated",mutation:R(this,lr),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&Ko(n.mutationKey)!==Ko(this.options.mutationKey)?this.reset():((s=R(this,lr))==null?void 0:s.state.status)==="pending"&&R(this,lr).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=R(this,lr))==null||r.removeObserver(this)}onMutationUpdate(r){Ne(this,es,ju).call(this),Ne(this,es,tm).call(this,r)}getCurrentResult(){return R(this,Ms)}reset(){var r;(r=R(this,lr))==null||r.removeObserver(this),re(this,lr,void 0),Ne(this,es,ju).call(this),Ne(this,es,tm).call(this)}mutate(r,n){var s;return re(this,Kn,n),(s=R(this,lr))==null||s.removeObserver(this),re(this,lr,R(this,Os).getMutationCache().build(R(this,Os),this.options)),R(this,lr).addObserver(this),R(this,lr).execute(r)}},Os=new WeakMap,Ms=new WeakMap,lr=new WeakMap,Kn=new WeakMap,es=new WeakSet,ju=function(){var n;const r=((n=R(this,lr))==null?void 0:n.state)??nk();re(this,Ms,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},tm=function(r){Et.batch(()=>{var n,s,o,i,l,c,u,d;if(R(this,Kn)&&this.hasListeners()){const f=R(this,Ms).variables,g=R(this,Ms).context;(r==null?void 0:r.type)==="success"?((s=(n=R(this,Kn)).onSuccess)==null||s.call(n,r.data,f,g),(i=(o=R(this,Kn)).onSettled)==null||i.call(o,r.data,null,f,g)):(r==null?void 0:r.type)==="error"&&((c=(l=R(this,Kn)).onError)==null||c.call(l,r.error,f,g),(d=(u=R(this,Kn)).onSettled)==null||d.call(u,void 0,r.error,f,g))}this.listeners.forEach(f=>{f(R(this,Ms))})})},Sb),ok=y.createContext(void 0),Qt=e=>{const t=y.useContext(ok);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},C2=({client:e,children:t})=>(y.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(ok.Provider,{value:e,children:t})),ik=y.createContext(!1),E2=()=>y.useContext(ik);ik.Provider;function N2(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var j2=y.createContext(N2()),$2=()=>y.useContext(j2),P2=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},T2=e=>{y.useEffect(()=>{e.clearReset()},[e])},R2=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||JS(r,[e.error,n])),I2=e=>{if(e.suspense){const t=n=>n==="static"?n:Math.max(n??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...n)=>t(r(...n)):t(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},A2=(e,t)=>e.isLoading&&e.isFetching&&!t,O2=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ew=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function M2(e,t,r){var f,g,v,b,h;const n=E2(),s=$2(),o=Qt(),i=o.defaultQueryOptions(e);(g=(f=o.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||g.call(f,i),i._optimisticResults=n?"isRestoring":"optimistic",I2(i),P2(i,s),T2(s);const l=!o.getQueryCache().get(i.queryHash),[c]=y.useState(()=>new t(o,i)),u=c.getOptimisticResult(i),d=!n&&e.subscribed!==!1;if(y.useSyncExternalStore(y.useCallback(w=>{const p=d?c.subscribe(Et.batchCalls(w)):rr;return c.updateResult(),p},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),y.useEffect(()=>{c.setOptions(i)},[i,c]),O2(i,u))throw Ew(i,c,s);if(R2({result:u,errorResetBoundary:s,throwOnError:i.throwOnError,query:o.getQueryCache().get(i.queryHash),suspense:i.suspense}))throw u.error;if((b=(v=o.getDefaultOptions().queries)==null?void 0:v._experimental_afterQuery)==null||b.call(v,i,u),i.experimental_prefetchInRender&&!Ho&&A2(u,n)){const w=l?Ew(i,c,s):(h=o.getQueryCache().get(i.queryHash))==null?void 0:h.promise;w==null||w.catch(rr).finally(()=>{c.updateResult()})}return i.notifyOnChangeProps?u:c.trackResult(u)}function Zt(e,t){return M2(e,b2)}function yt(e,t){const r=Qt(),[n]=y.useState(()=>new k2(r,e));y.useEffect(()=>{n.setOptions(e)},[n,e]);const s=y.useSyncExternalStore(y.useCallback(i=>n.subscribe(Et.batchCalls(i)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),o=y.useCallback((i,l)=>{n.mutate(i,l).catch(rr)},[n]);if(s.error&&JS(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}const D2="x-agent-deck-client",z2="dashboard",ak={[D2]:z2};async function lk(e){if(e.ok)return;let t=e.statusText;try{const r=await e.text();try{const n=JSON.parse(r);t=n.error||n.message||t}catch{r.trim()&&(t=`${e.status}: ${r}`)}}catch(r){console.warn("Response body parsing failed:",r)}throw new Error(t)}async function ke(e,t,r){const n=await fetch(t,{method:e,headers:{...ak,...r?{"Content-Type":"application/json"}:{}},body:r?JSON.stringify(r):void 0});return await lk(n),n}const L2=({on401:e})=>async({queryKey:t})=>{const r=t.join("/"),n=await fetch(r,{headers:ak});return await lk(n),await n.json()},F2=new x2({defaultOptions:{queries:{queryFn:L2({on401:"throw"}),refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0,gcTime:10*60*1e3,retry:!1},mutations:{retry:!1}}}),U2=1,q2=1e6;let wh=0;function V2(){return wh=(wh+1)%Number.MAX_SAFE_INTEGER,wh.toString()}const xh=new Map,Nw=e=>{if(xh.has(e))return;const t=setTimeout(()=>{xh.delete(e),wl({type:"REMOVE_TOAST",toastId:e})},q2);xh.set(e,t)},H2=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,U2)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?Nw(r):e.toasts.forEach(n=>{Nw(n.id)}),{...e,toasts:e.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},$u=[];let Pu={toasts:[]};function wl(e){Pu=H2(Pu,e),$u.forEach(t=>{t(Pu)})}function K2({...e}){const t=V2(),r=s=>wl({type:"UPDATE_TOAST",toast:{...s,id:t}}),n=()=>wl({type:"DISMISS_TOAST",toastId:t});return wl({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||n()}}}),{id:t,dismiss:n,update:r}}function Ut(){const[e,t]=y.useState(Pu);return y.useEffect(()=>($u.push(t),()=>{const r=$u.indexOf(t);r>-1&&$u.splice(r,1)}),[e]),{...e,toast:K2,dismiss:r=>wl({type:"DISMISS_TOAST",toastId:r})}}function pe(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e==null||e(s),r===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function jw(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ck(...e){return t=>{let r=!1;const n=e.map(s=>{const o=jw(s,t);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let s=0;s<n.length;s++){const o=n[s];typeof o=="function"?o():jw(e[s],null)}}}}function Ve(...e){return y.useCallback(ck(...e),e)}function B2(e,t){const r=y.createContext(t),n=o=>{const{children:i,...l}=o,c=y.useMemo(()=>l,Object.values(l));return a.jsx(r.Provider,{value:c,children:i})};n.displayName=e+"Provider";function s(o){const i=y.useContext(r);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[n,s]}function In(e,t=[]){let r=[];function n(o,i){const l=y.createContext(i),c=r.length;r=[...r,i];const u=f=>{var p;const{scope:g,children:v,...b}=f,h=((p=g==null?void 0:g[e])==null?void 0:p[c])||l,w=y.useMemo(()=>b,Object.values(b));return a.jsx(h.Provider,{value:w,children:v})};u.displayName=o+"Provider";function d(f,g){var h;const v=((h=g==null?void 0:g[e])==null?void 0:h[c])||l,b=y.useContext(v);if(b)return b;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[u,d]}const s=()=>{const o=r.map(i=>y.createContext(i));return function(l){const c=(l==null?void 0:l[e])||o;return y.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[n,W2(s,...t)]}function W2(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=n.reduce((l,{useScope:c,scopeName:u})=>{const f=c(o)[`__scope${u}`];return{...l,...f}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return r.scopeName=t.scopeName,r}function Bo(e){const t=G2(e),r=y.forwardRef((n,s)=>{const{children:o,...i}=n,l=y.Children.toArray(o),c=l.find(J2);if(c){const u=c.props.children,d=l.map(f=>f===c?y.Children.count(u)>1?y.Children.only(null):y.isValidElement(u)?u.props.children:null:f);return a.jsx(t,{...i,ref:s,children:y.isValidElement(u)?y.cloneElement(u,void 0,d):null})}return a.jsx(t,{...i,ref:s,children:o})});return r.displayName=`${e}.Slot`,r}var Z2=Bo("Slot");function G2(e){const t=y.forwardRef((r,n)=>{const{children:s,...o}=r;if(y.isValidElement(s)){const i=X2(s),l=Y2(o,s.props);return s.type!==y.Fragment&&(l.ref=n?ck(n,i):i),y.cloneElement(s,l)}return y.Children.count(s)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var uk=Symbol("radix.slottable");function Q2(e){const t=({children:r})=>a.jsx(a.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=uk,t}function J2(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===uk}function Y2(e,t){const r={...t};for(const n in t){const s=e[n],o=t[n];/^on[A-Z]/.test(n)?s&&o?r[n]=(...l)=>{const c=o(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...o}:n==="className"&&(r[n]=[s,o].filter(Boolean).join(" "))}return{...e,...r}}function X2(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function nv(e){const t=e+"CollectionProvider",[r,n]=In(t),[s,o]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=h=>{const{scope:w,children:p}=h,m=vn.useRef(null),x=vn.useRef(new Map).current;return a.jsx(s,{scope:w,itemMap:x,collectionRef:m,children:p})};i.displayName=t;const l=e+"CollectionSlot",c=Bo(l),u=vn.forwardRef((h,w)=>{const{scope:p,children:m}=h,x=o(l,p),_=Ve(w,x.collectionRef);return a.jsx(c,{ref:_,children:m})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",g=Bo(d),v=vn.forwardRef((h,w)=>{const{scope:p,children:m,...x}=h,_=vn.useRef(null),C=Ve(w,_),$=o(d,p);return vn.useEffect(()=>($.itemMap.set(_,{ref:_,...x}),()=>void $.itemMap.delete(_))),a.jsx(g,{[f]:"",ref:C,children:m})});v.displayName=d;function b(h){const w=o(e+"CollectionConsumer",h);return vn.useCallback(()=>{const m=w.collectionRef.current;if(!m)return[];const x=Array.from(m.querySelectorAll(`[${f}]`));return Array.from(w.itemMap.values()).sort(($,k)=>x.indexOf($.ref.current)-x.indexOf(k.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:i,Slot:u,ItemSlot:v},b,n]}var eR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_e=eR.reduce((e,t)=>{const r=Bo(`Primitive.${t}`),n=y.forwardRef((s,o)=>{const{asChild:i,...l}=s,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function dk(e,t){e&&ti.flushSync(()=>e.dispatchEvent(t))}function qr(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e}),y.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function tR(e,t=globalThis==null?void 0:globalThis.document){const r=qr(e);y.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var rR="DismissableLayer",rm="dismissableLayer.update",nR="dismissableLayer.pointerDownOutside",sR="dismissableLayer.focusOutside",$w,fk=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ca=y.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,onDismiss:l,...c}=e,u=y.useContext(fk),[d,f]=y.useState(null),g=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,v]=y.useState({}),b=Ve(t,k=>f(k)),h=Array.from(u.layers),[w]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),p=h.indexOf(w),m=d?h.indexOf(d):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,_=m>=p,C=iR(k=>{const I=k.target,E=[...u.branches].some(U=>U.contains(I));!_||E||(s==null||s(k),i==null||i(k),k.defaultPrevented||l==null||l())},g),$=aR(k=>{const I=k.target;[...u.branches].some(U=>U.contains(I))||(o==null||o(k),i==null||i(k),k.defaultPrevented||l==null||l())},g);return tR(k=>{m===u.layers.size-1&&(n==null||n(k),!k.defaultPrevented&&l&&(k.preventDefault(),l()))},g),y.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&($w=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Pw(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=$w)}},[d,g,r,u]),y.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Pw())},[d,u]),y.useEffect(()=>{const k=()=>v({});return document.addEventListener(rm,k),()=>document.removeEventListener(rm,k)},[]),a.jsx(_e.div,{...c,ref:b,style:{pointerEvents:x?_?"auto":"none":void 0,...e.style},onFocusCapture:pe(e.onFocusCapture,$.onFocusCapture),onBlurCapture:pe(e.onBlurCapture,$.onBlurCapture),onPointerDownCapture:pe(e.onPointerDownCapture,C.onPointerDownCapture)})});Ca.displayName=rR;var oR="DismissableLayerBranch",hk=y.forwardRef((e,t)=>{const r=y.useContext(fk),n=y.useRef(null),s=Ve(t,n);return y.useEffect(()=>{const o=n.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),a.jsx(_e.div,{...e,ref:s})});hk.displayName=oR;function iR(e,t=globalThis==null?void 0:globalThis.document){const r=qr(e),n=y.useRef(!1),s=y.useRef(()=>{});return y.useEffect(()=>{const o=l=>{if(l.target&&!n.current){let c=function(){pk(nR,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);n.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function aR(e,t=globalThis==null?void 0:globalThis.document){const r=qr(e),n=y.useRef(!1);return y.useEffect(()=>{const s=o=>{o.target&&!n.current&&pk(sR,r,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Pw(){const e=new CustomEvent(rm);document.dispatchEvent(e)}function pk(e,t,r,{discrete:n}){const s=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?dk(s,o):s.dispatchEvent(o)}var lR=Ca,cR=hk,Ft=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{},uR="Portal",cc=y.forwardRef((e,t)=>{var l;const{container:r,...n}=e,[s,o]=y.useState(!1);Ft(()=>o(!0),[]);const i=r||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return i?NT.createPortal(a.jsx(_e.div,{...n,ref:t}),i):null});cc.displayName=uR;function dR(e,t){return y.useReducer((r,n)=>t[r][n]??r,e)}var An=e=>{const{present:t,children:r}=e,n=fR(t),s=typeof r=="function"?r({present:n.isPresent}):y.Children.only(r),o=Ve(n.ref,hR(s));return typeof r=="function"||n.isPresent?y.cloneElement(s,{ref:o}):null};An.displayName="Presence";function fR(e){const[t,r]=y.useState(),n=y.useRef(null),s=y.useRef(e),o=y.useRef("none"),i=e?"mounted":"unmounted",[l,c]=dR(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const u=Qc(n.current);o.current=l==="mounted"?u:"none"},[l]),Ft(()=>{const u=n.current,d=s.current;if(d!==e){const g=o.current,v=Qc(u);e?c("MOUNT"):v==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&g!==v?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),Ft(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=v=>{const h=Qc(n.current).includes(CSS.escape(v.animationName));if(v.target===t&&h&&(c("ANIMATION_END"),!s.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},g=v=>{v.target===t&&(o.current=Qc(n.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:y.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function Qc(e){return(e==null?void 0:e.animationName)||"none"}function hR(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var pR=ig[" useInsertionEffect ".trim().toString()]||Ft;function eo({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,o,i]=mR({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:s;{const d=y.useRef(e!==void 0);y.useEffect(()=>{const f=d.current;f!==l&&console.warn(`${n} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,n])}const u=y.useCallback(d=>{var f;if(l){const g=gR(d)?d(e):d;g!==e&&((f=i.current)==null||f.call(i,g))}else o(d)},[l,e,o,i]);return[c,u]}function mR({defaultProp:e,onChange:t}){const[r,n]=y.useState(e),s=y.useRef(r),o=y.useRef(t);return pR(()=>{o.current=t},[t]),y.useEffect(()=>{var i;s.current!==r&&((i=o.current)==null||i.call(o,r),s.current=r)},[r,s]),[r,n,o]}function gR(e){return typeof e=="function"}var mk=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),vR="VisuallyHidden",df=y.forwardRef((e,t)=>a.jsx(_e.span,{...e,ref:t,style:{...mk,...e.style}}));df.displayName=vR;var yR=df,sv="ToastProvider",[ov,wR,xR]=nv("Toast"),[gk,CH]=In("Toast",[xR]),[bR,ff]=gk(sv),vk=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:o=50,children:i}=e,[l,c]=y.useState(null),[u,d]=y.useState(0),f=y.useRef(!1),g=y.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${sv}\`. Expected non-empty \`string\`.`),a.jsx(ov.Provider,{scope:t,children:a.jsx(bR,{scope:t,label:r,duration:n,swipeDirection:s,swipeThreshold:o,toastCount:u,viewport:l,onViewportChange:c,onToastAdd:y.useCallback(()=>d(v=>v+1),[]),onToastRemove:y.useCallback(()=>d(v=>v-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:g,children:i})})};vk.displayName=sv;var yk="ToastViewport",_R=["F8"],nm="toast.viewportPause",sm="toast.viewportResume",wk=y.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=_R,label:s="Notifications ({hotkey})",...o}=e,i=ff(yk,r),l=wR(r),c=y.useRef(null),u=y.useRef(null),d=y.useRef(null),f=y.useRef(null),g=Ve(t,f,i.onViewportChange),v=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=i.toastCount>0;y.useEffect(()=>{const w=p=>{var x;n.length!==0&&n.every(_=>p[_]||p.code===_)&&((x=f.current)==null||x.focus())};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[n]),y.useEffect(()=>{const w=c.current,p=f.current;if(b&&w&&p){const m=()=>{if(!i.isClosePausedRef.current){const $=new CustomEvent(nm);p.dispatchEvent($),i.isClosePausedRef.current=!0}},x=()=>{if(i.isClosePausedRef.current){const $=new CustomEvent(sm);p.dispatchEvent($),i.isClosePausedRef.current=!1}},_=$=>{!w.contains($.relatedTarget)&&x()},C=()=>{w.contains(document.activeElement)||x()};return w.addEventListener("focusin",m),w.addEventListener("focusout",_),w.addEventListener("pointermove",m),w.addEventListener("pointerleave",C),window.addEventListener("blur",m),window.addEventListener("focus",x),()=>{w.removeEventListener("focusin",m),w.removeEventListener("focusout",_),w.removeEventListener("pointermove",m),w.removeEventListener("pointerleave",C),window.removeEventListener("blur",m),window.removeEventListener("focus",x)}}},[b,i.isClosePausedRef]);const h=y.useCallback(({tabbingDirection:w})=>{const m=l().map(x=>{const _=x.ref.current,C=[_,...OR(_)];return w==="forwards"?C:C.reverse()});return(w==="forwards"?m.reverse():m).flat()},[l]);return y.useEffect(()=>{const w=f.current;if(w){const p=m=>{var C,$,k;const x=m.altKey||m.ctrlKey||m.metaKey;if(m.key==="Tab"&&!x){const I=document.activeElement,E=m.shiftKey;if(m.target===w&&E){(C=u.current)==null||C.focus();return}const O=h({tabbingDirection:E?"backwards":"forwards"}),L=O.findIndex(z=>z===I);bh(O.slice(L+1))?m.preventDefault():E?($=u.current)==null||$.focus():(k=d.current)==null||k.focus()}};return w.addEventListener("keydown",p),()=>w.removeEventListener("keydown",p)}},[l,h]),a.jsxs(cR,{ref:c,role:"region","aria-label":s.replace("{hotkey}",v),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&a.jsx(om,{ref:u,onFocusFromOutsideViewport:()=>{const w=h({tabbingDirection:"forwards"});bh(w)}}),a.jsx(ov.Slot,{scope:r,children:a.jsx(_e.ol,{tabIndex:-1,...o,ref:g})}),b&&a.jsx(om,{ref:d,onFocusFromOutsideViewport:()=>{const w=h({tabbingDirection:"backwards"});bh(w)}})]})});wk.displayName=yk;var xk="ToastFocusProxy",om=y.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=e,o=ff(xk,r);return a.jsx(df,{tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:i=>{var u;const l=i.relatedTarget;!((u=o.viewport)!=null&&u.contains(l))&&n()}})});om.displayName=xk;var uc="Toast",SR="toast.swipeStart",kR="toast.swipeMove",CR="toast.swipeCancel",ER="toast.swipeEnd",bk=y.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:o,...i}=e,[l,c]=eo({prop:n,defaultProp:s??!0,onChange:o,caller:uc});return a.jsx(An,{present:r||l,children:a.jsx($R,{open:l,...i,ref:t,onClose:()=>c(!1),onPause:qr(e.onPause),onResume:qr(e.onResume),onSwipeStart:pe(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:pe(e.onSwipeMove,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:pe(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:pe(e.onSwipeEnd,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})});bk.displayName=uc;var[NR,jR]=gk(uc,{onClose(){}}),$R=y.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:s,open:o,onClose:i,onEscapeKeyDown:l,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:g,onSwipeEnd:v,...b}=e,h=ff(uc,r),[w,p]=y.useState(null),m=Ve(t,z=>p(z)),x=y.useRef(null),_=y.useRef(null),C=s||h.duration,$=y.useRef(0),k=y.useRef(C),I=y.useRef(0),{onToastAdd:E,onToastRemove:U}=h,P=qr(()=>{var K;(w==null?void 0:w.contains(document.activeElement))&&((K=h.viewport)==null||K.focus()),i()}),O=y.useCallback(z=>{!z||z===1/0||(window.clearTimeout(I.current),$.current=new Date().getTime(),I.current=window.setTimeout(P,z))},[P]);y.useEffect(()=>{const z=h.viewport;if(z){const K=()=>{O(k.current),u==null||u()},Z=()=>{const W=new Date().getTime()-$.current;k.current=k.current-W,window.clearTimeout(I.current),c==null||c()};return z.addEventListener(nm,Z),z.addEventListener(sm,K),()=>{z.removeEventListener(nm,Z),z.removeEventListener(sm,K)}}},[h.viewport,C,c,u,O]),y.useEffect(()=>{o&&!h.isClosePausedRef.current&&O(C)},[o,C,h.isClosePausedRef,O]),y.useEffect(()=>(E(),()=>U()),[E,U]);const L=y.useMemo(()=>w?jk(w):null,[w]);return h.viewport?a.jsxs(a.Fragment,{children:[L&&a.jsx(PR,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite",children:L}),a.jsx(NR,{scope:r,onClose:P,children:ti.createPortal(a.jsx(ov.ItemSlot,{scope:r,children:a.jsx(lR,{asChild:!0,onEscapeKeyDown:pe(l,()=>{h.isFocusedToastEscapeKeyDownRef.current||P(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(_e.li,{tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":h.swipeDirection,...b,ref:m,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:pe(e.onKeyDown,z=>{z.key==="Escape"&&(l==null||l(z.nativeEvent),z.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,P()))}),onPointerDown:pe(e.onPointerDown,z=>{z.button===0&&(x.current={x:z.clientX,y:z.clientY})}),onPointerMove:pe(e.onPointerMove,z=>{if(!x.current)return;const K=z.clientX-x.current.x,Z=z.clientY-x.current.y,W=!!_.current,F=["left","right"].includes(h.swipeDirection),V=["left","up"].includes(h.swipeDirection)?Math.min:Math.max,D=F?V(0,K):0,T=F?0:V(0,Z),q=z.pointerType==="touch"?10:2,j={x:D,y:T},S={originalEvent:z,delta:j};W?(_.current=j,Jc(kR,f,S,{discrete:!1})):Tw(j,h.swipeDirection,q)?(_.current=j,Jc(SR,d,S,{discrete:!1}),z.target.setPointerCapture(z.pointerId)):(Math.abs(K)>q||Math.abs(Z)>q)&&(x.current=null)}),onPointerUp:pe(e.onPointerUp,z=>{const K=_.current,Z=z.target;if(Z.hasPointerCapture(z.pointerId)&&Z.releasePointerCapture(z.pointerId),_.current=null,x.current=null,K){const W=z.currentTarget,F={originalEvent:z,delta:K};Tw(K,h.swipeDirection,h.swipeThreshold)?Jc(ER,v,F,{discrete:!0}):Jc(CR,g,F,{discrete:!0}),W.addEventListener("click",V=>V.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),PR=e=>{const{__scopeToast:t,children:r,...n}=e,s=ff(uc,t),[o,i]=y.useState(!1),[l,c]=y.useState(!1);return IR(()=>i(!0)),y.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),l?null:a.jsx(cc,{asChild:!0,children:a.jsx(df,{...n,children:o&&a.jsxs(a.Fragment,{children:[s.label," ",r]})})})},TR="ToastTitle",_k=y.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return a.jsx(_e.div,{...n,ref:t})});_k.displayName=TR;var RR="ToastDescription",Sk=y.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return a.jsx(_e.div,{...n,ref:t})});Sk.displayName=RR;var kk="ToastAction",Ck=y.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?a.jsx(Nk,{altText:r,asChild:!0,children:a.jsx(iv,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${kk}\`. Expected non-empty \`string\`.`),null)});Ck.displayName=kk;var Ek="ToastClose",iv=y.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,s=jR(Ek,r);return a.jsx(Nk,{asChild:!0,children:a.jsx(_e.button,{type:"button",...n,ref:t,onClick:pe(e.onClick,s.onClose)})})});iv.displayName=Ek;var Nk=y.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...s}=e;return a.jsx(_e.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:t})});function jk(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),AR(n)){const s=n.ariaHidden||n.hidden||n.style.display==="none",o=n.dataset.radixToastAnnounceExclude==="";if(!s)if(o){const i=n.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...jk(n))}}),t}function Jc(e,t,r,{discrete:n}){const s=r.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?dk(s,o):s.dispatchEvent(o)}var Tw=(e,t,r=0)=>{const n=Math.abs(e.x),s=Math.abs(e.y),o=n>s;return t==="left"||t==="right"?o&&n>r:!o&&s>r};function IR(e=()=>{}){const t=qr(e);Ft(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function AR(e){return e.nodeType===e.ELEMENT_NODE}function OR(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function bh(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var MR=vk,$k=wk,Pk=bk,Tk=_k,Rk=Sk,Ik=Ck,Ak=iv;function Ok(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Ok(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Mk(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Ok(e))&&(n&&(n+=" "),n+=t);return n}const Rw=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Iw=Mk,hf=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return Iw(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(u=>{const d=r==null?void 0:r[u],f=o==null?void 0:o[u];if(d===null)return null;const g=Rw(d)||Rw(f);return s[u][g]}),l=r&&Object.entries(r).reduce((u,d)=>{let[f,g]=d;return g===void 0||(u[f]=g),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:f,className:g,...v}=d;return Object.entries(v).every(b=>{let[h,w]=b;return Array.isArray(w)?w.includes({...o,...l}[h]):{...o,...l}[h]===w})?[...u,f,g]:u},[]);return Iw(e,i,c,r==null?void 0:r.class,r==null?void 0:r.className)};/**
|
|
49
|
+
* @license lucide-react v0.453.0 - ISC
|
|
50
|
+
*
|
|
51
|
+
* This source code is licensed under the ISC license.
|
|
52
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
53
|
+
*/const DR=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Dk=(...e)=>e.filter((t,r,n)=>!!t&&n.indexOf(t)===r).join(" ");/**
|
|
54
|
+
* @license lucide-react v0.453.0 - ISC
|
|
55
|
+
*
|
|
56
|
+
* This source code is licensed under the ISC license.
|
|
57
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
58
|
+
*/var zR={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"};/**
|
|
59
|
+
* @license lucide-react v0.453.0 - ISC
|
|
60
|
+
*
|
|
61
|
+
* This source code is licensed under the ISC license.
|
|
62
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
63
|
+
*/const LR=y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:o,iconNode:i,...l},c)=>y.createElement("svg",{ref:c,...zR,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Dk("lucide",s),...l},[...i.map(([u,d])=>y.createElement(u,d)),...Array.isArray(o)?o:[o]]));/**
|
|
64
|
+
* @license lucide-react v0.453.0 - ISC
|
|
65
|
+
*
|
|
66
|
+
* This source code is licensed under the ISC license.
|
|
67
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
68
|
+
*/const Ae=(e,t)=>{const r=y.forwardRef(({className:n,...s},o)=>y.createElement(LR,{ref:o,iconNode:t,className:Dk(`lucide-${DR(e)}`,n),...s}));return r.displayName=`${e}`,r};/**
|
|
69
|
+
* @license lucide-react v0.453.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 FR=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"}]]);/**
|
|
74
|
+
* @license lucide-react v0.453.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
|
+
*/const zk=Ae("Bolt",[["path",{d:"M21 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.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/**
|
|
79
|
+
* @license lucide-react v0.453.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 av=Ae("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
|
|
84
|
+
* @license lucide-react v0.453.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 UR=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"}]]);/**
|
|
89
|
+
* @license lucide-react v0.453.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 _h=Ae("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
|
|
94
|
+
* @license lucide-react v0.453.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 Lk=Ae("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
99
|
+
* @license lucide-react v0.453.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 lv=Ae("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
104
|
+
* @license lucide-react v0.453.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 qR=Ae("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
109
|
+
* @license lucide-react v0.453.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 VR=Ae("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
114
|
+
* @license lucide-react v0.453.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 HR=Ae("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
119
|
+
* @license lucide-react v0.453.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 Fk=Ae("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
124
|
+
* @license lucide-react v0.453.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 im=Ae("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
|
129
|
+
* @license lucide-react v0.453.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 Aw=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"}]]);/**
|
|
134
|
+
* @license lucide-react v0.453.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 KR=Ae("ClipboardPaste",[["path",{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",key:"1pp7kr"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10",key:"2ik1ml"}],["path",{d:"m17 10 4 4-4 4",key:"vp2hj1"}]]);/**
|
|
139
|
+
* @license lucide-react v0.453.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 Uk=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"}]]);/**
|
|
144
|
+
* @license lucide-react v0.453.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 Ow=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"}]]);/**
|
|
149
|
+
* @license lucide-react v0.453.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 qk=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"}]]);/**
|
|
154
|
+
* @license lucide-react v0.453.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 Gn=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"}]]);/**
|
|
159
|
+
* @license lucide-react v0.453.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 BR=Ae("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
|
|
164
|
+
* @license lucide-react v0.453.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 am=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"}]]);/**
|
|
169
|
+
* @license lucide-react v0.453.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 Yc=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"}]]);/**
|
|
174
|
+
* @license lucide-react v0.453.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 lm=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:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
|
|
179
|
+
* @license lucide-react v0.453.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 WR=Ae("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
|
|
184
|
+
* @license lucide-react v0.453.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 Mw=Ae("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
189
|
+
* @license lucide-react v0.453.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 ZR=Ae("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
194
|
+
* @license lucide-react v0.453.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 Ls=Ae("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
199
|
+
* @license lucide-react v0.453.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 GR=Ae("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/**
|
|
204
|
+
* @license lucide-react v0.453.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 Vk=Ae("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
209
|
+
* @license lucide-react v0.453.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 vd=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"}]]);/**
|
|
214
|
+
* @license lucide-react v0.453.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 QR=Ae("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
219
|
+
* @license lucide-react v0.453.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 pf=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"}]]);/**
|
|
224
|
+
* @license lucide-react v0.453.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 rn=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"}]]);/**
|
|
229
|
+
* @license lucide-react v0.453.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 JR=Ae("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
|
|
234
|
+
* @license lucide-react v0.453.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 YR=Ae("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
|
|
239
|
+
* @license lucide-react v0.453.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 cv=Ae("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
|
|
244
|
+
* @license lucide-react v0.453.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 yd=Ae("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),uv="-",XR=e=>{const t=tI(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{const l=i.split(uv);return l[0]===""&&l.length!==1&&l.shift(),Hk(l,t)||eI(i)},getConflictingClassGroupIds:(i,l)=>{const c=r[i]||[];return l&&n[i]?[...c,...n[i]]:c}}},Hk=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),s=n?Hk(e.slice(1),n):void 0;if(s)return s;if(t.validators.length===0)return;const o=e.join(uv);return(i=t.validators.find(({validator:l})=>l(o)))==null?void 0:i.classGroupId},Dw=/^\[(.+)\]$/,eI=e=>{if(Dw.test(e)){const t=Dw.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},tI=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return nI(Object.entries(e.classGroups),r).forEach(([o,i])=>{cm(i,n,o,t)}),n},cm=(e,t,r,n)=>{e.forEach(s=>{if(typeof s=="string"){const o=s===""?t:zw(t,s);o.classGroupId=r;return}if(typeof s=="function"){if(rI(s)){cm(s(n),t,r,n);return}t.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([o,i])=>{cm(i,zw(t,o),r,n)})})},zw=(e,t)=>{let r=e;return t.split(uv).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},rI=e=>e.isThemeGetter,nI=(e,t)=>t?e.map(([r,n])=>{const s=n.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,l])=>[t+i,l])):o);return[r,s]}):e,sI=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const s=(o,i)=>{r.set(o,i),t++,t>e&&(t=0,n=r,r=new Map)};return{get(o){let i=r.get(o);if(i!==void 0)return i;if((i=n.get(o))!==void 0)return s(o,i),i},set(o,i){r.has(o)?r.set(o,i):s(o,i)}}},Kk="!",oI=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,s=t[0],o=t.length,i=l=>{const c=[];let u=0,d=0,f;for(let w=0;w<l.length;w++){let p=l[w];if(u===0){if(p===s&&(n||l.slice(w,w+o)===t)){c.push(l.slice(d,w)),d=w+o;continue}if(p==="/"){f=w;continue}}p==="["?u++:p==="]"&&u--}const g=c.length===0?l:l.substring(d),v=g.startsWith(Kk),b=v?g.substring(1):g,h=f&&f>d?f-d:void 0;return{modifiers:c,hasImportantModifier:v,baseClassName:b,maybePostfixModifierPosition:h}};return r?l=>r({className:l,parseClassName:i}):i},iI=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},aI=e=>({cache:sI(e.cacheSize),parseClassName:oI(e),...XR(e)}),lI=/\s+/,cI=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s}=t,o=[],i=e.trim().split(lI);let l="";for(let c=i.length-1;c>=0;c-=1){const u=i[c],{modifiers:d,hasImportantModifier:f,baseClassName:g,maybePostfixModifierPosition:v}=r(u);let b=!!v,h=n(b?g.substring(0,v):g);if(!h){if(!b){l=u+(l.length>0?" "+l:l);continue}if(h=n(g),!h){l=u+(l.length>0?" "+l:l);continue}b=!1}const w=iI(d).join(":"),p=f?w+Kk:w,m=p+h;if(o.includes(m))continue;o.push(m);const x=s(h,b);for(let _=0;_<x.length;++_){const C=x[_];o.push(p+C)}l=u+(l.length>0?" "+l:l)}return l};function uI(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=Bk(t))&&(n&&(n+=" "),n+=r);return n}const Bk=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Bk(e[n]))&&(r&&(r+=" "),r+=t);return r};function dI(e,...t){let r,n,s,o=i;function i(c){const u=t.reduce((d,f)=>f(d),e());return r=aI(u),n=r.cache.get,s=r.cache.set,o=l,l(c)}function l(c){const u=n(c);if(u)return u;const d=cI(c,r);return s(c,d),d}return function(){return o(uI.apply(null,arguments))}}const Qe=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},Wk=/^\[(?:([a-z-]+):)?(.+)\]$/i,fI=/^\d+\/\d+$/,hI=new Set(["px","full","screen"]),pI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,mI=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,gI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,vI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,zn=e=>Li(e)||hI.has(e)||fI.test(e),ps=e=>Ea(e,"length",EI),Li=e=>!!e&&!Number.isNaN(Number(e)),Sh=e=>Ea(e,"number",Li),Ba=e=>!!e&&Number.isInteger(Number(e)),wI=e=>e.endsWith("%")&&Li(e.slice(0,-1)),Ce=e=>Wk.test(e),ms=e=>pI.test(e),xI=new Set(["length","size","percentage"]),bI=e=>Ea(e,xI,Zk),_I=e=>Ea(e,"position",Zk),SI=new Set(["image","url"]),kI=e=>Ea(e,SI,jI),CI=e=>Ea(e,"",NI),Wa=()=>!0,Ea=(e,t,r)=>{const n=Wk.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},EI=e=>mI.test(e)&&!gI.test(e),Zk=()=>!1,NI=e=>vI.test(e),jI=e=>yI.test(e),$I=()=>{const e=Qe("colors"),t=Qe("spacing"),r=Qe("blur"),n=Qe("brightness"),s=Qe("borderColor"),o=Qe("borderRadius"),i=Qe("borderSpacing"),l=Qe("borderWidth"),c=Qe("contrast"),u=Qe("grayscale"),d=Qe("hueRotate"),f=Qe("invert"),g=Qe("gap"),v=Qe("gradientColorStops"),b=Qe("gradientColorStopPositions"),h=Qe("inset"),w=Qe("margin"),p=Qe("opacity"),m=Qe("padding"),x=Qe("saturate"),_=Qe("scale"),C=Qe("sepia"),$=Qe("skew"),k=Qe("space"),I=Qe("translate"),E=()=>["auto","contain","none"],U=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto",Ce,t],O=()=>[Ce,t],L=()=>["",zn,ps],z=()=>["auto",Li,Ce],K=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Z=()=>["solid","dashed","dotted","double","none"],W=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],F=()=>["start","end","center","between","around","evenly","stretch"],V=()=>["","0",Ce],D=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>[Li,Ce];return{cacheSize:500,separator:":",theme:{colors:[Wa],spacing:[zn,ps],blur:["none","",ms,Ce],brightness:T(),borderColor:[e],borderRadius:["none","","full",ms,Ce],borderSpacing:O(),borderWidth:L(),contrast:T(),grayscale:V(),hueRotate:T(),invert:V(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[wI,ps],inset:P(),margin:P(),opacity:T(),padding:O(),saturate:T(),scale:T(),sepia:V(),skew:T(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",Ce]}],container:["container"],columns:[{columns:[ms]}],"break-after":[{"break-after":D()}],"break-before":[{"break-before":D()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...K(),Ce]}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ba,Ce]}],basis:[{basis:P()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ce]}],grow:[{grow:V()}],shrink:[{shrink:V()}],order:[{order:["first","last","none",Ba,Ce]}],"grid-cols":[{"grid-cols":[Wa]}],"col-start-end":[{col:["auto",{span:["full",Ba,Ce]},Ce]}],"col-start":[{"col-start":z()}],"col-end":[{"col-end":z()}],"grid-rows":[{"grid-rows":[Wa]}],"row-start-end":[{row:["auto",{span:[Ba,Ce]},Ce]}],"row-start":[{"row-start":z()}],"row-end":[{"row-end":z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ce]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ce]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...F()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...F(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...F(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[m]}],px:[{px:[m]}],py:[{py:[m]}],ps:[{ps:[m]}],pe:[{pe:[m]}],pt:[{pt:[m]}],pr:[{pr:[m]}],pb:[{pb:[m]}],pl:[{pl:[m]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[k]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[k]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ce,t]}],"min-w":[{"min-w":[Ce,t,"min","max","fit"]}],"max-w":[{"max-w":[Ce,t,"none","full","min","max","fit","prose",{screen:[ms]},ms]}],h:[{h:[Ce,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ce,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ce,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ce,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ms,ps]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Sh]}],"font-family":[{font:[Wa]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ce]}],"line-clamp":[{"line-clamp":["none",Li,Sh]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",zn,Ce]}],"list-image":[{"list-image":["none",Ce]}],"list-style-type":[{list:["none","disc","decimal",Ce]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[p]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[p]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",zn,ps]}],"underline-offset":[{"underline-offset":["auto",zn,Ce]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ce]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ce]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[p]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...K(),_I]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",bI]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},kI]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[p]}],"border-style":[{border:[...Z(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[p]}],"divide-style":[{divide:Z()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...Z()]}],"outline-offset":[{"outline-offset":[zn,Ce]}],"outline-w":[{outline:[zn,ps]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:L()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[p]}],"ring-offset-w":[{"ring-offset":[zn,ps]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ms,CI]}],"shadow-color":[{shadow:[Wa]}],opacity:[{opacity:[p]}],"mix-blend":[{"mix-blend":[...W(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":W()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",ms,Ce]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[x]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[p]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ce]}],duration:[{duration:T()}],ease:[{ease:["linear","in","out","in-out",Ce]}],delay:[{delay:T()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ce]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[_]}],"scale-x":[{"scale-x":[_]}],"scale-y":[{"scale-y":[_]}],rotate:[{rotate:[Ba,Ce]}],"translate-x":[{"translate-x":[I]}],"translate-y":[{"translate-y":[I]}],"skew-x":[{"skew-x":[$]}],"skew-y":[{"skew-y":[$]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ce]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ce]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ce]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[zn,ps,Sh]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},PI=dI($I);function xe(...e){return PI(Mk(e))}const TI=MR,Gk=y.forwardRef(({className:e,...t},r)=>a.jsx($k,{ref:r,className:xe("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));Gk.displayName=$k.displayName;const RI=hf("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Qk=y.forwardRef(({className:e,variant:t,...r},n)=>a.jsx(Pk,{ref:n,className:xe(RI({variant:t}),e),...r}));Qk.displayName=Pk.displayName;const II=y.forwardRef(({className:e,...t},r)=>a.jsx(Ik,{ref:r,className:xe("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));II.displayName=Ik.displayName;const Jk=y.forwardRef(({className:e,...t},r)=>a.jsx(Ak,{ref:r,className:xe("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:a.jsx(yd,{className:"h-4 w-4"})}));Jk.displayName=Ak.displayName;const Yk=y.forwardRef(({className:e,...t},r)=>a.jsx(Tk,{ref:r,className:xe("text-sm font-semibold",e),...t}));Yk.displayName=Tk.displayName;const Xk=y.forwardRef(({className:e,...t},r)=>a.jsx(Rk,{ref:r,className:xe("text-sm opacity-90",e),...t}));Xk.displayName=Rk.displayName;function AI(){const{toasts:e}=Ut();return a.jsxs(TI,{children:[e.map(function({id:t,title:r,description:n,action:s,...o}){return a.jsxs(Qk,{...o,children:[a.jsxs("div",{className:"grid gap-1",children:[r&&a.jsx(Yk,{children:r}),n&&a.jsx(Xk,{children:n})]}),s,a.jsx(Jk,{})]},t)}),a.jsx(Gk,{})]})}var OI=ig[" useId ".trim().toString()]||(()=>{}),MI=0;function Jn(e){const[t,r]=y.useState(OI());return Ft(()=>{r(n=>n??String(MI++))},[e]),t?`radix-${t}`:""}const DI=["top","right","bottom","left"],to=Math.min,xr=Math.max,wd=Math.round,Xc=Math.floor,Tn=e=>({x:e,y:e}),zI={left:"right",right:"left",bottom:"top",top:"bottom"},LI={start:"end",end:"start"};function um(e,t,r){return xr(e,to(t,r))}function os(e,t){return typeof e=="function"?e(t):e}function is(e){return e.split("-")[0]}function Na(e){return e.split("-")[1]}function dv(e){return e==="x"?"y":"x"}function fv(e){return e==="y"?"height":"width"}const FI=new Set(["top","bottom"]);function En(e){return FI.has(is(e))?"y":"x"}function hv(e){return dv(En(e))}function UI(e,t,r){r===void 0&&(r=!1);const n=Na(e),s=hv(e),o=fv(s);let i=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=xd(i)),[i,xd(i)]}function qI(e){const t=xd(e);return[dm(e),t,dm(t)]}function dm(e){return e.replace(/start|end/g,t=>LI[t])}const Lw=["left","right"],Fw=["right","left"],VI=["top","bottom"],HI=["bottom","top"];function KI(e,t,r){switch(e){case"top":case"bottom":return r?t?Fw:Lw:t?Lw:Fw;case"left":case"right":return t?VI:HI;default:return[]}}function BI(e,t,r,n){const s=Na(e);let o=KI(is(e),r==="start",n);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(dm)))),o}function xd(e){return e.replace(/left|right|bottom|top/g,t=>zI[t])}function WI(e){return{top:0,right:0,bottom:0,left:0,...e}}function e1(e){return typeof e!="number"?WI(e):{top:e,right:e,bottom:e,left:e}}function bd(e){const{x:t,y:r,width:n,height:s}=e;return{width:n,height:s,top:r,left:t,right:t+n,bottom:r+s,x:t,y:r}}function Uw(e,t,r){let{reference:n,floating:s}=e;const o=En(t),i=hv(t),l=fv(i),c=is(t),u=o==="y",d=n.x+n.width/2-s.width/2,f=n.y+n.height/2-s.height/2,g=n[l]/2-s[l]/2;let v;switch(c){case"top":v={x:d,y:n.y-s.height};break;case"bottom":v={x:d,y:n.y+n.height};break;case"right":v={x:n.x+n.width,y:f};break;case"left":v={x:n.x-s.width,y:f};break;default:v={x:n.x,y:n.y}}switch(Na(t)){case"start":v[i]-=g*(r&&u?-1:1);break;case"end":v[i]+=g*(r&&u?-1:1);break}return v}const ZI=async(e,t,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:o=[],platform:i}=r,l=o.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:d,y:f}=Uw(u,n,c),g=n,v={},b=0;for(let h=0;h<l.length;h++){const{name:w,fn:p}=l[h],{x:m,y:x,data:_,reset:C}=await p({x:d,y:f,initialPlacement:n,placement:g,strategy:s,middlewareData:v,rects:u,platform:i,elements:{reference:e,floating:t}});d=m??d,f=x??f,v={...v,[w]:{...v[w],..._}},C&&b<=50&&(b++,typeof C=="object"&&(C.placement&&(g=C.placement),C.rects&&(u=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):C.rects),{x:d,y:f}=Uw(u,g,c)),h=-1)}return{x:d,y:f,placement:g,strategy:s,middlewareData:v}};async function Wl(e,t){var r;t===void 0&&(t={});const{x:n,y:s,platform:o,rects:i,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:g=!1,padding:v=0}=os(t,e),b=e1(v),w=l[g?f==="floating"?"reference":"floating":f],p=bd(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(w)))==null||r?w:w.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),m=f==="floating"?{x:n,y:s,width:i.floating.width,height:i.floating.height}:i.reference,x=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),_=await(o.isElement==null?void 0:o.isElement(x))?await(o.getScale==null?void 0:o.getScale(x))||{x:1,y:1}:{x:1,y:1},C=bd(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:m,offsetParent:x,strategy:c}):m);return{top:(p.top-C.top+b.top)/_.y,bottom:(C.bottom-p.bottom+b.bottom)/_.y,left:(p.left-C.left+b.left)/_.x,right:(C.right-p.right+b.right)/_.x}}const GI=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:s,rects:o,platform:i,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=os(e,t)||{};if(u==null)return{};const f=e1(d),g={x:r,y:n},v=hv(s),b=fv(v),h=await i.getDimensions(u),w=v==="y",p=w?"top":"left",m=w?"bottom":"right",x=w?"clientHeight":"clientWidth",_=o.reference[b]+o.reference[v]-g[v]-o.floating[b],C=g[v]-o.reference[v],$=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let k=$?$[x]:0;(!k||!await(i.isElement==null?void 0:i.isElement($)))&&(k=l.floating[x]||o.floating[b]);const I=_/2-C/2,E=k/2-h[b]/2-1,U=to(f[p],E),P=to(f[m],E),O=U,L=k-h[b]-P,z=k/2-h[b]/2+I,K=um(O,z,L),Z=!c.arrow&&Na(s)!=null&&z!==K&&o.reference[b]/2-(z<O?U:P)-h[b]/2<0,W=Z?z<O?z-O:z-L:0;return{[v]:g[v]+W,data:{[v]:K,centerOffset:z-K-W,...Z&&{alignmentOffset:W}},reset:Z}}}),QI=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:s,middlewareData:o,rects:i,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:h=!0,...w}=os(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const p=is(s),m=En(l),x=is(l)===l,_=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=g||(x||!h?[xd(l)]:qI(l)),$=b!=="none";!g&&$&&C.push(...BI(l,h,b,_));const k=[l,...C],I=await Wl(t,w),E=[];let U=((n=o.flip)==null?void 0:n.overflows)||[];if(d&&E.push(I[p]),f){const z=UI(s,i,_);E.push(I[z[0]],I[z[1]])}if(U=[...U,{placement:s,overflows:E}],!E.every(z=>z<=0)){var P,O;const z=(((P=o.flip)==null?void 0:P.index)||0)+1,K=k[z];if(K&&(!(f==="alignment"?m!==En(K):!1)||U.every(F=>En(F.placement)===m?F.overflows[0]>0:!0)))return{data:{index:z,overflows:U},reset:{placement:K}};let Z=(O=U.filter(W=>W.overflows[0]<=0).sort((W,F)=>W.overflows[1]-F.overflows[1])[0])==null?void 0:O.placement;if(!Z)switch(v){case"bestFit":{var L;const W=(L=U.filter(F=>{if($){const V=En(F.placement);return V===m||V==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(V=>V>0).reduce((V,D)=>V+D,0)]).sort((F,V)=>F[1]-V[1])[0])==null?void 0:L[0];W&&(Z=W);break}case"initialPlacement":Z=l;break}if(s!==Z)return{reset:{placement:Z}}}return{}}}};function qw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Vw(e){return DI.some(t=>e[t]>=0)}const JI=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...s}=os(e,t);switch(n){case"referenceHidden":{const o=await Wl(t,{...s,elementContext:"reference"}),i=qw(o,r.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Vw(i)}}}case"escaped":{const o=await Wl(t,{...s,altBoundary:!0}),i=qw(o,r.floating);return{data:{escapedOffsets:i,escaped:Vw(i)}}}default:return{}}}}},t1=new Set(["left","top"]);async function YI(e,t){const{placement:r,platform:n,elements:s}=e,o=await(n.isRTL==null?void 0:n.isRTL(s.floating)),i=is(r),l=Na(r),c=En(r)==="y",u=t1.has(i)?-1:1,d=o&&c?-1:1,f=os(t,e);let{mainAxis:g,crossAxis:v,alignmentAxis:b}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof b=="number"&&(v=l==="end"?b*-1:b),c?{x:v*d,y:g*u}:{x:g*u,y:v*d}}const XI=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:s,y:o,placement:i,middlewareData:l}=t,c=await YI(t,e);return i===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:i}}}}},eA=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:s}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:l={fn:w=>{let{x:p,y:m}=w;return{x:p,y:m}}},...c}=os(e,t),u={x:r,y:n},d=await Wl(t,c),f=En(is(s)),g=dv(f);let v=u[g],b=u[f];if(o){const w=g==="y"?"top":"left",p=g==="y"?"bottom":"right",m=v+d[w],x=v-d[p];v=um(m,v,x)}if(i){const w=f==="y"?"top":"left",p=f==="y"?"bottom":"right",m=b+d[w],x=b-d[p];b=um(m,b,x)}const h=l.fn({...t,[g]:v,[f]:b});return{...h,data:{x:h.x-r,y:h.y-n,enabled:{[g]:o,[f]:i}}}}}},tA=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:s,rects:o,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=os(e,t),d={x:r,y:n},f=En(s),g=dv(f);let v=d[g],b=d[f];const h=os(l,t),w=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const x=g==="y"?"height":"width",_=o.reference[g]-o.floating[x]+w.mainAxis,C=o.reference[g]+o.reference[x]-w.mainAxis;v<_?v=_:v>C&&(v=C)}if(u){var p,m;const x=g==="y"?"width":"height",_=t1.has(is(s)),C=o.reference[f]-o.floating[x]+(_&&((p=i.offset)==null?void 0:p[f])||0)+(_?0:w.crossAxis),$=o.reference[f]+o.reference[x]+(_?0:((m=i.offset)==null?void 0:m[f])||0)-(_?w.crossAxis:0);b<C?b=C:b>$&&(b=$)}return{[g]:v,[f]:b}}}},rA=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:s,rects:o,platform:i,elements:l}=t,{apply:c=()=>{},...u}=os(e,t),d=await Wl(t,u),f=is(s),g=Na(s),v=En(s)==="y",{width:b,height:h}=o.floating;let w,p;f==="top"||f==="bottom"?(w=f,p=g===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(p=f,w=g==="end"?"top":"bottom");const m=h-d.top-d.bottom,x=b-d.left-d.right,_=to(h-d[w],m),C=to(b-d[p],x),$=!t.middlewareData.shift;let k=_,I=C;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(I=x),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(k=m),$&&!g){const U=xr(d.left,0),P=xr(d.right,0),O=xr(d.top,0),L=xr(d.bottom,0);v?I=b-2*(U!==0||P!==0?U+P:xr(d.left,d.right)):k=h-2*(O!==0||L!==0?O+L:xr(d.top,d.bottom))}await c({...t,availableWidth:I,availableHeight:k});const E=await i.getDimensions(l.floating);return b!==E.width||h!==E.height?{reset:{rects:!0}}:{}}}};function mf(){return typeof window<"u"}function ja(e){return r1(e)?(e.nodeName||"").toLowerCase():"#document"}function kr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function On(e){var t;return(t=(r1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function r1(e){return mf()?e instanceof Node||e instanceof kr(e).Node:!1}function un(e){return mf()?e instanceof Element||e instanceof kr(e).Element:!1}function Rn(e){return mf()?e instanceof HTMLElement||e instanceof kr(e).HTMLElement:!1}function Hw(e){return!mf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof kr(e).ShadowRoot}const nA=new Set(["inline","contents"]);function dc(e){const{overflow:t,overflowX:r,overflowY:n,display:s}=dn(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!nA.has(s)}const sA=new Set(["table","td","th"]);function oA(e){return sA.has(ja(e))}const iA=[":popover-open",":modal"];function gf(e){return iA.some(t=>{try{return e.matches(t)}catch{return!1}})}const aA=["transform","translate","scale","rotate","perspective"],lA=["transform","translate","scale","rotate","perspective","filter"],cA=["paint","layout","strict","content"];function pv(e){const t=mv(),r=un(e)?dn(e):e;return aA.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||lA.some(n=>(r.willChange||"").includes(n))||cA.some(n=>(r.contain||"").includes(n))}function uA(e){let t=ro(e);for(;Rn(t)&&!ha(t);){if(pv(t))return t;if(gf(t))return null;t=ro(t)}return null}function mv(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const dA=new Set(["html","body","#document"]);function ha(e){return dA.has(ja(e))}function dn(e){return kr(e).getComputedStyle(e)}function vf(e){return un(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ro(e){if(ja(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Hw(e)&&e.host||On(e);return Hw(t)?t.host:t}function n1(e){const t=ro(e);return ha(t)?e.ownerDocument?e.ownerDocument.body:e.body:Rn(t)&&dc(t)?t:n1(t)}function Zl(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const s=n1(e),o=s===((n=e.ownerDocument)==null?void 0:n.body),i=kr(s);if(o){const l=fm(i);return t.concat(i,i.visualViewport||[],dc(s)?s:[],l&&r?Zl(l):[])}return t.concat(s,Zl(s,[],r))}function fm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function s1(e){const t=dn(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const s=Rn(e),o=s?e.offsetWidth:r,i=s?e.offsetHeight:n,l=wd(r)!==o||wd(n)!==i;return l&&(r=o,n=i),{width:r,height:n,$:l}}function gv(e){return un(e)?e:e.contextElement}function Fi(e){const t=gv(e);if(!Rn(t))return Tn(1);const r=t.getBoundingClientRect(),{width:n,height:s,$:o}=s1(t);let i=(o?wd(r.width):r.width)/n,l=(o?wd(r.height):r.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const fA=Tn(0);function o1(e){const t=kr(e);return!mv()||!t.visualViewport?fA:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function hA(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==kr(e)?!1:t}function Wo(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),o=gv(e);let i=Tn(1);t&&(n?un(n)&&(i=Fi(n)):i=Fi(e));const l=hA(o,r,n)?o1(o):Tn(0);let c=(s.left+l.x)/i.x,u=(s.top+l.y)/i.y,d=s.width/i.x,f=s.height/i.y;if(o){const g=kr(o),v=n&&un(n)?kr(n):n;let b=g,h=fm(b);for(;h&&n&&v!==b;){const w=Fi(h),p=h.getBoundingClientRect(),m=dn(h),x=p.left+(h.clientLeft+parseFloat(m.paddingLeft))*w.x,_=p.top+(h.clientTop+parseFloat(m.paddingTop))*w.y;c*=w.x,u*=w.y,d*=w.x,f*=w.y,c+=x,u+=_,b=kr(h),h=fm(b)}}return bd({width:d,height:f,x:c,y:u})}function yf(e,t){const r=vf(e).scrollLeft;return t?t.left+r:Wo(On(e)).left+r}function i1(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-yf(e,r),s=r.top+t.scrollTop;return{x:n,y:s}}function pA(e){let{elements:t,rect:r,offsetParent:n,strategy:s}=e;const o=s==="fixed",i=On(n),l=t?gf(t.floating):!1;if(n===i||l&&o)return r;let c={scrollLeft:0,scrollTop:0},u=Tn(1);const d=Tn(0),f=Rn(n);if((f||!f&&!o)&&((ja(n)!=="body"||dc(i))&&(c=vf(n)),Rn(n))){const v=Wo(n);u=Fi(n),d.x=v.x+n.clientLeft,d.y=v.y+n.clientTop}const g=i&&!f&&!o?i1(i,c):Tn(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+d.x+g.x,y:r.y*u.y-c.scrollTop*u.y+d.y+g.y}}function mA(e){return Array.from(e.getClientRects())}function gA(e){const t=On(e),r=vf(e),n=e.ownerDocument.body,s=xr(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=xr(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+yf(e);const l=-r.scrollTop;return dn(n).direction==="rtl"&&(i+=xr(t.clientWidth,n.clientWidth)-s),{width:s,height:o,x:i,y:l}}const Kw=25;function vA(e,t){const r=kr(e),n=On(e),s=r.visualViewport;let o=n.clientWidth,i=n.clientHeight,l=0,c=0;if(s){o=s.width,i=s.height;const d=mv();(!d||d&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const u=yf(n);if(u<=0){const d=n.ownerDocument,f=d.body,g=getComputedStyle(f),v=d.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,b=Math.abs(n.clientWidth-f.clientWidth-v);b<=Kw&&(o-=b)}else u<=Kw&&(o+=u);return{width:o,height:i,x:l,y:c}}const yA=new Set(["absolute","fixed"]);function wA(e,t){const r=Wo(e,!0,t==="fixed"),n=r.top+e.clientTop,s=r.left+e.clientLeft,o=Rn(e)?Fi(e):Tn(1),i=e.clientWidth*o.x,l=e.clientHeight*o.y,c=s*o.x,u=n*o.y;return{width:i,height:l,x:c,y:u}}function Bw(e,t,r){let n;if(t==="viewport")n=vA(e,r);else if(t==="document")n=gA(On(e));else if(un(t))n=wA(t,r);else{const s=o1(e);n={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return bd(n)}function a1(e,t){const r=ro(e);return r===t||!un(r)||ha(r)?!1:dn(r).position==="fixed"||a1(r,t)}function xA(e,t){const r=t.get(e);if(r)return r;let n=Zl(e,[],!1).filter(l=>un(l)&&ja(l)!=="body"),s=null;const o=dn(e).position==="fixed";let i=o?ro(e):e;for(;un(i)&&!ha(i);){const l=dn(i),c=pv(i);!c&&l.position==="fixed"&&(s=null),(o?!c&&!s:!c&&l.position==="static"&&!!s&&yA.has(s.position)||dc(i)&&!c&&a1(e,i))?n=n.filter(d=>d!==i):s=l,i=ro(i)}return t.set(e,n),n}function bA(e){let{element:t,boundary:r,rootBoundary:n,strategy:s}=e;const i=[...r==="clippingAncestors"?gf(t)?[]:xA(t,this._c):[].concat(r),n],l=i[0],c=i.reduce((u,d)=>{const f=Bw(t,d,s);return u.top=xr(f.top,u.top),u.right=to(f.right,u.right),u.bottom=to(f.bottom,u.bottom),u.left=xr(f.left,u.left),u},Bw(t,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function _A(e){const{width:t,height:r}=s1(e);return{width:t,height:r}}function SA(e,t,r){const n=Rn(t),s=On(t),o=r==="fixed",i=Wo(e,!0,o,t);let l={scrollLeft:0,scrollTop:0};const c=Tn(0);function u(){c.x=yf(s)}if(n||!n&&!o)if((ja(t)!=="body"||dc(s))&&(l=vf(t)),n){const v=Wo(t,!0,o,t);c.x=v.x+t.clientLeft,c.y=v.y+t.clientTop}else s&&u();o&&!n&&s&&u();const d=s&&!n&&!o?i1(s,l):Tn(0),f=i.left+l.scrollLeft-c.x-d.x,g=i.top+l.scrollTop-c.y-d.y;return{x:f,y:g,width:i.width,height:i.height}}function kh(e){return dn(e).position==="static"}function Ww(e,t){if(!Rn(e)||dn(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return On(e)===r&&(r=r.ownerDocument.body),r}function l1(e,t){const r=kr(e);if(gf(e))return r;if(!Rn(e)){let s=ro(e);for(;s&&!ha(s);){if(un(s)&&!kh(s))return s;s=ro(s)}return r}let n=Ww(e,t);for(;n&&oA(n)&&kh(n);)n=Ww(n,t);return n&&ha(n)&&kh(n)&&!pv(n)?r:n||uA(e)||r}const kA=async function(e){const t=this.getOffsetParent||l1,r=this.getDimensions,n=await r(e.floating);return{reference:SA(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function CA(e){return dn(e).direction==="rtl"}const EA={convertOffsetParentRelativeRectToViewportRelativeRect:pA,getDocumentElement:On,getClippingRect:bA,getOffsetParent:l1,getElementRects:kA,getClientRects:mA,getDimensions:_A,getScale:Fi,isElement:un,isRTL:CA};function c1(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function NA(e,t){let r=null,n;const s=On(e);function o(){var l;clearTimeout(n),(l=r)==null||l.disconnect(),r=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),o();const u=e.getBoundingClientRect(),{left:d,top:f,width:g,height:v}=u;if(l||t(),!g||!v)return;const b=Xc(f),h=Xc(s.clientWidth-(d+g)),w=Xc(s.clientHeight-(f+v)),p=Xc(d),x={rootMargin:-b+"px "+-h+"px "+-w+"px "+-p+"px",threshold:xr(0,to(1,c))||1};let _=!0;function C($){const k=$[0].intersectionRatio;if(k!==c){if(!_)return i();k?i(!1,k):n=setTimeout(()=>{i(!1,1e-7)},1e3)}k===1&&!c1(u,e.getBoundingClientRect())&&i(),_=!1}try{r=new IntersectionObserver(C,{...x,root:s.ownerDocument})}catch{r=new IntersectionObserver(C,x)}r.observe(e)}return i(!0),o}function jA(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=gv(e),d=s||o?[...u?Zl(u):[],...Zl(t)]:[];d.forEach(p=>{s&&p.addEventListener("scroll",r,{passive:!0}),o&&p.addEventListener("resize",r)});const f=u&&l?NA(u,r):null;let g=-1,v=null;i&&(v=new ResizeObserver(p=>{let[m]=p;m&&m.target===u&&v&&(v.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var x;(x=v)==null||x.observe(t)})),r()}),u&&!c&&v.observe(u),v.observe(t));let b,h=c?Wo(e):null;c&&w();function w(){const p=Wo(e);h&&!c1(h,p)&&r(),h=p,b=requestAnimationFrame(w)}return r(),()=>{var p;d.forEach(m=>{s&&m.removeEventListener("scroll",r),o&&m.removeEventListener("resize",r)}),f==null||f(),(p=v)==null||p.disconnect(),v=null,c&&cancelAnimationFrame(b)}}const $A=XI,PA=eA,TA=QI,RA=rA,IA=JI,Zw=GI,AA=tA,OA=(e,t,r)=>{const n=new Map,s={platform:EA,...r},o={...s.platform,_c:n};return ZI(e,t,{...s,platform:o})};var MA=typeof document<"u",DA=function(){},Tu=MA?y.useLayoutEffect:DA;function _d(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!_d(e[n],t[n]))return!1;return!0}if(s=Object.keys(e),r=s.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,s[n]))return!1;for(n=r;n--!==0;){const o=s[n];if(!(o==="_owner"&&e.$$typeof)&&!_d(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function u1(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Gw(e,t){const r=u1(e);return Math.round(t*r)/r}function Ch(e){const t=y.useRef(e);return Tu(()=>{t.current=e}),t}function zA(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:o,floating:i}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=y.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[g,v]=y.useState(n);_d(g,n)||v(n);const[b,h]=y.useState(null),[w,p]=y.useState(null),m=y.useCallback(F=>{F!==$.current&&($.current=F,h(F))},[]),x=y.useCallback(F=>{F!==k.current&&(k.current=F,p(F))},[]),_=o||b,C=i||w,$=y.useRef(null),k=y.useRef(null),I=y.useRef(d),E=c!=null,U=Ch(c),P=Ch(s),O=Ch(u),L=y.useCallback(()=>{if(!$.current||!k.current)return;const F={placement:t,strategy:r,middleware:g};P.current&&(F.platform=P.current),OA($.current,k.current,F).then(V=>{const D={...V,isPositioned:O.current!==!1};z.current&&!_d(I.current,D)&&(I.current=D,ti.flushSync(()=>{f(D)}))})},[g,t,r,P,O]);Tu(()=>{u===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,f(F=>({...F,isPositioned:!1})))},[u]);const z=y.useRef(!1);Tu(()=>(z.current=!0,()=>{z.current=!1}),[]),Tu(()=>{if(_&&($.current=_),C&&(k.current=C),_&&C){if(U.current)return U.current(_,C,L);L()}},[_,C,L,U,E]);const K=y.useMemo(()=>({reference:$,floating:k,setReference:m,setFloating:x}),[m,x]),Z=y.useMemo(()=>({reference:_,floating:C}),[_,C]),W=y.useMemo(()=>{const F={position:r,left:0,top:0};if(!Z.floating)return F;const V=Gw(Z.floating,d.x),D=Gw(Z.floating,d.y);return l?{...F,transform:"translate("+V+"px, "+D+"px)",...u1(Z.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:V,top:D}},[r,l,Z.floating,d.x,d.y]);return y.useMemo(()=>({...d,update:L,refs:K,elements:Z,floatingStyles:W}),[d,L,K,Z,W])}const LA=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:s}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?Zw({element:n.current,padding:s}).fn(r):{}:n?Zw({element:n,padding:s}).fn(r):{}}}},FA=(e,t)=>({...$A(e),options:[e,t]}),UA=(e,t)=>({...PA(e),options:[e,t]}),qA=(e,t)=>({...AA(e),options:[e,t]}),VA=(e,t)=>({...TA(e),options:[e,t]}),HA=(e,t)=>({...RA(e),options:[e,t]}),KA=(e,t)=>({...IA(e),options:[e,t]}),BA=(e,t)=>({...LA(e),options:[e,t]});var WA="Arrow",d1=y.forwardRef((e,t)=>{const{children:r,width:n=10,height:s=5,...o}=e;return a.jsx(_e.svg,{...o,ref:t,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});d1.displayName=WA;var ZA=d1;function f1(e){const[t,r]=y.useState(void 0);return Ft(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let i,l;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,l=u.blockSize}else i=e.offsetWidth,l=e.offsetHeight;r({width:i,height:l})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var vv="Popper",[h1,$a]=In(vv),[GA,p1]=h1(vv),m1=e=>{const{__scopePopper:t,children:r}=e,[n,s]=y.useState(null);return a.jsx(GA,{scope:t,anchor:n,onAnchorChange:s,children:r})};m1.displayName=vv;var g1="PopperAnchor",v1=y.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...s}=e,o=p1(g1,r),i=y.useRef(null),l=Ve(t,i),c=y.useRef(null);return y.useEffect(()=>{const u=c.current;c.current=(n==null?void 0:n.current)||i.current,u!==c.current&&o.onAnchorChange(c.current)}),n?null:a.jsx(_e.div,{...s,ref:l})});v1.displayName=g1;var yv="PopperContent",[QA,JA]=h1(yv),y1=y.forwardRef((e,t)=>{var H,G,me,ne,ue,ye;const{__scopePopper:r,side:n="bottom",sideOffset:s=0,align:o="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:g=!1,updatePositionStrategy:v="optimized",onPlaced:b,...h}=e,w=p1(yv,r),[p,m]=y.useState(null),x=Ve(t,Be=>m(Be)),[_,C]=y.useState(null),$=f1(_),k=($==null?void 0:$.width)??0,I=($==null?void 0:$.height)??0,E=n+(o!=="center"?"-"+o:""),U=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},P=Array.isArray(u)?u:[u],O=P.length>0,L={padding:U,boundary:P.filter(XA),altBoundary:O},{refs:z,floatingStyles:K,placement:Z,isPositioned:W,middlewareData:F}=zA({strategy:"fixed",placement:E,whileElementsMounted:(...Be)=>jA(...Be,{animationFrame:v==="always"}),elements:{reference:w.anchor},middleware:[FA({mainAxis:s+I,alignmentAxis:i}),c&&UA({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?qA():void 0,...L}),c&&VA({...L}),HA({...L,apply:({elements:Be,rects:pt,availableWidth:Y,availableHeight:de})=>{const{width:ee,height:$e}=pt.reference,oe=Be.floating.style;oe.setProperty("--radix-popper-available-width",`${Y}px`),oe.setProperty("--radix-popper-available-height",`${de}px`),oe.setProperty("--radix-popper-anchor-width",`${ee}px`),oe.setProperty("--radix-popper-anchor-height",`${$e}px`)}}),_&&BA({element:_,padding:l}),eO({arrowWidth:k,arrowHeight:I}),g&&KA({strategy:"referenceHidden",...L})]}),[V,D]=b1(Z),T=qr(b);Ft(()=>{W&&(T==null||T())},[W,T]);const q=(H=F.arrow)==null?void 0:H.x,j=(G=F.arrow)==null?void 0:G.y,S=((me=F.arrow)==null?void 0:me.centerOffset)!==0,[N,M]=y.useState();return Ft(()=>{p&&M(window.getComputedStyle(p).zIndex)},[p]),a.jsx("div",{ref:z.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:W?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:N,"--radix-popper-transform-origin":[(ne=F.transformOrigin)==null?void 0:ne.x,(ue=F.transformOrigin)==null?void 0:ue.y].join(" "),...((ye=F.hide)==null?void 0:ye.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(QA,{scope:r,placedSide:V,onArrowChange:C,arrowX:q,arrowY:j,shouldHideArrow:S,children:a.jsx(_e.div,{"data-side":V,"data-align":D,...h,ref:x,style:{...h.style,animation:W?void 0:"none"}})})})});y1.displayName=yv;var w1="PopperArrow",YA={top:"bottom",right:"left",bottom:"top",left:"right"},x1=y.forwardRef(function(t,r){const{__scopePopper:n,...s}=t,o=JA(w1,n),i=YA[o.placedSide];return a.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:a.jsx(ZA,{...s,ref:r,style:{...s.style,display:"block"}})})});x1.displayName=w1;function XA(e){return e!==null}var eO=e=>({name:"transformOrigin",options:e,fn(t){var w,p,m;const{placement:r,rects:n,middlewareData:s}=t,i=((w=s.arrow)==null?void 0:w.centerOffset)!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,d]=b1(r),f={start:"0%",center:"50%",end:"100%"}[d],g=(((p=s.arrow)==null?void 0:p.x)??0)+l/2,v=(((m=s.arrow)==null?void 0:m.y)??0)+c/2;let b="",h="";return u==="bottom"?(b=i?f:`${g}px`,h=`${-c}px`):u==="top"?(b=i?f:`${g}px`,h=`${n.floating.height+c}px`):u==="right"?(b=`${-c}px`,h=i?f:`${v}px`):u==="left"&&(b=`${n.floating.width+c}px`,h=i?f:`${v}px`),{data:{x:b,y:h}}}});function b1(e){const[t,r="center"]=e.split("-");return[t,r]}var _1=m1,wf=v1,wv=y1,xv=x1,[xf,EH]=In("Tooltip",[$a]),bv=$a(),S1="TooltipProvider",tO=700,Qw="tooltip.open",[rO,k1]=xf(S1),C1=e=>{const{__scopeTooltip:t,delayDuration:r=tO,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:o}=e,i=y.useRef(!0),l=y.useRef(!1),c=y.useRef(0);return y.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),a.jsx(rO,{scope:t,isOpenDelayedRef:i,delayDuration:r,onOpen:y.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,n)},[n]),isPointerInTransitRef:l,onPointerInTransitChange:y.useCallback(u=>{l.current=u},[]),disableHoverableContent:s,children:o})};C1.displayName=S1;var E1="Tooltip",[NH,bf]=xf(E1),hm="TooltipTrigger",nO=y.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=bf(hm,r),o=k1(hm,r),i=bv(r),l=y.useRef(null),c=Ve(t,l,s.onTriggerChange),u=y.useRef(!1),d=y.useRef(!1),f=y.useCallback(()=>u.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx(wf,{asChild:!0,...i,children:a.jsx(_e.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:pe(e.onPointerMove,g=>{g.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:pe(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:pe(e.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:pe(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:pe(e.onBlur,s.onClose),onClick:pe(e.onClick,s.onClose)})})});nO.displayName=hm;var sO="TooltipPortal",[jH,oO]=xf(sO,{forceMount:void 0}),pa="TooltipContent",N1=y.forwardRef((e,t)=>{const r=oO(pa,e.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...o}=e,i=bf(pa,e.__scopeTooltip);return a.jsx(An,{present:n||i.open,children:i.disableHoverableContent?a.jsx(j1,{side:s,...o,ref:t}):a.jsx(iO,{side:s,...o,ref:t})})}),iO=y.forwardRef((e,t)=>{const r=bf(pa,e.__scopeTooltip),n=k1(pa,e.__scopeTooltip),s=y.useRef(null),o=Ve(t,s),[i,l]=y.useState(null),{trigger:c,onClose:u}=r,d=s.current,{onPointerInTransitChange:f}=n,g=y.useCallback(()=>{l(null),f(!1)},[f]),v=y.useCallback((b,h)=>{const w=b.currentTarget,p={x:b.clientX,y:b.clientY},m=dO(p,w.getBoundingClientRect()),x=fO(p,m),_=hO(h.getBoundingClientRect()),C=mO([...x,..._]);l(C),f(!0)},[f]);return y.useEffect(()=>()=>g(),[g]),y.useEffect(()=>{if(c&&d){const b=w=>v(w,d),h=w=>v(w,c);return c.addEventListener("pointerleave",b),d.addEventListener("pointerleave",h),()=>{c.removeEventListener("pointerleave",b),d.removeEventListener("pointerleave",h)}}},[c,d,v,g]),y.useEffect(()=>{if(i){const b=h=>{const w=h.target,p={x:h.clientX,y:h.clientY},m=(c==null?void 0:c.contains(w))||(d==null?void 0:d.contains(w)),x=!pO(p,i);m?g():x&&(g(),u())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,d,i,u,g]),a.jsx(j1,{...e,ref:o})}),[aO,lO]=xf(E1,{isInside:!1}),cO=Q2("TooltipContent"),j1=y.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:i,...l}=e,c=bf(pa,r),u=bv(r),{onClose:d}=c;return y.useEffect(()=>(document.addEventListener(Qw,d),()=>document.removeEventListener(Qw,d)),[d]),y.useEffect(()=>{if(c.trigger){const f=g=>{const v=g.target;v!=null&&v.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),a.jsx(Ca,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:a.jsxs(wv,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(cO,{children:n}),a.jsx(aO,{scope:r,isInside:!0,children:a.jsx(yR,{id:c.contentId,role:"tooltip",children:s||n})})]})})});N1.displayName=pa;var $1="TooltipArrow",uO=y.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=bv(r);return lO($1,r).isInside?null:a.jsx(xv,{...s,...n,ref:t})});uO.displayName=$1;function dO(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(r,n,s,o)){case o:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function fO(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function hO(e){const{top:t,right:r,bottom:n,left:s}=e;return[{x:s,y:t},{x:r,y:t},{x:r,y:n},{x:s,y:n}]}function pO(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const l=t[o],c=t[i],u=l.x,d=l.y,f=c.x,g=c.y;d>n!=g>n&&r<(f-u)*(n-d)/(g-d)+u&&(s=!s)}return s}function mO(e){const t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),gO(t)}function gO(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const s=e[n];for(;t.length>=2;){const o=t[t.length-1],i=t[t.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))t.pop();else break}t.push(s)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const s=e[n];for(;r.length>=2;){const o=r[r.length-1],i=r[r.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))r.pop();else break}r.push(s)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var vO=C1,P1=N1;const yO=vO,wO=y.forwardRef(({className:e,sideOffset:t=4,...r},n)=>a.jsx(P1,{ref:n,sideOffset:t,className:xe("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...r}));wO.displayName=P1.displayName;const xO={total:0,byKind:{oauth_required:0,oauth_expired:0,service_unhealthy:0,credential_missing_secret:0,playbook_missing_deps:0},serviceWarnings:new Map,credentialWarnings:new Map,playbookWarnings:new Map};function bO(e){return e?{total:e.total,byKind:e.byKind,serviceWarnings:new Map(Object.entries(e.services)),credentialWarnings:new Map(Object.entries(e.credentials)),playbookWarnings:new Map(Object.entries(e.playbooks))}:xO}const er="#92E4DD",ur="#F9386D",Jr="#FFFFFF",_n="bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900";function gn(e){return er}function Sn(e){return{borderColor:e,color:e,boxShadow:`0 0 20px ${e}20`}}const _O=hf("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),ie=y.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...s},o)=>{const i=n?Z2:"button";return a.jsx(i,{className:xe(_O({variant:t,size:r,className:e})),ref:o,...s})});ie.displayName="Button";function Ui({warnings:e}){if(!(e!=null&&e.length))return null;const t=e.find(n=>n.severity==="error")??e[0],r=t.severity==="error";return a.jsxs("div",{className:`absolute left-1/2 -translate-x-1/2 top-8 z-20 flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[7px] font-semibold uppercase tracking-wide shadow-lg ${r?"bg-red-500/90 text-white border border-red-300/60":"bg-amber-500/90 text-black border border-amber-200/60"}`,title:e.map(n=>n.message).join(" · "),"data-testid":"card-warning-badge",children:[a.jsx(rn,{className:"h-2.5 w-2.5 shrink-0"}),a.jsx("span",{className:"max-w-[72px] truncate",children:t.message})]})}const Jw="data:image/svg+xml,%3csvg%20id='eSEM9z84vJh1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20300%20300'%20shape-rendering='geometricPrecision'%20text-rendering='geometricPrecision'%20project-id='c9405aa1bbb44eb388e44d7178ee1932'%20export-id='327eb6bfd5a543cb88b86ffe07ce0c92'%20cached='false'%3e%3crect%20width='63.894524'%20height='34.989858'%20rx='0'%20ry='0'%20transform='translate(71.928217%20125.25355)'%20stroke-width='0'/%3e%3crect%20width='63.894524'%20height='34.989858'%20rx='0'%20ry='0'%20transform='matrix(2.570356%200%200%202.449277%2067.884163%2017.275854)'%20stroke-width='0'/%3e%3crect%20width='63.894524'%20height='34.989858'%20rx='0'%20ry='0'%20transform='translate(163.184592%20125.25355)'%20stroke-width='0'/%3e%3crect%20width='63.894524'%20height='34.989858'%20rx='0'%20ry='0'%20transform='matrix(3.42849%200%200%200.403818%2040.469132%20102.975708)'%20stroke-width='0'/%3e%3cpolygon%20points='0,-42.01893%2030.924539,20.531677%2024.698107,33.994028%20-24.698107,33.994028%20-33.20748,20.12246%200,-42.01893'%20transform='matrix(-.687913%200.002106-.00101-.33%20149.995947%20212.592699)'%20stroke-width='0'/%3e%3cpolygon%20points='0,-42.01893%2036.327051,-24.945112%2016.852287,34.058016%20-19.029679,34.002758%20-36.534138,-25.057317%200,-42.01893'%20transform='matrix(-.466366%200.001428-.002837-.926983%20149.84238%20249.643929)'%20stroke-width='0'/%3e%3c/svg%3e";function SO(e){return e.iconUrl?e.iconUrl:null}function T1({service:e}){const t=gn(),r=SO(e),[n,s]=y.useState(!1);return r&&!n?a.jsx("img",{src:r,alt:"",className:"w-7 h-7 object-contain rounded-sm",draggable:!1,onError:()=>s(!0)}):a.jsx("div",{style:{width:28,height:28,backgroundColor:t,WebkitMask:`url(${Jw}) no-repeat center / contain`,mask:`url(${Jw}) no-repeat center / contain`},"aria-hidden":!0})}function _v(e){return e?"ring-2 ring-inset ring-yellow-400/90 shadow-[0_0_10px_rgba(250,204,21,0.2)]":""}function Sv(){return a.jsx("span",{className:"absolute top-1.5 left-1/2 z-20 -translate-x-1/2 rounded bg-yellow-500 px-1 py-px text-[7px] font-bold uppercase tracking-wide text-black shadow",children:"In deck"})}function kO({service:e,onDragStart:t,onDragEnd:r,isInActiveDeck:n,onCardClick:s,isInCollection:o=!1,onMouseEnter:i,onMouseLeave:l,activeDeck:c,warnings:u}){const d=Qt(),{toast:f}=Ut(),g=gn(),v=yt({mutationFn:async()=>{if(!c)throw new Error("No active deck found");return ke("POST",`/api/decks/${c.id}/services`,{serviceId:e.id,position:0})},onSuccess:()=>{d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"Service added to deck",description:`${e.name} has been added to your active deck.`})},onError:p=>{f({title:"Failed to add service",description:p.message,variant:"destructive"})}}),b=yt({mutationFn:async()=>ke("DELETE",`/api/services/${e.id}`,{}),onSuccess:()=>{d.invalidateQueries({queryKey:["/api/services"]}),d.invalidateQueries({queryKey:["/api/collection/warnings"]}),d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"Service deleted",description:`${e.name} has been deleted successfully.`})},onError:p=>{f({title:"Failed to delete service",description:p.message,variant:"destructive"})}}),h=p=>{p.stopPropagation(),v.mutate()},w=p=>{p.stopPropagation(),window.confirm(`Are you sure you want to delete ${e.name}? This action cannot be undone.`)&&b.mutate()};return a.jsx("div",{className:"relative group cursor-pointer",draggable:!n,onDragStart:p=>t(p,e),onDragEnd:r,onClick:()=>s==null?void 0:s(e),"data-testid":`card-${e.id}`,onMouseEnter:i,onMouseLeave:l,children:a.jsxs("div",{className:`
|
|
249
|
+
w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
|
|
250
|
+
transform transition-all duration-300 shadow-lg hover:shadow-2xl
|
|
251
|
+
bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
|
|
252
|
+
relative overflow-hidden
|
|
253
|
+
${_v(n)}
|
|
254
|
+
${o?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
|
|
255
|
+
`,style:{borderColor:g,boxShadow:`0 0 20px ${g}20`},children:[a.jsx(Ui,{warnings:u}),n&&a.jsx(Sv,{}),a.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:a.jsx("div",{className:"leading-none",style:{color:g},children:e.type==="mcp"?"RM":e.type==="local-mcp"?"LM":"A"})}),a.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:a.jsx("div",{className:"leading-none",style:{color:g},children:e.type==="mcp"?"RM":e.type==="local-mcp"?"LM":"A"})}),a.jsx("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-10",children:a.jsx(ie,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:w,title:`Delete ${e.name}`,children:a.jsx(pf,{className:"w-3 h-3"})})}),a.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[a.jsx("div",{className:"mb-2",style:{color:g},children:a.jsx(T1,{service:e})}),a.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2","data-testid":`text-service-name-${e.id}`,style:{color:g},children:e.name}),a.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:g,borderColor:g},children:e.type==="mcp"?"Remote MCP":e.type==="local-mcp"?"Local MCP":"A2A"})]}),a.jsx("div",{className:"absolute bottom-6 inset-x-1",children:a.jsx(ie,{size:"sm",className:"w-full text-[8px] px-1 py-1 h-5 bg-black/20 hover:bg-black/40 border",style:{color:g,borderColor:g},onClick:h,disabled:n||v.isPending,"data-testid":`button-add-to-deck-${e.id}`,children:n?"IN DECK":"ADD"})}),a.jsx("div",{className:"absolute inset-0 rounded-lg bg-gradient-to-br from-transparent via-white/5 to-transparent opacity-0 group-hover:opacity-100 transition-all duration-500 pointer-events-none"})]})})}const CO=y.memo(kO);function EO(e){return e.iconUrl?e.iconUrl:null}function R1({credential:e,color:t}){const r=EO(e);return r?a.jsx("img",{src:r,alt:"",className:"h-7 w-7 object-contain rounded-sm",draggable:!1}):a.jsx(am,{className:"h-7 w-7",strokeWidth:2.25,style:{color:t}})}function NO({credential:e,isInActiveDeck:t,activeDeck:r,isInCollection:n=!0,onDragStart:s,onDragEnd:o,onMouseEnter:i,onMouseLeave:l,onCardClick:c,warnings:u}){const d=Qt(),{toast:f}=Ut(),g=ur,v=yt({mutationFn:async()=>{if(!r)throw new Error("No active deck found");return ke("POST",`/api/decks/${r.id}/credentials`,{credentialId:e.id})},onSuccess:()=>{d.invalidateQueries({queryKey:["/api/decks"]}),d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"Added to deck",description:`${e.label} is in your active deck.`})},onError:h=>{f({title:"Failed to add to deck",description:h.message,variant:"destructive"})}}),b=yt({mutationFn:async()=>ke("DELETE",`/api/credentials/${e.id}`),onSuccess:()=>{d.invalidateQueries({queryKey:["/api/credentials/vault"]}),d.invalidateQueries({queryKey:["/api/decks"]}),d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"API key removed",description:`${e.label} was deleted from your vault.`})},onError:h=>{f({title:"Failed to remove API key",description:h.message,variant:"destructive"})}});return a.jsx("div",{className:"relative group cursor-pointer",draggable:!t&&!!s,onDragStart:s?h=>s(h,e):void 0,onDragEnd:o,onClick:()=>c==null?void 0:c(e),"data-testid":`card-${e.id}`,onMouseEnter:i,onMouseLeave:l,children:a.jsxs("div",{className:`
|
|
256
|
+
w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
|
|
257
|
+
transform transition-all duration-300 shadow-lg hover:shadow-2xl
|
|
258
|
+
bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
|
|
259
|
+
relative overflow-hidden
|
|
260
|
+
${_v(t)}
|
|
261
|
+
${n?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
|
|
262
|
+
`,style:{borderColor:g,boxShadow:`0 0 20px ${g}20`},children:[a.jsx(Ui,{warnings:u}),t&&a.jsx(Sv,{}),a.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:a.jsx("div",{className:"leading-none",style:{color:g},children:"AK"})}),a.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:a.jsx("div",{className:"leading-none",style:{color:g},children:"AK"})}),a.jsx("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-10",children:a.jsx(ie,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:h=>{h.stopPropagation(),window.confirm(`Remove ${e.label} from your vault?`)&&b.mutate()},title:`Remove ${e.label}`,children:a.jsx(pf,{className:"w-3 h-3"})})}),a.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[a.jsx("div",{className:"mb-2",style:{color:g},children:a.jsx(R1,{credential:e,color:g})}),a.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2","data-testid":`text-credential-name-${e.id}`,style:{color:g},children:e.label}),a.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:g,borderColor:g},children:e.hasSecret?"API Key":"Missing key"})]}),a.jsx("div",{className:"absolute bottom-6 inset-x-1",children:a.jsx(ie,{size:"sm",className:"w-full text-[8px] px-1 py-1 h-5 bg-black/20 hover:bg-black/40 border",style:{color:g,borderColor:g},onClick:h=>{h.stopPropagation(),v.mutate()},disabled:t||v.isPending||!r,"data-testid":`button-add-to-deck-${e.id}`,children:t?"IN DECK":"ADD"})}),a.jsx("div",{className:"absolute inset-0 rounded-lg bg-gradient-to-br from-transparent via-white/5 to-transparent opacity-0 group-hover:opacity-100 transition-all duration-500 pointer-events-none"})]})})}const jO=y.memo(NO);function $O({playbook:e,isInActiveDeck:t,activeDeck:r,isInCollection:n=!0,onDragStart:s,onDragEnd:o,onMouseEnter:i,onMouseLeave:l,onCardClick:c,warnings:u}){const d=Qt(),{toast:f}=Ut(),g=Jr,v=e.dependsOnCredentialIds.length+e.dependsOnServiceIds.length,b=yt({mutationFn:async()=>{if(!r)throw new Error("No deck selected");return ke("POST",`/api/decks/${r.id}/playbooks`,{playbookId:e.id})},onSuccess:()=>{d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"Playbook added to deck",description:`${e.title} is on this deck.`})},onError:w=>{f({title:"Failed to add playbook",description:w.message,variant:"destructive"})}}),h=yt({mutationFn:async()=>ke("DELETE",`/api/playbooks/${e.id}`),onSuccess:()=>{d.invalidateQueries({queryKey:["/api/playbooks/vault"]}),d.invalidateQueries({queryKey:["/api/decks"]}),f({title:"Playbook deleted",description:`${e.title} was removed from your collection.`})},onError:w=>{f({title:"Failed to delete playbook",description:w.message,variant:"destructive"})}});return a.jsx("div",{className:"relative group cursor-pointer",draggable:!t&&!!s,onDragStart:s?w=>s(w,e):void 0,onDragEnd:o,onClick:()=>c==null?void 0:c(e),"data-testid":`card-${e.id}`,onMouseEnter:i,onMouseLeave:l,children:a.jsxs("div",{className:`
|
|
263
|
+
w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
|
|
264
|
+
transform transition-all duration-300 shadow-lg hover:shadow-2xl
|
|
265
|
+
bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
|
|
266
|
+
relative overflow-hidden
|
|
267
|
+
${_v(t)}
|
|
268
|
+
${n?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
|
|
269
|
+
`,style:{borderColor:g,boxShadow:`0 0 20px ${g}20`},children:[a.jsx(Ui,{warnings:u}),t&&a.jsx(Sv,{}),a.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:a.jsx("div",{className:"leading-none",style:{color:g},children:"PB"})}),a.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:a.jsx("div",{className:"leading-none",style:{color:g},children:"PB"})}),a.jsx("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-10",children:a.jsx(ie,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:w=>{w.stopPropagation(),window.confirm(`Delete playbook "${e.title}"?`)&&h.mutate()},title:`Delete ${e.title}`,children:a.jsx(pf,{className:"w-3 h-3"})})}),a.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[a.jsx("div",{className:"mb-2",style:{color:g},children:a.jsx(av,{className:"h-7 w-7",strokeWidth:2.25})}),a.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:g},children:e.title}),a.jsxs("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:g,borderColor:g},children:["Playbook",v>0?` · ${v} deps`:""]})]}),a.jsx("div",{className:"absolute bottom-6 inset-x-1",children:a.jsx(ie,{size:"sm",className:"w-full text-[8px] px-1 py-1 h-5 bg-black/20 hover:bg-black/40 border",style:{color:g,borderColor:g},onClick:w=>{w.stopPropagation(),b.mutate()},disabled:t||b.isPending||!r,children:t?"IN DECK":"ADD"})}),a.jsx("div",{className:"absolute inset-0 rounded-lg bg-gradient-to-br from-transparent via-white/5 to-transparent opacity-0 group-hover:opacity-100 transition-all duration-500 pointer-events-none"})]})})}const PO=y.memo($O),Sd=128,TO=192,ma=48,RO=10,kd=12,eu=64,tu=4,Yw=14,I1=12,A1=1.08;function IO(e=I1,t=A1){const r=e*Math.PI/180,n=Sd*Math.sin(r)+TO*Math.cos(r);return Math.ceil(n*t)+8}const Xw=IO();function O1(e,t=ma){return e===0?0:Sd+Math.max(0,e-1)*(Sd-t)}function AO(e=RO,t=ma,r=kd){return O1(e,t)+2*r}function OO(e,t=ma){return O1(e,t)+2*kd}const MO=AO();function DO(e,t,r,n=I1){const s=t+r/2,o=r/2;if(o<=0)return 0;const i=(e-s)/o;return Math.max(-n,Math.min(n,i*n))}function zO(e){return{flexShrink:0,marginLeft:e===0?0:`-${ma}px`}}function LO(e,t,r){return r===e?999999:t-e}function FO({cardCount:e,children:t}){const r=y.useRef(null),n=y.useRef([]),s=y.useRef(0),o=y.useRef(void 0),[i,l]=y.useState(!1),[c,u]=y.useState(!1),[d,f]=y.useState(!1),[g,v]=y.useState(!1),[b,h]=y.useState(!1),w=y.useRef(!1),p=y.useRef(!1),[m,x]=y.useState(null),_=y.useRef(null);_.current=m;const C=y.useCallback(()=>{const P=r.current;if(!P)return;const O=P.getBoundingClientRect(),L=_.current;n.current.forEach((z,K)=>{if(!z)return;const Z=z.getBoundingClientRect(),W=Z.left+Z.width/2,F=L===K?0:DO(W,O.left,O.width),V=L===K?A1:1;z.style.transform=`rotate(${F}deg) scale(${V})`,z.style.transformOrigin="center center",z.style.zIndex=String(LO(K,e,L))})},[e]),$=y.useCallback(P=>{const O=r.current;if(!O)return;const L=Sd-ma;O.scrollBy({left:P==="left"?-L:L,behavior:"smooth"})},[]),k=y.useCallback(()=>{const P=r.current;if(!P)return;const L=OO(e,ma)>P.clientWidth+2;l(L),u(L&&P.scrollLeft>4),f(L&&P.scrollLeft+P.clientWidth<P.scrollWidth-4),C()},[e,C]);y.useLayoutEffect(()=>{const P=r.current;if(!P)return;k();const O=new ResizeObserver(k);return O.observe(P),P.addEventListener("scroll",k,{passive:!0}),()=>{O.disconnect(),P.removeEventListener("scroll",k)}},[e,k]),y.useEffect(()=>{const P=()=>{const O=r.current,L=s.current;if(O&&L!==0){O.scrollLeft+=L,C();const Z=O.scrollLeft>4,W=O.scrollLeft+O.clientWidth<O.scrollWidth-4;u(Z),f(W)}const z=L<0,K=L>0;z!==w.current&&(w.current=z,v(z)),K!==p.current&&(p.current=K,h(K)),o.current=requestAnimationFrame(P)};return o.current=requestAnimationFrame(P),()=>{o.current!==void 0&&cancelAnimationFrame(o.current)}},[C]);const I=P=>{const O=r.current;if(!O||!i){s.current=0;return}const L=O.getBoundingClientRect(),z=P.clientX-L.left;if(z<eu&&c){const K=1-z/eu;s.current=-(tu+K*(Yw-tu))}else if(z>L.width-eu&&d){const K=1-(L.width-z)/eu;s.current=tu+K*(Yw-tu)}else s.current=0;C()},E=()=>{s.current=0,w.current=!1,p.current=!1,v(!1),h(!1)};if(y.useLayoutEffect(()=>{n.current.length=e,C()},[e,m,C]),e===0)return a.jsx(a.Fragment,{children:t});const U=(P,O)=>`absolute ${P==="left"?"left-2":"right-2"} top-1/2 z-30 -translate-y-1/2 rounded-full bg-gray-950/90 p-1.5 text-yellow-300 shadow-lg ring-1 ring-black/50 transition-all duration-150 hover:bg-gray-950 hover:ring-yellow-300/40 ${O?"scale-110":"scale-100"}`;return a.jsxs("div",{className:"relative flex h-full w-full min-w-0 max-w-full items-center justify-center overflow-hidden","data-testid":"deck-fan",onMouseMove:I,onMouseLeave:E,children:[i&&c&&a.jsx("button",{type:"button",className:U("left",g),"aria-label":"Scroll deck left","data-testid":"deck-scroll-left",onClick:()=>$("left"),children:a.jsx(qR,{className:"h-6 w-6",strokeWidth:2.5})}),i&&d&&a.jsx("button",{type:"button",className:U("right",b),"aria-label":"Scroll deck right","data-testid":"deck-scroll-right",onClick:()=>$("right"),children:a.jsx(VR,{className:"h-6 w-6",strokeWidth:2.5})}),a.jsx("div",{ref:r,className:"max-w-full overflow-x-auto overflow-y-visible [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",style:{width:MO,maxWidth:"100%"},children:a.jsx("div",{className:"flex items-center justify-start isolate group/fan",style:{minHeight:Xw,paddingLeft:kd,paddingRight:kd},children:y.Children.map(t,(P,O)=>a.jsx("div",{ref:L=>{n.current[O]=L},className:"relative flex items-center justify-center transition-[transform,box-shadow] duration-500 will-change-transform",style:{...zO(O),minHeight:Xw},onMouseEnter:()=>x(O),onMouseLeave:()=>x(null),children:P},P&&typeof P=="object"&&"key"in P?P.key:O))})})]})}const He=y.forwardRef(({className:e,type:t,...r},n)=>a.jsx("input",{type:t,className:xe("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...r}));He.displayName="Input";function UO({deck:e,services:t,credentials:r=[],playbooks:n=[],collectionWarnings:s,onDrop:o,onDragStart:i,onCredentialDragStart:l,onPlaybookDragStart:c,onDragEnd:u,onCardClick:d,onPlaybookClick:f,onCredentialClick:g}){const[v,b]=y.useState(!1),[h,w]=y.useState(e.name),p=y.useRef(null),m=Qt(),{toast:x}=Ut();y.useEffect(()=>{w(e.name),b(!1)},[e.id,e.name]),y.useEffect(()=>{var E,U;v&&((E=p.current)==null||E.focus(),(U=p.current)==null||U.select())},[v]);const _=yt({mutationFn:async E=>(await ke("PUT",`/api/decks/${e.id}`,{name:E})).json(),onSuccess:E=>{if(!E.success)throw new Error(E.error||"Rename failed");m.invalidateQueries({queryKey:["/api/decks"]}),b(!1)},onError:E=>{w(e.name),b(!1),x({title:"Could not rename deck",description:E.message,variant:"destructive"})}}),C=()=>{const E=h.trim();if(!E||E===e.name){w(e.name),b(!1);return}_.mutate(E)},$=E=>{E.preventDefault(),o(E)},k=E=>{E.preventDefault()},I=t.length+r.length+n.length;return a.jsxs("div",{className:"flex h-full min-w-0 flex-col overflow-hidden",children:[a.jsxs("h3",{className:"mb-4 flex min-w-0 shrink-0 items-center text-lg font-bold",children:[a.jsx("i",{className:"fas fa-layer-group mr-2 text-blue-400"}),"Deck",v?a.jsx(He,{ref:p,value:h,disabled:_.isPending,onChange:E=>w(E.target.value),onBlur:C,onKeyDown:E=>{E.key==="Enter"?(E.preventDefault(),C()):E.key==="Escape"&&(E.preventDefault(),w(e.name),b(!1))},className:"ml-2 h-7 max-w-[12rem] border-white/20 bg-white/10 px-2 text-sm font-normal text-white sm:max-w-[16rem]","data-testid":"input-deck-name","aria-label":"Deck name"}):a.jsx("button",{type:"button",className:"ml-2 min-w-0 truncate text-left text-sm font-normal text-gray-400 hover:text-white hover:underline",title:"Click to rename",onClick:()=>b(!0),"data-testid":"button-rename-deck",children:e.name}),a.jsxs("span",{className:"ml-2 shrink-0 text-sm font-normal text-gray-400",children:["(",I," cards)"]})]}),a.jsx("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden rounded-xl border-2 border-dashed px-4 py-2 min-w-0",onDrop:$,onDragOver:k,style:{background:"linear-gradient(135deg, rgba(196, 182, 67, 0.1), rgba(212, 199, 96, 0.1))",borderColor:"rgba(196, 182, 67, 0.3)"},"data-testid":"deck-drop-zone",children:a.jsx("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden min-w-0",children:I===0?a.jsx("div",{className:"text-center",children:a.jsx("div",{className:"w-32 h-48 border-2 border-dashed border-gray-500 rounded-lg flex items-center justify-center opacity-50 hover:opacity-75 transition-all mb-4",children:a.jsx(Ls,{className:"w-8 h-8 text-gray-500"})})}):a.jsxs(FO,{cardCount:I,children:[r.map((E,U)=>a.jsxs("div",{className:"w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3 transition-shadow duration-500 shadow-lg hover:shadow-2xl bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900 relative overflow-hidden cursor-pointer",style:{borderColor:ur,boxShadow:`0 0 20px ${ur}20`},draggable:!0,onDragStart:P=>l(P,E,!0),onDragEnd:u,onClick:()=>g==null?void 0:g(E),"data-testid":`deck-card-${E.id}`,children:[a.jsx(Ui,{warnings:s==null?void 0:s.credentialWarnings.get(E.id)}),a.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:a.jsx("div",{className:"leading-none",style:{color:ur},children:"AK"})}),a.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:a.jsx("div",{className:"leading-none",style:{color:ur},children:"AK"})}),a.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[a.jsx("div",{className:"mb-2",style:{color:ur},children:a.jsx(R1,{credential:E,color:ur})}),a.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:ur},children:E.label}),a.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:ur,borderColor:ur},children:E.hasSecret?"API Key":"Missing key"})]})]},E.id)),n.map((E,U)=>a.jsxs("div",{className:"w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3 transition-shadow duration-500 shadow-lg hover:shadow-2xl bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900 relative overflow-hidden cursor-pointer",style:{borderColor:Jr,boxShadow:`0 0 20px ${Jr}20`},draggable:!0,onDragStart:P=>c(P,E,!0),onDragEnd:u,onClick:()=>f==null?void 0:f(E),"data-testid":`deck-card-${E.id}`,children:[a.jsx(Ui,{warnings:s==null?void 0:s.playbookWarnings.get(E.id)}),a.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:a.jsx("div",{className:"leading-none",style:{color:Jr},children:"PB"})}),a.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:a.jsx("div",{className:"leading-none",style:{color:Jr},children:"PB"})}),a.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[a.jsx("div",{className:"mb-2",style:{color:Jr},children:a.jsx(av,{className:"h-7 w-7",strokeWidth:2.25})}),a.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:Jr},children:E.title}),a.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:Jr,borderColor:Jr},children:"Playbook"})]})]},E.id)),t.map(E=>a.jsxs("div",{className:"w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3 transition-shadow duration-500 shadow-lg hover:shadow-2xl bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900 relative overflow-hidden cursor-pointer",style:{borderColor:gn(),boxShadow:`0 0 20px ${gn()}20`},draggable:!0,onDragStart:U=>i(U,E,!0),onDragEnd:u,onClick:()=>d==null?void 0:d(E),"data-testid":`deck-card-${E.id}`,children:[a.jsx(Ui,{warnings:s==null?void 0:s.serviceWarnings.get(E.id)}),a.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:a.jsx("div",{className:"leading-none",style:{color:gn()},children:E.type==="mcp"?"RM":E.type==="local-mcp"?"LM":"A"})}),a.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:a.jsx("div",{className:"leading-none",style:{color:gn()},children:E.type==="mcp"?"RM":E.type==="local-mcp"?"LM":"A"})}),a.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[a.jsx("div",{className:"mb-2",style:{color:gn()},children:a.jsx(T1,{service:E})}),a.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:gn()},children:E.name}),a.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:gn(),borderColor:gn()},children:E.type==="mcp"?"Remote MCP":E.type==="local-mcp"?"Local MCP":"A2A"})]})]},E.id))]})})})]})}var Eh=0;function kv(){y.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ex()),document.body.insertAdjacentElement("beforeend",e[1]??ex()),Eh++,()=>{Eh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Eh--}},[])}function ex(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Nh="focusScope.autoFocusOnMount",jh="focusScope.autoFocusOnUnmount",tx={bubbles:!1,cancelable:!0},qO="FocusScope",_f=y.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...i}=e,[l,c]=y.useState(null),u=qr(s),d=qr(o),f=y.useRef(null),g=Ve(t,h=>c(h)),v=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(n){let h=function(x){if(v.paused||!l)return;const _=x.target;l.contains(_)?f.current=_:ws(f.current,{select:!0})},w=function(x){if(v.paused||!l)return;const _=x.relatedTarget;_!==null&&(l.contains(_)||ws(f.current,{select:!0}))},p=function(x){if(document.activeElement===document.body)for(const C of x)C.removedNodes.length>0&&ws(l)};document.addEventListener("focusin",h),document.addEventListener("focusout",w);const m=new MutationObserver(p);return l&&m.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",w),m.disconnect()}}},[n,l,v.paused]),y.useEffect(()=>{if(l){nx.add(v);const h=document.activeElement;if(!l.contains(h)){const p=new CustomEvent(Nh,tx);l.addEventListener(Nh,u),l.dispatchEvent(p),p.defaultPrevented||(VO(ZO(M1(l)),{select:!0}),document.activeElement===h&&ws(l))}return()=>{l.removeEventListener(Nh,u),setTimeout(()=>{const p=new CustomEvent(jh,tx);l.addEventListener(jh,d),l.dispatchEvent(p),p.defaultPrevented||ws(h??document.body,{select:!0}),l.removeEventListener(jh,d),nx.remove(v)},0)}}},[l,u,d,v]);const b=y.useCallback(h=>{if(!r&&!n||v.paused)return;const w=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,p=document.activeElement;if(w&&p){const m=h.currentTarget,[x,_]=HO(m);x&&_?!h.shiftKey&&p===_?(h.preventDefault(),r&&ws(x,{select:!0})):h.shiftKey&&p===x&&(h.preventDefault(),r&&ws(_,{select:!0})):p===m&&h.preventDefault()}},[r,n,v.paused]);return a.jsx(_e.div,{tabIndex:-1,...i,ref:g,onKeyDown:b})});_f.displayName=qO;function VO(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(ws(n,{select:t}),document.activeElement!==r)return}function HO(e){const t=M1(e),r=rx(t,e),n=rx(t.reverse(),e);return[r,n]}function M1(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function rx(e,t){for(const r of e)if(!KO(r,{upTo:t}))return r}function KO(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function BO(e){return e instanceof HTMLInputElement&&"select"in e}function ws(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&BO(e)&&t&&e.select()}}var nx=WO();function WO(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=sx(e,t),e.unshift(t)},remove(t){var r;e=sx(e,t),(r=e[0])==null||r.resume()}}}function sx(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function ZO(e){return e.filter(t=>t.tagName!=="A")}var GO=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ii=new WeakMap,ru=new WeakMap,nu={},$h=0,D1=function(e){return e&&(e.host||D1(e.parentNode))},QO=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=D1(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},JO=function(e,t,r,n){var s=QO(t,Array.isArray(e)?e:[e]);nu[r]||(nu[r]=new WeakMap);var o=nu[r],i=[],l=new Set,c=new Set(s),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};s.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(g){if(l.has(g))d(g);else try{var v=g.getAttribute(n),b=v!==null&&v!=="false",h=(ii.get(g)||0)+1,w=(o.get(g)||0)+1;ii.set(g,h),o.set(g,w),i.push(g),h===1&&b&&ru.set(g,!0),w===1&&g.setAttribute(r,"true"),b||g.setAttribute(n,"true")}catch(p){console.error("aria-hidden: cannot operate on ",g,p)}})};return d(t),l.clear(),$h++,function(){i.forEach(function(f){var g=ii.get(f)-1,v=o.get(f)-1;ii.set(f,g),o.set(f,v),g||(ru.has(f)||f.removeAttribute(n),ru.delete(f)),v||f.removeAttribute(r)}),$h--,$h||(ii=new WeakMap,ii=new WeakMap,ru=new WeakMap,nu={})}},Cv=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),s=GO(e);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live], script"))),JO(n,s,r,"aria-hidden")):function(){return null}},kn=function(){return kn=Object.assign||function(t){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},kn.apply(this,arguments)};function z1(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r}function YO(e,t,r){if(r||arguments.length===2)for(var n=0,s=t.length,o;n<s;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}var Ru="right-scroll-bar-position",Iu="width-before-scroll-bar",XO="with-scroll-bars-hidden",eM="--removed-body-scroll-bar-size";function Ph(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function tM(e,t){var r=y.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var s=r.value;s!==n&&(r.value=n,r.callback(n,s))}}}})[0];return r.callback=t,r.facade}var rM=typeof window<"u"?y.useLayoutEffect:y.useEffect,ox=new WeakMap;function nM(e,t){var r=tM(null,function(n){return e.forEach(function(s){return Ph(s,n)})});return rM(function(){var n=ox.get(r);if(n){var s=new Set(n),o=new Set(e),i=r.current;s.forEach(function(l){o.has(l)||Ph(l,null)}),o.forEach(function(l){s.has(l)||Ph(l,i)})}ox.set(r,e)},[e]),r}function sM(e){return e}function oM(e,t){t===void 0&&(t=sM);var r=[],n=!1,s={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(o){var i=t(o,n);return r.push(i),function(){r=r.filter(function(l){return l!==i})}},assignSyncMedium:function(o){for(n=!0;r.length;){var i=r;r=[],i.forEach(o)}r={push:function(l){return o(l)},filter:function(){return r}}},assignMedium:function(o){n=!0;var i=[];if(r.length){var l=r;r=[],l.forEach(o),i=r}var c=function(){var d=i;i=[],d.forEach(o)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(d){i.push(d),u()},filter:function(d){return i=i.filter(d),r}}}};return s}function iM(e){e===void 0&&(e={});var t=oM(null);return t.options=kn({async:!0,ssr:!1},e),t}var L1=function(e){var t=e.sideCar,r=z1(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return y.createElement(n,kn({},r))};L1.isSideCarExport=!0;function aM(e,t){return e.useMedium(t),L1}var F1=iM(),Th=function(){},Sf=y.forwardRef(function(e,t){var r=y.useRef(null),n=y.useState({onScrollCapture:Th,onWheelCapture:Th,onTouchMoveCapture:Th}),s=n[0],o=n[1],i=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,g=e.sideCar,v=e.noRelative,b=e.noIsolation,h=e.inert,w=e.allowPinchZoom,p=e.as,m=p===void 0?"div":p,x=e.gapMode,_=z1(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=g,$=nM([r,t]),k=kn(kn({},_),s);return y.createElement(y.Fragment,null,d&&y.createElement(C,{sideCar:F1,removeScrollBar:u,shards:f,noRelative:v,noIsolation:b,inert:h,setCallbacks:o,allowPinchZoom:!!w,lockRef:r,gapMode:x}),i?y.cloneElement(y.Children.only(l),kn(kn({},k),{ref:$})):y.createElement(m,kn({},k,{className:c,ref:$}),l))});Sf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Sf.classNames={fullWidth:Iu,zeroRight:Ru};var lM=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function cM(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=lM();return t&&e.setAttribute("nonce",t),e}function uM(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function dM(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var fM=function(){var e=0,t=null;return{add:function(r){e==0&&(t=cM())&&(uM(t,r),dM(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},hM=function(){var e=fM();return function(t,r){y.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},U1=function(){var e=hM(),t=function(r){var n=r.styles,s=r.dynamic;return e(n,s),null};return t},pM={left:0,top:0,right:0,gap:0},Rh=function(e){return parseInt(e||"",10)||0},mM=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Rh(r),Rh(n),Rh(s)]},gM=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return pM;var t=mM(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},vM=U1(),qi="data-scroll-locked",yM=function(e,t,r,n){var s=e.left,o=e.top,i=e.right,l=e.gap;return r===void 0&&(r="margin"),`
|
|
270
|
+
.`.concat(XO,` {
|
|
271
|
+
overflow: hidden `).concat(n,`;
|
|
272
|
+
padding-right: `).concat(l,"px ").concat(n,`;
|
|
273
|
+
}
|
|
274
|
+
body[`).concat(qi,`] {
|
|
275
|
+
overflow: hidden `).concat(n,`;
|
|
276
|
+
overscroll-behavior: contain;
|
|
277
|
+
`).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
|
|
278
|
+
padding-left: `.concat(s,`px;
|
|
279
|
+
padding-top: `).concat(o,`px;
|
|
280
|
+
padding-right: `).concat(i,`px;
|
|
281
|
+
margin-left:0;
|
|
282
|
+
margin-top:0;
|
|
283
|
+
margin-right: `).concat(l,"px ").concat(n,`;
|
|
284
|
+
`),r==="padding"&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),`
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.`).concat(Ru,` {
|
|
288
|
+
right: `).concat(l,"px ").concat(n,`;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.`).concat(Iu,` {
|
|
292
|
+
margin-right: `).concat(l,"px ").concat(n,`;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.`).concat(Ru," .").concat(Ru,` {
|
|
296
|
+
right: 0 `).concat(n,`;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.`).concat(Iu," .").concat(Iu,` {
|
|
300
|
+
margin-right: 0 `).concat(n,`;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
body[`).concat(qi,`] {
|
|
304
|
+
`).concat(eM,": ").concat(l,`px;
|
|
305
|
+
}
|
|
306
|
+
`)},ix=function(){var e=parseInt(document.body.getAttribute(qi)||"0",10);return isFinite(e)?e:0},wM=function(){y.useEffect(function(){return document.body.setAttribute(qi,(ix()+1).toString()),function(){var e=ix()-1;e<=0?document.body.removeAttribute(qi):document.body.setAttribute(qi,e.toString())}},[])},xM=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=n===void 0?"margin":n;wM();var o=y.useMemo(function(){return gM(s)},[s]);return y.createElement(vM,{styles:yM(o,!t,s,r?"":"!important")})},pm=!1;if(typeof window<"u")try{var su=Object.defineProperty({},"passive",{get:function(){return pm=!0,!0}});window.addEventListener("test",su,su),window.removeEventListener("test",su,su)}catch{pm=!1}var ai=pm?{passive:!1}:!1,bM=function(e){return e.tagName==="TEXTAREA"},q1=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!bM(e)&&r[t]==="visible")},_M=function(e){return q1(e,"overflowY")},SM=function(e){return q1(e,"overflowX")},ax=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=V1(e,n);if(s){var o=H1(e,n),i=o[1],l=o[2];if(i>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},kM=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},CM=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},V1=function(e,t){return e==="v"?_M(t):SM(t)},H1=function(e,t){return e==="v"?kM(t):CM(t)},EM=function(e,t){return e==="h"&&t==="rtl"?-1:1},NM=function(e,t,r,n,s){var o=EM(e,window.getComputedStyle(t).direction),i=o*n,l=r.target,c=t.contains(l),u=!1,d=i>0,f=0,g=0;do{if(!l)break;var v=H1(e,l),b=v[0],h=v[1],w=v[2],p=h-w-o*b;(b||p)&&V1(e,l)&&(f+=p,g+=b);var m=l.parentNode;l=m&&m.nodeType===Node.DOCUMENT_FRAGMENT_NODE?m.host:m}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(f)<1||!d&&Math.abs(g)<1)&&(u=!0),u},ou=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},lx=function(e){return[e.deltaX,e.deltaY]},cx=function(e){return e&&"current"in e?e.current:e},jM=function(e,t){return e[0]===t[0]&&e[1]===t[1]},$M=function(e){return`
|
|
307
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
308
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
309
|
+
`)},PM=0,li=[];function TM(e){var t=y.useRef([]),r=y.useRef([0,0]),n=y.useRef(),s=y.useState(PM++)[0],o=y.useState(U1)[0],i=y.useRef(e);y.useEffect(function(){i.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var h=YO([e.lockRef.current],(e.shards||[]).map(cx),!0).filter(Boolean);return h.forEach(function(w){return w.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),h.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=y.useCallback(function(h,w){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!i.current.allowPinchZoom;var p=ou(h),m=r.current,x="deltaX"in h?h.deltaX:m[0]-p[0],_="deltaY"in h?h.deltaY:m[1]-p[1],C,$=h.target,k=Math.abs(x)>Math.abs(_)?"h":"v";if("touches"in h&&k==="h"&&$.type==="range")return!1;var I=ax(k,$);if(!I)return!0;if(I?C=k:(C=k==="v"?"h":"v",I=ax(k,$)),!I)return!1;if(!n.current&&"changedTouches"in h&&(x||_)&&(n.current=C),!C)return!0;var E=n.current||C;return NM(E,w,h,E==="h"?x:_)},[]),c=y.useCallback(function(h){var w=h;if(!(!li.length||li[li.length-1]!==o)){var p="deltaY"in w?lx(w):ou(w),m=t.current.filter(function(C){return C.name===w.type&&(C.target===w.target||w.target===C.shadowParent)&&jM(C.delta,p)})[0];if(m&&m.should){w.cancelable&&w.preventDefault();return}if(!m){var x=(i.current.shards||[]).map(cx).filter(Boolean).filter(function(C){return C.contains(w.target)}),_=x.length>0?l(w,x[0]):!i.current.noIsolation;_&&w.cancelable&&w.preventDefault()}}},[]),u=y.useCallback(function(h,w,p,m){var x={name:h,delta:w,target:p,should:m,shadowParent:RM(p)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(_){return _!==x})},1)},[]),d=y.useCallback(function(h){r.current=ou(h),n.current=void 0},[]),f=y.useCallback(function(h){u(h.type,lx(h),h.target,l(h,e.lockRef.current))},[]),g=y.useCallback(function(h){u(h.type,ou(h),h.target,l(h,e.lockRef.current))},[]);y.useEffect(function(){return li.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:g}),document.addEventListener("wheel",c,ai),document.addEventListener("touchmove",c,ai),document.addEventListener("touchstart",d,ai),function(){li=li.filter(function(h){return h!==o}),document.removeEventListener("wheel",c,ai),document.removeEventListener("touchmove",c,ai),document.removeEventListener("touchstart",d,ai)}},[]);var v=e.removeScrollBar,b=e.inert;return y.createElement(y.Fragment,null,b?y.createElement(o,{styles:$M(s)}):null,v?y.createElement(xM,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function RM(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const IM=aM(F1,TM);var kf=y.forwardRef(function(e,t){return y.createElement(Sf,kn({},e,{ref:t,sideCar:IM}))});kf.classNames=Sf.classNames;var Cf="Popover",[K1,$H]=In(Cf,[$a]),fc=$a(),[AM,lo]=K1(Cf),B1=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:i=!1}=e,l=fc(t),c=y.useRef(null),[u,d]=y.useState(!1),[f,g]=eo({prop:n,defaultProp:s??!1,onChange:o,caller:Cf});return a.jsx(_1,{...l,children:a.jsx(AM,{scope:t,contentId:Jn(),triggerRef:c,open:f,onOpenChange:g,onOpenToggle:y.useCallback(()=>g(v=>!v),[g]),hasCustomAnchor:u,onCustomAnchorAdd:y.useCallback(()=>d(!0),[]),onCustomAnchorRemove:y.useCallback(()=>d(!1),[]),modal:i,children:r})})};B1.displayName=Cf;var W1="PopoverAnchor",OM=y.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=lo(W1,r),o=fc(r),{onCustomAnchorAdd:i,onCustomAnchorRemove:l}=s;return y.useEffect(()=>(i(),()=>l()),[i,l]),a.jsx(wf,{...o,...n,ref:t})});OM.displayName=W1;var Z1="PopoverTrigger",G1=y.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=lo(Z1,r),o=fc(r),i=Ve(t,s.triggerRef),l=a.jsx(_e.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":eC(s.open),...n,ref:i,onClick:pe(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:a.jsx(wf,{asChild:!0,...o,children:l})});G1.displayName=Z1;var Ev="PopoverPortal",[MM,DM]=K1(Ev,{forceMount:void 0}),Q1=e=>{const{__scopePopover:t,forceMount:r,children:n,container:s}=e,o=lo(Ev,t);return a.jsx(MM,{scope:t,forceMount:r,children:a.jsx(An,{present:r||o.open,children:a.jsx(cc,{asChild:!0,container:s,children:n})})})};Q1.displayName=Ev;var ga="PopoverContent",J1=y.forwardRef((e,t)=>{const r=DM(ga,e.__scopePopover),{forceMount:n=r.forceMount,...s}=e,o=lo(ga,e.__scopePopover);return a.jsx(An,{present:n||o.open,children:o.modal?a.jsx(LM,{...s,ref:t}):a.jsx(FM,{...s,ref:t})})});J1.displayName=ga;var zM=Bo("PopoverContent.RemoveScroll"),LM=y.forwardRef((e,t)=>{const r=lo(ga,e.__scopePopover),n=y.useRef(null),s=Ve(t,n),o=y.useRef(!1);return y.useEffect(()=>{const i=n.current;if(i)return Cv(i)},[]),a.jsx(kf,{as:zM,allowPinchZoom:!0,children:a.jsx(Y1,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:pe(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),o.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:pe(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;o.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:pe(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),FM=y.forwardRef((e,t)=>{const r=lo(ga,e.__scopePopover),n=y.useRef(!1),s=y.useRef(!1);return a.jsx(Y1,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,o),o.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),o.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:o=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;((u=r.triggerRef.current)==null?void 0:u.contains(i))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),Y1=y.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...f}=e,g=lo(ga,r),v=fc(r);return kv(),a.jsx(_f,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:a.jsx(Ca,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>g.onOpenChange(!1),children:a.jsx(wv,{"data-state":eC(g.open),role:"dialog",id:g.contentId,...v,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),X1="PopoverClose",UM=y.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=lo(X1,r);return a.jsx(_e.button,{type:"button",...n,ref:t,onClick:pe(e.onClick,()=>s.onOpenChange(!1))})});UM.displayName=X1;var qM="PopoverArrow",VM=y.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=fc(r);return a.jsx(xv,{...s,...n,ref:t})});VM.displayName=qM;function eC(e){return e?"open":"closed"}var HM=B1,KM=G1,BM=Q1,tC=J1;const WM=HM,ZM=KM,rC=y.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},s)=>a.jsx(BM,{children:a.jsx(tC,{ref:s,align:t,sideOffset:r,className:xe("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",e),...n})}));rC.displayName=tC.displayName;function GM(e,t){const r=new Date(e).getTime();if(Number.isNaN(r))return"";const n=Math.max(0,Math.floor((t.getTime()-r)/1e3));if(n<60)return`${n}s`;const s=Math.floor(n/60);if(s<60)return`${s}m`;const o=Math.floor(s/60);return o<24?`${o}h`:`${Math.floor(o/24)}d`}function QM(e,t=24){return e.length>t?`${e.slice(0,t-1)}…`:e}function JM(e){const t=e.replace(/\/+$/,""),r=t.lastIndexOf("/");return r>=0?t.slice(r+1):t}function YM(e){const t=new Map;for(const r of e)t.set(r.deckId,(t.get(r.deckId)??0)+1);return t}function XM(e,t){const r=e>0?`${e} cards`:"Empty";if(t<=0)return r;const n=t===1?"1 session":`${t} sessions`;return`${r}, ${n}`}const e4=3e3;function t4({highlightDeckId:e}){const{data:t}=Zt({queryKey:["/api/scope/bindings"],refetchInterval:e4}),r=(t==null?void 0:t.data)??[],n=y.useMemo(()=>new Date,[t]),s=y.useMemo(()=>{const i=new Map;for(const l of r){const c=i.get(l.workspaceRoot)??[];c.push(l),i.set(l.workspaceRoot,c)}return[...i.entries()].sort(([l],[c])=>l.localeCompare(c)).map(([l,c])=>({workspaceRoot:l,rows:[...c].sort((u,d)=>u.lastActivityAt<d.lastActivityAt?1:-1)}))},[r]);if(r.length===0)return null;const o=e?r.filter(i=>i.deckId===e).length:0;return a.jsxs(WM,{children:[a.jsx(ZM,{asChild:!0,children:a.jsxs(ie,{type:"button",variant:"outline",size:"sm",className:"h-7 shrink-0 border-white/20 bg-black/30 px-2 text-xs text-gray-200 hover:bg-white/10 hover:text-white","data-testid":"live-session-badges-trigger",title:"Live MCP session binds — click for badges",children:[a.jsx(GR,{className:"mr-1 h-3 w-3",style:{color:er},"aria-hidden":!0}),a.jsxs("span",{className:"font-mono",children:["⌘",r.length]}),o>0&&o<r.length?a.jsxs("span",{className:"ml-1 text-gray-400",children:["(",o," here)"]}):null]})}),a.jsxs(rC,{align:"end",className:"w-80 border-white/10 bg-gray-950/95 p-0 text-gray-100","data-testid":"live-session-badges-panel",children:[a.jsxs("div",{className:"border-b border-white/10 px-3 py-2",children:[a.jsx("p",{className:"text-sm font-semibold",style:{color:er},children:"Live sessions"}),a.jsxs("p",{className:"text-xs text-gray-400",children:["Match ",a.jsx("span",{className:"font-mono",children:"⌘badge"})," to the chat opener"]})]}),a.jsx("div",{className:"max-h-64 overflow-y-auto p-2",children:s.map(({workspaceRoot:i,rows:l})=>a.jsxs("div",{className:"mb-2 last:mb-0",children:[a.jsxs("p",{className:"px-1 pb-1 text-[10px] uppercase tracking-wide text-gray-500",children:[JM(i),"/"]}),a.jsx("ul",{className:"space-y-1",children:l.map(c=>{const u=c.clientName??"agent",d=GM(c.lastActivityAt,n),f=d?`${u} · ${d}`:u,g=e===c.deckId;return a.jsxs("li",{className:xe("rounded-md px-2 py-1.5 font-mono text-xs",g?"bg-[#92E4DD]/10 ring-1 ring-[#92E4DD]/40":"bg-white/5"),"data-testid":`live-session-row-${c.badge}`,children:[a.jsx("span",{className:"text-gray-100",children:QM(c.deckName)})," ",a.jsxs("span",{style:{color:er},children:["⌘",c.badge]}),a.jsx("span",{className:"mt-0.5 block font-sans text-[10px] text-gray-400",children:f})]},c.badge)})})]},i))})]})]})}var Ef="Dialog",[nC,PH]=In(Ef),[r4,fn]=nC(Ef),sC=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,l=y.useRef(null),c=y.useRef(null),[u,d]=eo({prop:n,defaultProp:s??!1,onChange:o,caller:Ef});return a.jsx(r4,{scope:t,triggerRef:l,contentRef:c,contentId:Jn(),titleId:Jn(),descriptionId:Jn(),open:u,onOpenChange:d,onOpenToggle:y.useCallback(()=>d(f=>!f),[d]),modal:i,children:r})};sC.displayName=Ef;var oC="DialogTrigger",n4=y.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=fn(oC,r),o=Ve(t,s.triggerRef);return a.jsx(_e.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":$v(s.open),...n,ref:o,onClick:pe(e.onClick,s.onOpenToggle)})});n4.displayName=oC;var Nv="DialogPortal",[s4,iC]=nC(Nv,{forceMount:void 0}),aC=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,o=fn(Nv,t);return a.jsx(s4,{scope:t,forceMount:r,children:y.Children.map(n,i=>a.jsx(An,{present:r||o.open,children:a.jsx(cc,{asChild:!0,container:s,children:i})}))})};aC.displayName=Nv;var Cd="DialogOverlay",lC=y.forwardRef((e,t)=>{const r=iC(Cd,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=fn(Cd,e.__scopeDialog);return o.modal?a.jsx(An,{present:n||o.open,children:a.jsx(i4,{...s,ref:t})}):null});lC.displayName=Cd;var o4=Bo("DialogOverlay.RemoveScroll"),i4=y.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=fn(Cd,r);return a.jsx(kf,{as:o4,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(_e.div,{"data-state":$v(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),Zo="DialogContent",cC=y.forwardRef((e,t)=>{const r=iC(Zo,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=fn(Zo,e.__scopeDialog);return a.jsx(An,{present:n||o.open,children:o.modal?a.jsx(a4,{...s,ref:t}):a.jsx(l4,{...s,ref:t})})});cC.displayName=Zo;var a4=y.forwardRef((e,t)=>{const r=fn(Zo,e.__scopeDialog),n=y.useRef(null),s=Ve(t,r.contentRef,n);return y.useEffect(()=>{const o=n.current;if(o)return Cv(o)},[]),a.jsx(uC,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:pe(e.onCloseAutoFocus,o=>{var i;o.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:pe(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&o.preventDefault()}),onFocusOutside:pe(e.onFocusOutside,o=>o.preventDefault())})}),l4=y.forwardRef((e,t)=>{const r=fn(Zo,e.__scopeDialog),n=y.useRef(!1),s=y.useRef(!1);return a.jsx(uC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,o),o.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),o.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:o=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;((u=r.triggerRef.current)==null?void 0:u.contains(i))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),uC=y.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=e,l=fn(Zo,r),c=y.useRef(null),u=Ve(t,c);return kv(),a.jsxs(a.Fragment,{children:[a.jsx(_f,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:a.jsx(Ca,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":$v(l.open),...i,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(c4,{titleId:l.titleId}),a.jsx(d4,{contentRef:c,descriptionId:l.descriptionId})]})]})}),jv="DialogTitle",dC=y.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=fn(jv,r);return a.jsx(_e.h2,{id:s.titleId,...n,ref:t})});dC.displayName=jv;var fC="DialogDescription",hC=y.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=fn(fC,r);return a.jsx(_e.p,{id:s.descriptionId,...n,ref:t})});hC.displayName=fC;var pC="DialogClose",mC=y.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=fn(pC,r);return a.jsx(_e.button,{type:"button",...n,ref:t,onClick:pe(e.onClick,()=>s.onOpenChange(!1))})});mC.displayName=pC;function $v(e){return e?"open":"closed"}var gC="DialogTitleWarning",[TH,vC]=B2(gC,{contentName:Zo,titleName:jv,docsSlug:"dialog"}),c4=({titleId:e})=>{const t=vC(gC),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
310
|
+
|
|
311
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
312
|
+
|
|
313
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return y.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},u4="DialogDescriptionWarning",d4=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${vC(u4).contentName}}.`;return y.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},f4=sC,h4=aC,yC=lC,wC=cC,xC=dC,bC=hC,p4=mC;const co=f4,m4=h4,_C=y.forwardRef(({className:e,...t},r)=>a.jsx(yC,{ref:r,className:xe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));_C.displayName=yC.displayName;const cs=y.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(m4,{children:[a.jsx(_C,{}),a.jsxs(wC,{ref:n,className:xe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,a.jsxs(p4,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(yd,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));cs.displayName=wC.displayName;const us=({className:e,...t})=>a.jsx("div",{className:xe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});us.displayName="DialogHeader";const ds=y.forwardRef(({className:e,...t},r)=>a.jsx(xC,{ref:r,className:xe("text-lg font-semibold leading-none tracking-tight",e),...t}));ds.displayName=xC.displayName;const ri=y.forwardRef(({className:e,...t},r)=>a.jsx(bC,{ref:r,className:xe("text-sm text-muted-foreground",e),...t}));ri.displayName=bC.displayName;const Bn=y.forwardRef(({className:e,...t},r)=>a.jsx("textarea",{className:xe("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...t}));Bn.displayName="Textarea";var g4="Label",SC=y.forwardRef((e,t)=>a.jsx(_e.label,{...e,ref:t,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));SC.displayName=g4;var kC=SC;const v4=hf("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ie=y.forwardRef(({className:e,...t},r)=>a.jsx(kC,{ref:r,className:xe(v4(),e),...t}));Ie.displayName=kC.displayName;var y4=y.createContext(void 0);function Pv(e){const t=y.useContext(y4);return e||t||"ltr"}var Ih="rovingFocusGroup.onEntryFocus",w4={bubbles:!1,cancelable:!0},hc="RovingFocusGroup",[mm,CC,x4]=nv(hc),[b4,EC]=In(hc,[x4]),[_4,S4]=b4(hc),NC=y.forwardRef((e,t)=>a.jsx(mm.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(mm.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(k4,{...e,ref:t})})}));NC.displayName=hc;var k4=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,g=y.useRef(null),v=Ve(t,g),b=Pv(o),[h,w]=eo({prop:i,defaultProp:l??null,onChange:c,caller:hc}),[p,m]=y.useState(!1),x=qr(u),_=CC(r),C=y.useRef(!1),[$,k]=y.useState(0);return y.useEffect(()=>{const I=g.current;if(I)return I.addEventListener(Ih,x),()=>I.removeEventListener(Ih,x)},[x]),a.jsx(_4,{scope:r,orientation:n,dir:b,loop:s,currentTabStopId:h,onItemFocus:y.useCallback(I=>w(I),[w]),onItemShiftTab:y.useCallback(()=>m(!0),[]),onFocusableItemAdd:y.useCallback(()=>k(I=>I+1),[]),onFocusableItemRemove:y.useCallback(()=>k(I=>I-1),[]),children:a.jsx(_e.div,{tabIndex:p||$===0?-1:0,"data-orientation":n,...f,ref:v,style:{outline:"none",...e.style},onMouseDown:pe(e.onMouseDown,()=>{C.current=!0}),onFocus:pe(e.onFocus,I=>{const E=!C.current;if(I.target===I.currentTarget&&E&&!p){const U=new CustomEvent(Ih,w4);if(I.currentTarget.dispatchEvent(U),!U.defaultPrevented){const P=_().filter(Z=>Z.focusable),O=P.find(Z=>Z.active),L=P.find(Z=>Z.id===h),K=[O,L,...P].filter(Boolean).map(Z=>Z.ref.current);PC(K,d)}}C.current=!1}),onBlur:pe(e.onBlur,()=>m(!1))})})}),jC="RovingFocusGroupItem",$C=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:o,children:i,...l}=e,c=Jn(),u=o||c,d=S4(jC,r),f=d.currentTabStopId===u,g=CC(r),{onFocusableItemAdd:v,onFocusableItemRemove:b,currentTabStopId:h}=d;return y.useEffect(()=>{if(n)return v(),()=>b()},[n,v,b]),a.jsx(mm.ItemSlot,{scope:r,id:u,focusable:n,active:s,children:a.jsx(_e.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:pe(e.onMouseDown,w=>{n?d.onItemFocus(u):w.preventDefault()}),onFocus:pe(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:pe(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){d.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const p=N4(w,d.orientation,d.dir);if(p!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let x=g().filter(_=>_.focusable).map(_=>_.ref.current);if(p==="last")x.reverse();else if(p==="prev"||p==="next"){p==="prev"&&x.reverse();const _=x.indexOf(w.currentTarget);x=d.loop?j4(x,_+1):x.slice(_+1)}setTimeout(()=>PC(x))}}),children:typeof i=="function"?i({isCurrentTabStop:f,hasTabStop:h!=null}):i})})});$C.displayName=jC;var C4={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function E4(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function N4(e,t,r){const n=E4(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return C4[n]}function PC(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function j4(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var $4=NC,P4=$C,Nf="Tabs",[T4,RH]=In(Nf,[EC]),TC=EC(),[R4,Tv]=T4(Nf),RC=y.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:s,defaultValue:o,orientation:i="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=Pv(l),[f,g]=eo({prop:n,onChange:s,defaultProp:o??"",caller:Nf});return a.jsx(R4,{scope:r,baseId:Jn(),value:f,onValueChange:g,orientation:i,dir:d,activationMode:c,children:a.jsx(_e.div,{dir:d,"data-orientation":i,...u,ref:t})})});RC.displayName=Nf;var IC="TabsList",AC=y.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...s}=e,o=Tv(IC,r),i=TC(r);return a.jsx($4,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:n,children:a.jsx(_e.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});AC.displayName=IC;var OC="TabsTrigger",MC=y.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:s=!1,...o}=e,i=Tv(OC,r),l=TC(r),c=LC(i.baseId,n),u=FC(i.baseId,n),d=n===i.value;return a.jsx(P4,{asChild:!0,...l,focusable:!s,active:d,children:a.jsx(_e.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...o,ref:t,onMouseDown:pe(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?i.onValueChange(n):f.preventDefault()}),onKeyDown:pe(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(n)}),onFocus:pe(e.onFocus,()=>{const f=i.activationMode!=="manual";!d&&!s&&f&&i.onValueChange(n)})})})});MC.displayName=OC;var DC="TabsContent",zC=y.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:s,children:o,...i}=e,l=Tv(DC,r),c=LC(l.baseId,n),u=FC(l.baseId,n),d=n===l.value,f=y.useRef(d);return y.useEffect(()=>{const g=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(g)},[]),a.jsx(An,{present:s||d,children:({present:g})=>a.jsx(_e.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:g&&o})})});zC.displayName=DC;function LC(e,t){return`${e}-trigger-${t}`}function FC(e,t){return`${e}-content-${t}`}var I4=RC,UC=AC,qC=MC,VC=zC;const A4=I4,HC=y.forwardRef(({className:e,...t},r)=>a.jsx(UC,{ref:r,className:xe("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));HC.displayName=UC.displayName;const gm=y.forwardRef(({className:e,...t},r)=>a.jsx(qC,{ref:r,className:xe("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));gm.displayName=qC.displayName;const vm=y.forwardRef(({className:e,...t},r)=>a.jsx(VC,{ref:r,className:xe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));vm.displayName=VC.displayName;function xl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function KC(e){return xl(e)&&typeof e.command=="string"}function Ah(e){return!xl(e)||Object.keys(e).length===0?!1:Object.values(e).every(KC)}function O4(e){let t=e.trim();return t.startsWith("```")?t.replace(/^```(?:json)?\s*\n?/i,"").replace(/\n?```\s*$/,"").trim():t}function M4(e){if(!xl(e))throw new Error("Configuration must be a JSON object");if(xl(e.config)&&Ah(e.config.mcpServers))return{mcpServers:e.config.mcpServers};if(Ah(e.mcpServers))return{mcpServers:e.mcpServers};if(xl(e)&&typeof e.command=="string"){const t=typeof e.name=="string"&&e.name.trim()?e.name.trim():"local-server",{name:r,...n}=e;if(!KC(n))throw new Error("Missing or invalid command");return{mcpServers:{[t]:n}}}if(Ah(e))return{mcpServers:e};throw new Error(`Invalid configuration: expected a top-level "mcpServers" object. Example:
|
|
314
|
+
{
|
|
315
|
+
"mcpServers": {
|
|
316
|
+
"google-drive": {
|
|
317
|
+
"command": "npx",
|
|
318
|
+
"args": ["-y", "@piotr-agier/google-drive-mcp"]
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}`)}function D4(e){let t;try{t=JSON.parse(O4(e))}catch(r){throw new Error(`Failed to parse JSON: ${r instanceof Error?r.message:"Unknown error"}`)}return M4(t)}function z4({type:e,open:t,onOpenChange:r}){const[n,s]=y.useState("remote"),[o,i]=y.useState("json"),[l,c]=y.useState(`{
|
|
322
|
+
"mcpServers": {
|
|
323
|
+
"memory": {
|
|
324
|
+
"command": "npx",
|
|
325
|
+
"args": ["-y", "@modelcontextprotocol/server-memory"],
|
|
326
|
+
"env": {
|
|
327
|
+
"MEMORY_FILE_PATH": "/path/to/custom/memory.json"
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}`),[u,d]=y.useState(null),[f,g]=y.useState(null),[v,b]=y.useState(null),[h,w]=y.useState({name:"",type:"mcp",url:"http://localhost:8000/mcp",description:"",headers_enabled:!1,headers:{},cardColor:er}),[p,m]=y.useState(`{
|
|
332
|
+
|
|
333
|
+
}`),[x,_]=y.useState(null),[C,$]=y.useState({name:"",type:"local-mcp",command:"",args:[""],env:{},description:"",cardColor:er}),[k,I]=y.useState({name:"",type:"a2a",manifest_url:"http://localhost:8001/.well-known/a2a/manifest.json",description:"",cardColor:er}),E=Qt(),{toast:U}=Ut(),P=()=>{try{g(null);const S=D4(l),N=Object.entries(S.mcpServers);if(N.length===0)throw new Error("No MCP servers found in configuration");if(N.length>1)throw new Error("Multiple servers not supported. Please configure one server at a time.");const[M,H]=N[0],{command:G,args:me,env:ne,description:ue}=H;if(!G||typeof G!="string")throw new Error("Missing or invalid command");if(!me||!Array.isArray(me))throw new Error("Missing or invalid args array");const ye={name:M,command:G,args:me.map(String),env:ne&&typeof ne=="object"?ne:void 0,description:ue&&typeof ue=="string"?ue:void 0};d(ye),i("review"),$({name:ye.name,type:"local-mcp",command:ye.command,args:ye.args,env:ye.env||{},description:ye.description||"",cardColor:er}),O(M)}catch(S){g(S instanceof Error?S.message:"Failed to parse JSON"),d(null)}},O=async S=>{try{const H=((await ke("GET","/api/services")).data||[]).find(G=>G.name===S);b(H?S:null)}catch(N){console.error("Failed to check name conflict:",N)}},L=async S=>{await O(S)},z=yt({mutationFn:async S=>{if(e==="mcp"&&n==="local"){const N={mcpServers:{[S.name]:{command:S.command,args:S.args.filter(M=>M.trim()!==""),...Object.keys(S.env).length>0&&{env:S.env}}}};return console.log("Importing local MCP server:",N),ke("POST","/api/local-mcp/import",{config:JSON.stringify(N)})}else{const N={name:S.name,type:e,url:e==="mcp"?S.url:S.manifest_url,description:S.description,cardColor:S.cardColor,...S.headers_enabled&&{headers:S.headers}};return console.log("Sending service data:",N),ke("POST","/api/services",N)}},onSuccess:()=>{E.invalidateQueries({queryKey:["/api/services"]}),E.invalidateQueries({queryKey:["/api/collection/warnings"]}),U({title:"Service registered successfully!",description:`${(e==="mcp"?n==="remote"?h:C:k).name} has been added to your collection.`}),Z()},onError:S=>{var N;console.error("Registration failed:",S),console.error("Error details:",{message:S==null?void 0:S.message,name:S==null?void 0:S.name,stack:S==null?void 0:S.stack,toString:S==null?void 0:S.toString(),constructor:(N=S==null?void 0:S.constructor)==null?void 0:N.name}),U({title:"Registration failed",description:(S==null?void 0:S.message)||"Failed to register service. Please try again.",variant:"destructive"})}}),K=async()=>{if(e==="mcp"&&n==="local"){if(o==="json")P();else if(o==="review"){if(await L(C.name),v){U({title:"Name Conflict",description:`A service with the name "${C.name}" already exists. Please choose a different name.`,variant:"destructive"});return}z.mutate(C)}}else{const S=e==="mcp"?n==="remote"?h:C:k;if(await L(S.name),v){U({title:"Name Conflict",description:`A service with the name "${S.name}" already exists. Please choose a different name.`,variant:"destructive"});return}if(e==="mcp"&&n==="remote"&&h.headers_enabled){const N=V();if(N===null)return;z.mutate({...h,headers:N});return}z.mutate(S)}},Z=()=>{i("json"),c(`{
|
|
334
|
+
"mcpServers": {
|
|
335
|
+
"memory": {
|
|
336
|
+
"command": "npx",
|
|
337
|
+
"args": ["-y", "@modelcontextprotocol/server-memory"],
|
|
338
|
+
"env": {
|
|
339
|
+
"MEMORY_FILE_PATH": "/path/to/custom/memory.json"
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}`),d(null),g(null),b(null),w({name:"",type:"mcp",url:"http://localhost:8000/mcp",description:"",headers_enabled:!1,headers:{},cardColor:er}),m(`{
|
|
344
|
+
|
|
345
|
+
}`),_(null),$({name:"",type:"local-mcp",command:"",args:[""],env:{},description:"",cardColor:er}),I({name:"",type:"a2a",manifest_url:"http://localhost:8001/.well-known/a2a/manifest.json",description:"",cardColor:er}),r(!1)},W=(S,N)=>{w(M=>({...M,[S]:N}))},F=S=>{W("headers_enabled",S),S&&p.trim()===`{
|
|
346
|
+
|
|
347
|
+
}`&&m(`{
|
|
348
|
+
"Authorization": "Bearer "
|
|
349
|
+
}`),S||_(null)},V=()=>{const S=p.trim();if(!S||S==="{}")return{};try{const N=JSON.parse(S);if(typeof N!="object"||N===null||Array.isArray(N))return _('Headers must be a JSON object (e.g. {"Authorization": "Bearer token"})'),null;for(const[M,H]of Object.entries(N))if(typeof H!="string")return _(`Header "${M}" must be a string value`),null;return _(null),N}catch{return _("Invalid JSON — fix syntax before registering"),null}},D=(S,N)=>{$(M=>({...M,[S]:N}))},T=(S,N)=>{I(M=>({...M,[S]:N}))},q=()=>{if(e==="mcp"&&n==="local"){if(o==="json")return"Parse Configuration";if(o==="review")return v?"Register Anyway":"Register Service"}return"Register Service"},j=()=>{var S,N;if(e==="mcp"&&n==="local"){if(o==="json")return!l.trim();if(o==="review")return!C.name.trim()||!C.command.trim()}else{const M=e==="mcp"?n==="remote"?h:C:k;return!M.name.trim()||e==="mcp"&&n==="remote"&&!((S=M.url)!=null&&S.trim())||e==="a2a"&&!((N=M.manifest_url)!=null&&N.trim())}return!1};return a.jsx(co,{open:t,onOpenChange:r,children:a.jsxs(cs,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto bg-black/40 backdrop-blur-md border border-white/10 text-white shadow-2xl",children:[a.jsxs(us,{children:[a.jsxs(ds,{className:"text-2xl font-bold flex items-center",style:{background:"linear-gradient(to right, #C4B643, #D4C760)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:[e==="mcp"?a.jsx(vd,{className:"w-6 h-6 mr-3",style:{color:"#92E4DD"}}):a.jsx(UR,{className:"w-6 h-6 mr-3",style:{color:"#92E4DD"}}),"Register ",e==="mcp"?"MCP Server":"A2A Agent"]}),a.jsx(ri,{className:"mt-2",style:{color:"#92E4DD",opacity:.8},children:e==="mcp"?"Add a new Model Context Protocol (MCP) server to your service deck. Configure the server URL and provide details for registration.":"Register a new A2A agent with your service deck. Provide the agent manifest and configuration details."})]}),e==="mcp"?a.jsxs(A4,{value:n,onValueChange:S=>s(S),className:"w-full",children:[a.jsxs(HC,{className:"grid w-full grid-cols-2 bg-white/10 border border-white/20",children:[a.jsxs(gm,{value:"remote",className:"data-[state=active]:bg-white/20 data-[state=active]:text-white text-gray-400",children:[a.jsx(vd,{className:"w-4 h-4 mr-2"}),"Remote MCP"]}),a.jsxs(gm,{value:"local",className:"data-[state=active]:bg-white/20 data-[state=active]:text-white text-gray-400",children:[a.jsx(QR,{className:"w-4 h-4 mr-2"}),"Local MCP"]})]}),a.jsxs(vm,{value:"remote",className:"space-y-4 mt-4",children:[a.jsxs("div",{children:[a.jsx(Ie,{htmlFor:"name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Server Name"}),a.jsx(He,{id:"name",placeholder:"e.g., Database Tools",value:h.name,onChange:S=>{W("name",S.target.value),S.target.value.trim()?L(S.target.value):b(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-service-name"}),v&&a.jsxs("div",{className:"flex items-center gap-2 mt-1 text-red-400 text-sm",children:[a.jsx(rn,{className:"w-4 h-4"}),a.jsx("span",{children:"A service with this name already exists"})]})]}),a.jsxs("div",{children:[a.jsx(Ie,{htmlFor:"url",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"MCP URL"}),a.jsx(He,{id:"url",type:"url",placeholder:"http://localhost:8080/mcp or https://mcp.notion.com/mcp",value:h.url,onChange:S=>W("url",S.target.value),className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-mcp-url"}),a.jsxs("div",{className:"mt-1 text-xs text-gray-400",children:[a.jsx("p",{children:"Supported formats:"}),a.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[a.jsxs("li",{children:["HTTP MCP: ",a.jsx("code",{children:"http://localhost:8080/mcp"})]}),a.jsxs("li",{children:["SSE MCP: ",a.jsx("code",{children:"https://be.omnimcp.ai/api/v1/mcp/.../sse"})]}),a.jsxs("li",{children:["Notion MCP: ",a.jsx("code",{children:"https://mcp.notion.com/mcp"})]})]})]})]}),a.jsxs("div",{children:[a.jsx(Ie,{htmlFor:"description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),a.jsx(Bn,{id:"description",placeholder:"Brief description of capabilities...",value:h.description,onChange:S=>W("description",S.target.value),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-description"})]})]}),a.jsxs(vm,{value:"local",className:"space-y-4 mt-4",children:[o==="json"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(Ie,{htmlFor:"local-json",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Local MCP Configuration (JSON)"}),a.jsx(Bn,{id:"local-json",placeholder:`{
|
|
350
|
+
"mcpServers": {
|
|
351
|
+
"memory": {
|
|
352
|
+
"command": "npx",
|
|
353
|
+
"args": ["-y", "@modelcontextprotocol/server-memory"]
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}`,value:l,onChange:S=>c(S.target.value),rows:12,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none font-mono text-xs","data-testid":"textarea-local-json"}),a.jsxs("div",{className:"mt-2 text-xs text-gray-400",children:[a.jsx("p",{children:"Enter your local MCP server configuration in JSON format."}),a.jsx("p",{children:"Example:"}),a.jsx("pre",{className:"bg-white/10 p-2 rounded-md text-xs text-gray-300",children:`{
|
|
357
|
+
"mcpServers": {
|
|
358
|
+
"memory": {
|
|
359
|
+
"command": "npx",
|
|
360
|
+
"args": ["-y", "@modelcontextprotocol/server-memory"],
|
|
361
|
+
"env": {
|
|
362
|
+
"MEMORY_FILE_PATH": "/path/to/custom/memory.json"
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}`})]})]}),a.jsxs(ie,{type:"button",className:"flex-1 border",style:{background:"linear-gradient(135deg, #C4B643, #D4C760)",borderColor:"#C4B643",color:"#0A0A07"},onClick:P,disabled:!l.trim()||l.trim().length<10,"data-testid":"button-parse-json",children:[a.jsx(im,{className:"w-4 h-4 mr-2",style:{color:"#0A0A07"}}),"Parse Configuration"]})]}),o==="review"&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(Ie,{htmlFor:"local-name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Server Name"}),a.jsx(He,{id:"local-name",placeholder:"e.g., Memory Server",value:C.name,onChange:S=>{D("name",S.target.value),S.target.value.trim()?L(S.target.value):b(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-local-service-name"}),v&&a.jsxs("div",{className:"mt-2 text-xs text-red-400 flex items-center",children:[a.jsx(rn,{className:"w-4 h-4 mr-1"}),'A service with the name "',v,'" already exists.']})]}),a.jsxs("div",{children:[a.jsx(Ie,{htmlFor:"command",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Command"}),a.jsx(He,{id:"command",placeholder:"e.g., npx, python, node",value:C.command,onChange:S=>D("command",S.target.value),className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-command"}),a.jsx("div",{className:"mt-1 text-xs text-gray-400",children:"The command to execute (e.g., npx, python, node)"})]}),a.jsxs("div",{children:[a.jsx(Ie,{className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Arguments"}),C.args.map((S,N)=>a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx(He,{placeholder:`Argument ${N+1}`,value:S,onChange:M=>{const H=[...C.args];H[N]=M.target.value,D("args",H)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-arg-${N}`}),N===C.args.length-1&&a.jsx(ie,{type:"button",size:"sm",onClick:()=>D("args",[...C.args,""]),className:"bg-white/20 hover:bg-white/30 text-white",children:a.jsx(Ls,{className:"w-4 h-4"})}),C.args.length>1&&a.jsx(ie,{type:"button",size:"sm",variant:"destructive",onClick:()=>{const M=C.args.filter((H,G)=>G!==N);D("args",M)},className:"bg-red-500/80 hover:bg-red-500 text-white",children:a.jsx(yd,{className:"w-4 h-4"})})]},N)),a.jsx("div",{className:"mt-1 text-xs text-gray-400",children:"Command arguments (e.g., -y, @modelcontextprotocol/server-memory)"})]}),a.jsxs("div",{children:[a.jsx(Ie,{className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Environment Variables"}),Object.entries(C.env).length===0?a.jsx("div",{className:"text-gray-400 text-sm italic",children:"No environment variables configured"}):a.jsx("div",{className:"space-y-2",children:Object.entries(C.env).map(([S,N],M)=>a.jsxs("div",{className:"flex gap-2",children:[a.jsx(He,{placeholder:"Variable name",value:S,onChange:H=>{const G={...C.env};delete G[S],G[H.target.value]=N,D("env",G)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-env-key-${M}`}),a.jsx(He,{placeholder:"Value",value:N,onChange:H=>{const G={...C.env};G[S]=H.target.value,D("env",G)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-env-value-${M}`}),a.jsx(ie,{type:"button",size:"sm",variant:"destructive",onClick:()=>{const H={...C.env};delete H[S],D("env",H)},className:"bg-red-500/80 hover:bg-red-500 text-white",children:a.jsx(yd,{className:"w-4 h-4"})})]},M))}),a.jsxs(ie,{type:"button",size:"sm",onClick:()=>{const S={...C.env};S[""]="",D("env",S)},className:"mt-2 bg-white/20 hover:bg-white/30 text-white",children:[a.jsx(Ls,{className:"w-4 h-4 mr-2"}),"Add Environment Variable"]}),a.jsx("div",{className:"mt-1 text-xs text-gray-400",children:"Environment variables for the MCP server process"})]}),a.jsxs("div",{children:[a.jsx(Ie,{htmlFor:"local-description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),a.jsx(Bn,{id:"local-description",placeholder:"Brief description of capabilities...",value:C.description,onChange:S=>D("description",S.target.value),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-local-description"})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx(ie,{type:"button",variant:"outline",className:"flex-1 border-white/20 text-white hover:bg-white/10",onClick:()=>i("json"),"data-testid":"button-back-to-json",children:"← Back to JSON"}),a.jsxs(ie,{type:"button",variant:"ghost",className:`flex-1 border-2 hover:opacity-90 ${_n}`,style:Sn(er),onClick:K,disabled:j(),"data-testid":"button-register",children:[a.jsx(Ls,{className:"w-4 h-4 mr-2"}),z.isPending?"Registering...":q()]})]})]}),o==="complete"&&a.jsxs("div",{className:"text-center py-8",children:[a.jsx(im,{className:"w-16 h-16 text-green-500 mx-auto mb-4"}),a.jsx("h3",{className:"text-xl font-bold mb-2",style:{color:"#92E4DD"},children:"Local MCP Registered!"}),a.jsx("p",{className:"text-gray-400 mb-4",children:"Your local MCP server has been successfully registered."}),a.jsx(ie,{type:"button",className:"flex-1 border",style:{background:"linear-gradient(135deg, #C4B643, #D4C760)",borderColor:"#C4B643",color:"#0A0A07"},onClick:Z,"data-testid":"button-close",children:"Close"})]})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx(Ie,{htmlFor:"name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Agent Name"}),a.jsx(He,{id:"name",placeholder:"e.g., Code Assistant",value:k.name,onChange:S=>{T("name",S.target.value),S.target.value.trim()?L(S.target.value):b(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-service-name"}),v&&a.jsxs("div",{className:"flex items-center gap-2 mt-1 text-red-400 text-sm",children:[a.jsx(rn,{className:"w-4 h-4"}),a.jsx("span",{children:"A service with this name already exists"})]})]}),a.jsxs("div",{children:[a.jsx(Ie,{htmlFor:"manifest_url",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Manifest URL"}),a.jsx(He,{id:"manifest_url",type:"url",placeholder:"http://localhost:8001/.well-known/a2a/manifest.json",value:k.manifest_url,onChange:S=>T("manifest_url",S.target.value),className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-manifest-url"})]}),a.jsxs("div",{children:[a.jsx(Ie,{htmlFor:"description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),a.jsx(Bn,{id:"description",placeholder:"Brief description of capabilities...",value:k.description,onChange:S=>T("description",S.target.value),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-description"})]})]}),e==="mcp"&&n==="remote"&&a.jsxs("div",{className:"space-y-4 border border-white/10 rounded-lg p-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("input",{type:"checkbox",id:"headers_enabled",checked:h.headers_enabled,onChange:S=>F(S.target.checked),className:"rounded border-white/20 bg-white/10"}),a.jsx(Ie,{htmlFor:"headers_enabled",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"🔐 Authentication Required"})]}),a.jsx("div",{className:"text-xs text-gray-400",children:a.jsx("p",{children:"Enable this if your MCP server requires authentication (API keys, tokens, etc.)."})}),h.headers_enabled&&a.jsxs("div",{className:"space-y-3 pl-6",children:[a.jsxs("div",{className:"text-xs text-gray-400 mb-2",children:[a.jsx("p",{children:"Configure HTTP headers for authentication. Common examples:"}),a.jsxs("ul",{className:"list-disc list-inside ml-2 mt-1 space-y-1",children:[a.jsxs("li",{children:[a.jsx("code",{children:"Authorization: Bearer YOUR_TOKEN"})," - For API tokens"]}),a.jsxs("li",{children:[a.jsx("code",{children:"X-API-Key: YOUR_API_KEY"})," - For API keys"]}),a.jsxs("li",{children:[a.jsx("code",{children:"X-Custom-Header: value"})," - For custom headers"]})]})]}),a.jsxs("div",{children:[a.jsx(Ie,{htmlFor:"headers",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"HTTP Headers (JSON)"}),a.jsx(Bn,{id:"headers",placeholder:`{
|
|
367
|
+
"Authorization": "Bearer YOUR_TOKEN_HERE",
|
|
368
|
+
"X-API-Key": "YOUR_API_KEY_HERE"
|
|
369
|
+
}`,value:p,onChange:S=>{m(S.target.value),x&&_(null)},onBlur:()=>{p.trim()&&V()},rows:6,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none font-mono text-xs","data-testid":"textarea-headers"}),x&&a.jsxs("p",{className:"text-red-400 text-xs mt-1 flex items-center gap-1",children:[a.jsx(rn,{className:"w-3 h-3 shrink-0"}),x]}),a.jsx("div",{className:"text-xs text-gray-400 mt-1",children:a.jsx("p",{children:"Enter headers as JSON. Keys are header names, values are header values."})})]})]})]}),f&&a.jsxs("div",{className:"text-red-400 text-sm mt-2",children:[a.jsx(rn,{className:"w-4 h-4 mr-1"}),f]}),v&&a.jsxs("div",{className:"text-red-400 text-sm mt-2",children:[a.jsx(rn,{className:"w-4 h-4 mr-1"}),'A service with the name "',v,'" already exists. You can register it anyway, but it might overwrite the existing one.']}),a.jsxs("div",{className:"flex space-x-3 pt-4",children:[a.jsx(ie,{type:"button",variant:"secondary",className:"flex-1 border text-white",style:{background:"#ad095e",borderColor:"#ad095e"},onClick:Z,"data-testid":"button-cancel",children:"Cancel"}),!(e==="mcp"&&n==="local")&&a.jsxs(ie,{type:"button",variant:"ghost",className:`flex-1 border-2 hover:opacity-90 ${_n}`,style:Sn(er),disabled:z.isPending||j(),"data-testid":"button-register",onClick:K,children:[a.jsx(Ls,{className:"w-4 h-4 mr-2"}),z.isPending?"Registering...":"Register Service"]})]})]})})}async function BC(e){return(await(await ke("POST","/api/export",{scope:e.scope??"collection",...e.deckId?{deckId:e.deckId}:{}})).json()).data}async function L4(e){return(await(await ke("POST","/api/import",e)).json()).data}function WC(e,t){const r=new Blob([`${JSON.stringify(e,null,2)}
|
|
370
|
+
`],{type:"application/json"}),n=URL.createObjectURL(r),s=document.createElement("a");s.href=n,s.download=t,s.click(),URL.revokeObjectURL(n)}function F4(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"deck"}function ux(e){const{services:t,playbooks:r,decks:n}=e.counts;return`Decks +${n.created} / skipped ${n.reused}. Services +${t.created} / skipped ${t.reused}. Playbooks +${r.created} / skipped ${r.reused}.`}function U4({decks:e,editingDeckId:t,onSelectDeck:r,isLoading:n}){const[s,o]=y.useState(!1),[i,l]=y.useState({name:"",description:""}),c=Qt(),{toast:u}=Ut(),{data:d}=Zt({queryKey:["/api/scope/bindings"],refetchInterval:3e3}),f=y.useMemo(()=>YM((d==null?void 0:d.data)??[]),[d]),g=yt({mutationFn:async _=>ke("POST","/api/decks",{name:_.name,description:_.description,isActive:!1}),onSuccess:async _=>{var $;const C=await _.json();c.invalidateQueries({queryKey:["/api/decks"]}),($=C.data)!=null&&$.id&&r(C.data.id),u({title:"Deck created",description:`${i.name} has been created successfully.`}),o(!1),l({name:"",description:""})},onError:_=>{u({title:"Failed to create deck",description:_.message,variant:"destructive"})}}),v=yt({mutationFn:async _=>{const C=await BC({scope:"deck",deckId:_.id});return WC(C,`${F4(_.name)}.agent-deck.json`),C},onSuccess:(_,C)=>{u({title:"Deck exported",description:`${C.name}: ${_.services.length} services, ${_.playbooks.length} playbooks`})},onError:_=>{u({title:"Export failed",description:_.message,variant:"destructive"})}}),b=(_,C)=>{_.stopPropagation(),v.mutate(C)},h=yt({mutationFn:async _=>ke("DELETE",`/api/decks/${_}`,{}),onSuccess:()=>{c.invalidateQueries({queryKey:["/api/decks"]}),u({title:"Deck deleted",description:"Your deck has been deleted successfully."})},onError:_=>{_.message.includes("Cannot delete the last deck")?u({title:"Cannot delete deck",description:"You cannot delete the last deck. Please create another deck first.",variant:"destructive"}):u({title:"Failed to delete deck",description:_.message,variant:"destructive"})}}),w=async(_,C)=>{_.stopPropagation();try{await navigator.clipboard.writeText(C.id),u({title:"Copied deck id",description:"Use with bind_workspace({ workspaceRoot, deckId }) in your agent."})}catch($){u({title:"Failed to copy deck id",description:$ instanceof Error?$.message:"Unknown error",variant:"destructive"})}},p=(_,C)=>{_.stopPropagation(),window.confirm("Are you sure you want to delete this deck? This action cannot be undone.")&&h.mutate(C)},m=_=>{_.preventDefault(),g.mutate(i)},x=_=>{var C,$,k;return(((C=_.services)==null?void 0:C.length)??0)+((($=_.credentials)==null?void 0:$.length)??0)+(((k=_.playbooks)==null?void 0:k.length)??0)};return n?a.jsx("div",{className:"bg-black/40 backdrop-blur-md rounded-2xl border border-white/10 p-6 shadow-2xl",children:a.jsxs("div",{className:"animate-pulse space-y-4",children:[a.jsx("div",{className:"h-6 bg-white/10 rounded"}),a.jsx("div",{className:"space-y-3",children:Array.from({length:3}).map((_,C)=>a.jsx("div",{className:"h-16 bg-white/5 rounded-lg"},C))})]})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"h-full flex flex-col","data-testid":"deck-management-panel",children:[a.jsxs("h2",{className:"text-lg font-bold mb-3 flex items-center",children:[a.jsx(lm,{className:"w-4 h-4 mr-2",style:{color:"#92E4DD"}}),a.jsx("span",{style:{color:"#92E4DD"},children:"My Decks"})]}),a.jsx("div",{className:"mb-3",children:a.jsxs(ie,{onClick:()=>o(!0),className:"w-full border text-sm py-2",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},"data-testid":"create-deck-button",children:[a.jsx(Ls,{className:"w-3 h-3 mr-2"}),"Add Deck"]})}),a.jsx("div",{className:"flex-1 overflow-y-auto",children:a.jsx("div",{className:"space-y-2",children:e.map(_=>{const C=_.id===t,$=x(_),k=f.get(_.id)??0,I=XM($,k);return a.jsxs("div",{className:`p-2 rounded-lg border cursor-pointer transition-all relative group ${C?"bg-gradient-to-r from-yellow-500/20 to-yellow-600/20 border-2 border-yellow-500/40 hover:border-yellow-400/60":"bg-white/5 border border-white/10 hover:border-white/20"}`,onClick:()=>r(_.id),"data-testid":`deck-item-${_.id}`,children:[a.jsxs("div",{className:"absolute top-1 right-1 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200",children:[a.jsx(ie,{size:"sm",variant:"secondary",className:"h-5 w-5 p-0",onClick:E=>b(E,_),title:"Export this deck","data-testid":`export-deck-${_.id}`,children:a.jsx(qk,{className:"w-2 h-2"})}),a.jsx(ie,{size:"sm",variant:"secondary",className:"h-5 w-5 p-0",onClick:E=>w(E,_),title:"Copy deck id for bind_workspace",children:a.jsx(Uk,{className:"w-2 h-2"})}),a.jsx(ie,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:E=>p(E,_.id),title:"Delete deck",children:a.jsx(pf,{className:"w-2 h-2"})})]}),a.jsxs("div",{children:[a.jsx("h3",{className:`font-semibold text-sm pr-16 ${C?"text-yellow-300":"text-white"}`,children:_.name}),a.jsx("p",{className:"text-xs text-gray-400 select-none pointer-events-none",children:I})]})]},_.id)})})})]}),a.jsx(co,{open:s,onOpenChange:o,children:a.jsxs(cs,{className:"sm:max-w-md bg-gradient-to-br from-cosmic-900 to-cosmic-800 border border-white/20 text-white",children:[a.jsx(us,{children:a.jsxs(ds,{className:"text-xl font-bold flex items-center",children:[a.jsx(Ls,{className:"w-5 h-5 mr-2 text-purple-400"}),"Create New Deck"]})}),a.jsxs("form",{onSubmit:m,className:"space-y-4","data-testid":"form-create-deck",children:[a.jsxs("div",{children:[a.jsx(Ie,{htmlFor:"deckName",className:"text-sm font-semibold",children:"Deck Name"}),a.jsx(He,{id:"deckName",placeholder:"e.g., Hiring stack",value:i.name,onChange:_=>l(C=>({...C,name:_.target.value})),className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-deck-name"})]}),a.jsxs("div",{children:[a.jsx(Ie,{htmlFor:"deckDescription",className:"text-sm font-semibold",children:"Description"}),a.jsx(Bn,{id:"deckDescription",placeholder:"Brief description of this deck...",value:i.description,onChange:_=>l(C=>({...C,description:_.target.value})),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-deck-description"})]}),a.jsxs("div",{className:"flex space-x-3 pt-4",children:[a.jsx(ie,{type:"button",variant:"secondary",className:"flex-1",onClick:()=>o(!1),"data-testid":"button-cancel-create",children:"Cancel"}),a.jsx(ie,{type:"submit",className:"flex-1 bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-700 hover:to-blue-700",disabled:g.isPending,"data-testid":"button-submit-create",children:g.isPending?"Creating...":"Create Deck"})]})]})]})})]})}function q4({open:e,onOpenChange:t}){const[r,n]=y.useState(""),[s,o]=y.useState(""),i=Qt(),{toast:l}=Ut(),c=yt({mutationFn:async()=>ke("POST","/api/credentials",{label:r.trim(),value:s}),onSuccess:()=>{i.invalidateQueries({queryKey:["/api/credentials/vault"]}),i.invalidateQueries({queryKey:["/api/decks"]}),l({title:"API key saved",description:`${r.trim()} is stored securely. Your agent can use it from the active deck.`}),t(!1),n(""),o("")},onError:d=>{l({title:"Could not save API key",description:d.message,variant:"destructive"})}}),u=r.trim().length>0&&s.trim().length>0;return a.jsx(co,{open:e,onOpenChange:t,children:a.jsxs(cs,{className:"sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]",children:[a.jsxs(us,{children:[a.jsx(ds,{className:"text-[#E8F6F4]",children:"Register API key"}),a.jsx(ri,{className:"text-[#A8C4C0]",children:"Name the service and paste the key. Agent Deck handles the rest — stored in your vault, never shown again."})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ie,{htmlFor:"credential-name",className:"text-[#CFEAE6]",children:"Service name"}),a.jsx(He,{id:"credential-name",placeholder:"OpenAI, Linear, Slack…",value:r,onChange:d=>n(d.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ie,{htmlFor:"credential-value",className:"text-[#CFEAE6]",children:"API key"}),a.jsx(He,{id:"credential-value",type:"password",placeholder:"Paste key from the service dashboard",value:s,onChange:d=>o(d.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),a.jsx(ie,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${_n}`,style:Sn(ur),onClick:()=>c.mutate(),disabled:!u||c.isPending,children:"Save to vault"})]})]})})}function V4({open:e,onOpenChange:t}){const[r,n]=y.useState(""),[s,o]=y.useState(""),[i,l]=y.useState(""),[c,u]=y.useState(""),[d,f]=y.useState(""),[g,v]=y.useState([]),[b,h]=y.useState([]),w=Qt(),{toast:p}=Ut(),{data:m}=Zt({queryKey:["/api/credentials/vault"],enabled:e}),{data:x}=Zt({queryKey:["/api/services"],enabled:e}),_=(m==null?void 0:m.data)??[],C=(x==null?void 0:x.data)??[],$=yt({mutationFn:async()=>ke("POST","/api/playbooks",{title:r.trim(),body:s,triggers:i.split(",").map(E=>E.trim()).filter(Boolean),dependsOnCredentialIds:g,dependsOnServiceIds:b,exec:c.trim()||void 0,skill:d.trim()||void 0,autoDetectDependencies:!0}),onSuccess:()=>{w.invalidateQueries({queryKey:["/api/playbooks/vault"]}),p({title:"Playbook saved",description:`${r.trim()} is in your collection.`}),t(!1),n(""),o(""),l(""),u(""),f(""),v([]),h([])},onError:E=>{p({title:"Could not save playbook",description:E.message,variant:"destructive"})}}),k=(E,U,P)=>{P(E.includes(U)?E.filter(O=>O!==U):[...E,U])},I=r.trim().length>0&&s.trim().length>0;return a.jsx(co,{open:e,onOpenChange:t,children:a.jsxs(cs,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto border-border bg-[#161612] text-[#E8F6F4]",children:[a.jsxs(us,{children:[a.jsx(ds,{children:"Register Playbook"}),a.jsxs(ri,{className:"text-[#A8C4C0]",children:["Prefer"," ",a.jsx("span",{className:"font-mono text-xs",children:"register_playbook"})," /"," ",a.jsx("span",{className:"font-mono text-xs",children:"update_playbook"})," from your AI agent. This form also auto-detects API key and MCP dependencies from the content on save."]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ie,{htmlFor:"playbook-title",children:"Title"}),a.jsx(He,{id:"playbook-title",placeholder:"Hiring inbox, Ashby API guide…",value:r,onChange:E=>n(E.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ie,{htmlFor:"playbook-triggers",children:"Triggers (comma-separated)"}),a.jsx(He,{id:"playbook-triggers",placeholder:"check inbox, review applicants",value:i,onChange:E=>l(E.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ie,{htmlFor:"playbook-body",children:"Instructions (markdown)"}),a.jsx(Bn,{id:"playbook-body",rows:8,placeholder:`# Steps
|
|
371
|
+
1. …
|
|
372
|
+
2. …`,value:s,onChange:E=>o(E.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-sm"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ie,{children:"Extra API key deps (optional)"}),a.jsx("p",{className:"text-xs text-gray-500",children:"Merged with auto-detected refs from content."}),a.jsx("div",{className:"max-h-28 overflow-y-auto rounded border border-white/10 p-2 space-y-1",children:_.length===0?a.jsx("p",{className:"text-xs text-gray-500",children:"No API keys registered yet."}):_.map(E=>a.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:g.includes(E.id),onChange:()=>k(g,E.id,v)}),E.label]},E.id))})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ie,{children:"Extra MCP deps (optional)"}),a.jsx("p",{className:"text-xs text-gray-500",children:"Merged with auto-detected refs from content."}),a.jsx("div",{className:"max-h-28 overflow-y-auto rounded border border-white/10 p-2 space-y-1",children:C.length===0?a.jsx("p",{className:"text-xs text-gray-500",children:"No MCP services registered yet."}):C.map(E=>a.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:b.includes(E.id),onChange:()=>k(b,E.id,h)}),E.name]},E.id))})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ie,{htmlFor:"playbook-exec",children:"Suggested exec (optional)"}),a.jsx(He,{id:"playbook-exec",placeholder:"agent-deck exec --connections … -- uv run …",value:c,onChange:E=>u(E.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ie,{htmlFor:"playbook-skill",children:"Skill path hint (optional)"}),a.jsx(He,{id:"playbook-skill",placeholder:".cursor/skills/…/SKILL.md",value:d,onChange:E=>f(E.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),a.jsx(ie,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${_n}`,style:Sn(Jr),onClick:()=>$.mutate(),disabled:!I||$.isPending,children:"Save to collection"})]})]})})}function H4({playbookId:e,open:t,onOpenChange:r}){const{data:n,isLoading:s}=Zt({queryKey:e?[`/api/playbooks/${e}`]:["playbook-detail-disabled"],enabled:t&&!!e}),o=n==null?void 0:n.data,i=((o==null?void 0:o.dependencies.missingCredentialIds.length)??0)+((o==null?void 0:o.dependencies.missingServiceIds.length)??0);return a.jsx(co,{open:t,onOpenChange:r,children:a.jsxs(cs,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto border-border bg-[#161612] text-[#E8F6F4]",children:[a.jsxs(us,{children:[a.jsx(ds,{children:(o==null?void 0:o.title)??"Playbook"}),a.jsx(ri,{className:"text-[#A8C4C0]",children:(o==null?void 0:o.id)??e})]}),s||!o?a.jsx("p",{className:"text-sm text-gray-400",children:"Loading…"}):a.jsxs("div",{className:"space-y-4 text-sm",children:[a.jsxs("p",{className:"rounded-md border border-white/10 bg-white/5 px-3 py-2 text-[#A8C4C0]",children:["Ask your AI agent to refine this playbook with"," ",a.jsx("span",{className:"font-mono text-xs",children:"update_playbook"})," — dependencies are re-detected from the content automatically."]}),o.triggers.length>0&&a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Triggers"}),a.jsx("p",{className:"text-gray-300",children:o.triggers.join(", ")})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Dependencies"}),o.dependencies.credentials.length===0&&o.dependencies.services.length===0&&i===0?a.jsx("p",{className:"text-gray-400",children:"None declared."}):a.jsxs("ul",{className:"space-y-1 text-gray-300",children:[o.dependencies.credentials.map(l=>a.jsxs("li",{children:["API key: ",l.label]},l.id)),o.dependencies.services.map(l=>a.jsxs("li",{children:["MCP: ",l.label]},l.id)),o.dependencies.missingCredentialIds.map(l=>a.jsxs("li",{className:"text-amber-300 flex items-center gap-1",children:[a.jsx(rn,{className:"w-3 h-3"})," Missing API key: ",l]},l)),o.dependencies.missingServiceIds.map(l=>a.jsxs("li",{className:"text-amber-300 flex items-center gap-1",children:[a.jsx(rn,{className:"w-3 h-3"})," Missing MCP: ",l]},l))]})]}),o.exec&&a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Suggested exec"}),a.jsx("pre",{className:"rounded bg-black/40 p-2 text-xs overflow-x-auto",children:o.exec})]}),o.skill&&a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Skill hint"}),a.jsx("p",{className:"font-mono text-xs text-gray-300",children:o.skill})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Instructions"}),a.jsx("div",{className:"rounded bg-black/30 p-3 whitespace-pre-wrap text-gray-200",children:o.body})]})]})]})})}function K4({credentialId:e,open:t,onOpenChange:r}){const n=Qt(),{toast:s}=Ut(),[o,i]=y.useState(""),[l,c]=y.useState(""),[u,d]=y.useState(""),{data:f,isLoading:g}=Zt({queryKey:e?[`/api/credentials/${e}`]:["credential-detail-disabled"],enabled:t&&!!e}),v=f==null?void 0:f.data;y.useEffect(()=>{v&&(i(v.label),c(v.docsUrl??""),d(""))},[v==null?void 0:v.id,v==null?void 0:v.label,v==null?void 0:v.docsUrl]);const b=yt({mutationFn:async()=>{if(!e)throw new Error("No credential selected");const w=o.trim();if(!w)throw new Error("Name is required");const p=l.trim();if(p)try{new URL(p)}catch{throw new Error("Documentation link must be a valid URL")}await ke("PUT",`/api/credentials/${e}`,{label:w,docsUrl:p}),u.trim()&&await ke("POST",`/api/credentials/${e}/rotate`,{value:u.trim()})},onSuccess:()=>{n.invalidateQueries({queryKey:["/api/credentials/vault"]}),e&&n.invalidateQueries({queryKey:[`/api/credentials/${e}`]}),n.invalidateQueries({queryKey:["/api/collection/warnings"]}),n.invalidateQueries({queryKey:["/api/decks"]}),s({title:u.trim()?"API key updated":"API key saved",description:u.trim()?"Name, docs link, and key value were updated.":"Name and docs link were updated."}),d(""),r(!1)},onError:w=>{s({title:"Could not save API key",description:w.message,variant:"destructive"})}}),h=o.trim().length>0&&(o.trim()!==(v==null?void 0:v.label)||l.trim()!==((v==null?void 0:v.docsUrl)??"")||u.trim().length>0);return a.jsx(co,{open:t,onOpenChange:r,children:a.jsxs(cs,{className:"sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]",children:[a.jsxs(us,{children:[a.jsx(ds,{className:"text-[#E8F6F4]",children:(v==null?void 0:v.label)??"API key"}),a.jsx(ri,{className:"font-mono text-xs text-[#A8C4C0]",children:(v==null?void 0:v.id)??e})]}),g||!v?a.jsx("p",{className:"text-sm text-gray-400",children:"Loading…"}):a.jsxs("div",{className:"space-y-4",children:[!v.hasSecret&&a.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-amber-200",children:[a.jsx(rn,{className:"mt-0.5 h-4 w-4 shrink-0"}),a.jsx("p",{children:"No key is stored in your vault for this credential. Paste a key below to save it — the value is never shown after saving."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ie,{htmlFor:"credential-detail-name",className:"text-[#CFEAE6]",children:"Name"}),a.jsx(He,{id:"credential-detail-name",value:o,onChange:w=>i(w.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ie,{htmlFor:"credential-detail-key",className:"text-[#CFEAE6]",children:v.hasSecret?"Rotate API key":"API key"}),a.jsx(He,{id:"credential-detail-key",type:"password",placeholder:v.hasSecret?"Leave blank to keep current key":"Paste key from the service dashboard",value:u,onChange:w=>d(w.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"}),v.hasSecret&&a.jsx("p",{className:"text-xs text-[#6B8581]",children:"Stored securely in Keychain. Enter a new value only when rotating."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ie,{htmlFor:"credential-detail-docs",className:"text-[#CFEAE6]",children:"Documentation link"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(He,{id:"credential-detail-docs",type:"url",placeholder:"https://…",value:l,onChange:w=>c(w.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"}),l.trim()&&a.jsx(ie,{type:"button",variant:"outline",size:"icon",className:"shrink-0 border-white/15 bg-[#0F0F0C] text-[#A8C4C0] hover:bg-white/5",onClick:()=>window.open(l.trim(),"_blank","noopener,noreferrer"),title:"Open documentation",children:a.jsx(Gn,{className:"h-4 w-4"})})]})]}),a.jsx(ie,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${_n}`,style:Sn(ur),onClick:()=>b.mutate(),disabled:!h||b.isPending,children:b.isPending?"Saving…":"Save changes"})]})]})})}const B4=hf("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function pn({className:e,variant:t,...r}){return a.jsx("div",{className:xe(B4({variant:t}),e),...r})}function ZC(e){const t=y.useRef({value:e,previous:e});return y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var jf="Checkbox",[W4,IH]=In(jf),[Z4,Rv]=W4(jf);function G4(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:s,disabled:o,form:i,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[g,v]=eo({prop:r,defaultProp:s??!1,onChange:c,caller:jf}),[b,h]=y.useState(null),[w,p]=y.useState(null),m=y.useRef(!1),x=b?!!i||!!b.closest("form"):!0,_={checked:g,disabled:o,setChecked:v,control:b,setControl:h,name:l,form:i,value:d,hasConsumerStoppedPropagationRef:m,required:u,defaultChecked:Qs(s)?!1:s,isFormControl:x,bubbleInput:w,setBubbleInput:p};return a.jsx(Z4,{scope:t,..._,children:Q4(f)?f(_):n})}var GC="CheckboxTrigger",QC=y.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},s)=>{const{control:o,value:i,disabled:l,checked:c,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:g,isFormControl:v,bubbleInput:b}=Rv(GC,e),h=Ve(s,d),w=y.useRef(c);return y.useEffect(()=>{const p=o==null?void 0:o.form;if(p){const m=()=>f(w.current);return p.addEventListener("reset",m),()=>p.removeEventListener("reset",m)}},[o,f]),a.jsx(_e.button,{type:"button",role:"checkbox","aria-checked":Qs(c)?"mixed":c,"aria-required":u,"data-state":tE(c),"data-disabled":l?"":void 0,disabled:l,value:i,...n,ref:h,onKeyDown:pe(t,p=>{p.key==="Enter"&&p.preventDefault()}),onClick:pe(r,p=>{f(m=>Qs(m)?!0:!m),b&&v&&(g.current=p.isPropagationStopped(),g.current||p.stopPropagation())})})});QC.displayName=GC;var Iv=y.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:s,defaultChecked:o,required:i,disabled:l,value:c,onCheckedChange:u,form:d,...f}=e;return a.jsx(G4,{__scopeCheckbox:r,checked:s,defaultChecked:o,disabled:l,required:i,onCheckedChange:u,name:n,form:d,value:c,internal_do_not_use_render:({isFormControl:g})=>a.jsxs(a.Fragment,{children:[a.jsx(QC,{...f,ref:t,__scopeCheckbox:r}),g&&a.jsx(eE,{__scopeCheckbox:r})]})})});Iv.displayName=jf;var JC="CheckboxIndicator",YC=y.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...s}=e,o=Rv(JC,r);return a.jsx(An,{present:n||Qs(o.checked)||o.checked===!0,children:a.jsx(_e.span,{"data-state":tE(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});YC.displayName=JC;var XC="CheckboxBubbleInput",eE=y.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:s,checked:o,defaultChecked:i,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:g,setBubbleInput:v}=Rv(XC,e),b=Ve(r,v),h=ZC(o),w=f1(n);y.useEffect(()=>{const m=g;if(!m)return;const x=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(x,"checked").set,$=!s.current;if(h!==o&&C){const k=new Event("click",{bubbles:$});m.indeterminate=Qs(o),C.call(m,Qs(o)?!1:o),m.dispatchEvent(k)}},[g,h,o,s]);const p=y.useRef(Qs(o)?!1:o);return a.jsx(_e.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??p.current,required:l,disabled:c,name:u,value:d,form:f,...t,tabIndex:-1,ref:b,style:{...t.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});eE.displayName=XC;function Q4(e){return typeof e=="function"}function Qs(e){return e==="indeterminate"}function tE(e){return Qs(e)?"indeterminate":e?"checked":"unchecked"}const rE=y.forwardRef(({className:e,...t},r)=>a.jsx(Iv,{ref:r,className:xe("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:a.jsx(YC,{className:xe("flex items-center justify-center text-current"),children:a.jsx(Lk,{className:"h-4 w-4"})})}));rE.displayName=Iv.displayName;const nE=y.forwardRef(({className:e,...t},r)=>a.jsx("div",{className:"relative w-full overflow-auto",children:a.jsx("table",{ref:r,className:xe("w-full caption-bottom text-sm",e),...t})}));nE.displayName="Table";const sE=y.forwardRef(({className:e,...t},r)=>a.jsx("thead",{ref:r,className:xe("[&_tr]:border-b",e),...t}));sE.displayName="TableHeader";const oE=y.forwardRef(({className:e,...t},r)=>a.jsx("tbody",{ref:r,className:xe("[&_tr:last-child]:border-0",e),...t}));oE.displayName="TableBody";const J4=y.forwardRef(({className:e,...t},r)=>a.jsx("tfoot",{ref:r,className:xe("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));J4.displayName="TableFooter";const nl=y.forwardRef(({className:e,...t},r)=>a.jsx("tr",{ref:r,className:xe("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));nl.displayName="TableRow";const Au=y.forwardRef(({className:e,...t},r)=>a.jsx("th",{ref:r,className:xe("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));Au.displayName="TableHead";const fi=y.forwardRef(({className:e,...t},r)=>a.jsx("td",{ref:r,className:xe("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));fi.displayName="TableCell";const Y4=y.forwardRef(({className:e,...t},r)=>a.jsx("caption",{ref:r,className:xe("mt-4 text-sm text-muted-foreground",e),...t}));Y4.displayName="TableCaption";function Oh(e){return new Set(e.filter(t=>t.enabled===!1).map(t=>t.name))}function X4({serviceId:e,tools:t,isLoading:r}){const[n,s]=y.useState(""),[o,i]=y.useState(null),[l,c]=y.useState(()=>Oh(t)),u=Qt(),{toast:d}=Ut(),f=y.useMemo(()=>t.map(m=>`${m.name}:${m.enabled===!1?"0":"1"}`).sort().join("\0"),[t]);y.useEffect(()=>{c(Oh(t))},[e,f]);const g=yt({mutationFn:async m=>{await ke("PUT",`/api/services/${e}/tool-settings`,{disabledTools:m})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/services",e,"tools"]}),u.invalidateQueries({queryKey:["/api/services"]})},onError:m=>{d({title:"Could not save tool settings",description:m.message,variant:"destructive"}),c(Oh(t))}}),v=m=>{c(m),g.mutate([...m])},b=(m,x)=>{const _=new Set(l);x?_.delete(m):_.add(m),v(_)},h=m=>{if(m){v(new Set);return}v(new Set(t.map(x=>x.name)))},w=y.useMemo(()=>{const m=n.trim().toLowerCase();return m?t.filter(x=>x.name.toLowerCase().includes(m)||x.description.toLowerCase().includes(m)):t},[t,n]),p=t.length-l.size;return r?a.jsx("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:a.jsx("p",{className:"text-sm text-gray-400",children:"Loading tools…"})}):t.length===0?null:a.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[a.jsxs("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[a.jsxs("h3",{className:"text-lg font-semibold flex items-center",children:[a.jsx(cv,{className:"w-5 h-5 mr-2"}),"Tools",a.jsxs("span",{className:"ml-2 text-sm font-normal text-gray-400",children:[p," of ",t.length," enabled"]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(ie,{type:"button",size:"sm",variant:"ghost",className:"h-8 text-xs text-[#A8C4C0] hover:text-white hover:bg-white/10",onClick:()=>h(!0),disabled:l.size===0||g.isPending,children:"Enable all"}),a.jsx(ie,{type:"button",size:"sm",variant:"ghost",className:"h-8 text-xs text-[#A8C4C0] hover:text-white hover:bg-white/10",onClick:()=>h(!1),disabled:p===0||g.isPending,children:"Disable all"})]})]}),a.jsx("p",{className:"mb-3 text-xs text-[#A8C4C0]",children:"Choose which tools your agent can use from this MCP. Disabled tools are hidden from the agent but stay registered on the server."}),a.jsxs("div",{className:"relative mb-3",children:[a.jsx(Vk,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500"}),a.jsx(He,{value:n,onChange:m=>s(m.target.value),placeholder:"Search tools…",className:"border-white/15 bg-[#0F0F0C] pl-9 text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),a.jsx("div",{className:"rounded-md border border-white/10 overflow-hidden",children:a.jsxs(nE,{children:[a.jsx(sE,{children:a.jsxs(nl,{className:"border-white/10 hover:bg-transparent",children:[a.jsx(Au,{className:"w-[72px] text-center text-[#A8C4C0]",children:"Enabled"}),a.jsx(Au,{className:"w-[220px] text-[#A8C4C0]",children:"Tool"}),a.jsx(Au,{className:"text-[#A8C4C0]",children:"Description"})]})}),a.jsx(oE,{children:w.length===0?a.jsx(nl,{className:"border-white/10 hover:bg-transparent",children:a.jsx(fi,{colSpan:3,className:"py-8 text-center text-sm text-gray-400",children:"No tools match your search."})}):w.map(m=>{const x=!l.has(m.name),_=o===m.name,C=m.inputSchema&&Object.keys(m.inputSchema).length>0;return a.jsxs(y.Fragment,{children:[a.jsxs(nl,{className:`border-white/10 ${x?"hover:bg-white/5":"opacity-60 hover:bg-white/5"}`,children:[a.jsx(fi,{className:"text-center",children:a.jsx("div",{className:"flex justify-center",children:a.jsx(rE,{checked:x,onCheckedChange:$=>b(m.name,$===!0),disabled:g.isPending,"aria-label":`${x?"Disable":"Enable"} ${m.name}`,className:"h-[18px] w-[18px] border-white/40 bg-[#0F0F0C] data-[state=checked]:border-[#92E4DD] data-[state=checked]:bg-[#92E4DD] data-[state=checked]:text-[#0F0F0C]"})})}),a.jsx(fi,{children:C?a.jsxs("button",{type:"button",onClick:()=>i(_?null:m.name),className:"flex w-full items-center gap-1 text-left font-mono text-sm text-[#92E4DD] hover:text-white",children:[a.jsx(lv,{className:`h-4 w-4 shrink-0 transition-transform ${_?"rotate-180":""}`}),m.name]}):a.jsx("span",{className:"font-mono text-sm text-[#92E4DD]",children:m.name})}),a.jsx(fi,{className:"text-sm text-gray-300",children:m.description||"—"})]}),C&&_&&a.jsx(nl,{className:"border-white/10 bg-black/30 hover:bg-black/30",children:a.jsx(fi,{colSpan:3,className:"py-3",children:a.jsx("pre",{className:"max-h-48 overflow-auto rounded border border-white/10 bg-[#0F0F0C] p-3 text-xs text-gray-300",children:JSON.stringify(m.inputSchema,null,2)})})})]},m.name)})})]})})]})}function Mh({items:e,className:t}){return e.length===0?null:a.jsx("ol",{className:`list-decimal list-inside space-y-1 text-xs ${t??""}`,children:e.map((r,n)=>a.jsx("li",{children:r},`${n}-${r.slice(0,24)}`))})}function dx({serviceId:e,onConnected:t}){const{toast:r}=Ut(),[n,s]=y.useState(""),[o,i]=y.useState(""),[l,c]=y.useState(!1),[u,d]=y.useState(!1),[f,g]=y.useState(!1),{data:v,isLoading:b}=Zt({queryKey:["/api/oauth",e,"setup"],queryFn:async()=>{const C=await ke("GET",`/api/oauth/${e}/setup`),$=await C.json();if(!C.ok||!$.success)throw new Error($.error||"Failed to load OAuth setup");return $.data},enabled:!!e}),h=v==null?void 0:v.guide,w=!!(v!=null&&v.hasSavedCredentials),p=()=>{if(!u||(h==null?void 0:h.setupMode)!=="manual")return;const C={};return n.trim()&&(C.clientId=n.trim()),o.trim()&&(C.clientSecret=o.trim()),C},m=async(C,$)=>{try{await navigator.clipboard.writeText($),r({title:"Copied",description:`${C} copied to clipboard.`})}catch{r({title:"Copy failed",description:"Select and copy manually.",variant:"destructive"})}};y.useEffect(()=>{(h==null?void 0:h.setupMode)==="manual"?d(!0):d(!1),g(!w)},[h==null?void 0:h.setupMode,w]),y.useEffect(()=>{v!=null&&v.savedOAuthClientId&&!n&&s(v.savedOAuthClientId)},[v==null?void 0:v.savedOAuthClientId,n]);const x=async C=>{var $,k,I;c(!0);try{const E=await ke("POST",`/api/oauth/${e}/connect`,C??{}),U=await E.json();if(!E.ok||!U.success){(($=U.data)!=null&&$.needsCredentials||((k=U.data)==null?void 0:k.setupMode)==="manual")&&d(!0),r({title:"OAuth setup",description:U.error||"Could not start OAuth flow.",variant:"destructive"});return}(I=U.data)!=null&&I.authorizationUrl&&(window.open(U.data.authorizationUrl,"_blank"),r({title:"Continue in browser",description:"Complete sign-in in the new tab, then return here."}),t==null||t())}catch(E){r({title:"OAuth setup failed",description:E instanceof Error?E.message:"Unknown error",variant:"destructive"})}finally{c(!1)}};if(b)return a.jsx("p",{className:"text-sm text-orange-200",children:"Loading setup guide…"});if(!h)return null;if(h.setupMode==="unavailable")return a.jsxs("div",{className:"space-y-3 text-sm text-orange-100",children:[a.jsx("p",{children:h.unavailableReason}),h.docsUrl&&a.jsxs(ie,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(h.docsUrl,"_blank"),children:[a.jsx(Gn,{className:"w-4 h-4 mr-1"}),"Provider docs"]})]});const _=h.setupMode==="dynamic"||h.setupMode==="managed"||h.setupMode==="manual";return a.jsxs("div",{className:"space-y-4 text-sm text-orange-100",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-orange-200",children:h.title}),h.summary&&a.jsx("p",{className:"mt-1 text-xs text-orange-100/90",children:h.summary}),_&&a.jsxs("p",{className:"mt-2 text-xs text-orange-100/80",children:["Redirect URI:"," ",a.jsx("code",{className:"text-orange-50",children:h.redirectUri})]}),h.easierAlternative&&a.jsx("p",{className:"mt-2 text-xs text-orange-100/70 border-l-2 border-orange-500/30 pl-2",children:h.easierAlternative})]}),w&&h.setupMode==="manual"&&a.jsxs("div",{className:"rounded-lg border border-green-500/30 bg-green-500/10 p-3 text-xs text-green-100",children:[a.jsx("p",{className:"font-medium text-green-200",children:"OAuth credentials saved"}),a.jsx("p",{className:"mt-1 text-green-100/90",children:"Client ID is prefilled and your secret is remembered. Click Reconnect — no need to paste the secret again unless Slack rejects the flow."})]}),h.prerequisites&&h.prerequisites.length>0&&!w&&a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-medium text-orange-200 mb-1",children:"Before you start"}),a.jsx("ul",{className:"list-disc list-inside space-y-1 text-xs text-orange-100/90",children:h.prerequisites.map(C=>a.jsx("li",{children:C},C))})]}),(h.manifestJson||h.createAppUrl||_)&&a.jsxs("div",{className:"flex flex-wrap gap-2",children:[h.manifestJson&&a.jsxs(ie,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>void m("App manifest",h.manifestJson),children:[a.jsx(KR,{className:"w-4 h-4 mr-1"}),"Copy manifest"]}),_&&a.jsxs(ie,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>void m("Redirect URI",h.redirectUri),children:[a.jsx(Uk,{className:"w-4 h-4 mr-1"}),"Copy redirect URI"]}),h.createAppUrl&&a.jsxs(ie,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(h.createAppUrl,"_blank"),children:[a.jsx(Gn,{className:"w-4 h-4 mr-1"}),h.createAppLabel??"Open app creator"]})]}),h.steps.length>0&&a.jsx("div",{children:w&&h.setupMode==="manual"?a.jsxs("details",{className:"rounded-lg border border-orange-500/20 bg-orange-500/5 p-3",children:[a.jsx("summary",{className:"cursor-pointer text-xs font-medium text-orange-200",children:"First-time Slack app setup"}),a.jsx("div",{className:"mt-2",children:a.jsx(Mh,{items:h.steps})})]}):a.jsxs(a.Fragment,{children:[h.setupMode==="informational"?a.jsx("p",{className:"text-xs font-medium text-orange-200 mb-1",children:"What to do"}):null,a.jsx(Mh,{items:h.steps})]})}),h.tokenAlternative&&a.jsxs("p",{className:"text-xs text-orange-100/80 border-l-2 border-orange-500/30 pl-2",children:[a.jsx("span",{className:"font-medium text-orange-200",children:"Alternative: "}),h.tokenAlternative]}),u&&h.setupMode==="manual"&&a.jsxs("div",{className:"space-y-3 rounded-lg border border-orange-500/20 bg-orange-500/5 p-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(Ie,{htmlFor:`oauth-client-id-${e}`,className:"text-orange-200",children:"Client ID"}),a.jsx(He,{id:`oauth-client-id-${e}`,value:n,onChange:C=>s(C.target.value),placeholder:"OAuth Client ID",className:"bg-black/20 border-orange-500/30"})]}),f?a.jsxs("div",{className:"space-y-1",children:[a.jsx(Ie,{htmlFor:`oauth-client-secret-${e}`,className:"text-orange-200",children:"Client Secret"}),a.jsx(He,{id:`oauth-client-secret-${e}`,type:"password",value:o,onChange:C=>i(C.target.value),placeholder:"OAuth Client Secret",className:"bg-black/20 border-orange-500/30"})]}):a.jsx("p",{className:"text-xs text-orange-200/80",children:"Client secret is saved locally for this service."}),w&&a.jsx(ie,{type:"button",size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>g(C=>!C),children:f?"Hide client secret field":"Update client secret"}),(v==null?void 0:v.hasStoredClientSecret)&&f&&a.jsx("p",{className:"text-xs text-orange-200/80",children:"Leave blank to keep the saved secret. Enter a new value only if Slack rejected the last connect attempt."})]}),h.afterConnect&&h.afterConnect.length>0&&a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-medium text-orange-200 mb-1",children:"After connect"}),a.jsx(Mh,{items:h.afterConnect,className:"text-orange-100/80"})]}),_&&a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsx(ie,{size:"sm",className:"bg-orange-600 hover:bg-orange-700",disabled:l||u&&h.setupMode==="manual"&&!w&&(!n.trim()||!o.trim()),onClick:()=>x(p()),children:l?"Connecting…":w&&h.setupMode==="manual"?"Reconnect":h.setupMode==="dynamic"||h.setupMode==="managed"?"Connect":"Connect with credentials"}),h.docsUrl&&a.jsxs(ie,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(h.docsUrl,"_blank"),children:[a.jsx(Gn,{className:"w-4 h-4 mr-1"}),"Docs"]})]}),h.setupMode==="informational"&&h.docsUrl&&a.jsxs(ie,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(h.docsUrl,"_blank"),children:[a.jsx(Gn,{className:"w-4 h-4 mr-1"}),"Docs"]})]})}function eD(e){if(!e||e.type!=="local-mcp")return!1;const t=[e.localCommand,...e.localArgs??[],e.url,e.name].filter(Boolean).join(" ").toLowerCase();return t.includes("google-drive")||t.includes("google_drive")}function tD({service:e,isOpen:t,onClose:r}){var Y,de,ee,$e,oe,Oe,Me,De,Pr,Tr,Rr,mt,ir,ho,fs,si,Ec,Nc,jc,Oa,Ma,Da;const[n,s]=y.useState(null),[o,i]=y.useState(!1),[l,c]=y.useState(!1),[u,d]=y.useState(""),[f,g]=y.useState(""),[v,b]=y.useState(!1),[h,w]=y.useState(!1),[p,m]=y.useState(null),x=y.useRef(null),_=Qt(),{toast:C}=Ut(),$=e&&(p==null?void 0:p.id)===e.id?p:e,k=$,I=!!(k&&k.id&&k.url),{data:E,isLoading:U,error:P,refetch:O}=Zt({queryKey:["/api/mcp/discover",k==null?void 0:k.url],queryFn:async()=>{if(!k||k.type!=="mcp")return null;console.log(`🔍 Attempting MCP discovery for: ${k.url}`);try{const be=await(await ke("POST","/api/mcp/discover",{url:k.url})).json();return console.log(`✅ MCP discovery successful for ${k.url}:`,be),be}catch(le){throw console.log(`❌ MCP discovery failed for ${k.url}:`,le),le}},enabled:I&&k.type==="mcp"&&t,staleTime:0,gcTime:2*60*1e3}),L=((de=(Y=E==null?void 0:E.data)==null?void 0:Y.oauth)==null?void 0:de.required)===!0,{data:z,refetch:K}=Zt({queryKey:["/api/oauth",k==null?void 0:k.id,"status"],queryFn:async()=>{const le=await ke("GET",`/api/oauth/${k.id}/status`),be=await le.json();if(!le.ok||!be.success)throw new Error(be.error||"Failed to load OAuth status");return be.data},enabled:I&&k.type==="mcp"&&t&&L,refetchInterval:le=>{const be=le.state.data;return be!=null&&be.authenticated?!1:2e3}}),W=L?z!=null&&z.authenticated?{status:"authenticated",message:null}:z!=null&&z.hasToken&&(z!=null&&z.isExpired)?{status:"expired",message:"OAuth Token Expired - Please re-authenticate"}:{status:"required",message:"OAuth 2.0 Authentication Required"}:{status:"not_required",message:null};console.log("MCP Discovery Query Debug:",{apiService:k==null?void 0:k.id,apiServiceType:k==null?void 0:k.type,apiServiceUrl:k==null?void 0:k.url,isOpen:t,hasValidService:I,enabled:I&&k.type==="mcp"&&t,mcpDiscoveryLoading:U,mcpDiscoveryData:E?JSON.stringify(E,null,2):null,mcpDiscoveryDataKeys:E?Object.keys(E):null,oauthRequired:($e=(ee=E==null?void 0:E.data)==null?void 0:ee.oauth)==null?void 0:$e.required,oauthData:(oe=E==null?void 0:E.data)!=null&&oe.oauth?JSON.stringify(E.data.oauth,null,2):null,toolsQueryEnabled:I&&k.type==="mcp"&&t&&!((Me=(Oe=E==null?void 0:E.data)==null?void 0:Oe.oauth)!=null&&Me.required)});const{data:F,isLoading:V,error:D,refetch:T}=Zt({queryKey:["/api/services",k==null?void 0:k.id,"tools"],queryFn:async()=>{if(!k||k.type!=="mcp"&&k.type!=="local-mcp")return{data:[]};console.log(`🔍 Attempting to discover tools for MCP service: ${k.id} at ${k.url}`);try{const be=await(await ke("GET",`/api/services/${k.id}/tools`)).json();return console.log(`✅ MCP tools discovery successful for ${k.id}:`,be),be}catch(le){throw console.log(`❌ MCP tools discovery failed for ${k.id}:`,le),le}},enabled:I&&(k.type==="mcp"||k.type==="local-mcp")&&t&&(k.type==="local-mcp"||W.status==="authenticated"||W.status==="not_required"),staleTime:0,gcTime:2*60*1e3});y.useEffect(()=>{if(!t||!(k!=null&&k.id)||k.type!=="mcp"&&k.type!=="local-mcp"||!(k.type==="local-mcp"||W.status==="authenticated"||W.status==="not_required")||V||D)return;let be=!1;return(async()=>{try{const bt=await(await ke("GET",`/api/services/${k.id}`)).json();!be&&(bt!=null&&bt.success)&&bt.data&&m(bt.data),_.invalidateQueries({queryKey:["/api/services"]})}catch{}})(),()=>{be=!0}},[t,k==null?void 0:k.id,k==null?void 0:k.type,V,D,W.status,_]),y.useEffect(()=>{if(!t||!(k!=null&&k.id)||k.type!=="a2a")return;let le=!1;return(async()=>{try{await ke("GET",`/api/services/${k.id}/health`);const Fe=await(await ke("GET",`/api/services/${k.id}`)).json();!le&&(Fe!=null&&Fe.success)&&Fe.data&&m(Fe.data),_.invalidateQueries({queryKey:["/api/services"]})}catch{}})(),()=>{le=!0}},[t,k==null?void 0:k.id,k==null?void 0:k.type,_]),console.log("MCP Tools Query Debug:",{hasValidService:I,apiServiceType:k==null?void 0:k.type,isOpen:t,oauthRequired:(Pr=(De=E==null?void 0:E.data)==null?void 0:De.oauth)==null?void 0:Pr.required,oauthStatus:W.status,toolsQueryEnabled:I&&(k.type==="mcp"||k.type==="local-mcp")&&t&&(k.type==="local-mcp"||W.status==="authenticated"||W.status==="not_required"),mcpToolsLoading:V});const{data:q,isLoading:j,error:S}=Zt({queryKey:["/api/proxy/a2a",k==null?void 0:k.id,"manifest"],queryFn:async()=>{if(!k||k.type!=="a2a")return null;const be=await(await ke("GET",`/api/proxy/a2a/${k.id}/manifest`)).text();return JSON.parse(be)},enabled:I&&k.type==="a2a"&&t,staleTime:0,gcTime:2*60*1e3}),N=(F==null?void 0:F.data)||[],M=q,H=V||j;console.log("ServiceDetailsModal Debug:",{service:e==null?void 0:e.id,serviceType:e==null?void 0:e.type,isOpen:t,mcpDiscoveryLoading:U,mcpDiscoveryData:E,mcpDiscoveryError:P?String(P):null,mcpToolsLoading:V,a2aManifestLoading:j,mcpToolsError:D?String(D):null,a2aManifestError:S?String(S):null,mcpToolsCount:N.length,mcpToolsData:F,hasA2aManifest:!!M,isLoading:H,oauthRequired:(Rr=(Tr=E==null?void 0:E.data)==null?void 0:Tr.oauth)==null?void 0:Rr.required,oauthStatus:W.status,oauthMessage:W.message,oauthAuthenticated:z==null?void 0:z.authenticated,expiresAt:z==null?void 0:z.expiresAt}),y.useEffect(()=>{if(!t){m(null);return}e&&(m(e),d(e.name||""),g(e.description||""))},[e,t]);const G=y.useRef(!1);y.useEffect(()=>{if(!t||!(k!=null&&k.id)){G.current=!1;return}if(!(z!=null&&z.authenticated)){G.current=!1;return}if(G.current)return;G.current=!0,(async()=>{C({title:"OAuth completed",description:"Authentication successful! Refreshing service status..."}),_.invalidateQueries({queryKey:["/api/services",k.id]}),_.invalidateQueries({queryKey:["/api/mcp/discover",k.url]}),_.invalidateQueries({queryKey:["/api/collection-warnings"]});try{const be=await ke("GET",`/api/services/${k.id}`);if(be.ok){const Q=await be.json();m(Q.data??Q)}}catch{}await O(),_.invalidateQueries({queryKey:["/api/services",k.id,"tools"]}),await T()})()},[z==null?void 0:z.authenticated,t,k==null?void 0:k.id]);const me=()=>(e==null?void 0:e.type)==="mcp"?a.jsx(Ow,{className:"w-6 h-6"}):a.jsx(_h,{className:"w-6 h-6"}),ne=()=>(e==null?void 0:e.type)==="mcp"?"text-blue-400":"text-purple-400",ue=()=>(e==null?void 0:e.type)==="mcp"?"bg-blue-500/20":"bg-purple-500/20",ye=le=>new Date(le).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});y.useEffect(()=>{var le,be;o&&((le=x.current)==null||le.focus(),(be=x.current)==null||be.select())},[o]);const Be=async()=>{const le=($==null?void 0:$.name)||"",be=u.trim();if(!$||!be||be===le){d(le),i(!1);return}b(!0);try{await ke("PUT",`/api/services/${$.id}`,{name:be}),m({...$,name:be}),_.invalidateQueries({queryKey:["/api/services"]}),_.invalidateQueries({queryKey:["/api/collection/warnings"]}),_.invalidateQueries({queryKey:["/api/decks"]}),i(!1)}catch(Q){d(le),i(!1),C({title:"Could not rename service",description:Q instanceof Error?Q.message:"Failed to update name",variant:"destructive"})}finally{b(!1)}},pt=async()=>{if(e){w(!0);try{if((await ke("PUT",`/api/services/${e.id}`,{description:f.trim()})).ok){if(p){const be={...p,description:f.trim()};m(be)}_.invalidateQueries({queryKey:["/api/services"]}),_.invalidateQueries({queryKey:["/api/collection/warnings"]}),_.invalidateQueries({queryKey:["/api/decks"]}),_.invalidateQueries({queryKey:["/api/decks"]}),C({title:"Description updated",description:"Service description has been updated successfully."}),c(!1)}else throw new Error("Failed to update description")}catch{C({title:"Update failed",description:"Failed to update service description. Please try again.",variant:"destructive"})}finally{w(!1)}}};return a.jsx(co,{open:t,onOpenChange:r,children:a.jsxs(cs,{className:"sm:max-w-6xl bg-gradient-to-br from-cosmic-900 to-cosmic-800 border border-white/20 text-white max-h-[90vh] overflow-y-auto",children:[a.jsx(us,{children:a.jsxs(ds,{className:"text-2xl font-bold flex items-center",children:[me(),a.jsx("div",{className:"ml-3 flex min-w-0 items-center",children:o?a.jsx("input",{ref:x,type:"text",value:u,disabled:v,onChange:le=>d(le.target.value),onBlur:()=>{Be()},onKeyDown:le=>{le.key==="Enter"?(le.preventDefault(),Be()):le.key==="Escape"&&(le.preventDefault(),d(($==null?void 0:$.name)||""),i(!1))},className:"max-w-[16rem] rounded border border-white/20 bg-white/10 px-2 py-1 text-2xl font-bold text-white focus:border-white/40 focus:outline-none sm:max-w-[20rem]","aria-label":"Service name","data-testid":"input-service-name"}):a.jsx("button",{type:"button",className:"min-w-0 truncate text-left hover:underline",title:"Click to rename",onClick:()=>{d(($==null?void 0:$.name)||""),i(!0)},"data-testid":"button-rename-service",children:$==null?void 0:$.name})}),a.jsx(pn,{className:`ml-3 ${ue()} ${ne()}`,children:(mt=e==null?void 0:e.type)==null?void 0:mt.toUpperCase()})]})}),e&&a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[a.jsx("div",{className:"mb-3",children:a.jsxs("h3",{className:"text-lg font-semibold flex items-center",children:[a.jsx(FR,{className:"w-5 h-5 mr-2"}),"Service Overview"]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("p",{className:"text-gray-300 text-sm",children:"Description"}),!l&&a.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>c(!0),className:"h-6 w-6 p-0 opacity-0 hover:opacity-100 transition-opacity",title:"Edit description",children:a.jsx(cv,{className:"w-3 h-3"})})]}),l?a.jsxs("div",{className:"space-y-2",children:[a.jsx("textarea",{value:f,onChange:le=>g(le.target.value),className:"w-full bg-black/30 border border-white/20 rounded px-2 py-1 text-white focus:outline-none focus:border-white/40 resize-none",rows:3,placeholder:"Enter description...",autoFocus:!0}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(ie,{size:"sm",onClick:pt,disabled:h,className:"h-6 px-2 text-xs",children:h?"Saving...":"Save"}),a.jsx(ie,{size:"sm",variant:"outline",onClick:()=>{c(!1),g(($==null?void 0:$.description)||"")},className:"h-6 px-2 text-xs",children:"Cancel"})]})]}):a.jsx("p",{className:"text-white cursor-pointer hover:bg-white/10 px-2 py-1 rounded transition-colors",onClick:()=>c(!0),title:"Click to edit description",children:($==null?void 0:$.description)||"No description"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Endpoint"}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(pn,{variant:"outline",className:"border-blue-500/30 text-blue-300",children:k.type.toUpperCase()}),e.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0&&a.jsx(pn,{variant:"outline",className:"border-green-500/30 text-green-300",children:"Custom Headers"})]}),a.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>window.open(k.url,"_blank"),className:"p-1 h-auto",children:a.jsx(Gn,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"text-xs text-gray-400 break-all bg-black/20 p-2 rounded border border-white/10",children:k.url||"No URL available"}),e.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0&&a.jsxs("div",{className:"text-xs text-gray-400 bg-black/20 p-2 rounded border border-white/10",children:[a.jsx("p",{className:"font-semibold mb-1",children:"Custom Headers:"}),a.jsx("pre",{className:"text-xs overflow-x-auto",children:JSON.stringify(e.headers,null,2)})]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Health Status"}),a.jsx(pn,{className:k.health==="healthy"?"bg-green-500/20 text-green-300":k.health==="unhealthy"?"bg-red-500/20 text-red-300":"bg-amber-500/20 text-amber-200",children:k.health==="healthy"?"Healthy":k.health==="unhealthy"?"Unreachable":W.status==="required"||W.status==="expired"?"Auth required":"Unknown"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Registered"}),a.jsx("p",{className:"text-white text-sm",children:ye(k.registeredAt)})]})]})]}),H&&a.jsxs("div",{className:"text-center py-8",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-white mx-auto mb-4"}),a.jsx("p",{className:"text-gray-400",children:"Fetching service details..."})]}),n&&a.jsx("div",{className:"bg-red-500/20 border border-red-500/30 rounded-lg p-4",children:a.jsx("p",{className:"text-red-300",children:n})}),(e.type==="mcp"||e.type==="local-mcp")&&a.jsxs(a.Fragment,{children:[e.type==="local-mcp"&&a.jsxs("div",{className:"bg-cyan-500/15 border border-cyan-500/30 rounded-lg p-4 mb-4",children:[a.jsx("h3",{className:"text-cyan-200 font-semibold mb-2",children:"Local MCP — auth happens outside Agent Deck"}),a.jsx("div",{className:"text-cyan-100/90 text-sm space-y-2",children:eD(k)?a.jsxs(a.Fragment,{children:[a.jsxs("p",{children:["This card runs ",a.jsx("code",{className:"text-xs",children:"@piotr-agier/google-drive-mcp"})," on your machine. Agent Deck does ",a.jsx("strong",{children:"not"}),' handle Google OAuth for it. If Google shows "app not verified", that is ',a.jsx("strong",{children:"your Google Cloud project"}),", not Agent Deck."]}),a.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-1",children:[a.jsxs("li",{children:["Create a GCP OAuth client type ",a.jsx("strong",{children:"Desktop app"})," (not Web)."]}),a.jsxs("li",{children:["Add yourself as a ",a.jsx("strong",{children:"Test user"})," on the consent screen."]}),a.jsxs("li",{children:["Run in terminal first:"," ",a.jsx("code",{className:"text-xs block mt-1 bg-black/30 p-2 rounded whitespace-pre-wrap",children:`export GOOGLE_DRIVE_OAUTH_CREDENTIALS="/path/to/gcp-oauth.keys.json"
|
|
373
|
+
export GOOGLE_DRIVE_MCP_AUTH_PORT=3100
|
|
374
|
+
npx @piotr-agier/google-drive-mcp auth`})]}),a.jsxs("li",{children:["Set ",a.jsx("code",{className:"text-xs",children:"GOOGLE_DRIVE_MCP_TOKEN_PATH"})," in the card env to the same token file (",a.jsx("code",{className:"text-xs",children:"~/.config/google-drive-mcp/tokens.json"}),")."]})]}),a.jsxs("p",{className:"text-xs text-cyan-200/80",children:["Full steps: ",a.jsx("code",{className:"text-xs",children:"docs/GOOGLE_DRIVE_WORKAROUND.md"})," in the repo."]})]}):a.jsx("p",{children:"Local servers manage their own credentials (API keys, OAuth, etc.) in the spawned process. Complete any login in the terminal or config for that package before expecting tools here."})})]}),a.jsx(X4,{serviceId:k.id,tools:N,isLoading:V})]}),e.type==="a2a"&&M&&a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[a.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center",children:[a.jsx(YR,{className:"w-5 h-5 mr-2"}),"Agent Overview"]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Agent Name"}),a.jsx("p",{className:"text-white font-semibold",children:M.name})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Version"}),a.jsx("p",{className:"text-white",children:M.version})]}),a.jsxs("div",{className:"md:col-span-2",children:[a.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Description"}),a.jsx("p",{className:"text-white",children:M.description})]}),M.provider&&a.jsxs("div",{children:[a.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Provider"}),a.jsx("p",{className:"text-white",children:M.provider.organization})]}),M.documentationUrl&&a.jsxs("div",{children:[a.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Documentation"}),a.jsxs(ie,{size:"sm",variant:"ghost",onClick:()=>window.open(M.documentationUrl,"_blank"),className:"p-1 h-auto text-purple-300",children:[a.jsx(Gn,{className:"w-4 h-4 mr-1"}),"View Docs"]})]})]})]}),M.capabilities&&a.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[a.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center",children:[a.jsx(zk,{className:"w-5 h-5 mr-2"}),"Capabilities"]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[M.capabilities.streaming&&a.jsx(pn,{className:"bg-green-500/20 text-green-300",children:"Streaming"}),M.capabilities.pushNotifications&&a.jsx(pn,{className:"bg-blue-500/20 text-blue-300",children:"Push Notifications"}),M.capabilities.stateTransitionHistory&&a.jsx(pn,{className:"bg-purple-500/20 text-purple-300",children:"State History"})]})]}),M.skills&&M.skills.length>0&&a.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[a.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center",children:[a.jsx(_h,{className:"w-5 h-5 mr-2"}),"Skills (",M.skills.length,")"]}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-4",children:M.skills.map((le,be)=>a.jsxs("div",{className:"relative group cursor-pointer transform hover:scale-105 transition-all duration-300",style:{aspectRatio:"2/3",background:"linear-gradient(135deg, rgba(147, 51, 234, 0.1), rgba(196, 181, 253, 0.1))",border:"2px solid rgba(147, 51, 234, 0.3)",borderRadius:"12px",boxShadow:"0 4px 20px rgba(147, 51, 234, 0.2)",minWidth:"120px",maxWidth:"160px"},children:[a.jsx("div",{className:"absolute top-2 left-2 text-xs font-bold",children:a.jsx("div",{className:"text-purple-300 leading-none",children:"S"})}),a.jsx("div",{className:"absolute bottom-2 right-2 text-xs font-bold rotate-180",children:a.jsx("div",{className:"text-purple-300 leading-none",children:"S"})}),a.jsxs("div",{className:"absolute inset-x-3 top-8 bottom-8 flex flex-col items-center justify-center text-center",children:[a.jsx("div",{className:"text-purple-300 mb-2",children:a.jsx(_h,{className:"w-6 h-6"})}),a.jsx("h4",{className:"font-bold text-sm mb-2 line-clamp-2 text-white",children:le.name}),a.jsx("p",{className:"text-gray-300 text-xs line-clamp-4 mb-2",children:le.description}),le.tags&&le.tags.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1 justify-center",children:le.tags.slice(0,2).map((Q,Fe)=>a.jsx("span",{className:"text-purple-300 text-xs bg-purple-500/20 px-1 py-0.5 rounded",children:Q},Fe))})]}),a.jsx("div",{className:"absolute inset-0 rounded-lg bg-gradient-to-br from-transparent via-purple-500/5 to-transparent opacity-0 group-hover:opacity-100 transition-all duration-500 pointer-events-none"})]},be))})]}),(M.defaultInputModes||M.defaultOutputModes)&&a.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[a.jsxs("h3",{className:"text-lg font-semibold mb-3 flex items-center",children:[a.jsx(Ow,{className:"w-5 h-5 mr-2"}),"Data Modes"]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[M.defaultInputModes&&a.jsxs("div",{children:[a.jsx("p",{className:"text-gray-300 text-sm mb-2",children:"Input Modes"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:M.defaultInputModes.map((le,be)=>a.jsx(pn,{className:"bg-blue-500/20 text-blue-300 text-xs",children:le},be))})]}),M.defaultOutputModes&&a.jsxs("div",{children:[a.jsx("p",{className:"text-gray-300 text-sm mb-2",children:"Output Modes"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:M.defaultOutputModes.map((le,be)=>a.jsx(pn,{className:"bg-green-500/20 text-green-300 text-xs",children:le},be))})]})]})]})]}),(e==null?void 0:e.type)==="mcp"&&W.status==="not_required"&&(k==null?void 0:k.id)&&a.jsxs("div",{className:"bg-blue-500/20 border border-blue-500/30 rounded-lg p-4 mb-4",children:[a.jsx("h3",{className:"text-blue-300 font-semibold mb-2",children:"How to connect"}),a.jsx(dx,{serviceId:k.id})]}),(e==null?void 0:e.type)==="mcp"&&W.status!=="authenticated"&&W.status!=="not_required"&&a.jsxs("div",{className:`${W.status==="expired"?"bg-red-500/20 border-red-500/30":"bg-orange-500/20 border-orange-500/30"} rounded-lg p-4 mb-4`,children:[a.jsx("h3",{className:`${W.status==="expired"?"text-red-300":"text-orange-300"} font-semibold mb-2`,children:W.status==="expired"?"⏰ Token Expired":"🔐 Authentication Required"}),a.jsxs("div",{className:`${W.status==="expired"?"text-red-200":"text-orange-200"} text-sm space-y-2`,children:[a.jsx("p",{children:a.jsx("strong",{children:W.message})}),a.jsx("p",{children:W.status==="expired"?"Your OAuth token has expired. Please re-authenticate to continue using this service.":"This MCP server requires OAuth authentication to access its tools. Please authenticate to continue."}),(k==null?void 0:k.id)&&a.jsx(dx,{serviceId:k.id,onConnected:()=>void K()}),((ho=(ir=E==null?void 0:E.data)==null?void 0:ir.oauth)==null?void 0:ho.resourceName)&&a.jsx("div",{className:"mt-3 p-2 bg-orange-500/10 rounded border border-orange-500/20 text-xs text-orange-100",children:a.jsxs("p",{children:[a.jsx("strong",{children:"Resource:"})," ",E.data.oauth.resourceName]})})]})]}),(e==null?void 0:e.type)==="mcp"&&a.jsxs("div",{className:"bg-gray-800/50 border border-gray-600/30 rounded-lg p-4 mb-4",children:[a.jsx("h3",{className:"text-gray-300 font-semibold mb-2",children:"Connection Logs"}),a.jsxs("div",{className:"text-gray-200 text-sm space-y-2",children:[a.jsxs("div",{className:"bg-black/30 p-2 rounded text-xs",children:[a.jsx("p",{children:a.jsx("strong",{children:"🔍 Attempting to discover tools for MCP service:"})}),a.jsxs("p",{children:["Service ID: ",e==null?void 0:e.id]}),a.jsxs("p",{children:["Service URL: ",k==null?void 0:k.url]}),a.jsxs("p",{children:["Status: ",V?"🔄 Loading...":D?"❌ Failed":"✅ Complete"]})]}),V&&a.jsxs("div",{className:"bg-yellow-500/20 p-2 rounded text-xs",children:[a.jsxs("p",{children:["🔄 Making HTTP request to: ",a.jsxs("code",{children:["GET /api/services/",e==null?void 0:e.id,"/tools"]})]}),a.jsxs("p",{children:["Target MCP server: ",a.jsx("code",{children:k==null?void 0:k.url})]})]}),D&&a.jsxs("div",{className:"bg-red-500/20 p-2 rounded text-xs",children:[a.jsx("p",{children:"❌ Request failed:"}),a.jsx("pre",{className:"whitespace-pre-wrap overflow-x-auto",children:D instanceof Error?D.message:String(D)}),a.jsxs("div",{className:"mt-2 p-2 bg-black/30 rounded",children:[a.jsx("p",{children:a.jsx("strong",{children:"🔍 What we tried:"})}),a.jsxs("p",{children:["• Service ID: ",e==null?void 0:e.id]}),a.jsxs("p",{children:["• Target URL: ",k==null?void 0:k.url]}),a.jsxs("p",{children:["• Request: GET /api/services/",e==null?void 0:e.id,"/tools"]}),(k==null?void 0:k.headers)&&a.jsxs("div",{children:[a.jsx("p",{children:a.jsx("strong",{children:"📋 Headers sent:"})}),a.jsx("pre",{className:"text-xs overflow-x-auto",children:JSON.stringify(k.headers,null,2)})]}),a.jsxs("div",{className:"mt-2",children:[a.jsx("p",{children:a.jsx("strong",{children:"💡 What this means:"})}),a.jsxs("p",{children:["• The MCP server at ",k==null?void 0:k.url," returned an error"]}),a.jsx("p",{children:"• This could be due to authentication issues, server being down, or invalid configuration"}),a.jsx("p",{children:"• Check the error message above for specific details from the MCP server"})]})]})]}),!V&&!D&&N.length>0&&a.jsx("div",{className:"bg-green-500/20 p-2 rounded text-xs",children:a.jsxs("p",{children:["✅ Successfully discovered ",N.length," tools from MCP server"]})}),!V&&!D&&N.length===0&&a.jsxs("div",{className:"bg-yellow-500/20 p-2 rounded text-xs",children:[a.jsx("p",{children:"⚠️ Connected to MCP server but no tools were found"}),a.jsx("p",{children:"This could mean the server has no tools or requires specific authentication"})]})]})]}),D&&(e.type==="mcp"||e.type==="local-mcp")&&a.jsxs("div",{className:"bg-red-500/20 border border-red-500/30 rounded-lg p-4",children:[a.jsx("h3",{className:"text-red-300 font-semibold mb-2",children:"MCP Tool Discovery Failed"}),a.jsxs("div",{className:"text-red-200 text-sm space-y-2",children:[a.jsx("p",{children:a.jsx("strong",{children:"Raw Error:"})}),a.jsx("pre",{className:"bg-black/30 p-2 rounded text-xs overflow-x-auto whitespace-pre-wrap",children:D instanceof Error?D.message:String(D)}),a.jsxs("p",{children:[a.jsx("strong",{children:"Service URL:"})," ",k==null?void 0:k.url]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Service ID:"})," ",k==null?void 0:k.id]}),(k==null?void 0:k.headers)&&a.jsxs("div",{children:[a.jsx("p",{children:a.jsx("strong",{children:"Custom Headers:"})}),a.jsx("pre",{className:"bg-black/30 p-2 rounded text-xs overflow-x-auto",children:JSON.stringify(k.headers,null,2)})]})]})]}),S&&e.type==="a2a"&&a.jsxs("div",{className:"bg-red-500/20 border border-red-500/30 rounded-lg p-4",children:[a.jsx("h3",{className:"text-red-300 font-semibold mb-2",children:"A2A Manifest Discovery Failed"}),a.jsxs("div",{className:"text-red-200 text-sm space-y-2",children:[a.jsx("p",{children:a.jsx("strong",{children:"Raw Error:"})}),a.jsx("pre",{className:"bg-black/30 p-2 rounded text-xs overflow-x-auto whitespace-pre-wrap",children:S instanceof Error?S.message:String(S)}),a.jsxs("p",{children:[a.jsx("strong",{children:"Service URL:"})," ",k==null?void 0:k.url]}),a.jsxs("p",{children:[a.jsx("strong",{children:"Service ID:"})," ",k==null?void 0:k.id]})]})]}),!H&&!D&&!S&&(e.type==="mcp"||e.type==="local-mcp")&&N.length===0&&(e.type==="local-mcp"||!((si=(fs=E==null?void 0:E.data)==null?void 0:fs.oauth)!=null&&si.required))&&a.jsxs("div",{className:"bg-yellow-500/20 border border-yellow-500/30 rounded-lg p-4",children:[a.jsx("h3",{className:"text-yellow-300 font-semibold mb-2",children:"No Tools Available"}),a.jsxs("p",{className:"text-yellow-200 text-sm",children:["Successfully connected to MCP server at ",k==null?void 0:k.url,", but no tools were discovered."]}),a.jsxs("div",{className:"text-yellow-200 text-xs mt-2",children:[a.jsx("p",{children:a.jsx("strong",{children:"This could mean:"})}),a.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[a.jsx("li",{children:"The MCP server has no tools registered"}),a.jsx("li",{children:"Tools require specific authentication"}),a.jsx("li",{children:"Tools are only available after certain operations"})]})]})]}),(e.type==="mcp"||e.type==="local-mcp")&&a.jsxs("div",{className:"bg-blue-500/20 border border-blue-500/30 rounded-lg p-4",children:[a.jsx("h3",{className:"text-blue-300 font-semibold mb-2",children:"🔍 MCP Server Analysis"}),a.jsxs("div",{className:"text-blue-200 text-sm space-y-2",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Server URL:"})," ",k==null?void 0:k.url]}),U&&a.jsx("div",{className:"mt-3 p-3 bg-black/30 rounded",children:a.jsx("p",{children:"🔍 Analyzing MCP server configuration..."})}),E&&a.jsxs("div",{className:"mt-3 p-3 bg-black/30 rounded",children:[a.jsx("p",{children:a.jsx("strong",{children:"🔍 What we discovered:"})}),E.error&&E.analysis&&a.jsxs("div",{className:"text-yellow-200",children:[E.analysis.auth_type==="oauth2"&&a.jsxs("div",{children:[a.jsxs("p",{children:["• ",a.jsx("strong",{children:"OAuth 2.0 Authentication Required"})]}),a.jsx("p",{children:"• This MCP server requires OAuth 2.0 Bearer token authentication"}),a.jsx("p",{children:"• You'll need to provide OAuth credentials (client ID, client secret, authorization URL, token URL)"}),a.jsx("p",{children:"• Check the service provider's documentation for OAuth setup instructions"})]}),E.analysis.protocol==="sse"&&a.jsxs("div",{children:[a.jsxs("p",{children:["• ",a.jsx("strong",{children:"SSE Protocol Required"})]}),a.jsx("p",{children:"• This MCP server uses Server-Sent Events (SSE) protocol"}),a.jsx("p",{children:"• We'll need to connect using event streaming instead of HTTP"})]}),E.analysis.issue==="not_found"&&a.jsxs("div",{children:[a.jsxs("p",{children:["• ",a.jsx("strong",{children:"Server Not Found"})]}),a.jsx("p",{children:"• The MCP server URL might be incorrect"}),a.jsx("p",{children:"• Check if the server is running and the URL is correct"})]}),E.analysis.issue==="server_error"&&a.jsxs("div",{children:[a.jsxs("p",{children:["• ",a.jsx("strong",{children:"Server Error"})]}),a.jsx("p",{children:"• The MCP server is experiencing internal errors"}),a.jsx("p",{children:"• Try again later or contact the service provider"})]}),E.analysis.message&&a.jsxs("p",{children:["• ",a.jsx("strong",{children:"Analysis:"})," ",E.analysis.message]})]}),((Nc=(Ec=E==null?void 0:E.data)==null?void 0:Ec.oauth)==null?void 0:Nc.required)&&a.jsxs("div",{className:"text-yellow-200",children:[a.jsxs("p",{children:["• ",a.jsx("strong",{children:"OAuth 2.0 Authentication Required"})]}),E.data.oauth.authorizationUrl&&a.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[a.jsx(ie,{size:"sm",variant:"default",className:"h-7",onClick:async()=>{var le,be;if(k!=null&&k.id)try{C({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const Q=await ke("POST",`/api/oauth/${k.id}/auto-setup`,{});if(!Q.ok){const bt=await Q.json();(le=bt.data)!=null&&le.registrationUrl?(window.open(bt.data.registrationUrl,"_blank"),C({title:"OAuth Registration Required",description:`${bt.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):C({title:"OAuth Setup Failed",description:bt.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Fe=await Q.json();Fe.success&&((be=Fe.data)!=null&&be.authorizationUrl)?(window.open(Fe.data.authorizationUrl,"_blank"),C({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),K()):C({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(Q){C({title:"OAuth Setup Failed",description:Q instanceof Error?Q.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),a.jsxs(ie,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(E.data.oauth.authorizationUrl,"_blank"),children:[a.jsx(Gn,{className:"w-4 h-4 mr-1"}),"Open Raw Authorization URL"]})]}),!E.data.oauth.authorizationUrl&&E.data.oauth.protectedResourceConfigUrl&&a.jsx("div",{className:"mt-2",children:a.jsxs(ie,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(E.data.oauth.protectedResourceConfigUrl,"_blank"),children:[a.jsx(Gn,{className:"w-4 h-4 mr-1"}),"View OAuth Configuration"]})}),E.data.oauth.authorizationServerMetadataUrl&&a.jsxs("div",{className:"mt-2 text-xs text-gray-300",children:[a.jsx("span",{className:"mr-1",children:"Auth Server Metadata:"}),a.jsx("button",{className:"underline text-blue-300",onClick:()=>window.open(E.data.oauth.authorizationServerMetadataUrl,"_blank"),children:E.data.oauth.authorizationServerMetadataUrl})]})]}),(E==null?void 0:E.success)&&!((Oa=(jc=E==null?void 0:E.data)==null?void 0:jc.oauth)!=null&&Oa.required)&&a.jsxs("div",{className:"text-green-200",children:[a.jsxs("p",{children:["• ",a.jsx("strong",{children:"✅ Server Analysis Complete"})]}),a.jsx("p",{children:"• MCP server is accessible and responding"}),a.jsx("p",{children:"• No authentication issues detected"}),a.jsx("p",{children:"• Protocol compatibility confirmed"})]}),((Da=(Ma=E==null?void 0:E.data)==null?void 0:Ma.oauth)==null?void 0:Da.required)&&a.jsxs("div",{className:"text-orange-200",children:[a.jsxs("p",{children:["• ",a.jsx("strong",{children:"🔐 OAuth 2.0 Authentication Required"})]}),a.jsx("p",{children:"• This MCP server requires OAuth authentication"}),E.data.oauth.resourceName&&a.jsxs("p",{children:["• Service: ",E.data.oauth.resourceName]}),E.data.oauth.authorizationUrl&&a.jsxs("p",{children:["• Authorization URL: ",E.data.oauth.authorizationUrl]}),E.data.oauth.tokenUrl&&a.jsxs("p",{children:["• Token URL: ",E.data.oauth.tokenUrl]}),a.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[a.jsx(ie,{size:"sm",variant:"default",className:"bg-orange-600 hover:bg-orange-700",onClick:async()=>{var le,be;if(k!=null&&k.id)try{C({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const Q=await ke("POST",`/api/oauth/${k.id}/auto-setup`,{});if(!Q.ok){const bt=await Q.json();(le=bt.data)!=null&&le.registrationUrl?(window.open(bt.data.registrationUrl,"_blank"),C({title:"OAuth Registration Required",description:`${bt.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):C({title:"OAuth Setup Failed",description:bt.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Fe=await Q.json();Fe.success&&((be=Fe.data)!=null&&be.authorizationUrl)?(window.open(Fe.data.authorizationUrl,"_blank"),C({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),K()):C({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(Q){C({title:"OAuth Setup Failed",description:Q instanceof Error?Q.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),a.jsx(ie,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-300 hover:bg-orange-500/10",onClick:()=>{const le=`OAuth Setup Instructions:
|
|
375
|
+
|
|
376
|
+
1. Go to the service provider's OAuth/Developer settings
|
|
377
|
+
2. Create a new OAuth application
|
|
378
|
+
3. Set Redirect URL: http://localhost:8000/api/oauth/${k==null?void 0:k.id}/callback
|
|
379
|
+
4. Copy the Client ID and Client Secret
|
|
380
|
+
5. Edit this service and add the credentials
|
|
381
|
+
|
|
382
|
+
${E.data.oauth.authorizationUrl?`Authorization URL: ${E.data.oauth.authorizationUrl}`:""}
|
|
383
|
+
${E.data.oauth.tokenUrl?`Token URL: ${E.data.oauth.tokenUrl}`:""}
|
|
384
|
+
${E.data.oauth.issuer?`Issuer: ${E.data.oauth.issuer}`:""}`;C({title:"OAuth Setup Instructions",description:le,duration:1e4})},children:"📋 Setup Instructions"})]})]}),a.jsxs("div",{className:"mt-2 text-xs",children:[a.jsx("p",{children:a.jsx("strong",{children:"💡 Next Steps:"})}),a.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[a.jsx("li",{children:"For OAuth servers: Provide OAuth credentials in service settings"}),a.jsx("li",{children:"For SSE servers: We'll automatically use the correct protocol"}),a.jsx("li",{children:"For connection issues: Verify the server URL and status"})]})]})]}),P&&a.jsxs("div",{className:"mt-3 p-3 bg-red-500/20 rounded",children:[a.jsx("p",{children:a.jsx("strong",{children:"❌ Discovery Failed"})}),a.jsx("p",{children:"Could not analyze MCP server configuration"}),a.jsx("pre",{className:"text-xs overflow-x-auto",children:P instanceof Error?P.message:String(P)})]})]})]}),!H&&!D&&!S&&e.type==="a2a"&&!M&&a.jsxs("div",{className:"bg-yellow-500/20 border border-yellow-500/30 rounded-lg p-4",children:[a.jsx("h3",{className:"text-yellow-300 font-semibold mb-2",children:"Agent Details Not Available"}),a.jsxs("p",{className:"text-yellow-200 text-sm",children:["Successfully connected to A2A agent at ",k==null?void 0:k.url,", but no manifest was found."]}),a.jsxs("div",{className:"text-yellow-200 text-xs mt-2",children:[a.jsx("p",{children:a.jsx("strong",{children:"This could mean:"})}),a.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[a.jsx("li",{children:"The agent doesn't provide a manifest"}),a.jsx("li",{children:"Manifest endpoint is not implemented"}),a.jsx("li",{children:"Agent requires specific authentication"})]})]})]})]})]})})}function rD({open:e,onOpenChange:t}){const[r,n]=y.useState(null),[s,o]=y.useState(null),[i,l]=y.useState(null),[c,u]=y.useState(!1),d=Qt(),{toast:f}=Ut(),g=()=>{n(null),o(null),l(null),u(!1)},v=yt({mutationFn:async()=>{if(!r)throw new Error("Choose a bundle file first");const h=await r.text();let w;try{w=JSON.parse(h)}catch{throw new Error("File is not valid JSON")}return L4(w)},onSuccess:h=>{l(h),d.invalidateQueries({queryKey:["/api/decks"]}),d.invalidateQueries({queryKey:["/api/services"]}),d.invalidateQueries({queryKey:["/api/playbooks"]}),d.invalidateQueries({queryKey:["/api/playbooks/collection"]}),d.invalidateQueries({queryKey:["/api/credentials/collection"]}),d.invalidateQueries({queryKey:["/api/collection/warnings"]}),f({title:"Import complete",description:ux(h)})},onError:h=>{f({title:"Import failed",description:h.message,variant:"destructive"})}}),b=async h=>{var w,p,m;if(n(h),l(null),!h){o(null);return}try{const x=await h.text(),_=JSON.parse(x);o(`${((w=_.services)==null?void 0:w.length)??0} services · ${((p=_.playbooks)==null?void 0:p.length)??0} playbooks · ${((m=_.decks)==null?void 0:m.length)??0} decks`)}catch{o("Invalid JSON")}};return a.jsx(co,{open:e,onOpenChange:h=>{h||g(),t(h)},children:a.jsxs(cs,{className:"sm:max-w-lg border-border bg-[#161612] text-[#E8F6F4]",children:[a.jsxs(us,{children:[a.jsx(ds,{children:"Import bundle"}),a.jsx(ri,{asChild:!0,children:a.jsxs("div",{className:"space-y-2 text-left text-sm text-[#A8C4C0]",children:[a.jsx("p",{children:"Adds MCP, playbooks, and decks from a JSON file."}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-amber-200/90",children:"Notes"}),a.jsxs("ul",{className:"mt-1 list-disc space-y-0.5 pl-4",children:[a.jsx("li",{children:"Same name as an existing card or deck is skipped (linked only)."}),a.jsx("li",{children:"No credentials or secrets — re-enter keys and reconnect OAuth."})]})]})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ie,{htmlFor:"bundle-file",children:"Bundle file"}),a.jsx(He,{id:"bundle-file",type:"file",accept:".json,.agent-deck.json,application/json",className:"cursor-pointer bg-white/5 border-white/20",onChange:h=>{var w;return b(((w=h.target.files)==null?void 0:w[0])??null)},"data-testid":"input-import-bundle"}),s&&a.jsx("p",{className:"text-xs text-[#A8C4C0]","data-testid":"import-preview",children:s})]}),!i&&a.jsx(ie,{onClick:()=>v.mutate(),disabled:!r||v.isPending||s==="Invalid JSON",className:"rounded-full border px-6 text-sm font-semibold hover:opacity-90",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},"data-testid":"button-import-apply",children:v.isPending?"Importing…":"Import"}),i&&a.jsxs("div",{className:"space-y-2 rounded-lg border border-white/10 bg-white/5 p-3 text-sm","data-testid":"import-report",children:[a.jsx("p",{className:"font-medium",children:ux(i)}),i.servicesNeedingOauth.length>0&&a.jsxs("div",{children:[a.jsx("p",{className:"text-amber-200",children:"Needs OAuth reconnect:"}),a.jsx("ul",{className:"list-disc pl-5 text-[#A8C4C0]",children:i.servicesNeedingOauth.map(h=>a.jsx("li",{children:h},h))})]}),i.warnings.length>0&&a.jsxs("div",{children:[a.jsx("p",{className:"text-amber-200",children:"Warnings:"}),a.jsx("ul",{className:"list-disc pl-5 text-[#A8C4C0]",children:i.warnings.map(h=>a.jsx("li",{children:h},h))})]}),a.jsx(ie,{variant:"outline",size:"sm",className:"rounded-full border border-white/20 text-white hover:bg-white/10",onClick:()=>u(h=>!h),children:c?"Hide id map":"Show id map"}),c&&a.jsx("pre",{className:"max-h-40 overflow-auto rounded bg-black/40 p-2 text-xs",children:JSON.stringify(i.idMap,null,2)}),a.jsx(ie,{className:"rounded-full border px-6 text-sm font-semibold hover:opacity-90",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},onClick:()=>{g(),t(!1)},children:"Done"})]})]})]})})}function nD(){const[e,t]=y.useState("connecting"),[r,n]=y.useState(null),s=y.useRef(null),o=y.useRef(null),i=Qt();return y.useEffect(()=>{const c=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/ws/events`,u=()=>{try{const d=new WebSocket(c);s.current=d,d.onopen=()=>{console.log("WebSocket connected"),t("connected")},d.onmessage=f=>{try{const g=JSON.parse(f.data);n(g),g.type==="deck_update"?(console.log("Received deck update:",g),i.invalidateQueries({queryKey:["/api/decks"]}),i.invalidateQueries({queryKey:["/api/decks"]})):g.type==="service_update"?(console.log("Received service update:",g),i.invalidateQueries({queryKey:["/api/services"]})):g.type==="connection_status"&&t(g.status==="connected"?"connected":"disconnected")}catch(g){console.error("Failed to parse WebSocket message:",g)}},d.onclose=()=>{console.log("WebSocket disconnected"),t("disconnected"),o.current=setTimeout(()=>{console.log("Attempting to reconnect WebSocket..."),t("connecting"),u()},3e3)},d.onerror=f=>{console.error("WebSocket error:",f),t("disconnected")}}catch(d){console.error("Failed to connect WebSocket:",d),t("disconnected")}};return u(),()=>{o.current&&clearTimeout(o.current),s.current&&s.current.readyState===WebSocket.OPEN&&s.current.close()}},[i]),{connectionStatus:e,lastMessage:r}}async function fx(e,t){const r=e==="credential"?`credentialId=${encodeURIComponent(t)}`:`serviceId=${encodeURIComponent(t)}`;return(await(await ke("GET",`/api/playbooks/dependents/check?${r}`)).json()).data??[]}function sD(e){const[t,r]=y.useState(null),[n,s]=y.useState(null),[o,i]=y.useState(null),[l,c]=y.useState(!1),u=Qt(),{toast:d}=Ut(),f=()=>{if(!e)throw new Error("Select a deck to edit first");return e},g=yt({mutationFn:async P=>{var W,F,V;const O=f(),K=(W=(await(await ke("GET","/api/decks")).json()).data)==null?void 0:W.find(D=>D.id===O);if(!K)throw new Error("Selected deck not found");if((F=K.services)!=null&&F.some(D=>D.id===P))throw new Error("Service is already in the deck");const Z=((V=K.services)==null?void 0:V.length)??0;return ke("POST",`/api/decks/${O}/services`,{serviceId:P,position:Z})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Service added to deck",description:`${(t==null?void 0:t.name)||"Service"} has been added to the deck.`})},onError:P=>{d({title:"Failed to add service",description:P.message,variant:"destructive"})}}),v=yt({mutationFn:async P=>{var Z,W;const O=f(),K=(Z=(await(await ke("GET","/api/decks")).json()).data)==null?void 0:Z.find(F=>F.id===O);if((W=K==null?void 0:K.credentials)!=null&&W.some(F=>F.id===P))throw new Error("API key is already in the deck");return ke("POST",`/api/decks/${O}/credentials`,{credentialId:P})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"API key added to deck",description:`${(n==null?void 0:n.label)||"API key"} is scoped to this deck.`})},onError:P=>{d({title:"Failed to add API key",description:P.message,variant:"destructive"})}}),b=yt({mutationFn:async P=>{var Z,W;const O=f(),K=(Z=(await(await ke("GET","/api/decks")).json()).data)==null?void 0:Z.find(F=>F.id===O);if((W=K==null?void 0:K.playbooks)!=null&&W.some(F=>F.id===P))throw new Error("Playbook is already in the deck");return ke("POST",`/api/decks/${O}/playbooks`,{playbookId:P})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Playbook added to deck",description:`${(o==null?void 0:o.title)||"Playbook"} is on this deck.`})},onError:P=>{d({title:"Failed to add playbook",description:P.message,variant:"destructive"})}}),h=yt({mutationFn:async P=>{const O=await fx("service",P);if(O.length>0){const z=O.map(Z=>Z.title).join(", ");if(!window.confirm(`Warning: ${O.length} playbook(s) depend on this MCP (${z}). Remove from deck anyway?`))throw new Error("Cancelled")}const L=f();return ke("DELETE",`/api/decks/${L}/services`,{serviceId:P})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Service removed from deck",description:`${(t==null?void 0:t.name)||"Service"} has been removed from the deck.`})},onError:P=>{P.message!=="Cancelled"&&d({title:"Failed to remove service",description:P.message,variant:"destructive"})}}),w=yt({mutationFn:async P=>{const O=await fx("credential",P);if(O.length>0){const z=O.map(Z=>Z.title).join(", ");if(!window.confirm(`Warning: ${O.length} playbook(s) depend on this API key (${z}). Remove from deck anyway?`))throw new Error("Cancelled")}const L=f();return ke("DELETE",`/api/decks/${L}/credentials`,{credentialId:P})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"API key removed from deck",description:`${(n==null?void 0:n.label)||"API key"} is no longer on this deck.`})},onError:P=>{P.message!=="Cancelled"&&d({title:"Failed to remove API key",description:P.message,variant:"destructive"})}}),p=yt({mutationFn:async P=>{const O=f();return ke("DELETE",`/api/decks/${O}/playbooks`,{playbookId:P})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Playbook removed from deck",description:`${(o==null?void 0:o.title)||"Playbook"} is no longer on this deck.`})},onError:P=>{d({title:"Failed to remove playbook",description:P.message,variant:"destructive"})}}),m=(P,O)=>{P.currentTarget instanceof HTMLElement&&(P.currentTarget.style.opacity=O)},x=(P,O)=>{P.dataTransfer.setData("text/plain",O.id),P.dataTransfer.setData("application/json",JSON.stringify(O)),P.dataTransfer.effectAllowed=O.fromDeck?"move":"copy"},_=(P,O,L=!1)=>{r(O),s(null),i(null),c(L),x(P,{kind:"service",id:O.id,fromDeck:L}),m(P,"0.5")},C=(P,O,L=!1)=>{s(O),r(null),i(null),c(L),x(P,{kind:"credential",id:O.id,fromDeck:L}),m(P,"0.5")},$=(P,O,L=!1)=>{i(O),r(null),s(null),c(L),x(P,{kind:"playbook",id:O.id,fromDeck:L}),m(P,"0.5")},k=P=>{r(null),s(null),i(null),m(P,"1")},I=P=>{if(P.kind==="service"){P.fromDeck?h.mutate(P.id):g.mutate(P.id);return}if(P.kind==="credential"){P.fromDeck?w.mutate(P.id):v.mutate(P.id);return}P.fromDeck?p.mutate(P.id):b.mutate(P.id)};return{draggedService:t,draggedCredential:n,draggedPlaybook:o,isDraggingFromDeck:l,handleDragStart:_,handleCredentialDragStart:C,handlePlaybookDragStart:$,handleDragEnd:k,handleDrop:P=>{P.preventDefault();const O=P.dataTransfer.getData("application/json");if(O){try{I(JSON.parse(O))}catch{const L=P.dataTransfer.getData("text/plain");L&&t&&g.mutate(L)}r(null),s(null),i(null),c(!1)}},handleGlobalDrop:P=>{P.preventDefault();const O=P.dataTransfer.getData("application/json");if(O){try{const L=JSON.parse(O);L.fromDeck&&I(L)}catch{}r(null),s(null),i(null),c(!1)}},isDropping:g.isPending||v.isPending||b.isPending||h.isPending||w.isPending||p.isPending}}const Dh="agent-deck-editing-deck-id";function oD(e){const[t,r]=y.useState(()=>typeof window>"u"?null:localStorage.getItem(Dh));y.useEffect(()=>{if(e.length===0)return;if(!(t&&e.some(i=>i.id===t))){const i=e[0].id;r(i),localStorage.setItem(Dh,i)}},[e,t]);const n=o=>{r(o),localStorage.setItem(Dh,o)};return{editingDeck:e.find(o=>o.id===t)??null,editingDeckId:t,setEditingDeckId:n}}function hx(e,[t,r]){return Math.min(r,Math.max(t,e))}var iD=[" ","Enter","ArrowUp","ArrowDown"],aD=[" ","Enter"],Go="Select",[$f,Pf,lD]=nv(Go),[Pa,AH]=In(Go,[lD,$a]),Tf=$a(),[cD,uo]=Pa(Go),[uD,dD]=Pa(Go),iE=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:o,value:i,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:g,required:v,form:b}=e,h=Tf(t),[w,p]=y.useState(null),[m,x]=y.useState(null),[_,C]=y.useState(!1),$=Pv(u),[k,I]=eo({prop:n,defaultProp:s??!1,onChange:o,caller:Go}),[E,U]=eo({prop:i,defaultProp:l,onChange:c,caller:Go}),P=y.useRef(null),O=w?b||!!w.closest("form"):!0,[L,z]=y.useState(new Set),K=Array.from(L).map(Z=>Z.props.value).join(";");return a.jsx(_1,{...h,children:a.jsxs(cD,{required:v,scope:t,trigger:w,onTriggerChange:p,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:_,onValueNodeHasChildrenChange:C,contentId:Jn(),value:E,onValueChange:U,open:k,onOpenChange:I,dir:$,triggerPointerDownPosRef:P,disabled:g,children:[a.jsx($f.Provider,{scope:t,children:a.jsx(uD,{scope:e.__scopeSelect,onNativeOptionAdd:y.useCallback(Z=>{z(W=>new Set(W).add(Z))},[]),onNativeOptionRemove:y.useCallback(Z=>{z(W=>{const F=new Set(W);return F.delete(Z),F})},[]),children:r})}),O?a.jsxs(PE,{"aria-hidden":!0,required:v,tabIndex:-1,name:d,autoComplete:f,value:E,onChange:Z=>U(Z.target.value),disabled:g,form:b,children:[E===void 0?a.jsx("option",{value:""}):null,Array.from(L)]},K):null]})})};iE.displayName=Go;var aE="SelectTrigger",lE=y.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...s}=e,o=Tf(r),i=uo(aE,r),l=i.disabled||n,c=Ve(t,i.onTriggerChange),u=Pf(r),d=y.useRef("touch"),[f,g,v]=RE(h=>{const w=u().filter(x=>!x.disabled),p=w.find(x=>x.value===i.value),m=IE(w,h,p);m!==void 0&&i.onValueChange(m.value)}),b=h=>{l||(i.onOpenChange(!0),v()),h&&(i.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return a.jsx(wf,{asChild:!0,...o,children:a.jsx(_e.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":TE(i.value)?"":void 0,...s,ref:c,onClick:pe(s.onClick,h=>{h.currentTarget.focus(),d.current!=="mouse"&&b(h)}),onPointerDown:pe(s.onPointerDown,h=>{d.current=h.pointerType;const w=h.target;w.hasPointerCapture(h.pointerId)&&w.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(b(h),h.preventDefault())}),onKeyDown:pe(s.onKeyDown,h=>{const w=f.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&g(h.key),!(w&&h.key===" ")&&iD.includes(h.key)&&(b(),h.preventDefault())})})})});lE.displayName=aE;var cE="SelectValue",uE=y.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,children:o,placeholder:i="",...l}=e,c=uo(cE,r),{onValueNodeHasChildrenChange:u}=c,d=o!==void 0,f=Ve(t,c.onValueNodeChange);return Ft(()=>{u(d)},[u,d]),a.jsx(_e.span,{...l,ref:f,style:{pointerEvents:"none"},children:TE(c.value)?a.jsx(a.Fragment,{children:i}):o})});uE.displayName=cE;var fD="SelectIcon",dE=y.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...s}=e;return a.jsx(_e.span,{"aria-hidden":!0,...s,ref:t,children:n||"▼"})});dE.displayName=fD;var hD="SelectPortal",fE=e=>a.jsx(cc,{asChild:!0,...e});fE.displayName=hD;var Qo="SelectContent",hE=y.forwardRef((e,t)=>{const r=uo(Qo,e.__scopeSelect),[n,s]=y.useState();if(Ft(()=>{s(new DocumentFragment)},[]),!r.open){const o=n;return o?ti.createPortal(a.jsx(pE,{scope:e.__scopeSelect,children:a.jsx($f.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),o):null}return a.jsx(mE,{...e,ref:t})});hE.displayName=Qo;var Zr=10,[pE,fo]=Pa(Qo),pD="SelectContentImpl",mD=Bo("SelectContent.RemoveScroll"),mE=y.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:g,collisionPadding:v,sticky:b,hideWhenDetached:h,avoidCollisions:w,...p}=e,m=uo(Qo,r),[x,_]=y.useState(null),[C,$]=y.useState(null),k=Ve(t,H=>_(H)),[I,E]=y.useState(null),[U,P]=y.useState(null),O=Pf(r),[L,z]=y.useState(!1),K=y.useRef(!1);y.useEffect(()=>{if(x)return Cv(x)},[x]),kv();const Z=y.useCallback(H=>{const[G,...me]=O().map(ye=>ye.ref.current),[ne]=me.slice(-1),ue=document.activeElement;for(const ye of H)if(ye===ue||(ye==null||ye.scrollIntoView({block:"nearest"}),ye===G&&C&&(C.scrollTop=0),ye===ne&&C&&(C.scrollTop=C.scrollHeight),ye==null||ye.focus(),document.activeElement!==ue))return},[O,C]),W=y.useCallback(()=>Z([I,x]),[Z,I,x]);y.useEffect(()=>{L&&W()},[L,W]);const{onOpenChange:F,triggerPointerDownPosRef:V}=m;y.useEffect(()=>{if(x){let H={x:0,y:0};const G=ne=>{var ue,ye;H={x:Math.abs(Math.round(ne.pageX)-(((ue=V.current)==null?void 0:ue.x)??0)),y:Math.abs(Math.round(ne.pageY)-(((ye=V.current)==null?void 0:ye.y)??0))}},me=ne=>{H.x<=10&&H.y<=10?ne.preventDefault():x.contains(ne.target)||F(!1),document.removeEventListener("pointermove",G),V.current=null};return V.current!==null&&(document.addEventListener("pointermove",G),document.addEventListener("pointerup",me,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",G),document.removeEventListener("pointerup",me,{capture:!0})}}},[x,F,V]),y.useEffect(()=>{const H=()=>F(!1);return window.addEventListener("blur",H),window.addEventListener("resize",H),()=>{window.removeEventListener("blur",H),window.removeEventListener("resize",H)}},[F]);const[D,T]=RE(H=>{const G=O().filter(ue=>!ue.disabled),me=G.find(ue=>ue.ref.current===document.activeElement),ne=IE(G,H,me);ne&&setTimeout(()=>ne.ref.current.focus())}),q=y.useCallback((H,G,me)=>{const ne=!K.current&&!me;(m.value!==void 0&&m.value===G||ne)&&(E(H),ne&&(K.current=!0))},[m.value]),j=y.useCallback(()=>x==null?void 0:x.focus(),[x]),S=y.useCallback((H,G,me)=>{const ne=!K.current&&!me;(m.value!==void 0&&m.value===G||ne)&&P(H)},[m.value]),N=n==="popper"?ym:gE,M=N===ym?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:g,collisionPadding:v,sticky:b,hideWhenDetached:h,avoidCollisions:w}:{};return a.jsx(pE,{scope:r,content:x,viewport:C,onViewportChange:$,itemRefCallback:q,selectedItem:I,onItemLeave:j,itemTextRefCallback:S,focusSelectedItem:W,selectedItemText:U,position:n,isPositioned:L,searchRef:D,children:a.jsx(kf,{as:mD,allowPinchZoom:!0,children:a.jsx(_f,{asChild:!0,trapped:m.open,onMountAutoFocus:H=>{H.preventDefault()},onUnmountAutoFocus:pe(s,H=>{var G;(G=m.trigger)==null||G.focus({preventScroll:!0}),H.preventDefault()}),children:a.jsx(Ca,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:H=>H.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:a.jsx(N,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:H=>H.preventDefault(),...p,...M,onPlaced:()=>z(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...p.style},onKeyDown:pe(p.onKeyDown,H=>{const G=H.ctrlKey||H.altKey||H.metaKey;if(H.key==="Tab"&&H.preventDefault(),!G&&H.key.length===1&&T(H.key),["ArrowUp","ArrowDown","Home","End"].includes(H.key)){let ne=O().filter(ue=>!ue.disabled).map(ue=>ue.ref.current);if(["ArrowUp","End"].includes(H.key)&&(ne=ne.slice().reverse()),["ArrowUp","ArrowDown"].includes(H.key)){const ue=H.target,ye=ne.indexOf(ue);ne=ne.slice(ye+1)}setTimeout(()=>Z(ne)),H.preventDefault()}})})})})})})});mE.displayName=pD;var gD="SelectItemAlignedPosition",gE=y.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...s}=e,o=uo(Qo,r),i=fo(Qo,r),[l,c]=y.useState(null),[u,d]=y.useState(null),f=Ve(t,k=>d(k)),g=Pf(r),v=y.useRef(!1),b=y.useRef(!0),{viewport:h,selectedItem:w,selectedItemText:p,focusSelectedItem:m}=i,x=y.useCallback(()=>{if(o.trigger&&o.valueNode&&l&&u&&h&&w&&p){const k=o.trigger.getBoundingClientRect(),I=u.getBoundingClientRect(),E=o.valueNode.getBoundingClientRect(),U=p.getBoundingClientRect();if(o.dir!=="rtl"){const ue=U.left-I.left,ye=E.left-ue,Be=k.left-ye,pt=k.width+Be,Y=Math.max(pt,I.width),de=window.innerWidth-Zr,ee=hx(ye,[Zr,Math.max(Zr,de-Y)]);l.style.minWidth=pt+"px",l.style.left=ee+"px"}else{const ue=I.right-U.right,ye=window.innerWidth-E.right-ue,Be=window.innerWidth-k.right-ye,pt=k.width+Be,Y=Math.max(pt,I.width),de=window.innerWidth-Zr,ee=hx(ye,[Zr,Math.max(Zr,de-Y)]);l.style.minWidth=pt+"px",l.style.right=ee+"px"}const P=g(),O=window.innerHeight-Zr*2,L=h.scrollHeight,z=window.getComputedStyle(u),K=parseInt(z.borderTopWidth,10),Z=parseInt(z.paddingTop,10),W=parseInt(z.borderBottomWidth,10),F=parseInt(z.paddingBottom,10),V=K+Z+L+F+W,D=Math.min(w.offsetHeight*5,V),T=window.getComputedStyle(h),q=parseInt(T.paddingTop,10),j=parseInt(T.paddingBottom,10),S=k.top+k.height/2-Zr,N=O-S,M=w.offsetHeight/2,H=w.offsetTop+M,G=K+Z+H,me=V-G;if(G<=S){const ue=P.length>0&&w===P[P.length-1].ref.current;l.style.bottom="0px";const ye=u.clientHeight-h.offsetTop-h.offsetHeight,Be=Math.max(N,M+(ue?j:0)+ye+W),pt=G+Be;l.style.height=pt+"px"}else{const ue=P.length>0&&w===P[0].ref.current;l.style.top="0px";const Be=Math.max(S,K+h.offsetTop+(ue?q:0)+M)+me;l.style.height=Be+"px",h.scrollTop=G-S+h.offsetTop}l.style.margin=`${Zr}px 0`,l.style.minHeight=D+"px",l.style.maxHeight=O+"px",n==null||n(),requestAnimationFrame(()=>v.current=!0)}},[g,o.trigger,o.valueNode,l,u,h,w,p,o.dir,n]);Ft(()=>x(),[x]);const[_,C]=y.useState();Ft(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const $=y.useCallback(k=>{k&&b.current===!0&&(x(),m==null||m(),b.current=!1)},[x,m]);return a.jsx(yD,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:v,onScrollButtonChange:$,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:a.jsx(_e.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});gE.displayName=gD;var vD="SelectPopperPosition",ym=y.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=Zr,...o}=e,i=Tf(r);return a.jsx(wv,{...i,...o,ref:t,align:n,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});ym.displayName=vD;var[yD,Av]=Pa(Qo,{}),wm="SelectViewport",vE=y.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...s}=e,o=fo(wm,r),i=Av(wm,r),l=Ve(t,o.onViewportChange),c=y.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),a.jsx($f.Slot,{scope:r,children:a.jsx(_e.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:pe(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:g}=i;if(g!=null&&g.current&&f){const v=Math.abs(c.current-d.scrollTop);if(v>0){const b=window.innerHeight-Zr*2,h=parseFloat(f.style.minHeight),w=parseFloat(f.style.height),p=Math.max(h,w);if(p<b){const m=p+v,x=Math.min(b,m),_=m-x;f.style.height=x+"px",f.style.bottom==="0px"&&(d.scrollTop=_>0?_:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});vE.displayName=wm;var yE="SelectGroup",[wD,xD]=Pa(yE),bD=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Jn();return a.jsx(wD,{scope:r,id:s,children:a.jsx(_e.div,{role:"group","aria-labelledby":s,...n,ref:t})})});bD.displayName=yE;var wE="SelectLabel",xE=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=xD(wE,r);return a.jsx(_e.div,{id:s.id,...n,ref:t})});xE.displayName=wE;var Ed="SelectItem",[_D,bE]=Pa(Ed),_E=y.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:o,...i}=e,l=uo(Ed,r),c=fo(Ed,r),u=l.value===n,[d,f]=y.useState(o??""),[g,v]=y.useState(!1),b=Ve(t,m=>{var x;return(x=c.itemRefCallback)==null?void 0:x.call(c,m,n,s)}),h=Jn(),w=y.useRef("touch"),p=()=>{s||(l.onValueChange(n),l.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(_D,{scope:r,value:n,disabled:s,textId:h,isSelected:u,onItemTextChange:y.useCallback(m=>{f(x=>x||((m==null?void 0:m.textContent)??"").trim())},[]),children:a.jsx($f.ItemSlot,{scope:r,value:n,disabled:s,textValue:d,children:a.jsx(_e.div,{role:"option","aria-labelledby":h,"data-highlighted":g?"":void 0,"aria-selected":u&&g,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:b,onFocus:pe(i.onFocus,()=>v(!0)),onBlur:pe(i.onBlur,()=>v(!1)),onClick:pe(i.onClick,()=>{w.current!=="mouse"&&p()}),onPointerUp:pe(i.onPointerUp,()=>{w.current==="mouse"&&p()}),onPointerDown:pe(i.onPointerDown,m=>{w.current=m.pointerType}),onPointerMove:pe(i.onPointerMove,m=>{var x;w.current=m.pointerType,s?(x=c.onItemLeave)==null||x.call(c):w.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:pe(i.onPointerLeave,m=>{var x;m.currentTarget===document.activeElement&&((x=c.onItemLeave)==null||x.call(c))}),onKeyDown:pe(i.onKeyDown,m=>{var _;((_=c.searchRef)==null?void 0:_.current)!==""&&m.key===" "||(aD.includes(m.key)&&p(),m.key===" "&&m.preventDefault())})})})})});_E.displayName=Ed;var sl="SelectItemText",SE=y.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,...o}=e,i=uo(sl,r),l=fo(sl,r),c=bE(sl,r),u=dD(sl,r),[d,f]=y.useState(null),g=Ve(t,p=>f(p),c.onItemTextChange,p=>{var m;return(m=l.itemTextRefCallback)==null?void 0:m.call(l,p,c.value,c.disabled)}),v=d==null?void 0:d.textContent,b=y.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:v},c.value),[c.disabled,c.value,v]),{onNativeOptionAdd:h,onNativeOptionRemove:w}=u;return Ft(()=>(h(b),()=>w(b)),[h,w,b]),a.jsxs(a.Fragment,{children:[a.jsx(_e.span,{id:c.textId,...o,ref:g}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?ti.createPortal(o.children,i.valueNode):null]})});SE.displayName=sl;var kE="SelectItemIndicator",CE=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return bE(kE,r).isSelected?a.jsx(_e.span,{"aria-hidden":!0,...n,ref:t}):null});CE.displayName=kE;var xm="SelectScrollUpButton",EE=y.forwardRef((e,t)=>{const r=fo(xm,e.__scopeSelect),n=Av(xm,e.__scopeSelect),[s,o]=y.useState(!1),i=Ve(t,n.onScrollButtonChange);return Ft(()=>{if(r.viewport&&r.isPositioned){let l=function(){const u=c.scrollTop>0;o(u)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),s?a.jsx(jE,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});EE.displayName=xm;var bm="SelectScrollDownButton",NE=y.forwardRef((e,t)=>{const r=fo(bm,e.__scopeSelect),n=Av(bm,e.__scopeSelect),[s,o]=y.useState(!1),i=Ve(t,n.onScrollButtonChange);return Ft(()=>{if(r.viewport&&r.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;o(d)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),s?a.jsx(jE,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});NE.displayName=bm;var jE=y.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=e,o=fo("SelectScrollButton",r),i=y.useRef(null),l=Pf(r),c=y.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return y.useEffect(()=>()=>c(),[c]),Ft(()=>{var d;const u=l().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),a.jsx(_e.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:pe(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:pe(s.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:pe(s.onPointerLeave,()=>{c()})})}),SD="SelectSeparator",$E=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return a.jsx(_e.div,{"aria-hidden":!0,...n,ref:t})});$E.displayName=SD;var _m="SelectArrow",kD=y.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Tf(r),o=uo(_m,r),i=fo(_m,r);return o.open&&i.position==="popper"?a.jsx(xv,{...s,...n,ref:t}):null});kD.displayName=_m;var CD="SelectBubbleInput",PE=y.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const s=y.useRef(null),o=Ve(n,s),i=ZC(t);return y.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const f=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(f)}},[i,t]),a.jsx(_e.select,{...r,style:{...mk,...r.style},ref:o,defaultValue:t})});PE.displayName=CD;function TE(e){return e===""||e===void 0}function RE(e){const t=qr(e),r=y.useRef(""),n=y.useRef(0),s=y.useCallback(i=>{const l=r.current+i;t(l),function c(u){r.current=u,window.clearTimeout(n.current),u!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),o=y.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function IE(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let i=ED(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==r));const c=i.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function ED(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var ND=iE,AE=lE,jD=uE,$D=dE,PD=fE,OE=hE,TD=vE,ME=xE,DE=_E,RD=SE,ID=CE,zE=EE,LE=NE,FE=$E;const AD=ND,OD=jD,UE=y.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(AE,{ref:n,className:xe("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,a.jsx($D,{asChild:!0,children:a.jsx(lv,{className:"h-4 w-4 opacity-50"})})]}));UE.displayName=AE.displayName;const qE=y.forwardRef(({className:e,...t},r)=>a.jsx(zE,{ref:r,className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(HR,{className:"h-4 w-4"})}));qE.displayName=zE.displayName;const VE=y.forwardRef(({className:e,...t},r)=>a.jsx(LE,{ref:r,className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(lv,{className:"h-4 w-4"})}));VE.displayName=LE.displayName;const HE=y.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>a.jsx(PD,{children:a.jsxs(OE,{ref:s,className:xe("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[a.jsx(qE,{}),a.jsx(TD,{className:xe("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(VE,{})]})}));HE.displayName=OE.displayName;const MD=y.forwardRef(({className:e,...t},r)=>a.jsx(ME,{ref:r,className:xe("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));MD.displayName=ME.displayName;const hi=y.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(DE,{ref:n,className:xe("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(ID,{children:a.jsx(Lk,{className:"h-4 w-4"})})}),a.jsx(RD,{children:t})]}));hi.displayName=DE.displayName;const DD=y.forwardRef(({className:e,...t},r)=>a.jsx(FE,{ref:r,className:xe("-mx-1 my-1 h-px bg-muted",e),...t}));DD.displayName=FE.displayName;const zD="/assets/AgentDeckLogo3-X5qCXS2A.png";function LD(){const[e,t]=y.useState(""),[r,n]=y.useState(""),[s,o]=y.useState(!1),[i,l]=y.useState(!1),[c,u]=y.useState(null),[d,f]=y.useState(!1),[g,v]=y.useState(!1),[b,h]=y.useState(null),[w,p]=y.useState(!1),[m,x]=y.useState(!1),[_,C]=y.useState(null),[$,k]=y.useState(!1),[I,E]=y.useState(!1),[U,P]=y.useState(!1),[O,L]=y.useState(null),{toast:z}=Ut(),K=async()=>{P(!0);try{const Q=await BC({scope:"collection"});WC(Q,"backup.agent-deck.json"),z({title:"Exported collection",description:`${Q.services.length} services, ${Q.playbooks.length} playbooks, ${Q.decks.length} decks`})}catch(Q){z({title:"Export failed",description:Q instanceof Error?Q.message:"Unknown error",variant:"destructive"})}finally{P(!1)}},{connectionStatus:Z}=nD(),{data:W,isLoading:F,error:V}=Zt({queryKey:["/api/decks"]}),D=(W==null?void 0:W.data)||[],{editingDeck:T,editingDeckId:q,setEditingDeckId:j}=oD(D),{handleDragStart:S,handleCredentialDragStart:N,handlePlaybookDragStart:M,handleDragEnd:H,handleDrop:G,handleGlobalDrop:me,isDraggingFromDeck:ne}=sD(q),{data:ue,isLoading:ye,error:Be}=Zt({queryKey:["/api/services"]}),{data:pt,isLoading:Y}=Zt({queryKey:["/api/credentials/vault"]}),{data:de,isLoading:ee}=Zt({queryKey:["/api/playbooks/vault"]}),{data:$e}=Zt({queryKey:["/api/collection/warnings"],staleTime:6e4}),oe=(ue==null?void 0:ue.data)||[],Oe=(pt==null?void 0:pt.data)||[],Me=(de==null?void 0:de.data)||[],De=y.useMemo(()=>bO($e==null?void 0:$e.data),[$e==null?void 0:$e.data]),Pr=(Q,Fe)=>s?Q==="service"?De.serviceWarnings.has(Fe):Q==="credential"?De.credentialWarnings.has(Fe):De.playbookWarnings.has(Fe):!0,Tr=oe.filter(Q=>{var $c;if(!Pr("service",Q.id)||r==="api-key"||r==="playbook")return!1;const Fe=Q.name.toLowerCase().includes(e.toLowerCase())||(($c=Q.description)==null?void 0:$c.toLowerCase().includes(e.toLowerCase())),bt=!r||r==="all"||Q.type===r;return Fe&&bt}),Rr=Oe.filter(Q=>!Pr("credential",Q.id)||r&&r!=="all"&&r!=="api-key"?!1:Q.label.toLowerCase().includes(e.toLowerCase())),mt=Me.filter(Q=>!Pr("playbook",Q.id)||r&&r!=="all"&&r!=="playbook"?!1:Q.title.toLowerCase().includes(e.toLowerCase())||Q.body.toLowerCase().includes(e.toLowerCase())),ir=Tr.length+Rr.length+mt.length;Be&&console.error("Services error:",Be),V&&console.error("Decks error:",V);const ho=()=>{t(""),n(""),o(!1)},fs=!!(e||r||s),si=new Set(((T==null?void 0:T.credentials)??[]).map(Q=>Q.id)),Ec=new Set(((T==null?void 0:T.playbooks)??[]).map(Q=>Q.id)),Nc=(T==null?void 0:T.services)||[],jc=(T==null?void 0:T.playbooks)||[],Oa=Q=>{u(Q),f(!0)},Ma=Q=>{C(Q.id),k(!0)},Da=Q=>{h(Q.id),p(!0)},le=Q=>{L(Q)};if(Be||V){const Q=(V instanceof Error?V.message:null)??(Be instanceof Error?Be.message:null)??"There was an error loading the application data.";return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-900",children:a.jsxs("div",{className:"text-center max-w-lg px-4",children:[a.jsx("h2",{className:"text-2xl font-bold text-red-400 mb-4",children:"Error Loading Data"}),a.jsx("p",{className:"text-gray-300 mb-2",children:"There was an error loading the application data."}),a.jsx("p",{className:"text-gray-400 text-sm mb-4",children:Q}),a.jsxs("p",{className:"text-gray-500 text-xs mb-6",children:["Is the API running? Try ",a.jsx("code",{className:"text-gray-300",children:"agent-deck stop && agent-deck start"})]}),a.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700",children:"Reload Page"})]})})}return ye||F||Y||ee?a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-yellow-400 mx-auto mb-4"}),a.jsx("p",{className:"text-gray-300",children:"Loading AgentDeck..."})]})}):a.jsxs("div",{className:"flex min-h-dvh flex-col overflow-x-hidden",onDrop:me,onDragOver:Q=>Q.preventDefault(),style:{position:"relative",...ne&&{background:"linear-gradient(to bottom right, #1a1a2e, #16213e, #0f3460)"}},children:[a.jsx("header",{className:"relative z-20 shrink-0 bg-black/30 backdrop-blur-md border-b border-white/10",children:a.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-4",children:a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[a.jsx("img",{src:zD,alt:"Agent Deck Logo",className:"h-12 w-12 shrink-0 object-contain sm:h-16 sm:w-16"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h1",{className:"text-xl font-bold bg-gradient-to-r from-yellow-400 to-yellow-600 bg-clip-text text-transparent sm:text-2xl",style:{background:"linear-gradient(to right, #C4B643, #D4C760)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:"AgentDeck"}),a.jsx("p",{className:"text-xs sm:text-sm",style:{color:"#92E4DD"},children:"Build tool deck for your agent"})]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3 sm:gap-6",children:[a.jsxs("div",{className:`flex items-center space-x-2 px-3 py-1 rounded-full border ${Z==="connected"?"bg-emerald-500/20 border-emerald-500/30":"bg-red-500/20 border-red-500/30"}`,children:[a.jsx("div",{className:`w-2 h-2 rounded-full animate-pulse ${Z==="connected"?"bg-emerald-400":"bg-red-400"}`}),a.jsx("button",{className:`text-sm hover:underline cursor-pointer ${Z==="connected"?"text-emerald-300":"text-red-300"}`,"data-testid":"button-copy-mcp-url",onClick:()=>{navigator.clipboard.writeText("http://localhost:3001/mcp").then(()=>{z({title:"MCP URL copied!",description:"The MCP server URL has been copied to your clipboard."})})},title:"Click to copy MCP URL",children:"Get MCP URL"})]}),a.jsx(t4,{highlightDeckId:q??void 0})]})]})})}),ne&&a.jsx("div",{className:"fixed inset-0 pointer-events-none z-50 flex items-center justify-center",children:a.jsxs("div",{className:"bg-red-500/20 border-2 border-dashed border-red-500/50 rounded-lg p-8 text-center",children:[a.jsx("div",{className:"text-red-400 text-lg font-bold mb-2",children:"Drop to Remove"}),a.jsx("div",{className:"text-red-300 text-sm",children:"Release to remove card from deck"})]})}),a.jsx("main",{className:"container mx-auto flex min-h-0 flex-1 flex-col px-4 py-4 sm:py-6",children:a.jsxs("div",{className:"grid min-w-0 grid-cols-1 gap-4 sm:gap-6 xl:min-h-0 xl:flex-1 xl:grid-cols-4 xl:overflow-hidden",children:[a.jsxs("div",{className:"min-w-0 space-y-4 sm:space-y-6 xl:col-span-1 xl:min-h-0 xl:overflow-y-auto",children:[a.jsx("div",{className:"panel-surface h-64 overflow-hidden p-4 min-w-0 sm:h-72 xl:h-80",children:a.jsx(U4,{decks:D,editingDeckId:q,onSelectDeck:j,isLoading:F})}),a.jsxs("div",{className:"panel-surface p-4",children:[a.jsxs("h2",{className:"text-lg font-bold mb-3 flex items-center",children:[a.jsx(zk,{className:"w-4 h-4 mr-2",style:{color:"#92E4DD"}}),a.jsx("span",{style:{color:"#92E4DD"},children:"Add Cards"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(ie,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${_n}`,style:Sn(er),onClick:()=>l(!0),"data-testid":"button-register-mcp",children:[a.jsx(vd,{className:"w-3 h-3 mr-2"}),"Register MCP"]}),a.jsxs(ie,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${_n}`,style:Sn(ur),onClick:()=>v(!0),"data-testid":"button-register-api-key",children:[a.jsx(am,{className:"w-3 h-3 mr-2"}),"Register API key"]}),a.jsxs(ie,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${_n}`,style:Sn(Jr),onClick:()=>x(!0),"data-testid":"button-register-playbook",children:[a.jsx(av,{className:"w-3 h-3 mr-2"}),"Register Playbook"]})]})]})]}),a.jsxs("div",{className:"flex min-w-0 flex-col gap-4 sm:gap-6 xl:col-span-3 xl:h-full xl:min-h-0",children:[a.jsx("div",{className:"panel-surface h-64 shrink-0 overflow-hidden p-4 min-w-0 sm:h-72 xl:h-80",children:T?a.jsx("div",{className:"h-full",children:a.jsx(UO,{deck:T,services:Nc,credentials:T.credentials??[],playbooks:jc,allServices:oe,collectionWarnings:De,onDrop:G,onDragStart:S,onCredentialDragStart:N,onPlaybookDragStart:M,onDragEnd:H,onCardClick:Oa,onPlaybookClick:Ma,onCredentialClick:Da})}):a.jsxs("div",{className:"text-center h-full flex flex-col justify-center",children:[a.jsx("div",{className:"w-12 h-12 rounded-full bg-yellow-500/20 border border-yellow-500/30 flex items-center justify-center mx-auto mb-3",children:a.jsx(lm,{className:"w-6 h-6 text-yellow-400"})}),a.jsx("h3",{className:"text-lg font-bold mb-2",style:{color:"#92E4DD"},children:"No deck selected"}),a.jsx("p",{className:"text-gray-300 mb-4 text-sm",children:"Create a deck or select one from the sidebar to edit its cards."}),a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsxs(ie,{onClick:()=>{const Q=document.querySelector('[data-testid="create-deck-button"]');Q&&Q.click()},className:"border text-sm py-2",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},children:[a.jsx(Ls,{className:"w-4 h-4 mr-2"}),"Create New Deck"]}),a.jsxs(ie,{variant:"outline",className:"border-white/20 text-white hover:bg-white/10 text-sm py-2",onClick:()=>{const Q=document.querySelector('[data-testid="deck-management-panel"]');Q&&Q.scrollIntoView({behavior:"smooth"})},children:[a.jsx(lm,{className:"w-4 h-4 mr-2"}),"Manage Decks"]})]})]})}),a.jsxs("div",{className:"panel-surface flex min-h-[20rem] flex-col overflow-hidden p-4 min-w-0 sm:min-h-[24rem] xl:min-h-0 xl:flex-1","data-testid":"collection-panel",children:[a.jsxs("div",{className:"mb-3 flex shrink-0 flex-wrap items-center justify-between gap-2",children:[a.jsxs("h2",{className:"text-lg font-bold flex items-center",children:[a.jsx(WR,{className:"w-4 h-4 mr-2",style:{color:"#92E4DD"}}),a.jsx("span",{style:{color:"#92E4DD"},children:"My Collection"}),a.jsxs("span",{className:"ml-3 text-sm font-normal text-gray-400",children:["(",ir," cards)"]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs(ie,{size:"sm",variant:"outline",className:"h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10",onClick:K,disabled:U,title:"Export all MCP, playbooks, and decks","data-testid":"button-export-all",children:[a.jsx(qk,{className:"w-3 h-3 mr-1"}),U?"Exporting…":"Export all"]}),a.jsxs(ie,{size:"sm",variant:"outline",className:"h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10",onClick:()=>E(!0),title:"Import a bundle file","data-testid":"button-import-bundle",children:[a.jsx(JR,{className:"w-3 h-3 mr-1"}),"Import"]}),a.jsxs("div",{className:"relative",children:[a.jsx(Vk,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),a.jsx(He,{placeholder:"Search...",value:e,onChange:Q=>t(Q.target.value),className:"h-8 w-36 pl-8 text-sm bg-white/10 border-white/20 text-white placeholder-gray-400 sm:w-48","data-testid":"input-search"})]}),a.jsxs(AD,{value:r||"all",onValueChange:Q=>n(Q==="all"?"":Q),children:[a.jsxs(UE,{className:"w-[7.5rem] h-8 bg-white/10 border-white/20 text-white text-xs shrink-0","data-testid":"select-type",children:[a.jsx(BR,{className:"w-3 h-3 mr-1 shrink-0"}),a.jsx(OD,{placeholder:"Type"})]}),a.jsxs(HE,{children:[a.jsx(hi,{value:"all",children:"All"}),a.jsx(hi,{value:"mcp",children:"MCP"}),a.jsx(hi,{value:"local-mcp",children:"Local MCP"}),a.jsx(hi,{value:"api-key",children:"API Key"}),a.jsx(hi,{value:"playbook",children:"Playbook"})]})]}),(e||r||s)&&a.jsx(ie,{size:"sm",variant:"outline",className:"h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10",onClick:ho,title:"Clear all filters",children:"Clear"})]})]}),De.total>0&&a.jsx("button",{type:"button",onClick:()=>o(Q=>!Q),className:`mb-3 w-full shrink-0 rounded-lg border px-3 py-2 text-left text-sm transition-colors ${s?"border-amber-300/60 bg-amber-500/15 text-amber-100":"border-amber-400/30 bg-amber-500/10 text-amber-100 hover:bg-amber-500/15"}`,"data-testid":"button-collection-warnings",children:a.jsxs("span",{className:"flex items-start gap-2",children:[a.jsx(rn,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-300"}),a.jsx("span",{children:s?a.jsxs(a.Fragment,{children:["Showing ",a.jsx("strong",{children:ir})," card",ir===1?"":"s"," needing attention.",a.jsx("span",{className:"text-amber-200/80",children:" Click to show all cards."})]}):a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:De.total})," card",De.total===1?"":"s"," need attention",De.byKind.oauth_expired+De.byKind.oauth_required>0&&a.jsxs(a.Fragment,{children:[" ","(",De.byKind.oauth_expired+De.byKind.oauth_required," ","OAuth)"]}),". ",a.jsx("span",{className:"text-amber-200/80",children:"Click to filter."})]})})]})}),a.jsx("div",{className:"min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-1 py-2",children:ye||Y||ee?a.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,5rem)] gap-y-2 pr-12",children:Array.from({length:10}).map((Q,Fe)=>a.jsx("div",{className:"animate-pulse",children:a.jsx("div",{className:"bg-white/10 rounded-lg w-32 h-48 aspect-[2/3]"})},Fe))}):ir===0?a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"text-gray-400 mb-4",children:a.jsx("i",{className:"fas fa-layer-group text-4xl"})}),a.jsx("h3",{className:"text-lg font-semibold text-gray-300 mb-2",children:"No cards yet"}),a.jsx("p",{className:"text-gray-400 text-sm mb-4",children:fs?s?"No cards with warnings match your current filters":"Try adjusting your search or filters":"Register an MCP server, API key, or playbook to get started"}),!fs&&a.jsxs("div",{className:"flex gap-3 justify-center",children:[a.jsxs(ie,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${_n}`,style:Sn(er),onClick:()=>l(!0),"data-testid":"button-register-mcp-empty",children:[a.jsx(vd,{className:"w-3 h-3 mr-1"}),"Register MCP"]}),a.jsxs(ie,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${_n}`,style:Sn(ur),onClick:()=>v(!0),"data-testid":"button-register-api-key-empty",children:[a.jsx(am,{className:"w-3 h-3 mr-1"}),"Register API key"]})]})]}):a.jsxs("div",{className:"relative isolate grid grid-cols-[repeat(auto-fill,5rem)] gap-y-2 pr-12",style:{isolation:"isolate"},"data-testid":"collection-card-grid",children:[mt.map((Q,Fe)=>a.jsx("div",{className:"relative group",style:{zIndex:O===Q.id?999999:ir-Fe},children:a.jsx(PO,{playbook:Q,isInActiveDeck:Ec.has(Q.id),activeDeck:T??void 0,isInCollection:!0,onDragStart:M,onDragEnd:H,onCardClick:Ma,onMouseEnter:()=>le(Q.id),onMouseLeave:()=>le(null),warnings:De.playbookWarnings.get(Q.id)})},Q.id)),Rr.map((Q,Fe)=>a.jsx("div",{className:"relative group",style:{zIndex:O===Q.id?999999:ir-mt.length-Fe},children:a.jsx(jO,{credential:Q,isInActiveDeck:si.has(Q.id),activeDeck:T??void 0,isInCollection:!0,onDragStart:N,onDragEnd:H,onMouseEnter:()=>le(Q.id),onMouseLeave:()=>le(null),onCardClick:Da,warnings:De.credentialWarnings.get(Q.id)})},Q.id)),Tr.map((Q,Fe)=>{var bt;return a.jsx("div",{className:"relative group",style:{zIndex:O===Q.id?999999:ir-mt.length-Rr.length-Fe},children:a.jsx(CO,{service:Q,onDragStart:S,onDragEnd:H,isInActiveDeck:((bt=T==null?void 0:T.services)==null?void 0:bt.some($c=>$c.id===Q.id))||!1,onCardClick:Oa,isInCollection:!0,onMouseEnter:()=>le(Q.id),onMouseLeave:()=>le(null),activeDeck:T??void 0,warnings:De.serviceWarnings.get(Q.id)})},Q.id)})]})})]})]})]})}),a.jsxs("div",{className:"fixed inset-0 pointer-events-none z-0",children:[a.jsx("div",{className:"absolute top-20 left-20 w-96 h-96 bg-cyan-500/10 rounded-full blur-3xl animate-float"}),a.jsx("div",{className:"absolute bottom-20 right-20 w-96 h-96 bg-pink-500/10 rounded-full blur-3xl animate-float",style:{animationDelay:"-1s"}}),a.jsx("div",{className:"absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-96 h-96 bg-purple-500/5 rounded-full blur-3xl animate-float",style:{animationDelay:"-2s"}})]}),a.jsx(z4,{type:"mcp",open:i,onOpenChange:l}),a.jsx(tD,{service:c,isOpen:d,onClose:()=>f(!1)}),a.jsx(q4,{open:g,onOpenChange:v}),a.jsx(K4,{credentialId:b,open:w,onOpenChange:p}),a.jsx(V4,{open:m,onOpenChange:x}),a.jsx(H4,{playbookId:_,open:$,onOpenChange:k}),a.jsx(rD,{open:I,onOpenChange:E})]})}const _s=y.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:xe("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));_s.displayName="Card";const yo=y.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:xe("flex flex-col space-y-1.5 p-6",e),...t}));yo.displayName="CardHeader";const wo=y.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:xe("text-2xl font-semibold leading-none tracking-tight",e),...t}));wo.displayName="CardTitle";const Ou=y.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:xe("text-sm text-muted-foreground",e),...t}));Ou.displayName="CardDescription";const Ss=y.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:xe("p-6 pt-0",e),...t}));Ss.displayName="CardContent";const FD=y.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:xe("flex items-center p-6 pt-0",e),...t}));FD.displayName="CardFooter";function UD(){return a.jsx("div",{className:"min-h-screen w-full flex items-center justify-center bg-gray-50",children:a.jsx(_s,{className:"w-full max-w-md mx-4",children:a.jsxs(Ss,{className:"pt-6",children:[a.jsxs("div",{className:"flex mb-4 gap-2",children:[a.jsx(Fk,{className:"h-8 w-8 text-red-500"}),a.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"404 Page Not Found"})]}),a.jsx("p",{className:"mt-4 text-sm text-gray-600",children:"Did you forget to add the page to the router?"})]})})})}function qD(){const[e]=t2(),[t,r]=y.useState("loading"),[n,s]=y.useState("Authenticating...");return y.useEffect(()=>{(async()=>{try{const i=new URL(window.location.href),l=i.searchParams.get("success"),c=i.searchParams.get("error");l==="true"?(r("success"),s("Authentication successful! This window will close automatically."),setTimeout(()=>{window.close()},2e3)):l==="false"?(r("error"),s(`OAuth Error: ${c||"Authentication failed"}`)):(r("error"),s("Invalid OAuth callback - please try again"))}catch(i){r("error"),s(i instanceof Error?i.message:"Authentication failed")}})()},[e]),a.jsx("div",{className:"flex items-center justify-center min-h-screen bg-background",children:a.jsxs("div",{className:"text-center space-y-4",children:[t==="loading"&&a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto"}),t==="success"&&a.jsx("div",{className:"text-green-500 text-4xl",children:"✓"}),t==="error"&&a.jsx("div",{className:"text-red-500 text-4xl",children:"✗"}),a.jsx("h1",{className:"text-xl font-semibold",children:n}),t==="error"&&a.jsx("button",{onClick:()=>window.close(),className:"px-4 py-2 bg-primary text-primary-foreground rounded hover:bg-primary/90",children:"Close Window"})]})})}function Pi(e){const t=()=>{throw new Error(`Invalid url to pass to open(): ${e}`)};let r;try{r=new URL(e)}catch{t()}return r.protocol!=="https:"&&r.protocol!=="http:"&&t(),r.hostname!==encodeURIComponent(r.hostname)&&t(),r.username&&(r.username=encodeURIComponent(r.username)),r.password&&(r.password=encodeURIComponent(r.password)),r.pathname=r.pathname.slice(0,1)+encodeURIComponent(r.pathname.slice(1)).replace(/%2f/ig,"/"),r.search=r.search.slice(0,1)+Array.from(r.searchParams.entries()).map(VD).join("&"),r.hash=r.hash.slice(0,1)+encodeURIComponent(r.hash.slice(1)),r.href}function VD([e,t]){return`${encodeURIComponent(e)}${t.length>0?`=${encodeURIComponent(t)}`:""}`}var px=class{constructor(e,t={}){Dn(this,"serverUrl");Dn(this,"storageKeyPrefix");Dn(this,"serverUrlHash");Dn(this,"clientName");Dn(this,"clientUri");Dn(this,"callbackUrl");Dn(this,"preventAutoAuth");Dn(this,"onPopupWindow");this.serverUrl=e,this.storageKeyPrefix=t.storageKeyPrefix||"mcp:auth",this.serverUrlHash=this.hashString(e),this.clientName=t.clientName||"MCP Browser Client",this.clientUri=t.clientUri||(typeof window<"u"?window.location.origin:""),this.callbackUrl=Pi(t.callbackUrl||(typeof window<"u"?new URL("/oauth/callback",window.location.origin).toString():"/oauth/callback")),this.preventAutoAuth=t.preventAutoAuth,this.onPopupWindow=t.onPopupWindow}get redirectUrl(){return Pi(this.callbackUrl)}get clientMetadata(){return{redirect_uris:[this.redirectUrl],token_endpoint_auth_method:"none",grant_types:["authorization_code","refresh_token"],response_types:["code"],client_name:this.clientName,client_uri:this.clientUri}}async clientInformation(){const e=this.getKey("client_info"),t=localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(r){console.warn(`[${this.storageKeyPrefix}] Failed to parse client information:`,r),localStorage.removeItem(e);return}}async saveClientInformation(e){const t=this.getKey("client_info");localStorage.setItem(t,JSON.stringify(e))}async tokens(){const e=this.getKey("tokens"),t=localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(r){console.warn(`[${this.storageKeyPrefix}] Failed to parse tokens:`,r),localStorage.removeItem(e);return}}async saveTokens(e){const t=this.getKey("tokens");localStorage.setItem(t,JSON.stringify(e)),localStorage.removeItem(this.getKey("code_verifier")),localStorage.removeItem(this.getKey("last_auth_url"))}async saveCodeVerifier(e){const t=this.getKey("code_verifier");localStorage.setItem(t,e)}async codeVerifier(){const e=this.getKey("code_verifier"),t=localStorage.getItem(e);if(!t)throw new Error(`[${this.storageKeyPrefix}] Code verifier not found in storage for key ${e}. Auth flow likely corrupted or timed out.`);return t}async prepareAuthorizationUrl(e){const t=crypto.randomUUID(),r=`${this.storageKeyPrefix}:state_${t}`,n={serverUrlHash:this.serverUrlHash,expiry:Date.now()+1e3*60*10,providerOptions:{serverUrl:this.serverUrl,storageKeyPrefix:this.storageKeyPrefix,clientName:this.clientName,clientUri:this.clientUri,callbackUrl:this.callbackUrl}};localStorage.setItem(r,JSON.stringify(n)),e.searchParams.set("state",t);const s=e.toString(),o=Pi(s);return localStorage.setItem(this.getKey("last_auth_url"),o),o}async redirectToAuthorization(e){if(this.preventAutoAuth)return;const t=await this.prepareAuthorizationUrl(e),r="width=600,height=700,resizable=yes,scrollbars=yes,status=yes";try{const n=window.open(t,`mcp_auth_${this.serverUrlHash}`,r);this.onPopupWindow&&this.onPopupWindow(t,r,n),!n||n.closed||typeof n.closed>"u"?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(n.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(n){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,n)}}getLastAttemptedAuthUrl(){const e=localStorage.getItem(this.getKey("last_auth_url"));return e?Pi(e):null}clearStorage(){const e=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,t=`${this.storageKeyPrefix}:state_`,r=[];let n=0;for(let o=0;o<localStorage.length;o++){const i=localStorage.key(o);if(i){if(i.startsWith(e))r.push(i);else if(i.startsWith(t))try{const l=localStorage.getItem(i);l&&JSON.parse(l).serverUrlHash===this.serverUrlHash&&r.push(i)}catch(l){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${i} during clearStorage:`,l)}}}return[...new Set(r)].forEach(o=>{localStorage.removeItem(o),n++}),n}hashString(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(16)}getKey(e){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${e}`}};const HD=Object.freeze({status:"aborted"});function B(e,t,r){function n(l,c){var u;Object.defineProperty(l,"_zod",{value:l._zod??{},enumerable:!1}),(u=l._zod).traits??(u.traits=new Set),l._zod.traits.add(e),t(l,c);for(const d in i.prototype)d in l||Object.defineProperty(l,d,{value:i.prototype[d].bind(l)});l._zod.constr=i,l._zod.def=c}const s=(r==null?void 0:r.Parent)??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function i(l){var c;const u=r!=null&&r.Parent?new o:this;n(u,l),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:l=>{var c,u;return r!=null&&r.Parent&&l instanceof r.Parent?!0:(u=(c=l==null?void 0:l._zod)==null?void 0:c.traits)==null?void 0:u.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}class Gl extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const KE={};function no(e){return KE}function KD(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,s])=>t.indexOf(+n)===-1).map(([n,s])=>s)}function BD(e,t){return typeof t=="bigint"?t.toString():t}function Ov(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Mv(e){return e==null}function Dv(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function WD(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,o=Number.parseInt(e.toFixed(s).replace(".","")),i=Number.parseInt(t.toFixed(s).replace(".",""));return o%i/10**s}function tt(e,t,r){Object.defineProperty(e,t,{get(){{const n=r();return e[t]=n,n}},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Rf(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Za(e){return JSON.stringify(e)}const BE=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Nd(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const ZD=Ov(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function jd(e){if(Nd(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(Nd(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}const GD=new Set(["string","number","symbol"]);function pc(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ni(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r!=null&&r.parent)&&(n._zod.parent=e),n}function ce(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function QD(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const JD={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function YD(e,t){const r={},n=e._zod.def;for(const s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(r[s]=n.shape[s])}return ni(e,{...e._zod.def,shape:r,checks:[]})}function XD(e,t){const r={...e._zod.def.shape},n=e._zod.def;for(const s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete r[s]}return ni(e,{...e._zod.def,shape:r,checks:[]})}function ez(e,t){if(!jd(t))throw new Error("Invalid input to extend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Rf(this,"shape",n),n},checks:[]};return ni(e,r)}function tz(e,t){return ni(e,{...e._zod.def,get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Rf(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function rz(e,t,r){const n=t._zod.def.shape,s={...n};if(r)for(const o in r){if(!(o in n))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(s[o]=e?new e({type:"optional",innerType:n[o]}):n[o])}else for(const o in n)s[o]=e?new e({type:"optional",innerType:n[o]}):n[o];return ni(t,{...t._zod.def,shape:s,checks:[]})}function nz(e,t,r){const n=t._zod.def.shape,s={...n};if(r)for(const o in r){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(s[o]=new e({type:"nonoptional",innerType:n[o]}))}else for(const o in n)s[o]=new e({type:"nonoptional",innerType:n[o]});return ni(t,{...t._zod.def,shape:s,checks:[]})}function bl(e,t=0){var r;for(let n=t;n<e.issues.length;n++)if(((r=e.issues[n])==null?void 0:r.continue)!==!0)return!0;return!1}function jo(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function iu(e){return typeof e=="string"?e:e==null?void 0:e.message}function so(e,t,r){var s,o,i,l,c,u;const n={...e,path:e.path??[]};if(!e.message){const d=iu((i=(o=(s=e.inst)==null?void 0:s._zod.def)==null?void 0:o.error)==null?void 0:i.call(o,e))??iu((l=t==null?void 0:t.error)==null?void 0:l.call(t,e))??iu((c=r.customError)==null?void 0:c.call(r,e))??iu((u=r.localeError)==null?void 0:u.call(r,e))??"Invalid input";n.message=d}return delete n.inst,delete n.continue,t!=null&&t.reportInput||delete n.input,n}function zv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ql(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const WE=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,BD,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ZE=B("$ZodError",WE),GE=B("$ZodError",WE,{Parent:Error});function sz(e,t=r=>r.message){const r={},n=[];for(const s of e.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}function oz(e,t){const r=t||function(o){return o.message},n={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(l=>s({issues:l}));else if(i.code==="invalid_key")s({issues:i.issues});else if(i.code==="invalid_element")s({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else{let l=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(r(i))):l[u]=l[u]||{_errors:[]},l=l[u],c++}}};return s(e),n}const iz=e=>(t,r,n,s)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Gl;if(i.issues.length){const l=new((s==null?void 0:s.Err)??e)(i.issues.map(c=>so(c,o,no())));throw BE(l,s==null?void 0:s.callee),l}return i.value},az=e=>async(t,r,n,s)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise&&(i=await i),i.issues.length){const l=new((s==null?void 0:s.Err)??e)(i.issues.map(c=>so(c,o,no())));throw BE(l,s==null?void 0:s.callee),l}return i.value},QE=e=>(t,r,n)=>{const s=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new Gl;return o.issues.length?{success:!1,error:new(e??ZE)(o.issues.map(i=>so(i,s,no())))}:{success:!0,data:o.value}},JE=QE(GE),YE=e=>async(t,r,n)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},s);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(i=>so(i,s,no())))}:{success:!0,data:o.value}},lz=YE(GE),cz=/^[cC][^\s-]{8,}$/,uz=/^[0-9a-z]+$/,dz=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,fz=/^[0-9a-vA-V]{20}$/,hz=/^[A-Za-z0-9]{27}$/,pz=/^[a-zA-Z0-9_-]{21}$/,mz=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,gz=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,mx=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,vz=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,yz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function wz(){return new RegExp(yz,"u")}const xz=/^(?:(?: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])$/,bz=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,_z=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,Sz=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,kz=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,XE=/^[A-Za-z0-9_-]*$/,Cz=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Ez=/^\+(?:[0-9]){6,14}[0-9]$/,eN="(?:(?:\\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])))",Nz=new RegExp(`^${eN}$`);function tN(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function jz(e){return new RegExp(`^${tN(e)}$`)}function $z(e){const t=tN({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-]\\d{2}:\\d{2})");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${eN}T(?:${n})$`)}const Pz=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Tz=/^\d+$/,Rz=/^-?\d+(?:\.\d+)?/i,Iz=/true|false/i,Az=/null/i,Oz=/^[^A-Z]*$/,Mz=/^[^a-z]*$/,yr=B("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),rN={number:"number",bigint:"bigint",object:"date"},nN=B("$ZodCheckLessThan",(e,t)=>{yr.init(e,t);const r=rN[typeof t.value];e._zod.onattach.push(n=>{const s=n._zod.bag,o=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),sN=B("$ZodCheckGreaterThan",(e,t)=>{yr.init(e,t);const r=rN[typeof t.value];e._zod.onattach.push(n=>{const s=n._zod.bag,o=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Dz=B("$ZodCheckMultipleOf",(e,t)=>{yr.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):WD(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),zz=B("$ZodCheckNumberFormat",(e,t)=>{var i;yr.init(e,t),t.format=t.format||"float64";const r=(i=t.format)==null?void 0:i.includes("int"),n=r?"int":"number",[s,o]=JD[t.format];e._zod.onattach.push(l=>{const c=l._zod.bag;c.format=t.format,c.minimum=s,c.maximum=o,r&&(c.pattern=Tz)}),e._zod.check=l=>{const c=l.value;if(r){if(!Number.isInteger(c)){l.issues.push({expected:n,format:t.format,code:"invalid_type",input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?l.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):l.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}c<s&&l.issues.push({origin:"number",input:c,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),c>o&&l.issues.push({origin:"number",input:c,code:"too_big",maximum:o,inst:e})}}),Lz=B("$ZodCheckMaxLength",(e,t)=>{var r;yr.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!Mv(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const s=n.value;if(s.length<=t.maximum)return;const i=zv(s);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Fz=B("$ZodCheckMinLength",(e,t)=>{var r;yr.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!Mv(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const s=n.value;if(s.length>=t.minimum)return;const i=zv(s);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Uz=B("$ZodCheckLengthEquals",(e,t)=>{var r;yr.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!Mv(s)&&s.length!==void 0}),e._zod.onattach.push(n=>{const s=n._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=n=>{const s=n.value,o=s.length;if(o===t.length)return;const i=zv(s),l=o>t.length;n.issues.push({origin:i,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),If=B("$ZodCheckStringFormat",(e,t)=>{var r,n;yr.init(e,t),e._zod.onattach.push(s=>{const o=s._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),qz=B("$ZodCheckRegex",(e,t)=>{If.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Vz=B("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Oz),If.init(e,t)}),Hz=B("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Mz),If.init(e,t)}),Kz=B("$ZodCheckIncludes",(e,t)=>{yr.init(e,t);const r=pc(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),Bz=B("$ZodCheckStartsWith",(e,t)=>{yr.init(e,t);const r=new RegExp(`^${pc(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Wz=B("$ZodCheckEndsWith",(e,t)=>{yr.init(e,t);const r=new RegExp(`.*${pc(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Zz=B("$ZodCheckOverwrite",(e,t)=>{yr.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Gz{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
|
|
385
|
+
`).filter(i=>i),s=Math.min(...n.map(i=>i.length-i.trimStart().length)),o=n.map(i=>i.slice(s)).map(i=>" ".repeat(this.indent*2)+i);for(const i of o)this.content.push(i)}compile(){const t=Function,r=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(o=>` ${o}`)];return new t(...r,s.join(`
|
|
386
|
+
`))}}const Qz={major:4,minor:0,patch:0},Ge=B("$ZodType",(e,t)=>{var s;var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Qz;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),(s=e._zod.deferred)==null||s.push(()=>{e._zod.run=e._zod.parse});else{const o=(i,l,c)=>{let u=bl(i),d;for(const f of l){if(f._zod.def.when){if(!f._zod.def.when(i))continue}else if(u)continue;const g=i.issues.length,v=f._zod.check(i);if(v instanceof Promise&&(c==null?void 0:c.async)===!1)throw new Gl;if(d||v instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await v,i.issues.length!==g&&(u||(u=bl(i,g)))});else{if(i.issues.length===g)continue;u||(u=bl(i,g))}}return d?d.then(()=>i):i};e._zod.run=(i,l)=>{const c=e._zod.parse(i,l);if(c instanceof Promise){if(l.async===!1)throw new Gl;return c.then(u=>o(u,n,l))}return o(c,n,l)}}e["~standard"]={validate:o=>{var i;try{const l=JE(e,o);return l.success?{value:l.data}:{issues:(i=l.error)==null?void 0:i.issues}}catch{return lz(e,o).then(c=>{var u;return c.success?{value:c.data}:{issues:(u=c.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}}),Lv=B("$ZodString",(e,t)=>{var r;Ge.init(e,t),e._zod.pattern=[...((r=e==null?void 0:e._zod.bag)==null?void 0:r.patterns)??[]].pop()??Pz(e._zod.bag),e._zod.parse=(n,s)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),ot=B("$ZodStringFormat",(e,t)=>{If.init(e,t),Lv.init(e,t)}),Jz=B("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=gz),ot.init(e,t)}),Yz=B("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=mx(n))}else t.pattern??(t.pattern=mx());ot.init(e,t)}),Xz=B("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=vz),ot.init(e,t)}),e3=B("$ZodURL",(e,t)=>{ot.init(e,t),e._zod.check=r=>{try{const n=r.value,s=new URL(n),o=s.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Cz.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),!n.endsWith("/")&&o.endsWith("/")?r.value=o.slice(0,-1):r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),t3=B("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=wz()),ot.init(e,t)}),r3=B("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=pz),ot.init(e,t)}),n3=B("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=cz),ot.init(e,t)}),s3=B("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=uz),ot.init(e,t)}),o3=B("$ZodULID",(e,t)=>{t.pattern??(t.pattern=dz),ot.init(e,t)}),i3=B("$ZodXID",(e,t)=>{t.pattern??(t.pattern=fz),ot.init(e,t)}),a3=B("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=hz),ot.init(e,t)}),l3=B("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=$z(t)),ot.init(e,t)}),c3=B("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Nz),ot.init(e,t)}),u3=B("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=jz(t)),ot.init(e,t)}),d3=B("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=mz),ot.init(e,t)}),f3=B("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=xz),ot.init(e,t),e._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv4"})}),h3=B("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=bz),ot.init(e,t),e._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv6"}),e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),p3=B("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=_z),ot.init(e,t)}),m3=B("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Sz),ot.init(e,t),e._zod.check=r=>{const[n,s]=r.value.split("/");try{if(!s)throw new Error;const o=Number(s);if(`${o}`!==s)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function oN(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const g3=B("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=kz),ot.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{oN(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function v3(e){if(!XE.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return oN(r)}const y3=B("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=XE),ot.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{v3(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),w3=B("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ez),ot.init(e,t)});function x3(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const s=JSON.parse(atob(n));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const b3=B("$ZodJWT",(e,t)=>{ot.init(e,t),e._zod.check=r=>{x3(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),iN=B("$ZodNumber",(e,t)=>{Ge.init(e,t),e._zod.pattern=e._zod.bag.pattern??Rz,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const s=r.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return r;const o=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...o?{received:o}:{}}),r}}),_3=B("$ZodNumber",(e,t)=>{zz.init(e,t),iN.init(e,t)}),S3=B("$ZodBoolean",(e,t)=>{Ge.init(e,t),e._zod.pattern=Iz,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}const s=r.value;return typeof s=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),r}}),k3=B("$ZodNull",(e,t)=>{Ge.init(e,t),e._zod.pattern=Az,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{const s=r.value;return s===null||r.issues.push({expected:"null",code:"invalid_type",input:s,inst:e}),r}}),C3=B("$ZodAny",(e,t)=>{Ge.init(e,t),e._zod.parse=r=>r}),E3=B("$ZodUnknown",(e,t)=>{Ge.init(e,t),e._zod.parse=r=>r}),N3=B("$ZodNever",(e,t)=>{Ge.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function gx(e,t,r){e.issues.length&&t.issues.push(...jo(r,e.issues)),t.value[r]=e.value}const j3=B("$ZodArray",(e,t)=>{Ge.init(e,t),e._zod.parse=(r,n)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);const o=[];for(let i=0;i<s.length;i++){const l=s[i],c=t.element._zod.run({value:l,issues:[]},n);c instanceof Promise?o.push(c.then(u=>gx(u,r,i))):gx(c,r,i)}return o.length?Promise.all(o).then(()=>r):r}});function au(e,t,r){e.issues.length&&t.issues.push(...jo(r,e.issues)),t.value[r]=e.value}function vx(e,t,r,n){e.issues.length?n[r]===void 0?r in n?t.value[r]=void 0:t.value[r]=e.value:t.issues.push(...jo(r,e.issues)):e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}const $3=B("$ZodObject",(e,t)=>{Ge.init(e,t);const r=Ov(()=>{const f=Object.keys(t.shape);for(const v of f)if(!(t.shape[v]instanceof Ge))throw new Error(`Invalid element at key "${v}": expected a Zod schema`);const g=QD(t.shape);return{shape:t.shape,keys:f,keySet:new Set(f),numKeys:f.length,optionalKeys:new Set(g)}});tt(e._zod,"propValues",()=>{const f=t.shape,g={};for(const v in f){const b=f[v]._zod;if(b.values){g[v]??(g[v]=new Set);for(const h of b.values)g[v].add(h)}}return g});const n=f=>{const g=new Gz(["shape","payload","ctx"]),v=r.value,b=m=>{const x=Za(m);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};g.write("const input = payload.value;");const h=Object.create(null);let w=0;for(const m of v.keys)h[m]=`key_${w++}`;g.write("const newResult = {}");for(const m of v.keys)if(v.optionalKeys.has(m)){const x=h[m];g.write(`const ${x} = ${b(m)};`);const _=Za(m);g.write(`
|
|
387
|
+
if (${x}.issues.length) {
|
|
388
|
+
if (input[${_}] === undefined) {
|
|
389
|
+
if (${_} in input) {
|
|
390
|
+
newResult[${_}] = undefined;
|
|
391
|
+
}
|
|
392
|
+
} else {
|
|
393
|
+
payload.issues = payload.issues.concat(
|
|
394
|
+
${x}.issues.map((iss) => ({
|
|
395
|
+
...iss,
|
|
396
|
+
path: iss.path ? [${_}, ...iss.path] : [${_}],
|
|
397
|
+
}))
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
} else if (${x}.value === undefined) {
|
|
401
|
+
if (${_} in input) newResult[${_}] = undefined;
|
|
402
|
+
} else {
|
|
403
|
+
newResult[${_}] = ${x}.value;
|
|
404
|
+
}
|
|
405
|
+
`)}else{const x=h[m];g.write(`const ${x} = ${b(m)};`),g.write(`
|
|
406
|
+
if (${x}.issues.length) payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
|
|
407
|
+
...iss,
|
|
408
|
+
path: iss.path ? [${Za(m)}, ...iss.path] : [${Za(m)}]
|
|
409
|
+
})));`),g.write(`newResult[${Za(m)}] = ${x}.value`)}g.write("payload.value = newResult;"),g.write("return payload;");const p=g.compile();return(m,x)=>p(f,m,x)};let s;const o=Nd,i=!KE.jitless,c=i&&ZD.value,u=t.catchall;let d;e._zod.parse=(f,g)=>{d??(d=r.value);const v=f.value;if(!o(v))return f.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),f;const b=[];if(i&&c&&(g==null?void 0:g.async)===!1&&g.jitless!==!0)s||(s=n(t.shape)),f=s(f,g);else{f.value={};const x=d.shape;for(const _ of d.keys){const C=x[_],$=C._zod.run({value:v[_],issues:[]},g),k=C._zod.optin==="optional"&&C._zod.optout==="optional";$ instanceof Promise?b.push($.then(I=>k?vx(I,f,_,v):au(I,f,_))):k?vx($,f,_,v):au($,f,_)}}if(!u)return b.length?Promise.all(b).then(()=>f):f;const h=[],w=d.keySet,p=u._zod,m=p.def.type;for(const x of Object.keys(v)){if(w.has(x))continue;if(m==="never"){h.push(x);continue}const _=p.run({value:v[x],issues:[]},g);_ instanceof Promise?b.push(_.then(C=>au(C,f,x))):au(_,f,x)}return h.length&&f.issues.push({code:"unrecognized_keys",keys:h,input:v,inst:e}),b.length?Promise.all(b).then(()=>f):f}});function yx(e,t,r,n){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(o=>so(o,n,no())))}),t}const aN=B("$ZodUnion",(e,t)=>{Ge.init(e,t),tt(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),tt(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),tt(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),tt(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>Dv(n.source)).join("|")})$`)}}),e._zod.parse=(r,n)=>{let s=!1;const o=[];for(const i of t.options){const l=i._zod.run({value:r.value,issues:[]},n);if(l instanceof Promise)o.push(l),s=!0;else{if(l.issues.length===0)return l;o.push(l)}}return s?Promise.all(o).then(i=>yx(i,r,e,n)):yx(o,r,e,n)}}),P3=B("$ZodDiscriminatedUnion",(e,t)=>{aN.init(e,t);const r=e._zod.parse;tt(e._zod,"propValues",()=>{const s={};for(const o of t.options){const i=o._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const[l,c]of Object.entries(i)){s[l]||(s[l]=new Set);for(const u of c)s[l].add(u)}}return s});const n=Ov(()=>{const s=t.options,o=new Map;for(const i of s){const l=i._zod.propValues[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const c of l){if(o.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);o.set(c,i)}}return o});e._zod.parse=(s,o)=>{const i=s.value;if(!Nd(i))return s.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),s;const l=n.value.get(i==null?void 0:i[t.discriminator]);return l?l._zod.run(s,o):t.unionFallback?r(s,o):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[t.discriminator],inst:e}),s)}}),T3=B("$ZodIntersection",(e,t)=>{Ge.init(e,t),e._zod.parse=(r,n)=>{const s=r.value,o=t.left._zod.run({value:s,issues:[]},n),i=t.right._zod.run({value:s,issues:[]},n);return o instanceof Promise||i instanceof Promise?Promise.all([o,i]).then(([c,u])=>wx(r,c,u)):wx(r,o,i)}});function Sm(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(jd(e)&&jd(t)){const r=Object.keys(t),n=Object.keys(e).filter(o=>r.indexOf(o)!==-1),s={...e,...t};for(const o of n){const i=Sm(e[o],t[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};s[o]=i.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const s=e[n],o=t[n],i=Sm(s,o);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function wx(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),bl(e))return e;const n=Sm(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const R3=B("$ZodRecord",(e,t)=>{Ge.init(e,t),e._zod.parse=(r,n)=>{const s=r.value;if(!jd(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;const o=[];if(t.keyType._zod.values){const i=t.keyType._zod.values;r.value={};for(const c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){const u=t.valueType._zod.run({value:s[c],issues:[]},n);u instanceof Promise?o.push(u.then(d=>{d.issues.length&&r.issues.push(...jo(c,d.issues)),r.value[c]=d.value})):(u.issues.length&&r.issues.push(...jo(c,u.issues)),r.value[c]=u.value)}let l;for(const c in s)i.has(c)||(l=l??[],l.push(c));l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:l})}else{r.value={};for(const i of Reflect.ownKeys(s)){if(i==="__proto__")continue;const l=t.keyType._zod.run({value:i,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:l.issues.map(u=>so(u,n,no())),input:i,path:[i],inst:e}),r.value[l.value]=l.value;continue}const c=t.valueType._zod.run({value:s[i],issues:[]},n);c instanceof Promise?o.push(c.then(u=>{u.issues.length&&r.issues.push(...jo(i,u.issues)),r.value[l.value]=u.value})):(c.issues.length&&r.issues.push(...jo(i,c.issues)),r.value[l.value]=c.value)}}return o.length?Promise.all(o).then(()=>r):r}}),I3=B("$ZodEnum",(e,t)=>{Ge.init(e,t);const r=KD(t.entries);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter(n=>GD.has(typeof n)).map(n=>typeof n=="string"?pc(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{const o=n.value;return e._zod.values.has(o)||n.issues.push({code:"invalid_value",values:r,input:o,inst:e}),n}}),A3=B("$ZodLiteral",(e,t)=>{Ge.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?pc(r):r?r.toString():String(r)).join("|")})$`),e._zod.parse=(r,n)=>{const s=r.value;return e._zod.values.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),O3=B("$ZodTransform",(e,t)=>{Ge.init(e,t),e._zod.parse=(r,n)=>{const s=t.transform(r.value,r);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then(i=>(r.value=i,r));if(s instanceof Promise)throw new Gl;return r.value=s,r}}),M3=B("$ZodOptional",(e,t)=>{Ge.init(e,t),e._zod.optin="optional",e._zod.optout="optional",tt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),tt(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Dv(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(r,n):r.value===void 0?r:t.innerType._zod.run(r,n)}),D3=B("$ZodNullable",(e,t)=>{Ge.init(e,t),tt(e._zod,"optin",()=>t.innerType._zod.optin),tt(e._zod,"optout",()=>t.innerType._zod.optout),tt(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Dv(r.source)}|null)$`):void 0}),tt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),z3=B("$ZodDefault",(e,t)=>{Ge.init(e,t),e._zod.optin="optional",tt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(r.value===void 0)return r.value=t.defaultValue,r;const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>xx(o,t)):xx(s,t)}});function xx(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const L3=B("$ZodPrefault",(e,t)=>{Ge.init(e,t),e._zod.optin="optional",tt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),F3=B("$ZodNonOptional",(e,t)=>{Ge.init(e,t),tt(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>bx(o,e)):bx(s,e)}});function bx(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const U3=B("$ZodCatch",(e,t)=>{Ge.init(e,t),e._zod.optin="optional",tt(e._zod,"optout",()=>t.innerType._zod.optout),tt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>so(i,n,no()))},input:r.value}),r.issues=[]),r)):(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(o=>so(o,n,no()))},input:r.value}),r.issues=[]),r)}}),q3=B("$ZodPipe",(e,t)=>{Ge.init(e,t),tt(e._zod,"values",()=>t.in._zod.values),tt(e._zod,"optin",()=>t.in._zod.optin),tt(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(r,n)=>{const s=t.in._zod.run(r,n);return s instanceof Promise?s.then(o=>_x(o,t,n)):_x(s,t,n)}});function _x(e,t,r){return bl(e)?e:t.out._zod.run({value:e.value,issues:e.issues},r)}const V3=B("$ZodReadonly",(e,t)=>{Ge.init(e,t),tt(e._zod,"propValues",()=>t.innerType._zod.propValues),tt(e._zod,"values",()=>t.innerType._zod.values),tt(e._zod,"optin",()=>t.innerType._zod.optin),tt(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,n)=>{const s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(Sx):Sx(s)}});function Sx(e){return e.value=Object.freeze(e.value),e}const H3=B("$ZodCustom",(e,t)=>{yr.init(e,t),Ge.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,s=t.fn(n);if(s instanceof Promise)return s.then(o=>kx(o,r,n,e));kx(s,r,n,e)}});function kx(e,t,r,n){if(!e){const s={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(s.params=n._zod.def.params),t.issues.push(Ql(s))}}class K3{constructor(){this._map=new Map,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}}function B3(){return new K3}const lu=B3();function W3(e,t){return new e({type:"string",...ce(t)})}function Z3(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ce(t)})}function Cx(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ce(t)})}function G3(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ce(t)})}function Q3(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ce(t)})}function J3(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ce(t)})}function Y3(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ce(t)})}function lN(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ce(t)})}function X3(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ce(t)})}function eL(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ce(t)})}function tL(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ce(t)})}function rL(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ce(t)})}function nL(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ce(t)})}function sL(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ce(t)})}function oL(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ce(t)})}function iL(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ce(t)})}function aL(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ce(t)})}function lL(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ce(t)})}function cL(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ce(t)})}function uL(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ce(t)})}function dL(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ce(t)})}function fL(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ce(t)})}function hL(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ce(t)})}function pL(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ce(t)})}function mL(e,t){return new e({type:"string",format:"date",check:"string_format",...ce(t)})}function gL(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ce(t)})}function vL(e,t){return new e({type:"string",format:"duration",check:"string_format",...ce(t)})}function yL(e,t){return new e({type:"number",checks:[],...ce(t)})}function wL(e,t){return new e({type:"number",coerce:!0,checks:[],...ce(t)})}function xL(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ce(t)})}function bL(e,t){return new e({type:"boolean",...ce(t)})}function _L(e,t){return new e({type:"null",...ce(t)})}function SL(e){return new e({type:"any"})}function kL(e){return new e({type:"unknown"})}function CL(e,t){return new e({type:"never",...ce(t)})}function Ex(e,t){return new nN({check:"less_than",...ce(t),value:e,inclusive:!1})}function zh(e,t){return new nN({check:"less_than",...ce(t),value:e,inclusive:!0})}function Nx(e,t){return new sN({check:"greater_than",...ce(t),value:e,inclusive:!1})}function Lh(e,t){return new sN({check:"greater_than",...ce(t),value:e,inclusive:!0})}function jx(e,t){return new Dz({check:"multiple_of",...ce(t),value:e})}function cN(e,t){return new Lz({check:"max_length",...ce(t),maximum:e})}function $d(e,t){return new Fz({check:"min_length",...ce(t),minimum:e})}function uN(e,t){return new Uz({check:"length_equals",...ce(t),length:e})}function EL(e,t){return new qz({check:"string_format",format:"regex",...ce(t),pattern:e})}function NL(e){return new Vz({check:"string_format",format:"lowercase",...ce(e)})}function jL(e){return new Hz({check:"string_format",format:"uppercase",...ce(e)})}function $L(e,t){return new Kz({check:"string_format",format:"includes",...ce(t),includes:e})}function PL(e,t){return new Bz({check:"string_format",format:"starts_with",...ce(t),prefix:e})}function TL(e,t){return new Wz({check:"string_format",format:"ends_with",...ce(t),suffix:e})}function mc(e){return new Zz({check:"overwrite",tx:e})}function RL(e){return mc(t=>t.normalize(e))}function IL(){return mc(e=>e.trim())}function AL(){return mc(e=>e.toLowerCase())}function OL(){return mc(e=>e.toUpperCase())}function ML(e,t,r){return new e({type:"array",element:t,...ce(r)})}function DL(e,t,r){const n=ce(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function zL(e,t,r){return new e({type:"custom",check:"custom",fn:t,...ce(r)})}const LL=B("ZodISODateTime",(e,t)=>{l3.init(e,t),ht.init(e,t)});function dN(e){return pL(LL,e)}const FL=B("ZodISODate",(e,t)=>{c3.init(e,t),ht.init(e,t)});function UL(e){return mL(FL,e)}const qL=B("ZodISOTime",(e,t)=>{u3.init(e,t),ht.init(e,t)});function VL(e){return gL(qL,e)}const HL=B("ZodISODuration",(e,t)=>{d3.init(e,t),ht.init(e,t)});function KL(e){return vL(HL,e)}const BL=(e,t)=>{ZE.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>oz(e,r)},flatten:{value:r=>sz(e,r)},addIssue:{value:r=>e.issues.push(r)},addIssues:{value:r=>e.issues.push(...r)},isEmpty:{get(){return e.issues.length===0}}})},Af=B("ZodError",BL,{Parent:Error}),WL=iz(Af),ZL=az(Af),GL=QE(Af),QL=YE(Af),it=B("ZodType",(e,t)=>(Ge.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(r,n)=>ni(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.parse=(r,n)=>WL(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>GL(e,r,n),e.parseAsync=async(r,n)=>ZL(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>QL(e,r,n),e.spa=e.safeParseAsync,e.refine=(r,n)=>e.check(VF(r,n)),e.superRefine=r=>e.check(HF(r)),e.overwrite=r=>e.check(mc(r)),e.optional=()=>ct(e),e.nullable=()=>Tx(e),e.nullish=()=>ct(Tx(e)),e.nonoptional=r=>OF(e,r),e.array=()=>X(e),e.or=r=>at([e,r]),e.and=r=>Uv(e,r),e.transform=r=>Cm(e,vN(r)),e.default=r=>RF(e,r),e.prefault=r=>AF(e,r),e.catch=r=>DF(e,r),e.pipe=r=>Cm(e,r),e.readonly=()=>FF(e),e.describe=r=>{const n=e.clone();return lu.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){var r;return(r=lu.get(e))==null?void 0:r.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return lu.get(e);const n=e.clone();return lu.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),fN=B("_ZodString",(e,t)=>{Lv.init(e,t),it.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(EL(...n)),e.includes=(...n)=>e.check($L(...n)),e.startsWith=(...n)=>e.check(PL(...n)),e.endsWith=(...n)=>e.check(TL(...n)),e.min=(...n)=>e.check($d(...n)),e.max=(...n)=>e.check(cN(...n)),e.length=(...n)=>e.check(uN(...n)),e.nonempty=(...n)=>e.check($d(1,...n)),e.lowercase=n=>e.check(NL(n)),e.uppercase=n=>e.check(jL(n)),e.trim=()=>e.check(IL()),e.normalize=(...n)=>e.check(RL(...n)),e.toLowerCase=()=>e.check(AL()),e.toUpperCase=()=>e.check(OL())}),JL=B("ZodString",(e,t)=>{Lv.init(e,t),fN.init(e,t),e.email=r=>e.check(Z3(YL,r)),e.url=r=>e.check(lN(hN,r)),e.jwt=r=>e.check(hL(pF,r)),e.emoji=r=>e.check(X3(eF,r)),e.guid=r=>e.check(Cx($x,r)),e.uuid=r=>e.check(G3(cu,r)),e.uuidv4=r=>e.check(Q3(cu,r)),e.uuidv6=r=>e.check(J3(cu,r)),e.uuidv7=r=>e.check(Y3(cu,r)),e.nanoid=r=>e.check(eL(tF,r)),e.guid=r=>e.check(Cx($x,r)),e.cuid=r=>e.check(tL(rF,r)),e.cuid2=r=>e.check(rL(nF,r)),e.ulid=r=>e.check(nL(sF,r)),e.base64=r=>e.check(uL(dF,r)),e.base64url=r=>e.check(dL(fF,r)),e.xid=r=>e.check(sL(oF,r)),e.ksuid=r=>e.check(oL(iF,r)),e.ipv4=r=>e.check(iL(aF,r)),e.ipv6=r=>e.check(aL(lF,r)),e.cidrv4=r=>e.check(lL(cF,r)),e.cidrv6=r=>e.check(cL(uF,r)),e.e164=r=>e.check(fL(hF,r)),e.datetime=r=>e.check(dN(r)),e.date=r=>e.check(UL(r)),e.time=r=>e.check(VL(r)),e.duration=r=>e.check(KL(r))});function A(e){return W3(JL,e)}const ht=B("ZodStringFormat",(e,t)=>{ot.init(e,t),fN.init(e,t)}),YL=B("ZodEmail",(e,t)=>{Xz.init(e,t),ht.init(e,t)}),$x=B("ZodGUID",(e,t)=>{Jz.init(e,t),ht.init(e,t)}),cu=B("ZodUUID",(e,t)=>{Yz.init(e,t),ht.init(e,t)}),hN=B("ZodURL",(e,t)=>{e3.init(e,t),ht.init(e,t)});function XL(e){return lN(hN,e)}const eF=B("ZodEmoji",(e,t)=>{t3.init(e,t),ht.init(e,t)}),tF=B("ZodNanoID",(e,t)=>{r3.init(e,t),ht.init(e,t)}),rF=B("ZodCUID",(e,t)=>{n3.init(e,t),ht.init(e,t)}),nF=B("ZodCUID2",(e,t)=>{s3.init(e,t),ht.init(e,t)}),sF=B("ZodULID",(e,t)=>{o3.init(e,t),ht.init(e,t)}),oF=B("ZodXID",(e,t)=>{i3.init(e,t),ht.init(e,t)}),iF=B("ZodKSUID",(e,t)=>{a3.init(e,t),ht.init(e,t)}),aF=B("ZodIPv4",(e,t)=>{f3.init(e,t),ht.init(e,t)}),lF=B("ZodIPv6",(e,t)=>{h3.init(e,t),ht.init(e,t)}),cF=B("ZodCIDRv4",(e,t)=>{p3.init(e,t),ht.init(e,t)}),uF=B("ZodCIDRv6",(e,t)=>{m3.init(e,t),ht.init(e,t)}),dF=B("ZodBase64",(e,t)=>{g3.init(e,t),ht.init(e,t)}),fF=B("ZodBase64URL",(e,t)=>{y3.init(e,t),ht.init(e,t)}),hF=B("ZodE164",(e,t)=>{w3.init(e,t),ht.init(e,t)}),pF=B("ZodJWT",(e,t)=>{b3.init(e,t),ht.init(e,t)}),Fv=B("ZodNumber",(e,t)=>{iN.init(e,t),it.init(e,t),e.gt=(n,s)=>e.check(Nx(n,s)),e.gte=(n,s)=>e.check(Lh(n,s)),e.min=(n,s)=>e.check(Lh(n,s)),e.lt=(n,s)=>e.check(Ex(n,s)),e.lte=(n,s)=>e.check(zh(n,s)),e.max=(n,s)=>e.check(zh(n,s)),e.int=n=>e.check(Px(n)),e.safe=n=>e.check(Px(n)),e.positive=n=>e.check(Nx(0,n)),e.nonnegative=n=>e.check(Lh(0,n)),e.negative=n=>e.check(Ex(0,n)),e.nonpositive=n=>e.check(zh(0,n)),e.multipleOf=(n,s)=>e.check(jx(n,s)),e.step=(n,s)=>e.check(jx(n,s)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Ue(e){return yL(Fv,e)}const mF=B("ZodNumberFormat",(e,t)=>{_3.init(e,t),Fv.init(e,t)});function Px(e){return xL(mF,e)}const gF=B("ZodBoolean",(e,t)=>{S3.init(e,t),it.init(e,t)});function Xe(e){return bL(gF,e)}const vF=B("ZodNull",(e,t)=>{k3.init(e,t),it.init(e,t)});function yF(e){return _L(vF,e)}const wF=B("ZodAny",(e,t)=>{C3.init(e,t),it.init(e,t)});function xF(){return SL(wF)}const bF=B("ZodUnknown",(e,t)=>{E3.init(e,t),it.init(e,t)});function dt(){return kL(bF)}const _F=B("ZodNever",(e,t)=>{N3.init(e,t),it.init(e,t)});function SF(e){return CL(_F,e)}const kF=B("ZodArray",(e,t)=>{j3.init(e,t),it.init(e,t),e.element=t.element,e.min=(r,n)=>e.check($d(r,n)),e.nonempty=r=>e.check($d(1,r)),e.max=(r,n)=>e.check(cN(r,n)),e.length=(r,n)=>e.check(uN(r,n)),e.unwrap=()=>e.element});function X(e,t){return ML(kF,e,t)}const pN=B("ZodObject",(e,t)=>{$3.init(e,t),it.init(e,t),tt(e,"shape",()=>t.shape),e.keyof=()=>jr(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:dt()}),e.loose=()=>e.clone({...e._zod.def,catchall:dt()}),e.strict=()=>e.clone({...e._zod.def,catchall:SF()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>ez(e,r),e.merge=r=>tz(e,r),e.pick=r=>YD(e,r),e.omit=r=>XD(e,r),e.partial=(...r)=>rz(yN,e,r[0]),e.required=(...r)=>nz(wN,e,r[0])});function te(e,t){const r={type:"object",get shape(){return Rf(this,"shape",{...e}),this.shape},...ce(t)};return new pN(r)}function Dt(e,t){return new pN({type:"object",get shape(){return Rf(this,"shape",{...e}),this.shape},catchall:dt(),...ce(t)})}const mN=B("ZodUnion",(e,t)=>{aN.init(e,t),it.init(e,t),e.options=t.options});function at(e,t){return new mN({type:"union",options:e,...ce(t)})}const CF=B("ZodDiscriminatedUnion",(e,t)=>{mN.init(e,t),P3.init(e,t)});function gN(e,t,r){return new CF({type:"union",options:t,discriminator:e,...ce(r)})}const EF=B("ZodIntersection",(e,t)=>{T3.init(e,t),it.init(e,t)});function Uv(e,t){return new EF({type:"intersection",left:e,right:t})}const NF=B("ZodRecord",(e,t)=>{R3.init(e,t),it.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function rt(e,t,r){return new NF({type:"record",keyType:e,valueType:t,...ce(r)})}const km=B("ZodEnum",(e,t)=>{I3.init(e,t),it.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,s)=>{const o={};for(const i of n)if(r.has(i))o[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new km({...t,checks:[],...ce(s),entries:o})},e.exclude=(n,s)=>{const o={...t.entries};for(const i of n)if(r.has(i))delete o[i];else throw new Error(`Key ${i} not found in enum`);return new km({...t,checks:[],...ce(s),entries:o})}});function jr(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new km({type:"enum",entries:r,...ce(t)})}const jF=B("ZodLiteral",(e,t)=>{A3.init(e,t),it.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function he(e,t){return new jF({type:"literal",values:Array.isArray(e)?e:[e],...ce(t)})}const $F=B("ZodTransform",(e,t)=>{O3.init(e,t),it.init(e,t),e._zod.parse=(r,n)=>{r.addIssue=o=>{if(typeof o=="string")r.issues.push(Ql(o,r.value,t));else{const i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),i.continue??(i.continue=!0),r.issues.push(Ql(i))}};const s=t.transform(r.value,r);return s instanceof Promise?s.then(o=>(r.value=o,r)):(r.value=s,r)}});function vN(e){return new $F({type:"transform",transform:e})}const yN=B("ZodOptional",(e,t)=>{M3.init(e,t),it.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ct(e){return new yN({type:"optional",innerType:e})}const PF=B("ZodNullable",(e,t)=>{D3.init(e,t),it.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Tx(e){return new PF({type:"nullable",innerType:e})}const TF=B("ZodDefault",(e,t)=>{z3.init(e,t),it.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function RF(e,t){return new TF({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const IF=B("ZodPrefault",(e,t)=>{L3.init(e,t),it.init(e,t),e.unwrap=()=>e._zod.def.innerType});function AF(e,t){return new IF({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const wN=B("ZodNonOptional",(e,t)=>{F3.init(e,t),it.init(e,t),e.unwrap=()=>e._zod.def.innerType});function OF(e,t){return new wN({type:"nonoptional",innerType:e,...ce(t)})}const MF=B("ZodCatch",(e,t)=>{U3.init(e,t),it.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function DF(e,t){return new MF({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const zF=B("ZodPipe",(e,t)=>{q3.init(e,t),it.init(e,t),e.in=t.in,e.out=t.out});function Cm(e,t){return new zF({type:"pipe",in:e,out:t})}const LF=B("ZodReadonly",(e,t)=>{V3.init(e,t),it.init(e,t)});function FF(e){return new LF({type:"readonly",innerType:e})}const xN=B("ZodCustom",(e,t)=>{H3.init(e,t),it.init(e,t)});function UF(e){const t=new yr({check:"custom"});return t._zod.check=e,t}function qF(e,t){return DL(xN,e??(()=>!0),t)}function VF(e,t={}){return zL(xN,e,t)}function HF(e){const t=UF(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Ql(n,r.value,t._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),r.issues.push(Ql(s))}},e(r.value,r)));return t}function bN(e,t){return Cm(vN(e),t)}const KF={custom:"custom"};function BF(e){return wL(Fv,e)}const Of="2025-11-25",WF=[Of,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],xo="io.modelcontextprotocol/related-task",Mf="2.0",jt=qF(e=>e!==null&&(typeof e=="object"||typeof e=="function")),_N=at([A(),Ue().int()]),SN=A();Dt({ttl:Ue().optional(),pollInterval:Ue().optional()});const ZF=te({ttl:Ue().optional()}),GF=te({taskId:A()}),qv=Dt({progressToken:_N.optional(),[xo]:GF.optional()}),$r=te({_meta:qv.optional()}),gc=$r.extend({task:ZF.optional()}),QF=e=>gc.safeParse(e).success,qt=te({method:A(),params:$r.loose().optional()}),Vr=te({_meta:qv.optional()}),Hr=te({method:A(),params:Vr.loose().optional()}),Vt=Dt({_meta:qv.optional()}),Df=at([A(),Ue().int()]),kN=te({jsonrpc:he(Mf),id:Df,...qt.shape}).strict(),Em=e=>kN.safeParse(e).success,CN=te({jsonrpc:he(Mf),...Hr.shape}).strict(),JF=e=>CN.safeParse(e).success,Vv=te({jsonrpc:he(Mf),id:Df,result:Vt}).strict(),ol=e=>Vv.safeParse(e).success;var Se;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Se||(Se={}));const Hv=te({jsonrpc:he(Mf),id:Df.optional(),error:te({code:Ue().int(),message:A(),data:dt().optional()})}).strict(),YF=e=>Hv.safeParse(e).success,Mu=at([kN,CN,Vv,Hv]);at([Vv,Hv]);const Ti=Vt.strict(),XF=Vr.extend({requestId:Df.optional(),reason:A().optional()}),Kv=Hr.extend({method:he("notifications/cancelled"),params:XF}),eU=te({src:A(),mimeType:A().optional(),sizes:X(A()).optional(),theme:jr(["light","dark"]).optional()}),vc=te({icons:X(eU).optional()}),va=te({name:A(),title:A().optional()}),EN=va.extend({...va.shape,...vc.shape,version:A(),websiteUrl:A().optional(),description:A().optional()}),tU=Uv(te({applyDefaults:Xe().optional()}),rt(A(),dt())),rU=bN(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Uv(te({form:tU.optional(),url:jt.optional()}),rt(A(),dt()).optional())),nU=Dt({list:jt.optional(),cancel:jt.optional(),requests:Dt({sampling:Dt({createMessage:jt.optional()}).optional(),elicitation:Dt({create:jt.optional()}).optional()}).optional()}),sU=Dt({list:jt.optional(),cancel:jt.optional(),requests:Dt({tools:Dt({call:jt.optional()}).optional()}).optional()}),oU=te({experimental:rt(A(),jt).optional(),sampling:te({context:jt.optional(),tools:jt.optional()}).optional(),elicitation:rU.optional(),roots:te({listChanged:Xe().optional()}).optional(),tasks:nU.optional(),extensions:rt(A(),jt).optional()}),iU=$r.extend({protocolVersion:A(),capabilities:oU,clientInfo:EN}),aU=qt.extend({method:he("initialize"),params:iU}),lU=te({experimental:rt(A(),jt).optional(),logging:jt.optional(),completions:jt.optional(),prompts:te({listChanged:Xe().optional()}).optional(),resources:te({subscribe:Xe().optional(),listChanged:Xe().optional()}).optional(),tools:te({listChanged:Xe().optional()}).optional(),tasks:sU.optional(),extensions:rt(A(),jt).optional()}),NN=Vt.extend({protocolVersion:A(),capabilities:lU,serverInfo:EN,instructions:A().optional()}),jN=Hr.extend({method:he("notifications/initialized"),params:Vr.optional()}),cU=e=>jN.safeParse(e).success,Bv=qt.extend({method:he("ping"),params:$r.optional()}),uU=te({progress:Ue(),total:ct(Ue()),message:ct(A())}),dU=te({...Vr.shape,...uU.shape,progressToken:_N}),Wv=Hr.extend({method:he("notifications/progress"),params:dU}),fU=$r.extend({cursor:SN.optional()}),yc=qt.extend({params:fU.optional()}),wc=Vt.extend({nextCursor:SN.optional()}),hU=jr(["working","input_required","completed","failed","cancelled"]),xc=te({taskId:A(),status:hU,ttl:at([Ue(),yF()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:ct(Ue()),statusMessage:ct(A())}),Jl=Vt.extend({task:xc}),pU=Vr.merge(xc),Pd=Hr.extend({method:he("notifications/tasks/status"),params:pU}),Zv=qt.extend({method:he("tasks/get"),params:$r.extend({taskId:A()})}),Gv=Vt.merge(xc),Qv=qt.extend({method:he("tasks/result"),params:$r.extend({taskId:A()})});Vt.loose();const Jv=yc.extend({method:he("tasks/list")}),Yv=wc.extend({tasks:X(xc)}),Xv=qt.extend({method:he("tasks/cancel"),params:$r.extend({taskId:A()})}),mU=Vt.merge(xc),$N=te({uri:A(),mimeType:ct(A()),_meta:rt(A(),dt()).optional()}),PN=$N.extend({text:A()}),ey=A().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),TN=$N.extend({blob:ey}),bc=jr(["user","assistant"]),Ta=te({audience:X(bc).optional(),priority:Ue().min(0).max(1).optional(),lastModified:dN({offset:!0}).optional()}),RN=te({...va.shape,...vc.shape,uri:A(),description:ct(A()),mimeType:ct(A()),size:ct(Ue()),annotations:Ta.optional(),_meta:ct(Dt({}))}),gU=te({...va.shape,...vc.shape,uriTemplate:A(),description:ct(A()),mimeType:ct(A()),annotations:Ta.optional(),_meta:ct(Dt({}))}),vU=yc.extend({method:he("resources/list")}),Td=wc.extend({resources:X(RN)}),yU=yc.extend({method:he("resources/templates/list")}),IN=wc.extend({resourceTemplates:X(gU)}),ty=$r.extend({uri:A()}),wU=ty,xU=qt.extend({method:he("resources/read"),params:wU}),ry=Vt.extend({contents:X(at([PN,TN]))}),AN=Hr.extend({method:he("notifications/resources/list_changed"),params:Vr.optional()}),bU=ty,_U=qt.extend({method:he("resources/subscribe"),params:bU}),SU=ty,kU=qt.extend({method:he("resources/unsubscribe"),params:SU}),CU=Vr.extend({uri:A()}),EU=Hr.extend({method:he("notifications/resources/updated"),params:CU}),NU=te({name:A(),description:ct(A()),required:ct(Xe())}),jU=te({...va.shape,...vc.shape,description:ct(A()),arguments:ct(X(NU)),_meta:ct(Dt({}))}),$U=yc.extend({method:he("prompts/list")}),Rd=wc.extend({prompts:X(jU)}),PU=$r.extend({name:A(),arguments:rt(A(),A()).optional()}),TU=qt.extend({method:he("prompts/get"),params:PU}),ny=te({type:he("text"),text:A(),annotations:Ta.optional(),_meta:rt(A(),dt()).optional()}),sy=te({type:he("image"),data:ey,mimeType:A(),annotations:Ta.optional(),_meta:rt(A(),dt()).optional()}),oy=te({type:he("audio"),data:ey,mimeType:A(),annotations:Ta.optional(),_meta:rt(A(),dt()).optional()}),RU=te({type:he("tool_use"),name:A(),id:A(),input:rt(A(),dt()),_meta:rt(A(),dt()).optional()}),IU=te({type:he("resource"),resource:at([PN,TN]),annotations:Ta.optional(),_meta:rt(A(),dt()).optional()}),AU=RN.extend({type:he("resource_link")}),iy=at([ny,sy,oy,AU,IU]),OU=te({role:bc,content:iy}),ay=Vt.extend({description:A().optional(),messages:X(OU)}),ON=Hr.extend({method:he("notifications/prompts/list_changed"),params:Vr.optional()}),MU=te({title:A().optional(),readOnlyHint:Xe().optional(),destructiveHint:Xe().optional(),idempotentHint:Xe().optional(),openWorldHint:Xe().optional()}),DU=te({taskSupport:jr(["required","optional","forbidden"]).optional()}),MN=te({...va.shape,...vc.shape,description:A().optional(),inputSchema:te({type:he("object"),properties:rt(A(),jt).optional(),required:X(A()).optional()}).catchall(dt()),outputSchema:te({type:he("object"),properties:rt(A(),jt).optional(),required:X(A()).optional()}).catchall(dt()).optional(),annotations:MU.optional(),execution:DU.optional(),_meta:rt(A(),dt()).optional()}),zU=yc.extend({method:he("tools/list")}),ly=wc.extend({tools:X(MN)}),_c=Vt.extend({content:X(iy).default([]),structuredContent:rt(A(),dt()).optional(),isError:Xe().optional()});_c.or(Vt.extend({toolResult:dt()}));const LU=gc.extend({name:A(),arguments:rt(A(),dt()).optional()}),FU=qt.extend({method:he("tools/call"),params:LU}),DN=Hr.extend({method:he("notifications/tools/list_changed"),params:Vr.optional()}),UU=te({autoRefresh:Xe().default(!0),debounceMs:Ue().int().nonnegative().default(300)}),zN=jr(["debug","info","notice","warning","error","critical","alert","emergency"]),qU=$r.extend({level:zN}),VU=qt.extend({method:he("logging/setLevel"),params:qU}),HU=Vr.extend({level:zN,logger:A().optional(),data:dt()}),KU=Hr.extend({method:he("notifications/message"),params:HU}),BU=te({name:A().optional()}),WU=te({hints:X(BU).optional(),costPriority:Ue().min(0).max(1).optional(),speedPriority:Ue().min(0).max(1).optional(),intelligencePriority:Ue().min(0).max(1).optional()}),ZU=te({mode:jr(["auto","required","none"]).optional()}),GU=te({type:he("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:X(iy).default([]),structuredContent:te({}).loose().optional(),isError:Xe().optional(),_meta:rt(A(),dt()).optional()}),QU=gN("type",[ny,sy,oy]),Id=gN("type",[ny,sy,oy,RU,GU]),JU=te({role:bc,content:at([Id,X(Id)]),_meta:rt(A(),dt()).optional()}),YU=gc.extend({messages:X(JU),modelPreferences:WU.optional(),systemPrompt:A().optional(),includeContext:jr(["none","thisServer","allServers"]).optional(),temperature:Ue().optional(),maxTokens:Ue().int(),stopSequences:X(A()).optional(),metadata:jt.optional(),tools:X(MN).optional(),toolChoice:ZU.optional()}),LN=qt.extend({method:he("sampling/createMessage"),params:YU}),FN=Vt.extend({model:A(),stopReason:ct(jr(["endTurn","stopSequence","maxTokens"]).or(A())),role:bc,content:QU}),UN=Vt.extend({model:A(),stopReason:ct(jr(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:bc,content:at([Id,X(Id)])}),XU=te({type:he("boolean"),title:A().optional(),description:A().optional(),default:Xe().optional()}),e5=te({type:he("string"),title:A().optional(),description:A().optional(),minLength:Ue().optional(),maxLength:Ue().optional(),format:jr(["email","uri","date","date-time"]).optional(),default:A().optional()}),t5=te({type:jr(["number","integer"]),title:A().optional(),description:A().optional(),minimum:Ue().optional(),maximum:Ue().optional(),default:Ue().optional()}),r5=te({type:he("string"),title:A().optional(),description:A().optional(),enum:X(A()),default:A().optional()}),n5=te({type:he("string"),title:A().optional(),description:A().optional(),oneOf:X(te({const:A(),title:A()})),default:A().optional()}),s5=te({type:he("string"),title:A().optional(),description:A().optional(),enum:X(A()),enumNames:X(A()).optional(),default:A().optional()}),o5=at([r5,n5]),i5=te({type:he("array"),title:A().optional(),description:A().optional(),minItems:Ue().optional(),maxItems:Ue().optional(),items:te({type:he("string"),enum:X(A())}),default:X(A()).optional()}),a5=te({type:he("array"),title:A().optional(),description:A().optional(),minItems:Ue().optional(),maxItems:Ue().optional(),items:te({anyOf:X(te({const:A(),title:A()}))}),default:X(A()).optional()}),l5=at([i5,a5]),c5=at([s5,o5,l5]),u5=at([c5,XU,e5,t5]),d5=gc.extend({mode:he("form").optional(),message:A(),requestedSchema:te({type:he("object"),properties:rt(A(),u5),required:X(A()).optional()})}),f5=gc.extend({mode:he("url"),message:A(),elicitationId:A(),url:A().url()}),h5=at([d5,f5]),qN=qt.extend({method:he("elicitation/create"),params:h5}),p5=Vr.extend({elicitationId:A()}),m5=Hr.extend({method:he("notifications/elicitation/complete"),params:p5}),VN=Vt.extend({action:jr(["accept","decline","cancel"]),content:bN(e=>e===null?void 0:e,rt(A(),at([A(),Ue(),Xe(),X(A())])).optional())}),g5=te({type:he("ref/resource"),uri:A()}),v5=te({type:he("ref/prompt"),name:A()}),y5=$r.extend({ref:at([v5,g5]),argument:te({name:A(),value:A()}),context:te({arguments:rt(A(),A()).optional()}).optional()}),w5=qt.extend({method:he("completion/complete"),params:y5}),HN=Vt.extend({completion:Dt({values:X(A()).max(100),total:ct(Ue().int()),hasMore:ct(Xe())})}),x5=te({uri:A().startsWith("file://"),name:A().optional(),_meta:rt(A(),dt()).optional()}),b5=qt.extend({method:he("roots/list"),params:$r.optional()}),_5=Vt.extend({roots:X(x5)}),S5=Hr.extend({method:he("notifications/roots/list_changed"),params:Vr.optional()});at([Bv,aU,w5,VU,TU,$U,vU,yU,xU,_U,kU,FU,zU,Zv,Qv,Jv,Xv]);at([Kv,Wv,jN,S5,Pd]);at([Ti,FN,UN,VN,_5,Gv,Yv,Jl]);at([Bv,LN,qN,b5,Zv,Qv,Jv,Xv]);at([Kv,Wv,KU,EU,AN,DN,ON,Pd,m5]);at([Ti,NN,HN,ay,Rd,Td,IN,ry,_c,ly,Gv,Yv,Jl]);class ve extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===Se.UrlElicitationRequired&&n){const s=n;if(s.elicitations)return new k5(s.elicitations,r)}return new ve(t,r,n)}}class k5 extends ve{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(Se.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){var t;return((t=this.data)==null?void 0:t.elicitations)??[]}}class Rx extends Error{constructor(t,r){super(t),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}function Fh(e){}function KN(e){if(typeof e=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:t=Fh,onError:r=Fh,onRetry:n=Fh,onComment:s}=e;let o="",i=!0,l,c="",u="";function d(h){const w=i?h.replace(/^\xEF\xBB\xBF/,""):h,[p,m]=C5(`${o}${w}`);for(const x of p)f(x);o=m,i=!1}function f(h){if(h===""){v();return}if(h.startsWith(":")){s&&s(h.slice(h.startsWith(": ")?2:1));return}const w=h.indexOf(":");if(w!==-1){const p=h.slice(0,w),m=h[w+1]===" "?2:1,x=h.slice(w+m);g(p,x,h);return}g(h,"",h)}function g(h,w,p){switch(h){case"event":u=w;break;case"data":c=`${c}${w}
|
|
410
|
+
`;break;case"id":l=w.includes("\0")?void 0:w;break;case"retry":/^\d+$/.test(w)?n(parseInt(w,10)):r(new Rx(`Invalid \`retry\` value: "${w}"`,{type:"invalid-retry",value:w,line:p}));break;default:r(new Rx(`Unknown field "${h.length>20?`${h.slice(0,20)}…`:h}"`,{type:"unknown-field",field:h,value:w,line:p}));break}}function v(){c.length>0&&t({id:l,event:u||void 0,data:c.endsWith(`
|
|
411
|
+
`)?c.slice(0,-1):c}),l=void 0,c="",u=""}function b(h={}){o&&h.consume&&f(o),i=!0,l=void 0,c="",u="",o=""}return{feed:d,reset:b}}function C5(e){const t=[];let r="",n=0;for(;n<e.length;){const s=e.indexOf("\r",n),o=e.indexOf(`
|
|
412
|
+
`,n);let i=-1;if(s!==-1&&o!==-1?i=Math.min(s,o):s!==-1?s===e.length-1?i=-1:i=s:o!==-1&&(i=o),i===-1){r=e.slice(n);break}else{const l=e.slice(n,i);t.push(l),n=i+1,e[n-1]==="\r"&&e[n]===`
|
|
413
|
+
`&&n++}}return[t,r]}class Ix extends Event{constructor(t,r){var n,s;super(t),this.code=(n=r==null?void 0:r.code)!=null?n:void 0,this.message=(s=r==null?void 0:r.message)!=null?s:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,r,n){return n(Ax(this),r)}[Symbol.for("Deno.customInspect")](t,r){return t(Ax(this),r)}}function E5(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function Nm(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(Nm).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${Nm(e.cause)}`:e.message:`${e}`}function Ax(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var BN=e=>{throw TypeError(e)},cy=(e,t,r)=>t.has(e)||BN("Cannot "+r),Te=(e,t,r)=>(cy(e,t,"read from private field"),r?r.call(e):t.get(e)),St=(e,t,r)=>t.has(e)?BN("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),nt=(e,t,r,n)=>(cy(e,t,"write to private field"),t.set(e,r),r),Fn=(e,t,r)=>(cy(e,t,"access private method"),r),dr,bo,pi,Du,Ad,_l,Ri,Sl,Ns,mi,Vi,gi,il,Gr,jm,$m,Pm,Ox,Tm,Rm,al,Im,Am;class zu extends EventTarget{constructor(t,r){var n,s;super(),St(this,Gr),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,St(this,dr),St(this,bo),St(this,pi),St(this,Du),St(this,Ad),St(this,_l),St(this,Ri),St(this,Sl,null),St(this,Ns),St(this,mi),St(this,Vi,null),St(this,gi,null),St(this,il,null),St(this,$m,async o=>{var i;Te(this,mi).reset();const{body:l,redirected:c,status:u,headers:d}=o;if(u===204){Fn(this,Gr,al).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?nt(this,pi,new URL(o.url)):nt(this,pi,void 0),u!==200){Fn(this,Gr,al).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){Fn(this,Gr,al).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Te(this,dr)===this.CLOSED)return;nt(this,dr,this.OPEN);const f=new Event("open");if((i=Te(this,il))==null||i.call(this,f),this.dispatchEvent(f),typeof l!="object"||!l||!("getReader"in l)){Fn(this,Gr,al).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}const g=new TextDecoder,v=l.getReader();let b=!0;do{const{done:h,value:w}=await v.read();w&&Te(this,mi).feed(g.decode(w,{stream:!h})),h&&(b=!1,Te(this,mi).reset(),Fn(this,Gr,Im).call(this))}while(b)}),St(this,Pm,o=>{nt(this,Ns,void 0),!(o.name==="AbortError"||o.type==="aborted")&&Fn(this,Gr,Im).call(this,Nm(o))}),St(this,Tm,o=>{typeof o.id=="string"&&nt(this,Sl,o.id);const i=new MessageEvent(o.event||"message",{data:o.data,origin:Te(this,pi)?Te(this,pi).origin:Te(this,bo).origin,lastEventId:o.id||""});Te(this,gi)&&(!o.event||o.event==="message")&&Te(this,gi).call(this,i),this.dispatchEvent(i)}),St(this,Rm,o=>{nt(this,_l,o)}),St(this,Am,()=>{nt(this,Ri,void 0),Te(this,dr)===this.CONNECTING&&Fn(this,Gr,jm).call(this)});try{if(t instanceof URL)nt(this,bo,t);else if(typeof t=="string")nt(this,bo,new URL(t,N5()));else throw new Error("Invalid URL")}catch{throw E5("An invalid or illegal string was specified")}nt(this,mi,KN({onEvent:Te(this,Tm),onRetry:Te(this,Rm)})),nt(this,dr,this.CONNECTING),nt(this,_l,3e3),nt(this,Ad,(n=r==null?void 0:r.fetch)!=null?n:globalThis.fetch),nt(this,Du,(s=r==null?void 0:r.withCredentials)!=null?s:!1),Fn(this,Gr,jm).call(this)}get readyState(){return Te(this,dr)}get url(){return Te(this,bo).href}get withCredentials(){return Te(this,Du)}get onerror(){return Te(this,Vi)}set onerror(t){nt(this,Vi,t)}get onmessage(){return Te(this,gi)}set onmessage(t){nt(this,gi,t)}get onopen(){return Te(this,il)}set onopen(t){nt(this,il,t)}addEventListener(t,r,n){const s=r;super.addEventListener(t,s,n)}removeEventListener(t,r,n){const s=r;super.removeEventListener(t,s,n)}close(){Te(this,Ri)&&clearTimeout(Te(this,Ri)),Te(this,dr)!==this.CLOSED&&(Te(this,Ns)&&Te(this,Ns).abort(),nt(this,dr,this.CLOSED),nt(this,Ns,void 0))}}dr=new WeakMap,bo=new WeakMap,pi=new WeakMap,Du=new WeakMap,Ad=new WeakMap,_l=new WeakMap,Ri=new WeakMap,Sl=new WeakMap,Ns=new WeakMap,mi=new WeakMap,Vi=new WeakMap,gi=new WeakMap,il=new WeakMap,Gr=new WeakSet,jm=function(){nt(this,dr,this.CONNECTING),nt(this,Ns,new AbortController),Te(this,Ad)(Te(this,bo),Fn(this,Gr,Ox).call(this)).then(Te(this,$m)).catch(Te(this,Pm))},$m=new WeakMap,Pm=new WeakMap,Ox=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Te(this,Sl)?{"Last-Event-ID":Te(this,Sl)}:void 0},cache:"no-store",signal:(e=Te(this,Ns))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},Tm=new WeakMap,Rm=new WeakMap,al=function(e,t){var r;Te(this,dr)!==this.CLOSED&&nt(this,dr,this.CLOSED);const n=new Ix("error",{code:t,message:e});(r=Te(this,Vi))==null||r.call(this,n),this.dispatchEvent(n)},Im=function(e,t){var r;if(Te(this,dr)===this.CLOSED)return;nt(this,dr,this.CONNECTING);const n=new Ix("error",{code:t,message:e});(r=Te(this,Vi))==null||r.call(this,n),this.dispatchEvent(n),nt(this,Ri,setTimeout(Te(this,Am),Te(this,_l)))},Am=new WeakMap,zu.CONNECTING=0,zu.OPEN=1,zu.CLOSED=2;function N5(){const e="document"in globalThis?globalThis.document:void 0;return e&&typeof e=="object"&&"baseURI"in e&&typeof e.baseURI=="string"?e.baseURI:void 0}function Od(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function WN(e=fetch,t){return t?async(r,n)=>{const s={...t,...n,headers:n!=null&&n.headers?{...Od(t.headers),...Od(n.headers)}:t.headers};return e(r,s)}:e}let uy;uy=globalThis.crypto;async function j5(e){return(await uy).getRandomValues(new Uint8Array(e))}async function $5(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let r="";const n=await j5(e);for(let s=0;s<e;s++){const o=n[s]%t.length;r+=t[o]}return r}async function P5(e){return await $5(e)}async function T5(e){const t=await(await uy).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function R5(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;const t=await P5(e),r=await T5(t);return{code_verifier:t,code_challenge:r}}const Ot=XL().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:KF.custom,message:"URL must be parseable",fatal:!0}),HD}).refine(e=>{const t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),I5=Dt({resource:A().url(),authorization_servers:X(Ot).optional(),jwks_uri:A().url().optional(),scopes_supported:X(A()).optional(),bearer_methods_supported:X(A()).optional(),resource_signing_alg_values_supported:X(A()).optional(),resource_name:A().optional(),resource_documentation:A().optional(),resource_policy_uri:A().url().optional(),resource_tos_uri:A().url().optional(),tls_client_certificate_bound_access_tokens:Xe().optional(),authorization_details_types_supported:X(A()).optional(),dpop_signing_alg_values_supported:X(A()).optional(),dpop_bound_access_tokens_required:Xe().optional()}),ZN=Dt({issuer:A(),authorization_endpoint:Ot,token_endpoint:Ot,registration_endpoint:Ot.optional(),scopes_supported:X(A()).optional(),response_types_supported:X(A()),response_modes_supported:X(A()).optional(),grant_types_supported:X(A()).optional(),token_endpoint_auth_methods_supported:X(A()).optional(),token_endpoint_auth_signing_alg_values_supported:X(A()).optional(),service_documentation:Ot.optional(),revocation_endpoint:Ot.optional(),revocation_endpoint_auth_methods_supported:X(A()).optional(),revocation_endpoint_auth_signing_alg_values_supported:X(A()).optional(),introspection_endpoint:A().optional(),introspection_endpoint_auth_methods_supported:X(A()).optional(),introspection_endpoint_auth_signing_alg_values_supported:X(A()).optional(),code_challenge_methods_supported:X(A()).optional(),client_id_metadata_document_supported:Xe().optional()}),A5=Dt({issuer:A(),authorization_endpoint:Ot,token_endpoint:Ot,userinfo_endpoint:Ot.optional(),jwks_uri:Ot,registration_endpoint:Ot.optional(),scopes_supported:X(A()).optional(),response_types_supported:X(A()),response_modes_supported:X(A()).optional(),grant_types_supported:X(A()).optional(),acr_values_supported:X(A()).optional(),subject_types_supported:X(A()),id_token_signing_alg_values_supported:X(A()),id_token_encryption_alg_values_supported:X(A()).optional(),id_token_encryption_enc_values_supported:X(A()).optional(),userinfo_signing_alg_values_supported:X(A()).optional(),userinfo_encryption_alg_values_supported:X(A()).optional(),userinfo_encryption_enc_values_supported:X(A()).optional(),request_object_signing_alg_values_supported:X(A()).optional(),request_object_encryption_alg_values_supported:X(A()).optional(),request_object_encryption_enc_values_supported:X(A()).optional(),token_endpoint_auth_methods_supported:X(A()).optional(),token_endpoint_auth_signing_alg_values_supported:X(A()).optional(),display_values_supported:X(A()).optional(),claim_types_supported:X(A()).optional(),claims_supported:X(A()).optional(),service_documentation:A().optional(),claims_locales_supported:X(A()).optional(),ui_locales_supported:X(A()).optional(),claims_parameter_supported:Xe().optional(),request_parameter_supported:Xe().optional(),request_uri_parameter_supported:Xe().optional(),require_request_uri_registration:Xe().optional(),op_policy_uri:Ot.optional(),op_tos_uri:Ot.optional(),client_id_metadata_document_supported:Xe().optional()}),O5=te({...A5.shape,...ZN.pick({code_challenge_methods_supported:!0}).shape}),M5=te({access_token:A(),id_token:A().optional(),token_type:A(),expires_in:BF().optional(),scope:A().optional(),refresh_token:A().optional()}).strip(),D5=te({error:A(),error_description:A().optional(),error_uri:A().optional()}),Mx=Ot.optional().or(he("").transform(()=>{})),z5=te({redirect_uris:X(Ot),token_endpoint_auth_method:A().optional(),grant_types:X(A()).optional(),response_types:X(A()).optional(),client_name:A().optional(),client_uri:Ot.optional(),logo_uri:Mx,scope:A().optional(),contacts:X(A()).optional(),tos_uri:Mx,policy_uri:A().optional(),jwks_uri:Ot.optional(),jwks:xF().optional(),software_id:A().optional(),software_version:A().optional(),software_statement:A().optional()}).strip(),L5=te({client_id:A(),client_secret:A().optional(),client_id_issued_at:Ue().optional(),client_secret_expires_at:Ue().optional()}).strip(),F5=z5.merge(L5);te({error:A(),error_description:A().optional()}).strip();te({token:A(),token_type_hint:A().optional()}).strip();function U5(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function q5({requestedResource:e,configuredResource:t}){const r=typeof e=="string"?new URL(e):new URL(e.href),n=typeof t=="string"?new URL(t):new URL(t.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;const s=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return s.startsWith(o)}class Rt extends Error{constructor(t,r){super(t),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){const t={error:this.errorCode,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}get errorCode(){return this.constructor.errorCode}}class Om extends Rt{}Om.errorCode="invalid_request";class Md extends Rt{}Md.errorCode="invalid_client";class Dd extends Rt{}Dd.errorCode="invalid_grant";class zd extends Rt{}zd.errorCode="unauthorized_client";class Mm extends Rt{}Mm.errorCode="unsupported_grant_type";class Dm extends Rt{}Dm.errorCode="invalid_scope";class zm extends Rt{}zm.errorCode="access_denied";class ya extends Rt{}ya.errorCode="server_error";class Lm extends Rt{}Lm.errorCode="temporarily_unavailable";class Fm extends Rt{}Fm.errorCode="unsupported_response_type";class Um extends Rt{}Um.errorCode="unsupported_token_type";class qm extends Rt{}qm.errorCode="invalid_token";class Vm extends Rt{}Vm.errorCode="method_not_allowed";class Hm extends Rt{}Hm.errorCode="too_many_requests";class Ld extends Rt{}Ld.errorCode="invalid_client_metadata";class Km extends Rt{}Km.errorCode="insufficient_scope";class Bm extends Rt{}Bm.errorCode="invalid_target";const V5={[Om.errorCode]:Om,[Md.errorCode]:Md,[Dd.errorCode]:Dd,[zd.errorCode]:zd,[Mm.errorCode]:Mm,[Dm.errorCode]:Dm,[zm.errorCode]:zm,[ya.errorCode]:ya,[Lm.errorCode]:Lm,[Fm.errorCode]:Fm,[Um.errorCode]:Um,[qm.errorCode]:qm,[Vm.errorCode]:Vm,[Hm.errorCode]:Hm,[Ld.errorCode]:Ld,[Km.errorCode]:Km,[Bm.errorCode]:Bm};class br extends Error{constructor(t){super(t??"Unauthorized")}}function H5(e){return["client_secret_basic","client_secret_post","none"].includes(e)}const Uh="code",qh="S256";function K5(e,t){const r=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&H5(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?r?"client_secret_basic":"none":r&&t.includes("client_secret_basic")?"client_secret_basic":r&&t.includes("client_secret_post")?"client_secret_post":t.includes("none")?"none":r?"client_secret_post":"none"}function B5(e,t,r,n){const{client_id:s,client_secret:o}=t;switch(e){case"client_secret_basic":W5(s,o,r);return;case"client_secret_post":Z5(s,o,n);return;case"none":G5(s,n);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function W5(e,t,r){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");const n=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${n}`)}function Z5(e,t,r){r.set("client_id",e),t&&r.set("client_secret",t)}function G5(e,t){t.set("client_id",e)}async function GN(e){const t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{const n=D5.parse(JSON.parse(r)),{error:s,error_description:o,error_uri:i}=n,l=V5[s]||ya;return new l(o||"",i)}catch(n){const s=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new ya(s)}}async function sn(e,t){var r,n;try{return await Vh(e,t)}catch(s){if(s instanceof Md||s instanceof zd)return await((r=e.invalidateCredentials)==null?void 0:r.call(e,"all")),await Vh(e,t);if(s instanceof Dd)return await((n=e.invalidateCredentials)==null?void 0:n.call(e,"tokens")),await Vh(e,t);throw s}}async function Vh(e,{serverUrl:t,authorizationCode:r,scope:n,resourceMetadataUrl:s,fetchFn:o}){var x,_,C,$,k;const i=await((x=e.discoveryState)==null?void 0:x.call(e));let l,c,u,d=s;if(!d&&(i!=null&&i.resourceMetadataUrl)&&(d=new URL(i.resourceMetadataUrl)),i!=null&&i.authorizationServerUrl){if(c=i.authorizationServerUrl,l=i.resourceMetadata,u=i.authorizationServerMetadata??await JN(c,{fetchFn:o}),!l)try{l=await QN(t,{resourceMetadataUrl:d},o)}catch{}(u!==i.authorizationServerMetadata||l!==i.resourceMetadata)&&await((_=e.saveDiscoveryState)==null?void 0:_.call(e,{authorizationServerUrl:String(c),resourceMetadataUrl:d==null?void 0:d.toString(),resourceMetadata:l,authorizationServerMetadata:u}))}else{const I=await r9(t,{resourceMetadataUrl:d,fetchFn:o});c=I.authorizationServerUrl,u=I.authorizationServerMetadata,l=I.resourceMetadata,await((C=e.saveDiscoveryState)==null?void 0:C.call(e,{authorizationServerUrl:String(c),resourceMetadataUrl:d==null?void 0:d.toString(),resourceMetadata:l,authorizationServerMetadata:u}))}const f=await J5(t,e,l),g=n||(($=l==null?void 0:l.scopes_supported)==null?void 0:$.join(" "))||e.clientMetadata.scope;let v=await Promise.resolve(e.clientInformation());if(!v){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");const I=(u==null?void 0:u.client_id_metadata_document_supported)===!0,E=e.clientMetadataUrl;if(E&&!Q5(E))throw new Ld(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${E}`);if(I&&E)v={client_id:E},await((k=e.saveClientInformation)==null?void 0:k.call(e,v));else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const P=await a9(c,{metadata:u,clientMetadata:e.clientMetadata,scope:g,fetchFn:o});await e.saveClientInformation(P),v=P}}const b=!e.redirectUrl;if(r!==void 0||b){const I=await i9(e,c,{metadata:u,resource:f,authorizationCode:r,fetchFn:o});return await e.saveTokens(I),"AUTHORIZED"}const h=await e.tokens();if(h!=null&&h.refresh_token)try{const I=await o9(c,{metadata:u,clientInformation:v,refreshToken:h.refresh_token,resource:f,addClientAuthentication:e.addClientAuthentication,fetchFn:o});return await e.saveTokens(I),"AUTHORIZED"}catch(I){if(!(!(I instanceof Rt)||I instanceof ya))throw I}const w=e.state?await e.state():void 0,{authorizationUrl:p,codeVerifier:m}=await n9(c,{metadata:u,clientInformation:v,state:w,redirectUrl:e.redirectUrl,scope:g,resource:f});return await e.saveCodeVerifier(m),await e.redirectToAuthorization(p),"REDIRECT"}function Q5(e){if(!e)return!1;try{const t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function J5(e,t,r){const n=U5(e);if(t.validateResourceURL)return await t.validateResourceURL(n,r==null?void 0:r.resource);if(r){if(!q5({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function Fd(e){const t=e.headers.get("WWW-Authenticate");if(!t)return{};const[r,n]=t.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};const s=Hh(e,"resource_metadata")||void 0;let o;if(s)try{o=new URL(s)}catch{}const i=Hh(e,"scope")||void 0,l=Hh(e,"error")||void 0;return{resourceMetadataUrl:o,scope:i,error:l}}function Hh(e,t){const r=e.headers.get("WWW-Authenticate");if(!r)return null;const n=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),s=r.match(n);return s?s[1]||s[2]:null}async function QN(e,t,r=fetch){var s,o;const n=await e9(e,"oauth-protected-resource",r,{protocolVersion:t==null?void 0:t.protocolVersion,metadataUrl:t==null?void 0:t.resourceMetadataUrl});if(!n||n.status===404)throw await((s=n==null?void 0:n.body)==null?void 0:s.cancel()),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await((o=n.body)==null?void 0:o.cancel()),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return I5.parse(await n.json())}async function dy(e,t,r=fetch){try{return await r(e,{headers:t})}catch(n){if(n instanceof TypeError)return t?dy(e,void 0,r):void 0;throw n}}function Y5(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function Dx(e,t,r=fetch){return await dy(e,{"MCP-Protocol-Version":t},r)}function X5(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function e9(e,t,r,n){const s=new URL(e),o=(n==null?void 0:n.protocolVersion)??Of;let i;if(n!=null&&n.metadataUrl)i=new URL(n.metadataUrl);else{const c=Y5(t,s.pathname);i=new URL(c,(n==null?void 0:n.metadataServerUrl)??s),i.search=s.search}let l=await Dx(i,o,r);if(!(n!=null&&n.metadataUrl)&&X5(l,s.pathname)){const c=new URL(`/.well-known/${t}`,s);l=await Dx(c,o,r)}return l}function t9(e){const t=typeof e=="string"?new URL(e):e,r=t.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),n;let s=t.pathname;return s.endsWith("/")&&(s=s.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${s}`,t.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${s}`,t.origin),type:"oidc"}),n.push({url:new URL(`${s}/.well-known/openid-configuration`,t.origin),type:"oidc"}),n}async function JN(e,{fetchFn:t=fetch,protocolVersion:r=Of}={}){var o;const n={"MCP-Protocol-Version":r,Accept:"application/json"},s=t9(e);for(const{url:i,type:l}of s){const c=await dy(i,n,t);if(c){if(!c.ok){if(await((o=c.body)==null?void 0:o.cancel()),c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${l==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}return l==="oauth"?ZN.parse(await c.json()):O5.parse(await c.json())}}}async function r9(e,t){let r,n;try{r=await QN(e,{resourceMetadataUrl:t==null?void 0:t.resourceMetadataUrl},t==null?void 0:t.fetchFn),r.authorization_servers&&r.authorization_servers.length>0&&(n=r.authorization_servers[0])}catch{}n||(n=String(new URL("/",e)));const s=await JN(n,{fetchFn:t==null?void 0:t.fetchFn});return{authorizationServerUrl:n,authorizationServerMetadata:s,resourceMetadata:r}}async function n9(e,{metadata:t,clientInformation:r,redirectUrl:n,scope:s,state:o,resource:i}){let l;if(t){if(l=new URL(t.authorization_endpoint),!t.response_types_supported.includes(Uh))throw new Error(`Incompatible auth server: does not support response type ${Uh}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(qh))throw new Error(`Incompatible auth server: does not support code challenge method ${qh}`)}else l=new URL("/authorize",e);const c=await R5(),u=c.code_verifier,d=c.code_challenge;return l.searchParams.set("response_type",Uh),l.searchParams.set("client_id",r.client_id),l.searchParams.set("code_challenge",d),l.searchParams.set("code_challenge_method",qh),l.searchParams.set("redirect_uri",String(n)),o&&l.searchParams.set("state",o),s&&l.searchParams.set("scope",s),s!=null&&s.includes("offline_access")&&l.searchParams.append("prompt","consent"),i&&l.searchParams.set("resource",i.href),{authorizationUrl:l,codeVerifier:u}}function s9(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function YN(e,{metadata:t,tokenRequestParams:r,clientInformation:n,addClientAuthentication:s,resource:o,fetchFn:i}){const l=t!=null&&t.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),c=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(o&&r.set("resource",o.href),s)await s(c,r,l,t);else if(n){const d=(t==null?void 0:t.token_endpoint_auth_methods_supported)??[],f=K5(n,d);B5(f,n,c,r)}const u=await(i??fetch)(l,{method:"POST",headers:c,body:r});if(!u.ok)throw await GN(u);return M5.parse(await u.json())}async function o9(e,{metadata:t,clientInformation:r,refreshToken:n,resource:s,addClientAuthentication:o,fetchFn:i}){const l=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),c=await YN(e,{metadata:t,tokenRequestParams:l,clientInformation:r,addClientAuthentication:o,resource:s,fetchFn:i});return{refresh_token:n,...c}}async function i9(e,t,{metadata:r,resource:n,authorizationCode:s,fetchFn:o}={}){const i=e.clientMetadata.scope;let l;if(e.prepareTokenRequest&&(l=await e.prepareTokenRequest(i)),!l){if(!s)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");const u=await e.codeVerifier();l=s9(s,u,e.redirectUrl)}const c=await e.clientInformation();return YN(t,{metadata:r,tokenRequestParams:l,clientInformation:c??void 0,addClientAuthentication:e.addClientAuthentication,resource:n,fetchFn:o})}async function a9(e,{metadata:t,clientMetadata:r,scope:n,fetchFn:s}){let o;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");o=new URL(t.registration_endpoint)}else o=new URL("/register",e);const i=await(s??fetch)(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...n!==void 0?{scope:n}:{}})});if(!i.ok)throw await GN(i);return F5.parse(await i.json())}class l9 extends Error{constructor(t,r,n){super(`SSE error: ${r}`),this.code=t,this.event=n}}class c9{constructor(t,r){this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r==null?void 0:r.eventSourceInit,this._requestInit=r==null?void 0:r.requestInit,this._authProvider=r==null?void 0:r.authProvider,this._fetch=r==null?void 0:r.fetch,this._fetchWithInit=WN(r==null?void 0:r.fetch,r==null?void 0:r.requestInit)}async _authThenStart(){var r;if(!this._authProvider)throw new br("No auth provider");let t;try{t=await sn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw(r=this.onerror)==null||r.call(this,n),n}if(t!=="AUTHORIZED")throw new br;return await this._startOrAuth()}async _commonHeaders(){var n;const t={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(t.Authorization=`Bearer ${s.access_token}`)}this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);const r=Od((n=this._requestInit)==null?void 0:n.headers);return new Headers({...t,...r})}_startOrAuth(){var r;const t=((r=this==null?void 0:this._eventSourceInit)==null?void 0:r.fetch)??this._fetch??fetch;return new Promise((n,s)=>{this._eventSource=new zu(this._url.href,{...this._eventSourceInit,fetch:async(o,i)=>{const l=await this._commonHeaders();l.set("Accept","text/event-stream");const c=await t(o,{...i,headers:l});if(c.status===401&&c.headers.has("www-authenticate")){const{resourceMetadataUrl:u,scope:d}=Fd(c);this._resourceMetadataUrl=u,this._scope=d}return c}}),this._abortController=new AbortController,this._eventSource.onerror=o=>{var l;if(o.code===401&&this._authProvider){this._authThenStart().then(n,s);return}const i=new l9(o.code,o.message,o);s(i),(l=this.onerror)==null||l.call(this,i)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",o=>{var l;const i=o;try{if(this._endpoint=new URL(i.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(c){s(c),(l=this.onerror)==null||l.call(this,c),this.close();return}n()}),this._eventSource.onmessage=o=>{var c,u;const i=o;let l;try{l=Mu.parse(JSON.parse(i.data))}catch(d){(c=this.onerror)==null||c.call(this,d);return}(u=this.onmessage)==null||u.call(this,l)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(t){if(!this._authProvider)throw new br("No auth provider");if(await sn(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new br("Failed to authorize")}async close(){var t,r,n;(t=this._abortController)==null||t.abort(),(r=this._eventSource)==null||r.close(),(n=this.onclose)==null||n.call(this)}async send(t){var r,n,s;if(!this._endpoint)throw new Error("Not connected");try{const o=await this._commonHeaders();o.set("content-type","application/json");const i={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(t),signal:(r=this._abortController)==null?void 0:r.signal},l=await(this._fetch??fetch)(this._endpoint,i);if(!l.ok){const c=await l.text().catch(()=>null);if(l.status===401&&this._authProvider){const{resourceMetadataUrl:u,scope:d}=Fd(l);if(this._resourceMetadataUrl=u,this._scope=d,await sn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new br;return this.send(t)}throw new Error(`Error POSTing to endpoint (HTTP ${l.status}): ${c}`)}await((n=l.body)==null?void 0:n.cancel())}catch(o){throw(s=this.onerror)==null||s.call(this,o),o}}setProtocolVersion(t){this._protocolVersion=t}}class u9 extends TransformStream{constructor({onError:t,onRetry:r,onComment:n}={}){let s;super({start(o){s=KN({onEvent:i=>{o.enqueue(i)},onError(i){t==="terminate"?o.error(i):typeof t=="function"&&t(i)},onRetry:r,onComment:n})},transform(o){s.feed(o)}})}}const d9={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class ci extends Error{constructor(t,r){super(`Streamable HTTP error: ${r}`),this.code=t}}class f9{constructor(t,r){this._hasCompletedAuthFlow=!1,this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r==null?void 0:r.requestInit,this._authProvider=r==null?void 0:r.authProvider,this._fetch=r==null?void 0:r.fetch,this._fetchWithInit=WN(r==null?void 0:r.fetch,r==null?void 0:r.requestInit),this._sessionId=r==null?void 0:r.sessionId,this._reconnectionOptions=(r==null?void 0:r.reconnectionOptions)??d9}async _authThenStart(){var r;if(!this._authProvider)throw new br("No auth provider");let t;try{t=await sn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw(r=this.onerror)==null||r.call(this,n),n}if(t!=="AUTHORIZED")throw new br;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var n;const t={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(t.Authorization=`Bearer ${s.access_token}`)}this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);const r=Od((n=this._requestInit)==null?void 0:n.headers);return new Headers({...t,...r})}async _startOrAuthSse(t){var n,s,o;const{resumptionToken:r}=t;try{const i=await this._commonHeaders();i.set("Accept","text/event-stream"),r&&i.set("last-event-id",r);const l=await(this._fetch??fetch)(this._url,{method:"GET",headers:i,signal:(n=this._abortController)==null?void 0:n.signal});if(!l.ok){if(await((s=l.body)==null?void 0:s.cancel()),l.status===401&&this._authProvider)return await this._authThenStart();if(l.status===405)return;throw new ci(l.status,`Failed to open SSE stream: ${l.statusText}`)}this._handleSseStream(l.body,t,!0)}catch(i){throw(o=this.onerror)==null||o.call(this,i),i}}_getNextReconnectionDelay(t){if(this._serverRetryMs!==void 0)return this._serverRetryMs;const r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,s=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,t),s)}_scheduleReconnection(t,r=0){var o;const n=this._reconnectionOptions.maxRetries;if(r>=n){(o=this.onerror)==null||o.call(this,new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}const s=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(t).catch(i=>{var l;(l=this.onerror)==null||l.call(this,new Error(`Failed to reconnect SSE stream: ${i instanceof Error?i.message:String(i)}`)),this._scheduleReconnection(t,r+1)})},s)}_handleSseStream(t,r,n){if(!t)return;const{onresumptiontoken:s,replayMessageId:o}=r;let i,l=!1,c=!1;(async()=>{var d,f,g,v;try{const b=t.pipeThrough(new TextDecoderStream).pipeThrough(new u9({onRetry:p=>{this._serverRetryMs=p}})).getReader();for(;;){const{value:p,done:m}=await b.read();if(m)break;if(p.id&&(i=p.id,l=!0,s==null||s(p.id)),!!p.data&&(!p.event||p.event==="message"))try{const x=Mu.parse(JSON.parse(p.data));ol(x)&&(c=!0,o!==void 0&&(x.id=o)),(d=this.onmessage)==null||d.call(this,x)}catch(x){(f=this.onerror)==null||f.call(this,x)}}(n||l)&&!c&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:s,replayMessageId:o},0)}catch(b){if((g=this.onerror)==null||g.call(this,new Error(`SSE stream disconnected: ${b}`)),(n||l)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:s,replayMessageId:o},0)}catch(p){(v=this.onerror)==null||v.call(this,new Error(`Failed to reconnect: ${p instanceof Error?p.message:String(p)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(t){if(!this._authProvider)throw new br("No auth provider");if(await sn(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new br("Failed to authorize")}async close(){var t,r;this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),(t=this._abortController)==null||t.abort(),(r=this.onclose)==null||r.call(this)}async send(t,r){var n,s,o,i,l,c;try{const{resumptionToken:u,onresumptiontoken:d}=r||{};if(u){this._startOrAuthSse({resumptionToken:u,replayMessageId:Em(t)?t.id:void 0}).catch(m=>{var x;return(x=this.onerror)==null?void 0:x.call(this,m)});return}const f=await this._commonHeaders();f.set("content-type","application/json"),f.set("accept","application/json, text/event-stream");const g={...this._requestInit,method:"POST",headers:f,body:JSON.stringify(t),signal:(n=this._abortController)==null?void 0:n.signal},v=await(this._fetch??fetch)(this._url,g),b=v.headers.get("mcp-session-id");if(b&&(this._sessionId=b),!v.ok){const m=await v.text().catch(()=>null);if(v.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new ci(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:x,scope:_}=Fd(v);if(this._resourceMetadataUrl=x,this._scope=_,await sn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new br;return this._hasCompletedAuthFlow=!0,this.send(t)}if(v.status===403&&this._authProvider){const{resourceMetadataUrl:x,scope:_,error:C}=Fd(v);if(C==="insufficient_scope"){const $=v.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===$)throw new ci(403,"Server returned 403 after trying upscoping");if(_&&(this._scope=_),x&&(this._resourceMetadataUrl=x),this._lastUpscopingHeader=$??void 0,await sn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new br;return this.send(t)}}throw new ci(v.status,`Error POSTing to endpoint: ${m}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,v.status===202){await((s=v.body)==null?void 0:s.cancel()),cU(t)&&this._startOrAuthSse({resumptionToken:void 0}).catch(m=>{var x;return(x=this.onerror)==null?void 0:x.call(this,m)});return}const w=(Array.isArray(t)?t:[t]).filter(m=>"method"in m&&"id"in m&&m.id!==void 0).length>0,p=v.headers.get("content-type");if(w)if(p!=null&&p.includes("text/event-stream"))this._handleSseStream(v.body,{onresumptiontoken:d},!1);else if(p!=null&&p.includes("application/json")){const m=await v.json(),x=Array.isArray(m)?m.map(_=>Mu.parse(_)):[Mu.parse(m)];for(const _ of x)(o=this.onmessage)==null||o.call(this,_)}else throw await((i=v.body)==null?void 0:i.cancel()),new ci(-1,`Unexpected content type: ${p}`);else await((l=v.body)==null?void 0:l.cancel())}catch(u){throw(c=this.onerror)==null||c.call(this,u),u}}get sessionId(){return this._sessionId}async terminateSession(){var t,r,n;if(this._sessionId)try{const s=await this._commonHeaders(),o={...this._requestInit,method:"DELETE",headers:s,signal:(t=this._abortController)==null?void 0:t.signal},i=await(this._fetch??fetch)(this._url,o);if(await((r=i.body)==null?void 0:r.cancel()),!i.ok&&i.status!==405)throw new ci(i.status,`Failed to terminate session: ${i.statusText}`);this._sessionId=void 0}catch(s){throw(n=this.onerror)==null||n.call(this,s),s}}setProtocolVersion(t){this._protocolVersion=t}get protocolVersion(){return this._protocolVersion}async resumeStream(t,r){await this._startOrAuthSse({resumptionToken:t,onresumptiontoken:r==null?void 0:r.onresumptiontoken})}}function zf(e){return!!e._zod}function ks(e,t){return zf(e)?JE(e,t):e.safeParse(t)}function XN(e){var r,n;if(!e)return;let t;if(zf(e)?t=(n=(r=e._zod)==null?void 0:r.def)==null?void 0:n.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function h9(e){var s;if(zf(e)){const i=(s=e._zod)==null?void 0:s.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}const r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}const n=e.value;if(n!==void 0)return n}function po(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function zx(e){const t=XN(e),r=t==null?void 0:t.method;if(!r)throw new Error("Schema is missing a method literal");const n=h9(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Lx(e,t){const r=ks(e,t);if(!r.success)throw r.error;return r.data}const p9=6e4;class m9{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Kv,r=>{this._oncancel(r)}),this.setNotificationHandler(Wv,r=>{this._onprogress(r)}),this.setRequestHandler(Bv,r=>({})),this._taskStore=t==null?void 0:t.taskStore,this._taskMessageQueue=t==null?void 0:t.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Zv,async(r,n)=>{const s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new ve(Se.InvalidParams,"Failed to retrieve task: Task not found");return{...s}}),this.setRequestHandler(Qv,async(r,n)=>{const s=async()=>{var l;const o=r.params.taskId;if(this._taskMessageQueue){let c;for(;c=await this._taskMessageQueue.dequeue(o,n.sessionId);){if(c.type==="response"||c.type==="error"){const u=c.message,d=u.id,f=this._requestResolvers.get(d);if(f)if(this._requestResolvers.delete(d),c.type==="response")f(u);else{const g=u,v=new ve(g.error.code,g.error.message,g.error.data);f(v)}else{const g=c.type==="response"?"Response":"Error";this._onerror(new Error(`${g} handler missing for request ${d}`))}continue}await((l=this._transport)==null?void 0:l.send(c.message,{relatedRequestId:n.requestId}))}}const i=await this._taskStore.getTask(o,n.sessionId);if(!i)throw new ve(Se.InvalidParams,`Task not found: ${o}`);if(!po(i.status))return await this._waitForTaskUpdate(o,n.signal),await s();if(po(i.status)){const c=await this._taskStore.getTaskResult(o,n.sessionId);return this._clearTaskQueue(o),{...c,_meta:{...c._meta,[xo]:{taskId:o}}}}return await s()};return await s()}),this.setRequestHandler(Jv,async(r,n)=>{var s;try{const{tasks:o,nextCursor:i}=await this._taskStore.listTasks((s=r.params)==null?void 0:s.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new ve(Se.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Xv,async(r,n)=>{try{const s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new ve(Se.InvalidParams,`Task not found: ${r.params.taskId}`);if(po(s.status))throw new ve(Se.InvalidParams,`Cannot cancel task in terminal status: ${s.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);const o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new ve(Se.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...o}}catch(s){throw s instanceof ve?s:new ve(Se.InvalidRequest,`Failed to cancel task: ${s instanceof Error?s.message:String(s)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;const r=this._requestHandlerAbortControllers.get(t.params.requestId);r==null||r.abort(t.params.reason)}_setupTimeout(t,r,n,s,o=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(s,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:o,onTimeout:s})}_resetTimeout(t){const r=this._timeoutInfo.get(t);if(!r)return!1;const n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),ve.fromError(Se.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){const r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){var o,i,l;if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;const r=(o=this.transport)==null?void 0:o.onclose;this._transport.onclose=()=>{r==null||r(),this._onclose()};const n=(i=this.transport)==null?void 0:i.onerror;this._transport.onerror=c=>{n==null||n(c),this._onerror(c)};const s=(l=this._transport)==null?void 0:l.onmessage;this._transport.onmessage=(c,u)=>{s==null||s(c,u),ol(c)||YF(c)?this._onresponse(c):Em(c)?this._onrequest(c,u):JF(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var n;const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const s of this._timeoutInfo.values())clearTimeout(s.timeoutId);this._timeoutInfo.clear();for(const s of this._requestHandlerAbortControllers.values())s.abort();this._requestHandlerAbortControllers.clear();const r=ve.fromError(Se.ConnectionClosed,"Connection closed");this._transport=void 0,(n=this.onclose)==null||n.call(this);for(const s of t.values())s(r)}_onerror(t){var r;(r=this.onerror)==null||r.call(this,t)}_onnotification(t){const r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){var d,f,g,v;const n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,s=this._transport,o=(g=(f=(d=t.params)==null?void 0:d._meta)==null?void 0:f[xo])==null?void 0:g.taskId;if(n===void 0){const b={jsonrpc:"2.0",id:t.id,error:{code:Se.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:b,timestamp:Date.now()},s==null?void 0:s.sessionId).catch(h=>this._onerror(new Error(`Failed to enqueue error response: ${h}`))):s==null||s.send(b).catch(h=>this._onerror(new Error(`Failed to send an error response: ${h}`)));return}const i=new AbortController;this._requestHandlerAbortControllers.set(t.id,i);const l=QF(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,s==null?void 0:s.sessionId):void 0,u={signal:i.signal,sessionId:s==null?void 0:s.sessionId,_meta:(v=t.params)==null?void 0:v._meta,sendNotification:async b=>{if(i.signal.aborted)return;const h={relatedRequestId:t.id};o&&(h.relatedTask={taskId:o}),await this.notification(b,h)},sendRequest:async(b,h,w)=>{var x;if(i.signal.aborted)throw new ve(Se.ConnectionClosed,"Request was cancelled");const p={...w,relatedRequestId:t.id};o&&!p.relatedTask&&(p.relatedTask={taskId:o});const m=((x=p.relatedTask)==null?void 0:x.taskId)??o;return m&&c&&await c.updateTaskStatus(m,"input_required"),await this.request(b,h,p)},authInfo:r==null?void 0:r.authInfo,requestId:t.id,requestInfo:r==null?void 0:r.requestInfo,taskId:o,taskStore:c,taskRequestedTtl:l==null?void 0:l.ttl,closeSSEStream:r==null?void 0:r.closeSSEStream,closeStandaloneSSEStream:r==null?void 0:r.closeStandaloneSSEStream};Promise.resolve().then(()=>{l&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async b=>{if(i.signal.aborted)return;const h={result:b,jsonrpc:"2.0",id:t.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:h,timestamp:Date.now()},s==null?void 0:s.sessionId):await(s==null?void 0:s.send(h))},async b=>{if(i.signal.aborted)return;const h={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(b.code)?b.code:Se.InternalError,message:b.message??"Internal error",...b.data!==void 0&&{data:b.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:h,timestamp:Date.now()},s==null?void 0:s.sessionId):await(s==null?void 0:s.send(h))}).catch(b=>this._onerror(new Error(`Failed to send response: ${b}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===i&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){const{progressToken:r,...n}=t.params,s=Number(r),o=this._progressHandlers.get(s);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const i=this._responseHandlers.get(s),l=this._timeoutInfo.get(s);if(l&&i&&l.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(c){this._responseHandlers.delete(s),this._progressHandlers.delete(s),this._cleanupTimeout(s),i(c);return}o(n)}_onresponse(t){const r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),ol(t))n(t);else{const i=new ve(t.error.code,t.error.message,t.error.data);n(i)}return}const s=this._responseHandlers.get(r);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let o=!1;if(ol(t)&&t.result&&typeof t.result=="object"){const i=t.result;if(i.task&&typeof i.task=="object"){const l=i.task;typeof l.taskId=="string"&&(o=!0,this._taskProgressTokens.set(l.taskId,r))}}if(o||this._progressHandlers.delete(r),ol(t))s(t);else{const i=ve.fromError(t.error.code,t.error.message,t.error.data);s(i)}}get transport(){return this._transport}async close(){var t;await((t=this._transport)==null?void 0:t.close())}async*requestStream(t,r,n){var i,l;const{task:s}=n??{};if(!s){try{yield{type:"result",result:await this.request(t,r,n)}}catch(c){yield{type:"error",error:c instanceof ve?c:new ve(Se.InternalError,String(c))}}return}let o;try{const c=await this.request(t,Jl,n);if(c.task)o=c.task.taskId,yield{type:"taskCreated",task:c.task};else throw new ve(Se.InternalError,"Task creation did not return a task");for(;;){const u=await this.getTask({taskId:o},n);if(yield{type:"taskStatus",task:u},po(u.status)){u.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)}:u.status==="failed"?yield{type:"error",error:new ve(Se.InternalError,`Task ${o} failed`)}:u.status==="cancelled"&&(yield{type:"error",error:new ve(Se.InternalError,`Task ${o} was cancelled`)});return}if(u.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)};return}const d=u.pollInterval??((i=this._options)==null?void 0:i.defaultTaskPollInterval)??1e3;await new Promise(f=>setTimeout(f,d)),(l=n==null?void 0:n.signal)==null||l.throwIfAborted()}}catch(c){yield{type:"error",error:c instanceof ve?c:new ve(Se.InternalError,String(c))}}}request(t,r,n){const{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i,task:l,relatedTask:c}=n??{};return new Promise((u,d)=>{var m,x,_,C,$;const f=k=>{d(k)};if(!this._transport){f(new Error("Not connected"));return}if(((m=this._options)==null?void 0:m.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(t.method),l&&this.assertTaskCapability(t.method)}catch(k){f(k);return}(x=n==null?void 0:n.signal)==null||x.throwIfAborted();const g=this._requestMessageId++,v={...t,jsonrpc:"2.0",id:g};n!=null&&n.onprogress&&(this._progressHandlers.set(g,n.onprogress),v.params={...t.params,_meta:{...((_=t.params)==null?void 0:_._meta)||{},progressToken:g}}),l&&(v.params={...v.params,task:l}),c&&(v.params={...v.params,_meta:{...((C=v.params)==null?void 0:C._meta)||{},[xo]:c}});const b=k=>{var E;this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),(E=this._transport)==null||E.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(k)}},{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i}).catch(U=>this._onerror(new Error(`Failed to send cancellation: ${U}`)));const I=k instanceof ve?k:new ve(Se.RequestTimeout,String(k));d(I)};this._responseHandlers.set(g,k=>{var I;if(!((I=n==null?void 0:n.signal)!=null&&I.aborted)){if(k instanceof Error)return d(k);try{const E=ks(r,k.result);E.success?u(E.data):d(E.error)}catch(E){d(E)}}}),($=n==null?void 0:n.signal)==null||$.addEventListener("abort",()=>{var k;b((k=n==null?void 0:n.signal)==null?void 0:k.reason)});const h=(n==null?void 0:n.timeout)??p9,w=()=>b(ve.fromError(Se.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(g,h,n==null?void 0:n.maxTotalTimeout,w,(n==null?void 0:n.resetTimeoutOnProgress)??!1);const p=c==null?void 0:c.taskId;if(p){const k=I=>{const E=this._responseHandlers.get(g);E?E(I):this._onerror(new Error(`Response handler missing for side-channeled request ${g}`))};this._requestResolvers.set(g,k),this._enqueueTaskMessage(p,{type:"request",message:v,timestamp:Date.now()}).catch(I=>{this._cleanupTimeout(g),d(I)})}else this._transport.send(v,{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i}).catch(k=>{this._cleanupTimeout(g),d(k)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Gv,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},Yv,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},mU,r)}async notification(t,r){var l,c,u,d;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);const n=(l=r==null?void 0:r.relatedTask)==null?void 0:l.taskId;if(n){const f={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...((c=t.params)==null?void 0:c._meta)||{},[xo]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:f,timestamp:Date.now()});return}if((((u=this._options)==null?void 0:u.debouncedNotificationMethods)??[]).includes(t.method)&&!t.params&&!(r!=null&&r.relatedRequestId)&&!(r!=null&&r.relatedTask)){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{var g,v;if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let f={...t,jsonrpc:"2.0"};r!=null&&r.relatedTask&&(f={...f,params:{...f.params,_meta:{...((g=f.params)==null?void 0:g._meta)||{},[xo]:r.relatedTask}}}),(v=this._transport)==null||v.send(f,r).catch(b=>this._onerror(b))});return}let i={...t,jsonrpc:"2.0"};r!=null&&r.relatedTask&&(i={...i,params:{...i.params,_meta:{...((d=i.params)==null?void 0:d._meta)||{},[xo]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(t,r){const n=zx(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(s,o)=>{const i=Lx(t,s);return Promise.resolve(r(i,o))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){const n=zx(t);this._notificationHandlers.set(n,s=>{const o=Lx(t,s);return Promise.resolve(r(o))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){const r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){var o;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const s=(o=this._options)==null?void 0:o.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,s)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){const n=await this._taskMessageQueue.dequeueAll(t,r);for(const s of n)if(s.type==="request"&&Em(s.message)){const o=s.message.id,i=this._requestResolvers.get(o);i?(i(new ve(Se.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){var s,o;let n=((s=this._options)==null?void 0:s.defaultTaskPollInterval)??1e3;try{const i=await((o=this._taskStore)==null?void 0:o.getTask(t));i!=null&&i.pollInterval&&(n=i.pollInterval)}catch{}return new Promise((i,l)=>{if(r.aborted){l(new ve(Se.InvalidRequest,"Request cancelled"));return}const c=setTimeout(i,n);r.addEventListener("abort",()=>{clearTimeout(c),l(new ve(Se.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){const n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async s=>{if(!t)throw new Error("No request provided");return await n.createTask(s,t.id,{method:t.method,params:t.params},r)},getTask:async s=>{const o=await n.getTask(s,r);if(!o)throw new ve(Se.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(s,o,i)=>{await n.storeTaskResult(s,o,i,r);const l=await n.getTask(s,r);if(l){const c=Pd.parse({method:"notifications/tasks/status",params:l});await this.notification(c),po(l.status)&&this._cleanupTaskProgressHandler(s)}},getTaskResult:s=>n.getTaskResult(s,r),updateTaskStatus:async(s,o,i)=>{const l=await n.getTask(s,r);if(!l)throw new ve(Se.InvalidParams,`Task "${s}" not found - it may have been cleaned up`);if(po(l.status))throw new ve(Se.InvalidParams,`Cannot update task "${s}" from terminal status "${l.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(s,o,i,r);const c=await n.getTask(s,r);if(c){const u=Pd.parse({method:"notifications/tasks/status",params:c});await this.notification(u),po(c.status)&&this._cleanupTaskProgressHandler(s)}},listTasks:s=>n.listTasks(s,r)}}}function Fx(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function g9(e,t){const r={...e};for(const n in t){const s=n,o=t[s];if(o===void 0)continue;const i=r[s];Fx(i)&&Fx(o)?r[s]={...i,...o}:r[s]=o}return r}var Wm={exports:{}},ej={},ln={},wa={},Sc={},je={},Yl={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(m){if(super(),!e.IDENTIFIER.test(m))throw new Error("CodeGen: name must be a valid identifier");this.str=m}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(m){super(),this._items=typeof m=="string"?[m]:m}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const m=this._items[0];return m===""||m==='""'}get str(){var m;return(m=this._str)!==null&&m!==void 0?m:this._str=this._items.reduce((x,_)=>`${x}${_}`,"")}get names(){var m;return(m=this._names)!==null&&m!==void 0?m:this._names=this._items.reduce((x,_)=>(_ instanceof r&&(x[_.str]=(x[_.str]||0)+1),x),{})}}e._Code=n,e.nil=new n("");function s(p,...m){const x=[p[0]];let _=0;for(;_<m.length;)l(x,m[_]),x.push(p[++_]);return new n(x)}e._=s;const o=new n("+");function i(p,...m){const x=[v(p[0])];let _=0;for(;_<m.length;)x.push(o),l(x,m[_]),x.push(o,v(p[++_]));return c(x),new n(x)}e.str=i;function l(p,m){m instanceof n?p.push(...m._items):m instanceof r?p.push(m):p.push(f(m))}e.addCodeArg=l;function c(p){let m=1;for(;m<p.length-1;){if(p[m]===o){const x=u(p[m-1],p[m+1]);if(x!==void 0){p.splice(m-1,3,x);continue}p[m++]="+"}m++}}function u(p,m){if(m==='""')return p;if(p==='""')return m;if(typeof p=="string")return m instanceof r||p[p.length-1]!=='"'?void 0:typeof m!="string"?`${p.slice(0,-1)}${m}"`:m[0]==='"'?p.slice(0,-1)+m.slice(1):void 0;if(typeof m=="string"&&m[0]==='"'&&!(p instanceof r))return`"${p}${m.slice(1)}`}function d(p,m){return m.emptyStr()?p:p.emptyStr()?m:i`${p}${m}`}e.strConcat=d;function f(p){return typeof p=="number"||typeof p=="boolean"||p===null?p:v(Array.isArray(p)?p.join(","):p)}function g(p){return new n(v(p))}e.stringify=g;function v(p){return JSON.stringify(p).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=v;function b(p){return typeof p=="string"&&e.IDENTIFIER.test(p)?new n(`.${p}`):s`[${p}]`}e.getProperty=b;function h(p){if(typeof p=="string"&&e.IDENTIFIER.test(p))return new n(`${p}`);throw new Error(`CodeGen: invalid export name: ${p}, use explicit $id name mapping`)}e.getEsmExportName=h;function w(p){return new n(p.toString())}e.regexpCode=w})(Yl);var Zm={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=Yl;class r extends Error{constructor(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}}var n;(function(c){c[c.Started=0]="Started",c[c.Completed=1]="Completed"})(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class s{constructor({prefixes:u,parent:d}={}){this._names={},this._prefixes=u,this._parent=d}toName(u){return u instanceof t.Name?u:this.name(u)}name(u){return new t.Name(this._newName(u))}_newName(u){const d=this._names[u]||this._nameGroup(u);return`${u}${d.index++}`}_nameGroup(u){var d,f;if(!((f=(d=this._parent)===null||d===void 0?void 0:d._prefixes)===null||f===void 0)&&f.has(u)||this._prefixes&&!this._prefixes.has(u))throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);return this._names[u]={prefix:u,index:0}}}e.Scope=s;class o extends t.Name{constructor(u,d){super(d),this.prefix=u}setValue(u,{property:d,itemIndex:f}){this.value=u,this.scopePath=(0,t._)`.${new t.Name(d)}[${f}]`}}e.ValueScopeName=o;const i=(0,t._)`\n`;class l extends s{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts={...u,_n:u.lines?i:t.nil}}get(){return this._scope}name(u){return new o(u,this._newName(u))}value(u,d){var f;if(d.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const g=this.toName(u),{prefix:v}=g,b=(f=d.key)!==null&&f!==void 0?f:d.ref;let h=this._values[v];if(h){const m=h.get(b);if(m)return m}else h=this._values[v]=new Map;h.set(b,g);const w=this._scope[v]||(this._scope[v]=[]),p=w.length;return w[p]=d.ref,g.setValue(d,{property:v,itemIndex:p}),g}getValue(u,d){const f=this._values[u];if(f)return f.get(d)}scopeRefs(u,d=this._values){return this._reduceValues(d,f=>{if(f.scopePath===void 0)throw new Error(`CodeGen: name "${f}" has no value`);return(0,t._)`${u}${f.scopePath}`})}scopeCode(u=this._values,d,f){return this._reduceValues(u,g=>{if(g.value===void 0)throw new Error(`CodeGen: name "${g}" has no value`);return g.value.code},d,f)}_reduceValues(u,d,f={},g){let v=t.nil;for(const b in u){const h=u[b];if(!h)continue;const w=f[b]=f[b]||new Map;h.forEach(p=>{if(w.has(p))return;w.set(p,n.Started);let m=d(p);if(m){const x=this.opts.es5?e.varKinds.var:e.varKinds.const;v=(0,t._)`${v}${x} ${p} = ${m};${this.opts._n}`}else if(m=g==null?void 0:g(p))v=(0,t._)`${v}${m}${this.opts._n}`;else throw new r(p);w.set(p,n.Completed)})}return v}}e.ValueScope=l})(Zm);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=Yl,r=Zm;var n=Yl;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var s=Zm;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class o{optimizeNodes(){return this}optimizeNames(S,N){return this}}class i extends o{constructor(S,N,M){super(),this.varKind=S,this.name=N,this.rhs=M}render({es5:S,_n:N}){const M=S?r.varKinds.var:this.varKind,H=this.rhs===void 0?"":` = ${this.rhs}`;return`${M} ${this.name}${H};`+N}optimizeNames(S,N){if(S[this.name.str])return this.rhs&&(this.rhs=z(this.rhs,S,N)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class l extends o{constructor(S,N,M){super(),this.lhs=S,this.rhs=N,this.sideEffects=M}render({_n:S}){return`${this.lhs} = ${this.rhs};`+S}optimizeNames(S,N){if(!(this.lhs instanceof t.Name&&!S[this.lhs.str]&&!this.sideEffects))return this.rhs=z(this.rhs,S,N),this}get names(){const S=this.lhs instanceof t.Name?{}:{...this.lhs.names};return L(S,this.rhs)}}class c extends l{constructor(S,N,M,H){super(S,M,H),this.op=N}render({_n:S}){return`${this.lhs} ${this.op}= ${this.rhs};`+S}}class u extends o{constructor(S){super(),this.label=S,this.names={}}render({_n:S}){return`${this.label}:`+S}}class d extends o{constructor(S){super(),this.label=S,this.names={}}render({_n:S}){return`break${this.label?` ${this.label}`:""};`+S}}class f extends o{constructor(S){super(),this.error=S}render({_n:S}){return`throw ${this.error};`+S}get names(){return this.error.names}}class g extends o{constructor(S){super(),this.code=S}render({_n:S}){return`${this.code};`+S}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(S,N){return this.code=z(this.code,S,N),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class v extends o{constructor(S=[]){super(),this.nodes=S}render(S){return this.nodes.reduce((N,M)=>N+M.render(S),"")}optimizeNodes(){const{nodes:S}=this;let N=S.length;for(;N--;){const M=S[N].optimizeNodes();Array.isArray(M)?S.splice(N,1,...M):M?S[N]=M:S.splice(N,1)}return S.length>0?this:void 0}optimizeNames(S,N){const{nodes:M}=this;let H=M.length;for(;H--;){const G=M[H];G.optimizeNames(S,N)||(K(S,G.names),M.splice(H,1))}return M.length>0?this:void 0}get names(){return this.nodes.reduce((S,N)=>O(S,N.names),{})}}class b extends v{render(S){return"{"+S._n+super.render(S)+"}"+S._n}}class h extends v{}class w extends b{}w.kind="else";class p extends b{constructor(S,N){super(N),this.condition=S}render(S){let N=`if(${this.condition})`+super.render(S);return this.else&&(N+="else "+this.else.render(S)),N}optimizeNodes(){super.optimizeNodes();const S=this.condition;if(S===!0)return this.nodes;let N=this.else;if(N){const M=N.optimizeNodes();N=this.else=Array.isArray(M)?new w(M):M}if(N)return S===!1?N instanceof p?N:N.nodes:this.nodes.length?this:new p(Z(S),N instanceof p?[N]:N.nodes);if(!(S===!1||!this.nodes.length))return this}optimizeNames(S,N){var M;if(this.else=(M=this.else)===null||M===void 0?void 0:M.optimizeNames(S,N),!!(super.optimizeNames(S,N)||this.else))return this.condition=z(this.condition,S,N),this}get names(){const S=super.names;return L(S,this.condition),this.else&&O(S,this.else.names),S}}p.kind="if";class m extends b{}m.kind="for";class x extends m{constructor(S){super(),this.iteration=S}render(S){return`for(${this.iteration})`+super.render(S)}optimizeNames(S,N){if(super.optimizeNames(S,N))return this.iteration=z(this.iteration,S,N),this}get names(){return O(super.names,this.iteration.names)}}class _ extends m{constructor(S,N,M,H){super(),this.varKind=S,this.name=N,this.from=M,this.to=H}render(S){const N=S.es5?r.varKinds.var:this.varKind,{name:M,from:H,to:G}=this;return`for(${N} ${M}=${H}; ${M}<${G}; ${M}++)`+super.render(S)}get names(){const S=L(super.names,this.from);return L(S,this.to)}}class C extends m{constructor(S,N,M,H){super(),this.loop=S,this.varKind=N,this.name=M,this.iterable=H}render(S){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(S)}optimizeNames(S,N){if(super.optimizeNames(S,N))return this.iterable=z(this.iterable,S,N),this}get names(){return O(super.names,this.iterable.names)}}class $ extends b{constructor(S,N,M){super(),this.name=S,this.args=N,this.async=M}render(S){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(S)}}$.kind="func";class k extends v{render(S){return"return "+super.render(S)}}k.kind="return";class I extends b{render(S){let N="try"+super.render(S);return this.catch&&(N+=this.catch.render(S)),this.finally&&(N+=this.finally.render(S)),N}optimizeNodes(){var S,N;return super.optimizeNodes(),(S=this.catch)===null||S===void 0||S.optimizeNodes(),(N=this.finally)===null||N===void 0||N.optimizeNodes(),this}optimizeNames(S,N){var M,H;return super.optimizeNames(S,N),(M=this.catch)===null||M===void 0||M.optimizeNames(S,N),(H=this.finally)===null||H===void 0||H.optimizeNames(S,N),this}get names(){const S=super.names;return this.catch&&O(S,this.catch.names),this.finally&&O(S,this.finally.names),S}}class E extends b{constructor(S){super(),this.error=S}render(S){return`catch(${this.error})`+super.render(S)}}E.kind="catch";class U extends b{render(S){return"finally"+super.render(S)}}U.kind="finally";class P{constructor(S,N={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...N,_n:N.lines?`
|
|
414
|
+
`:""},this._extScope=S,this._scope=new r.Scope({parent:S}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(S){return this._scope.name(S)}scopeName(S){return this._extScope.name(S)}scopeValue(S,N){const M=this._extScope.value(S,N);return(this._values[M.prefix]||(this._values[M.prefix]=new Set)).add(M),M}getScopeValue(S,N){return this._extScope.getValue(S,N)}scopeRefs(S){return this._extScope.scopeRefs(S,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(S,N,M,H){const G=this._scope.toName(N);return M!==void 0&&H&&(this._constants[G.str]=M),this._leafNode(new i(S,G,M)),G}const(S,N,M){return this._def(r.varKinds.const,S,N,M)}let(S,N,M){return this._def(r.varKinds.let,S,N,M)}var(S,N,M){return this._def(r.varKinds.var,S,N,M)}assign(S,N,M){return this._leafNode(new l(S,N,M))}add(S,N){return this._leafNode(new c(S,e.operators.ADD,N))}code(S){return typeof S=="function"?S():S!==t.nil&&this._leafNode(new g(S)),this}object(...S){const N=["{"];for(const[M,H]of S)N.length>1&&N.push(","),N.push(M),(M!==H||this.opts.es5)&&(N.push(":"),(0,t.addCodeArg)(N,H));return N.push("}"),new t._Code(N)}if(S,N,M){if(this._blockNode(new p(S)),N&&M)this.code(N).else().code(M).endIf();else if(N)this.code(N).endIf();else if(M)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(S){return this._elseNode(new p(S))}else(){return this._elseNode(new w)}endIf(){return this._endBlockNode(p,w)}_for(S,N){return this._blockNode(S),N&&this.code(N).endFor(),this}for(S,N){return this._for(new x(S),N)}forRange(S,N,M,H,G=this.opts.es5?r.varKinds.var:r.varKinds.let){const me=this._scope.toName(S);return this._for(new _(G,me,N,M),()=>H(me))}forOf(S,N,M,H=r.varKinds.const){const G=this._scope.toName(S);if(this.opts.es5){const me=N instanceof t.Name?N:this.var("_arr",N);return this.forRange("_i",0,(0,t._)`${me}.length`,ne=>{this.var(G,(0,t._)`${me}[${ne}]`),M(G)})}return this._for(new C("of",H,G,N),()=>M(G))}forIn(S,N,M,H=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(S,(0,t._)`Object.keys(${N})`,M);const G=this._scope.toName(S);return this._for(new C("in",H,G,N),()=>M(G))}endFor(){return this._endBlockNode(m)}label(S){return this._leafNode(new u(S))}break(S){return this._leafNode(new d(S))}return(S){const N=new k;if(this._blockNode(N),this.code(S),N.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(S,N,M){if(!N&&!M)throw new Error('CodeGen: "try" without "catch" and "finally"');const H=new I;if(this._blockNode(H),this.code(S),N){const G=this.name("e");this._currNode=H.catch=new E(G),N(G)}return M&&(this._currNode=H.finally=new U,this.code(M)),this._endBlockNode(E,U)}throw(S){return this._leafNode(new f(S))}block(S,N){return this._blockStarts.push(this._nodes.length),S&&this.code(S).endBlock(N),this}endBlock(S){const N=this._blockStarts.pop();if(N===void 0)throw new Error("CodeGen: not in self-balancing block");const M=this._nodes.length-N;if(M<0||S!==void 0&&M!==S)throw new Error(`CodeGen: wrong number of nodes: ${M} vs ${S} expected`);return this._nodes.length=N,this}func(S,N=t.nil,M,H){return this._blockNode(new $(S,N,M)),H&&this.code(H).endFunc(),this}endFunc(){return this._endBlockNode($)}optimize(S=1){for(;S-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(S){return this._currNode.nodes.push(S),this}_blockNode(S){this._currNode.nodes.push(S),this._nodes.push(S)}_endBlockNode(S,N){const M=this._currNode;if(M instanceof S||N&&M instanceof N)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${N?`${S.kind}/${N.kind}`:S.kind}"`)}_elseNode(S){const N=this._currNode;if(!(N instanceof p))throw new Error('CodeGen: "else" without "if"');return this._currNode=N.else=S,this}get _root(){return this._nodes[0]}get _currNode(){const S=this._nodes;return S[S.length-1]}set _currNode(S){const N=this._nodes;N[N.length-1]=S}}e.CodeGen=P;function O(j,S){for(const N in S)j[N]=(j[N]||0)+(S[N]||0);return j}function L(j,S){return S instanceof t._CodeOrName?O(j,S.names):j}function z(j,S,N){if(j instanceof t.Name)return M(j);if(!H(j))return j;return new t._Code(j._items.reduce((G,me)=>(me instanceof t.Name&&(me=M(me)),me instanceof t._Code?G.push(...me._items):G.push(me),G),[]));function M(G){const me=N[G.str];return me===void 0||S[G.str]!==1?G:(delete S[G.str],me)}function H(G){return G instanceof t._Code&&G._items.some(me=>me instanceof t.Name&&S[me.str]===1&&N[me.str]!==void 0)}}function K(j,S){for(const N in S)j[N]=(j[N]||0)-(S[N]||0)}function Z(j){return typeof j=="boolean"||typeof j=="number"||j===null?!j:(0,t._)`!${q(j)}`}e.not=Z;const W=T(e.operators.AND);function F(...j){return j.reduce(W)}e.and=F;const V=T(e.operators.OR);function D(...j){return j.reduce(V)}e.or=D;function T(j){return(S,N)=>S===t.nil?N:N===t.nil?S:(0,t._)`${q(S)} ${j} ${q(N)}`}function q(j){return j instanceof t.Name?j:(0,t._)`(${j})`}})(je);var se={};Object.defineProperty(se,"__esModule",{value:!0});se.checkStrictMode=se.getErrorPath=se.Type=se.useFunc=se.setEvaluated=se.evaluatedPropsToName=se.mergeEvaluated=se.eachItem=se.unescapeJsonPointer=se.escapeJsonPointer=se.escapeFragment=se.unescapeFragment=se.schemaRefOrVal=se.schemaHasRulesButRef=se.schemaHasRules=se.checkUnknownRules=se.alwaysValidSchema=se.toHash=void 0;const We=je,v9=Yl;function y9(e){const t={};for(const r of e)t[r]=!0;return t}se.toHash=y9;function w9(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(tj(e,t),!rj(t,e.self.RULES.all))}se.alwaysValidSchema=w9;function tj(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;const s=n.RULES.keywords;for(const o in t)s[o]||oj(e,`unknown keyword: "${o}"`)}se.checkUnknownRules=tj;function rj(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(t[r])return!0;return!1}se.schemaHasRules=rj;function x9(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}se.schemaHasRulesButRef=x9;function b9({topSchemaRef:e,schemaPath:t},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,We._)`${r}`}return(0,We._)`${e}${t}${(0,We.getProperty)(n)}`}se.schemaRefOrVal=b9;function _9(e){return nj(decodeURIComponent(e))}se.unescapeFragment=_9;function S9(e){return encodeURIComponent(fy(e))}se.escapeFragment=S9;function fy(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}se.escapeJsonPointer=fy;function nj(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}se.unescapeJsonPointer=nj;function k9(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)}se.eachItem=k9;function Ux({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(s,o,i,l)=>{const c=i===void 0?o:i instanceof We.Name?(o instanceof We.Name?e(s,o,i):t(s,o,i),i):o instanceof We.Name?(t(s,i,o),o):r(o,i);return l===We.Name&&!(c instanceof We.Name)?n(s,c):c}}se.mergeEvaluated={props:Ux({mergeNames:(e,t,r)=>e.if((0,We._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,We._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,We._)`${r} || {}`).code((0,We._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,We._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,We._)`${r} || {}`),hy(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:sj}),items:Ux({mergeNames:(e,t,r)=>e.if((0,We._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,We._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,We._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,We._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function sj(e,t){if(t===!0)return e.var("props",!0);const r=e.var("props",(0,We._)`{}`);return t!==void 0&&hy(e,r,t),r}se.evaluatedPropsToName=sj;function hy(e,t,r){Object.keys(r).forEach(n=>e.assign((0,We._)`${t}${(0,We.getProperty)(n)}`,!0))}se.setEvaluated=hy;const qx={};function C9(e,t){return e.scopeValue("func",{ref:t,code:qx[t.code]||(qx[t.code]=new v9._Code(t.code))})}se.useFunc=C9;var Gm;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Gm||(se.Type=Gm={}));function E9(e,t,r){if(e instanceof We.Name){const n=t===Gm.Num;return r?n?(0,We._)`"[" + ${e} + "]"`:(0,We._)`"['" + ${e} + "']"`:n?(0,We._)`"/" + ${e}`:(0,We._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,We.getProperty)(e).toString():"/"+fy(e)}se.getErrorPath=E9;function oj(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}se.checkStrictMode=oj;var Mn={};Object.defineProperty(Mn,"__esModule",{value:!0});const Bt=je,N9={data:new Bt.Name("data"),valCxt:new Bt.Name("valCxt"),instancePath:new Bt.Name("instancePath"),parentData:new Bt.Name("parentData"),parentDataProperty:new Bt.Name("parentDataProperty"),rootData:new Bt.Name("rootData"),dynamicAnchors:new Bt.Name("dynamicAnchors"),vErrors:new Bt.Name("vErrors"),errors:new Bt.Name("errors"),this:new Bt.Name("this"),self:new Bt.Name("self"),scope:new Bt.Name("scope"),json:new Bt.Name("json"),jsonPos:new Bt.Name("jsonPos"),jsonLen:new Bt.Name("jsonLen"),jsonPart:new Bt.Name("jsonPart")};Mn.default=N9;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=je,r=se,n=Mn;e.keywordError={message:({keyword:w})=>(0,t.str)`must pass "${w}" keyword validation`},e.keyword$DataError={message:({keyword:w,schemaType:p})=>p?(0,t.str)`"${w}" keyword must be ${p} ($data)`:(0,t.str)`"${w}" keyword is invalid ($data)`};function s(w,p=e.keywordError,m,x){const{it:_}=w,{gen:C,compositeRule:$,allErrors:k}=_,I=f(w,p,m);x??($||k)?c(C,I):u(_,(0,t._)`[${I}]`)}e.reportError=s;function o(w,p=e.keywordError,m){const{it:x}=w,{gen:_,compositeRule:C,allErrors:$}=x,k=f(w,p,m);c(_,k),C||$||u(x,n.default.vErrors)}e.reportExtraError=o;function i(w,p){w.assign(n.default.errors,p),w.if((0,t._)`${n.default.vErrors} !== null`,()=>w.if(p,()=>w.assign((0,t._)`${n.default.vErrors}.length`,p),()=>w.assign(n.default.vErrors,null)))}e.resetErrorsCount=i;function l({gen:w,keyword:p,schemaValue:m,data:x,errsCount:_,it:C}){if(_===void 0)throw new Error("ajv implementation error");const $=w.name("err");w.forRange("i",_,n.default.errors,k=>{w.const($,(0,t._)`${n.default.vErrors}[${k}]`),w.if((0,t._)`${$}.instancePath === undefined`,()=>w.assign((0,t._)`${$}.instancePath`,(0,t.strConcat)(n.default.instancePath,C.errorPath))),w.assign((0,t._)`${$}.schemaPath`,(0,t.str)`${C.errSchemaPath}/${p}`),C.opts.verbose&&(w.assign((0,t._)`${$}.schema`,m),w.assign((0,t._)`${$}.data`,x))})}e.extendErrors=l;function c(w,p){const m=w.const("err",p);w.if((0,t._)`${n.default.vErrors} === null`,()=>w.assign(n.default.vErrors,(0,t._)`[${m}]`),(0,t._)`${n.default.vErrors}.push(${m})`),w.code((0,t._)`${n.default.errors}++`)}function u(w,p){const{gen:m,validateName:x,schemaEnv:_}=w;_.$async?m.throw((0,t._)`new ${w.ValidationError}(${p})`):(m.assign((0,t._)`${x}.errors`,p),m.return(!1))}const d={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function f(w,p,m){const{createErrors:x}=w.it;return x===!1?(0,t._)`{}`:g(w,p,m)}function g(w,p,m={}){const{gen:x,it:_}=w,C=[v(_,m),b(w,m)];return h(w,p,C),x.object(...C)}function v({errorPath:w},{instancePath:p}){const m=p?(0,t.str)`${w}${(0,r.getErrorPath)(p,r.Type.Str)}`:w;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,m)]}function b({keyword:w,it:{errSchemaPath:p}},{schemaPath:m,parentSchema:x}){let _=x?p:(0,t.str)`${p}/${w}`;return m&&(_=(0,t.str)`${_}${(0,r.getErrorPath)(m,r.Type.Str)}`),[d.schemaPath,_]}function h(w,{params:p,message:m},x){const{keyword:_,data:C,schemaValue:$,it:k}=w,{opts:I,propertyName:E,topSchemaRef:U,schemaPath:P}=k;x.push([d.keyword,_],[d.params,typeof p=="function"?p(w):p||(0,t._)`{}`]),I.messages&&x.push([d.message,typeof m=="function"?m(w):m]),I.verbose&&x.push([d.schema,$],[d.parentSchema,(0,t._)`${U}${P}`],[n.default.data,C]),E&&x.push([d.propertyName,E])}})(Sc);Object.defineProperty(wa,"__esModule",{value:!0});wa.boolOrEmptySchema=wa.topBoolOrEmptySchema=void 0;const j9=Sc,$9=je,P9=Mn,T9={message:"boolean schema is false"};function R9(e){const{gen:t,schema:r,validateName:n}=e;r===!1?ij(e,!1):typeof r=="object"&&r.$async===!0?t.return(P9.default.data):(t.assign((0,$9._)`${n}.errors`,null),t.return(!0))}wa.topBoolOrEmptySchema=R9;function I9(e,t){const{gen:r,schema:n}=e;n===!1?(r.var(t,!1),ij(e)):r.var(t,!0)}wa.boolOrEmptySchema=I9;function ij(e,t){const{gen:r,data:n}=e,s={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,j9.reportError)(s,T9,void 0,t)}var Ct={},Jo={};Object.defineProperty(Jo,"__esModule",{value:!0});Jo.getRules=Jo.isJSONType=void 0;const A9=["string","number","integer","boolean","null","object","array"],O9=new Set(A9);function M9(e){return typeof e=="string"&&O9.has(e)}Jo.isJSONType=M9;function D9(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}Jo.getRules=D9;var Yn={};Object.defineProperty(Yn,"__esModule",{value:!0});Yn.shouldUseRule=Yn.shouldUseGroup=Yn.schemaHasRulesForType=void 0;function z9({schema:e,self:t},r){const n=t.RULES.types[r];return n&&n!==!0&&aj(e,n)}Yn.schemaHasRulesForType=z9;function aj(e,t){return t.rules.some(r=>lj(e,r))}Yn.shouldUseGroup=aj;function lj(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}Yn.shouldUseRule=lj;Object.defineProperty(Ct,"__esModule",{value:!0});Ct.reportTypeError=Ct.checkDataTypes=Ct.checkDataType=Ct.coerceAndCheckDataType=Ct.getJSONTypes=Ct.getSchemaTypes=Ct.DataType=void 0;const L9=Jo,F9=Yn,U9=Sc,Ee=je,cj=se;var Hi;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Hi||(Ct.DataType=Hi={}));function q9(e){const t=uj(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Ct.getSchemaTypes=q9;function uj(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(L9.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ct.getJSONTypes=uj;function V9(e,t){const{gen:r,data:n,opts:s}=e,o=H9(t,s.coerceTypes),i=t.length>0&&!(o.length===0&&t.length===1&&(0,F9.schemaHasRulesForType)(e,t[0]));if(i){const l=py(t,n,s.strictNumbers,Hi.Wrong);r.if(l,()=>{o.length?K9(e,t,o):my(e)})}return i}Ct.coerceAndCheckDataType=V9;const dj=new Set(["string","number","integer","boolean","null"]);function H9(e,t){return t?e.filter(r=>dj.has(r)||t==="array"&&r==="array"):[]}function K9(e,t,r){const{gen:n,data:s,opts:o}=e,i=n.let("dataType",(0,Ee._)`typeof ${s}`),l=n.let("coerced",(0,Ee._)`undefined`);o.coerceTypes==="array"&&n.if((0,Ee._)`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0,Ee._)`${s}[0]`).assign(i,(0,Ee._)`typeof ${s}`).if(py(t,s,o.strictNumbers),()=>n.assign(l,s))),n.if((0,Ee._)`${l} !== undefined`);for(const u of r)(dj.has(u)||u==="array"&&o.coerceTypes==="array")&&c(u);n.else(),my(e),n.endIf(),n.if((0,Ee._)`${l} !== undefined`,()=>{n.assign(s,l),B9(e,l)});function c(u){switch(u){case"string":n.elseIf((0,Ee._)`${i} == "number" || ${i} == "boolean"`).assign(l,(0,Ee._)`"" + ${s}`).elseIf((0,Ee._)`${s} === null`).assign(l,(0,Ee._)`""`);return;case"number":n.elseIf((0,Ee._)`${i} == "boolean" || ${s} === null
|
|
415
|
+
|| (${i} == "string" && ${s} && ${s} == +${s})`).assign(l,(0,Ee._)`+${s}`);return;case"integer":n.elseIf((0,Ee._)`${i} === "boolean" || ${s} === null
|
|
416
|
+
|| (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(l,(0,Ee._)`+${s}`);return;case"boolean":n.elseIf((0,Ee._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(l,!1).elseIf((0,Ee._)`${s} === "true" || ${s} === 1`).assign(l,!0);return;case"null":n.elseIf((0,Ee._)`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(l,null);return;case"array":n.elseIf((0,Ee._)`${i} === "string" || ${i} === "number"
|
|
417
|
+
|| ${i} === "boolean" || ${s} === null`).assign(l,(0,Ee._)`[${s}]`)}}}function B9({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,Ee._)`${t} !== undefined`,()=>e.assign((0,Ee._)`${t}[${r}]`,n))}function Qm(e,t,r,n=Hi.Correct){const s=n===Hi.Correct?Ee.operators.EQ:Ee.operators.NEQ;let o;switch(e){case"null":return(0,Ee._)`${t} ${s} null`;case"array":o=(0,Ee._)`Array.isArray(${t})`;break;case"object":o=(0,Ee._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=i((0,Ee._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=i();break;default:return(0,Ee._)`typeof ${t} ${s} ${e}`}return n===Hi.Correct?o:(0,Ee.not)(o);function i(l=Ee.nil){return(0,Ee.and)((0,Ee._)`typeof ${t} == "number"`,l,r?(0,Ee._)`isFinite(${t})`:Ee.nil)}}Ct.checkDataType=Qm;function py(e,t,r,n){if(e.length===1)return Qm(e[0],t,r,n);let s;const o=(0,cj.toHash)(e);if(o.array&&o.object){const i=(0,Ee._)`typeof ${t} != "object"`;s=o.null?i:(0,Ee._)`!${t} || ${i}`,delete o.null,delete o.array,delete o.object}else s=Ee.nil;o.number&&delete o.integer;for(const i in o)s=(0,Ee.and)(s,Qm(i,t,r,n));return s}Ct.checkDataTypes=py;const W9={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,Ee._)`{type: ${e}}`:(0,Ee._)`{type: ${t}}`};function my(e){const t=Z9(e);(0,U9.reportError)(t,W9)}Ct.reportTypeError=my;function Z9(e){const{gen:t,data:r,schema:n}=e,s=(0,cj.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}var Lf={};Object.defineProperty(Lf,"__esModule",{value:!0});Lf.assignDefaults=void 0;const ui=je,G9=se;function Q9(e,t){const{properties:r,items:n}=e.schema;if(t==="object"&&r)for(const s in r)Vx(e,s,r[s].default);else t==="array"&&Array.isArray(n)&&n.forEach((s,o)=>Vx(e,o,s.default))}Lf.assignDefaults=Q9;function Vx(e,t,r){const{gen:n,compositeRule:s,data:o,opts:i}=e;if(r===void 0)return;const l=(0,ui._)`${o}${(0,ui.getProperty)(t)}`;if(s){(0,G9.checkStrictMode)(e,`default is ignored for: ${l}`);return}let c=(0,ui._)`${l} === undefined`;i.useDefaults==="empty"&&(c=(0,ui._)`${c} || ${l} === null || ${l} === ""`),n.if(c,(0,ui._)`${l} = ${(0,ui.stringify)(r)}`)}var Nn={},Pe={};Object.defineProperty(Pe,"__esModule",{value:!0});Pe.validateUnion=Pe.validateArray=Pe.usePattern=Pe.callValidateCode=Pe.schemaProperties=Pe.allSchemaProperties=Pe.noPropertyInData=Pe.propertyInData=Pe.isOwnProperty=Pe.hasPropFunc=Pe.reportMissingProp=Pe.checkMissingProp=Pe.checkReportMissingProp=void 0;const Ye=je,gy=se,gs=Mn,J9=se;function Y9(e,t){const{gen:r,data:n,it:s}=e;r.if(yy(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0,Ye._)`${t}`},!0),e.error()})}Pe.checkReportMissingProp=Y9;function X9({gen:e,data:t,it:{opts:r}},n,s){return(0,Ye.or)(...n.map(o=>(0,Ye.and)(yy(e,t,o,r.ownProperties),(0,Ye._)`${s} = ${o}`)))}Pe.checkMissingProp=X9;function e6(e,t){e.setParams({missingProperty:t},!0),e.error()}Pe.reportMissingProp=e6;function fj(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Ye._)`Object.prototype.hasOwnProperty`})}Pe.hasPropFunc=fj;function vy(e,t,r){return(0,Ye._)`${fj(e)}.call(${t}, ${r})`}Pe.isOwnProperty=vy;function t6(e,t,r,n){const s=(0,Ye._)`${t}${(0,Ye.getProperty)(r)} !== undefined`;return n?(0,Ye._)`${s} && ${vy(e,t,r)}`:s}Pe.propertyInData=t6;function yy(e,t,r,n){const s=(0,Ye._)`${t}${(0,Ye.getProperty)(r)} === undefined`;return n?(0,Ye.or)(s,(0,Ye.not)(vy(e,t,r))):s}Pe.noPropertyInData=yy;function hj(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}Pe.allSchemaProperties=hj;function r6(e,t){return hj(t).filter(r=>!(0,gy.alwaysValidSchema)(e,t[r]))}Pe.schemaProperties=r6;function n6({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:o},it:i},l,c,u){const d=u?(0,Ye._)`${e}, ${t}, ${n}${s}`:t,f=[[gs.default.instancePath,(0,Ye.strConcat)(gs.default.instancePath,o)],[gs.default.parentData,i.parentData],[gs.default.parentDataProperty,i.parentDataProperty],[gs.default.rootData,gs.default.rootData]];i.opts.dynamicRef&&f.push([gs.default.dynamicAnchors,gs.default.dynamicAnchors]);const g=(0,Ye._)`${d}, ${r.object(...f)}`;return c!==Ye.nil?(0,Ye._)`${l}.call(${c}, ${g})`:(0,Ye._)`${l}(${g})`}Pe.callValidateCode=n6;const s6=(0,Ye._)`new RegExp`;function o6({gen:e,it:{opts:t}},r){const n=t.unicodeRegExp?"u":"",{regExp:s}=t.code,o=s(r,n);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,Ye._)`${s.code==="new RegExp"?s6:(0,J9.useFunc)(e,s)}(${r}, ${n})`})}Pe.usePattern=o6;function i6(e){const{gen:t,data:r,keyword:n,it:s}=e,o=t.name("valid");if(s.allErrors){const l=t.let("valid",!0);return i(()=>t.assign(l,!1)),l}return t.var(o,!0),i(()=>t.break()),o;function i(l){const c=t.const("len",(0,Ye._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:gy.Type.Num},o),t.if((0,Ye.not)(o),l)})}}Pe.validateArray=i6;function a6(e){const{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,gy.alwaysValidSchema)(s,c))&&!s.opts.unevaluated)return;const i=t.let("valid",!1),l=t.name("_valid");t.block(()=>r.forEach((c,u)=>{const d=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},l);t.assign(i,(0,Ye._)`${i} || ${l}`),e.mergeValidEvaluated(d,l)||t.if((0,Ye.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}Pe.validateUnion=a6;Object.defineProperty(Nn,"__esModule",{value:!0});Nn.validateKeywordUsage=Nn.validSchemaType=Nn.funcKeywordCode=Nn.macroKeywordCode=void 0;const tr=je,_o=Mn,l6=Pe,c6=Sc;function u6(e,t){const{gen:r,keyword:n,schema:s,parentSchema:o,it:i}=e,l=t.macro.call(i.self,s,o,i),c=pj(r,n,l);i.opts.validateSchema!==!1&&i.self.validateSchema(l,!0);const u=r.name("valid");e.subschema({schema:l,schemaPath:tr.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}Nn.macroKeywordCode=u6;function d6(e,t){var r;const{gen:n,keyword:s,schema:o,parentSchema:i,$data:l,it:c}=e;h6(c,t);const u=!l&&t.compile?t.compile.call(c.self,o,i,c):t.validate,d=pj(n,s,u),f=n.let("valid");e.block$data(f,g),e.ok((r=t.valid)!==null&&r!==void 0?r:f);function g(){if(t.errors===!1)h(),t.modifying&&Hx(e),w(()=>e.error());else{const p=t.async?v():b();t.modifying&&Hx(e),w(()=>f6(e,p))}}function v(){const p=n.let("ruleErrs",null);return n.try(()=>h((0,tr._)`await `),m=>n.assign(f,!1).if((0,tr._)`${m} instanceof ${c.ValidationError}`,()=>n.assign(p,(0,tr._)`${m}.errors`),()=>n.throw(m))),p}function b(){const p=(0,tr._)`${d}.errors`;return n.assign(p,null),h(tr.nil),p}function h(p=t.async?(0,tr._)`await `:tr.nil){const m=c.opts.passContext?_o.default.this:_o.default.self,x=!("compile"in t&&!l||t.schema===!1);n.assign(f,(0,tr._)`${p}${(0,l6.callValidateCode)(e,d,m,x)}`,t.modifying)}function w(p){var m;n.if((0,tr.not)((m=t.valid)!==null&&m!==void 0?m:f),p)}}Nn.funcKeywordCode=d6;function Hx(e){const{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,tr._)`${n.parentData}[${n.parentDataProperty}]`))}function f6(e,t){const{gen:r}=e;r.if((0,tr._)`Array.isArray(${t})`,()=>{r.assign(_o.default.vErrors,(0,tr._)`${_o.default.vErrors} === null ? ${t} : ${_o.default.vErrors}.concat(${t})`).assign(_o.default.errors,(0,tr._)`${_o.default.vErrors}.length`),(0,c6.extendErrors)(e)},()=>e.error())}function h6({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function pj(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,tr.stringify)(r)})}function p6(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}Nn.validSchemaType=p6;function m6({schema:e,opts:t,self:r,errSchemaPath:n},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw new Error("ajv implementation error");const i=s.dependencies;if(i!=null&&i.some(l=>!Object.prototype.hasOwnProperty.call(e,l)))throw new Error(`parent schema must have dependencies of ${o}: ${i.join(",")}`);if(s.validateSchema&&!s.validateSchema(e[o])){const c=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Nn.validateKeywordUsage=m6;var Js={};Object.defineProperty(Js,"__esModule",{value:!0});Js.extendSubschemaMode=Js.extendSubschemaData=Js.getSubschema=void 0;const Cn=je,mj=se;function g6(e,{keyword:t,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:o,topSchemaRef:i}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){const l=e.schema[t];return r===void 0?{schema:l,schemaPath:(0,Cn._)`${e.schemaPath}${(0,Cn.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:l[r],schemaPath:(0,Cn._)`${e.schemaPath}${(0,Cn.getProperty)(t)}${(0,Cn.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,mj.escapeFragment)(r)}`}}if(n!==void 0){if(s===void 0||o===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:i,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}Js.getSubschema=g6;function v6(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:o,propertyName:i}){if(s!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:l}=t;if(r!==void 0){const{errorPath:u,dataPathArr:d,opts:f}=t,g=l.let("data",(0,Cn._)`${t.data}${(0,Cn.getProperty)(r)}`,!0);c(g),e.errorPath=(0,Cn.str)`${u}${(0,mj.getErrorPath)(r,n,f.jsPropertySyntax)}`,e.parentDataProperty=(0,Cn._)`${r}`,e.dataPathArr=[...d,e.parentDataProperty]}if(s!==void 0){const u=s instanceof Cn.Name?s:l.let("data",s,!0);c(u),i!==void 0&&(e.propertyName=i)}o&&(e.dataTypes=o);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}Js.extendSubschemaData=v6;function y6(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:o}){n!==void 0&&(e.compositeRule=n),s!==void 0&&(e.createErrors=s),o!==void 0&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}Js.extendSubschemaMode=y6;var Mt={},gj=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,o;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[s]))return!1;for(s=n;s--!==0;){var i=o[s];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r},vj={exports:{}},Fs=vj.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};Lu(t,n,s,e,"",e)};Fs.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Fs.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Fs.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Fs.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Lu(e,t,r,n,s,o,i,l,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,o,i,l,c,u);for(var d in n){var f=n[d];if(Array.isArray(f)){if(d in Fs.arrayKeywords)for(var g=0;g<f.length;g++)Lu(e,t,r,f[g],s+"/"+d+"/"+g,o,s,d,n,g)}else if(d in Fs.propsKeywords){if(f&&typeof f=="object")for(var v in f)Lu(e,t,r,f[v],s+"/"+d+"/"+w6(v),o,s,d,n,v)}else(d in Fs.keywords||e.allKeys&&!(d in Fs.skipKeywords))&&Lu(e,t,r,f,s+"/"+d,o,s,d,n)}r(n,s,o,i,l,c,u)}}function w6(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var x6=vj.exports;Object.defineProperty(Mt,"__esModule",{value:!0});Mt.getSchemaRefs=Mt.resolveUrl=Mt.normalizeId=Mt._getFullPath=Mt.getFullPath=Mt.inlineRef=void 0;const b6=se,_6=gj,S6=x6,k6=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function C6(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Jm(e):t?yj(e)<=t:!1}Mt.inlineRef=C6;const E6=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Jm(e){for(const t in e){if(E6.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(Jm)||typeof r=="object"&&Jm(r))return!0}return!1}function yj(e){let t=0;for(const r in e){if(r==="$ref")return 1/0;if(t++,!k6.has(r)&&(typeof e[r]=="object"&&(0,b6.eachItem)(e[r],n=>t+=yj(n)),t===1/0))return 1/0}return t}function wj(e,t="",r){r!==!1&&(t=Ki(t));const n=e.parse(t);return xj(e,n)}Mt.getFullPath=wj;function xj(e,t){return e.serialize(t).split("#")[0]+"#"}Mt._getFullPath=xj;const N6=/#\/?$/;function Ki(e){return e?e.replace(N6,""):""}Mt.normalizeId=Ki;function j6(e,t,r){return r=Ki(r),e.resolve(t,r)}Mt.resolveUrl=j6;const $6=/^[a-z_][-a-z0-9._]*$/i;function P6(e,t){if(typeof e=="boolean")return{};const{schemaId:r,uriResolver:n}=this.opts,s=Ki(e[r]||t),o={"":s},i=wj(n,s,!1),l={},c=new Set;return S6(e,{allKeys:!0},(f,g,v,b)=>{if(b===void 0)return;const h=i+g;let w=o[b];typeof f[r]=="string"&&(w=p.call(this,f[r])),m.call(this,f.$anchor),m.call(this,f.$dynamicAnchor),o[g]=w;function p(x){const _=this.opts.uriResolver.resolve;if(x=Ki(w?_(w,x):x),c.has(x))throw d(x);c.add(x);let C=this.refs[x];return typeof C=="string"&&(C=this.refs[C]),typeof C=="object"?u(f,C.schema,x):x!==Ki(h)&&(x[0]==="#"?(u(f,l[x],x),l[x]=f):this.refs[x]=h),x}function m(x){if(typeof x=="string"){if(!$6.test(x))throw new Error(`invalid anchor "${x}"`);p.call(this,`#${x}`)}}}),l;function u(f,g,v){if(g!==void 0&&!_6(f,g))throw d(v)}function d(f){return new Error(`reference "${f}" resolves to more than one schema`)}}Mt.getSchemaRefs=P6;Object.defineProperty(ln,"__esModule",{value:!0});ln.getData=ln.KeywordCxt=ln.validateFunctionCode=void 0;const bj=wa,Kx=Ct,wy=Yn,Ud=Ct,T6=Lf,kl=Nn,Kh=Js,fe=je,we=Mn,R6=Mt,Xn=se,Ga=Sc;function I6(e){if(kj(e)&&(Cj(e),Sj(e))){M6(e);return}_j(e,()=>(0,bj.topBoolOrEmptySchema)(e))}ln.validateFunctionCode=I6;function _j({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},o){s.code.es5?e.func(t,(0,fe._)`${we.default.data}, ${we.default.valCxt}`,n.$async,()=>{e.code((0,fe._)`"use strict"; ${Bx(r,s)}`),O6(e,s),e.code(o)}):e.func(t,(0,fe._)`${we.default.data}, ${A6(s)}`,n.$async,()=>e.code(Bx(r,s)).code(o))}function A6(e){return(0,fe._)`{${we.default.instancePath}="", ${we.default.parentData}, ${we.default.parentDataProperty}, ${we.default.rootData}=${we.default.data}${e.dynamicRef?(0,fe._)`, ${we.default.dynamicAnchors}={}`:fe.nil}}={}`}function O6(e,t){e.if(we.default.valCxt,()=>{e.var(we.default.instancePath,(0,fe._)`${we.default.valCxt}.${we.default.instancePath}`),e.var(we.default.parentData,(0,fe._)`${we.default.valCxt}.${we.default.parentData}`),e.var(we.default.parentDataProperty,(0,fe._)`${we.default.valCxt}.${we.default.parentDataProperty}`),e.var(we.default.rootData,(0,fe._)`${we.default.valCxt}.${we.default.rootData}`),t.dynamicRef&&e.var(we.default.dynamicAnchors,(0,fe._)`${we.default.valCxt}.${we.default.dynamicAnchors}`)},()=>{e.var(we.default.instancePath,(0,fe._)`""`),e.var(we.default.parentData,(0,fe._)`undefined`),e.var(we.default.parentDataProperty,(0,fe._)`undefined`),e.var(we.default.rootData,we.default.data),t.dynamicRef&&e.var(we.default.dynamicAnchors,(0,fe._)`{}`)})}function M6(e){const{schema:t,opts:r,gen:n}=e;_j(e,()=>{r.$comment&&t.$comment&&Nj(e),U6(e),n.let(we.default.vErrors,null),n.let(we.default.errors,0),r.unevaluated&&D6(e),Ej(e),H6(e)})}function D6(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,fe._)`${r}.evaluated`),t.if((0,fe._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,fe._)`${e.evaluated}.props`,(0,fe._)`undefined`)),t.if((0,fe._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,fe._)`${e.evaluated}.items`,(0,fe._)`undefined`))}function Bx(e,t){const r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,fe._)`/*# sourceURL=${r} */`:fe.nil}function z6(e,t){if(kj(e)&&(Cj(e),Sj(e))){L6(e,t);return}(0,bj.boolOrEmptySchema)(e,t)}function Sj({schema:e,self:t}){if(typeof e=="boolean")return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function kj(e){return typeof e.schema!="boolean"}function L6(e,t){const{schema:r,gen:n,opts:s}=e;s.$comment&&r.$comment&&Nj(e),q6(e),V6(e);const o=n.const("_errs",we.default.errors);Ej(e,o),n.var(t,(0,fe._)`${o} === ${we.default.errors}`)}function Cj(e){(0,Xn.checkUnknownRules)(e),F6(e)}function Ej(e,t){if(e.opts.jtd)return Wx(e,[],!1,t);const r=(0,Kx.getSchemaTypes)(e.schema),n=(0,Kx.coerceAndCheckDataType)(e,r);Wx(e,r,!n,t)}function F6(e){const{schema:t,errSchemaPath:r,opts:n,self:s}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Xn.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function U6(e){const{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Xn.checkStrictMode)(e,"default is ignored in the schema root")}function q6(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,R6.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function V6(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Nj({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){const o=r.$comment;if(s.$comment===!0)e.code((0,fe._)`${we.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){const i=(0,fe.str)`${n}/$comment`,l=e.scopeValue("root",{ref:t.root});e.code((0,fe._)`${we.default.self}.opts.$comment(${o}, ${i}, ${l}.schema)`)}}function H6(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:o}=e;r.$async?t.if((0,fe._)`${we.default.errors} === 0`,()=>t.return(we.default.data),()=>t.throw((0,fe._)`new ${s}(${we.default.vErrors})`)):(t.assign((0,fe._)`${n}.errors`,we.default.vErrors),o.unevaluated&&K6(e),t.return((0,fe._)`${we.default.errors} === 0`))}function K6({gen:e,evaluated:t,props:r,items:n}){r instanceof fe.Name&&e.assign((0,fe._)`${t}.props`,r),n instanceof fe.Name&&e.assign((0,fe._)`${t}.items`,n)}function Wx(e,t,r,n){const{gen:s,schema:o,data:i,allErrors:l,opts:c,self:u}=e,{RULES:d}=u;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,Xn.schemaHasRulesButRef)(o,d))){s.block(()=>Pj(e,"$ref",d.all.$ref.definition));return}c.jtd||B6(e,t),s.block(()=>{for(const g of d.rules)f(g);f(d.post)});function f(g){(0,wy.shouldUseGroup)(o,g)&&(g.type?(s.if((0,Ud.checkDataType)(g.type,i,c.strictNumbers)),Zx(e,g),t.length===1&&t[0]===g.type&&r&&(s.else(),(0,Ud.reportTypeError)(e)),s.endIf()):Zx(e,g),l||s.if((0,fe._)`${we.default.errors} === ${n||0}`))}}function Zx(e,t){const{gen:r,schema:n,opts:{useDefaults:s}}=e;s&&(0,T6.assignDefaults)(e,t.type),r.block(()=>{for(const o of t.rules)(0,wy.shouldUseRule)(n,o)&&Pj(e,o.keyword,o.definition,t.type)})}function B6(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(W6(e,t),e.opts.allowUnionTypes||Z6(e,t),G6(e,e.dataTypes))}function W6(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{jj(e.dataTypes,r)||xy(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),J6(e,t)}}function Z6(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&xy(e,"use allowUnionTypes to allow union type keyword")}function G6(e,t){const r=e.self.RULES.all;for(const n in r){const s=r[n];if(typeof s=="object"&&(0,wy.shouldUseRule)(e.schema,s)){const{type:o}=s.definition;o.length&&!o.some(i=>Q6(t,i))&&xy(e,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function Q6(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function jj(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function J6(e,t){const r=[];for(const n of e.dataTypes)jj(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function xy(e,t){const r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Xn.checkStrictMode)(e,t,e.opts.strictTypes)}class $j{constructor(t,r,n){if((0,kl.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Xn.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",Tj(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,kl.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",we.default.errors))}result(t,r,n){this.failResult((0,fe.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,fe.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);const{schemaCode:r}=this;this.fail((0,fe._)`${r} !== undefined && (${(0,fe.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?Ga.reportExtraError:Ga.reportError)(this,this.def.error,r)}$dataError(){(0,Ga.reportError)(this,this.def.$dataError||Ga.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ga.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=fe.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=fe.nil,r=fe.nil){if(!this.$data)return;const{gen:n,schemaCode:s,schemaType:o,def:i}=this;n.if((0,fe.or)((0,fe._)`${s} === undefined`,r)),t!==fe.nil&&n.assign(t,!0),(o.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==fe.nil&&n.assign(t,!1)),n.else()}invalid$data(){const{gen:t,schemaCode:r,schemaType:n,def:s,it:o}=this;return(0,fe.or)(i(),l());function i(){if(n.length){if(!(r instanceof fe.Name))throw new Error("ajv implementation error");const c=Array.isArray(n)?n:[n];return(0,fe._)`${(0,Ud.checkDataTypes)(c,r,o.opts.strictNumbers,Ud.DataType.Wrong)}`}return fe.nil}function l(){if(s.validateSchema){const c=t.scopeValue("validate$data",{ref:s.validateSchema});return(0,fe._)`!${c}(${r})`}return fe.nil}}subschema(t,r){const n=(0,Kh.getSubschema)(this.it,t);(0,Kh.extendSubschemaData)(n,this.it,t),(0,Kh.extendSubschemaMode)(n,t);const s={...this.it,...n,items:void 0,props:void 0};return z6(s,r),s}mergeEvaluated(t,r){const{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Xn.mergeEvaluated.props(s,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Xn.mergeEvaluated.items(s,t.items,n.items,r)))}mergeValidEvaluated(t,r){const{it:n,gen:s}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return s.if(r,()=>this.mergeEvaluated(t,fe.Name)),!0}}ln.KeywordCxt=$j;function Pj(e,t,r,n){const s=new $j(e,r,t);"code"in r?r.code(s,n):s.$data&&r.validate?(0,kl.funcKeywordCode)(s,r):"macro"in r?(0,kl.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,kl.funcKeywordCode)(s,r)}const Y6=/^\/(?:[^~]|~0|~1)*$/,X6=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Tj(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,o;if(e==="")return we.default.rootData;if(e[0]==="/"){if(!Y6.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);s=e,o=we.default.rootData}else{const u=X6.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);const d=+u[1];if(s=u[2],s==="#"){if(d>=t)throw new Error(c("property/index",d));return n[t-d]}if(d>t)throw new Error(c("data",d));if(o=r[t-d],!s)return o}let i=o;const l=s.split("/");for(const u of l)u&&(o=(0,fe._)`${o}${(0,fe.getProperty)((0,Xn.unescapeJsonPointer)(u))}`,i=(0,fe._)`${i} && ${o}`);return i;function c(u,d){return`Cannot access ${u} ${d} levels up, current level is ${t}`}}ln.getData=Tj;var kc={};Object.defineProperty(kc,"__esModule",{value:!0});class e8 extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}kc.default=e8;var Ra={};Object.defineProperty(Ra,"__esModule",{value:!0});const Bh=Mt;class t8 extends Error{constructor(t,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Bh.resolveUrl)(t,r,n),this.missingSchema=(0,Bh.normalizeId)((0,Bh.getFullPath)(t,this.missingRef))}}Ra.default=t8;var hr={};Object.defineProperty(hr,"__esModule",{value:!0});hr.resolveSchema=hr.getCompilingSchema=hr.resolveRef=hr.compileSchema=hr.SchemaEnv=void 0;const Br=je,r8=kc,mo=Mn,nn=Mt,Gx=se,n8=ln;class Ff{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,nn.normalizeId)(n==null?void 0:n[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n==null?void 0:n.$async,this.refs={}}}hr.SchemaEnv=Ff;function by(e){const t=Rj.call(this,e);if(t)return t;const r=(0,nn.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new Br.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o});let l;e.$async&&(l=i.scopeValue("Error",{ref:r8.default,code:(0,Br._)`require("ajv/dist/runtime/validation_error").default`}));const c=i.scopeName("validate");e.validateName=c;const u={gen:i,allErrors:this.opts.allErrors,data:mo.default.data,parentData:mo.default.parentData,parentDataProperty:mo.default.parentDataProperty,dataNames:[mo.default.data],dataPathArr:[Br.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Br.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:l,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Br.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Br._)`""`,opts:this.opts,self:this};let d;try{this._compilations.add(e),(0,n8.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);const f=i.toString();d=`${i.scopeRefs(mo.default.scope)}return ${f}`,this.opts.code.process&&(d=this.opts.code.process(d,e));const v=new Function(`${mo.default.self}`,`${mo.default.scope}`,d)(this,this.scope.get());if(this.scope.value(c,{ref:v}),v.errors=null,v.schema=e.schema,v.schemaEnv=e,e.$async&&(v.$async=!0),this.opts.code.source===!0&&(v.source={validateName:c,validateCode:f,scopeValues:i._values}),this.opts.unevaluated){const{props:b,items:h}=u;v.evaluated={props:b instanceof Br.Name?void 0:b,items:h instanceof Br.Name?void 0:h,dynamicProps:b instanceof Br.Name,dynamicItems:h instanceof Br.Name},v.source&&(v.source.evaluated=(0,Br.stringify)(v.evaluated))}return e.validate=v,e}catch(f){throw delete e.validate,delete e.validateName,d&&this.logger.error("Error compiling schema, function code:",d),f}finally{this._compilations.delete(e)}}hr.compileSchema=by;function s8(e,t,r){var n;r=(0,nn.resolveUrl)(this.opts.uriResolver,t,r);const s=e.refs[r];if(s)return s;let o=a8.call(this,e,r);if(o===void 0){const i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:l}=this.opts;i&&(o=new Ff({schema:i,schemaId:l,root:e,baseId:t}))}if(o!==void 0)return e.refs[r]=o8.call(this,o)}hr.resolveRef=s8;function o8(e){return(0,nn.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:by.call(this,e)}function Rj(e){for(const t of this._compilations)if(i8(t,e))return t}hr.getCompilingSchema=Rj;function i8(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function a8(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Uf.call(this,e,t)}function Uf(e,t){const r=this.opts.uriResolver.parse(t),n=(0,nn._getFullPath)(this.opts.uriResolver,r);let s=(0,nn.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return Wh.call(this,r,e);const o=(0,nn.normalizeId)(n),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){const l=Uf.call(this,e,i);return typeof(l==null?void 0:l.schema)!="object"?void 0:Wh.call(this,r,l)}if(typeof(i==null?void 0:i.schema)=="object"){if(i.validate||by.call(this,i),o===(0,nn.normalizeId)(t)){const{schema:l}=i,{schemaId:c}=this.opts,u=l[c];return u&&(s=(0,nn.resolveUrl)(this.opts.uriResolver,s,u)),new Ff({schema:l,schemaId:c,root:e,baseId:s})}return Wh.call(this,r,i)}}hr.resolveSchema=Uf;const l8=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Wh(e,{baseId:t,schema:r,root:n}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(const l of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;const c=r[(0,Gx.unescapeFragment)(l)];if(c===void 0)return;r=c;const u=typeof r=="object"&&r[this.opts.schemaId];!l8.has(l)&&u&&(t=(0,nn.resolveUrl)(this.opts.uriResolver,t,u))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,Gx.schemaHasRulesButRef)(r,this.RULES)){const l=(0,nn.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=Uf.call(this,n,l)}const{schemaId:i}=this.opts;if(o=o||new Ff({schema:r,schemaId:i,root:n,baseId:t}),o.schema!==o.root.schema)return o}const c8="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",u8="Meta-schema for $data reference (JSON AnySchema extension proposal)",d8="object",f8=["$data"],h8={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},p8=!1,m8={$id:c8,description:u8,type:d8,required:f8,properties:h8,additionalProperties:p8};var _y={},qf={exports:{}};const g8={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};var v8={HEX:g8};const{HEX:y8}=v8,w8=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function Ij(e){if(Oj(e,".")<3)return{host:e,isIPV4:!1};const t=e.match(w8)||[],[r]=t;return r?{host:b8(r,"."),isIPV4:!0}:{host:e,isIPV4:!1}}function Qx(e,t=!1){let r="",n=!0;for(const s of e){if(y8[s]===void 0)return;s!=="0"&&n===!0&&(n=!1),n||(r+=s)}return t&&r.length===0&&(r="0"),r}function x8(e){let t=0;const r={error:!1,address:"",zone:""},n=[],s=[];let o=!1,i=!1,l=!1;function c(){if(s.length){if(o===!1){const u=Qx(s);if(u!==void 0)n.push(u);else return r.error=!0,!1}s.length=0}return!0}for(let u=0;u<e.length;u++){const d=e[u];if(!(d==="["||d==="]"))if(d===":"){if(i===!0&&(l=!0),!c())break;if(t++,n.push(":"),t>7){r.error=!0;break}u-1>=0&&e[u-1]===":"&&(i=!0);continue}else if(d==="%"){if(!c())break;o=!0}else{s.push(d);continue}}return s.length&&(o?r.zone=s.join(""):l?n.push(s.join("")):n.push(Qx(s))),r.address=n.join(""),r}function Aj(e){if(Oj(e,":")<2)return{host:e,isIPV6:!1};const t=x8(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,escapedHost:n,isIPV6:!0}}}function b8(e,t){let r="",n=!0;const s=e.length;for(let o=0;o<s;o++){const i=e[o];i==="0"&&n?(o+1<=s&&e[o+1]===t||o+1===s)&&(r+=i,n=!1):(i===t?n=!0:n=!1,r+=i)}return r}function Oj(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}const Jx=/^\.\.?\//u,Yx=/^\/\.(?:\/|$)/u,Xx=/^\/\.\.(?:\/|$)/u,_8=/^\/?(?:.|\n)*?(?=\/|$)/u;function S8(e){const t=[];for(;e.length;)if(e.match(Jx))e=e.replace(Jx,"");else if(e.match(Yx))e=e.replace(Yx,"/");else if(e.match(Xx))e=e.replace(Xx,"/"),t.pop();else if(e==="."||e==="..")e="";else{const r=e.match(_8);if(r){const n=r[0];e=e.slice(n.length),t.push(n)}else throw new Error("Unexpected dot segment condition")}return t.join("")}function k8(e,t){const r=t!==!0?escape:unescape;return e.scheme!==void 0&&(e.scheme=r(e.scheme)),e.userinfo!==void 0&&(e.userinfo=r(e.userinfo)),e.host!==void 0&&(e.host=r(e.host)),e.path!==void 0&&(e.path=r(e.path)),e.query!==void 0&&(e.query=r(e.query)),e.fragment!==void 0&&(e.fragment=r(e.fragment)),e}function C8(e){const t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);const n=Ij(r);if(n.isIPV4)r=n.host;else{const s=Aj(n.host);s.isIPV6===!0?r=`[${s.escapedHost}]`:r=e.host}t.push(r)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}var E8={recomposeAuthority:C8,normalizeComponentEncoding:k8,removeDotSegments:S8,normalizeIPv4:Ij,normalizeIPv6:Aj};const N8=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,j8=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function Mj(e){return typeof e.secure=="boolean"?e.secure:String(e.scheme).toLowerCase()==="wss"}function Dj(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function zj(e){const t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function $8(e){return e.secure=Mj(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function P8(e){if((e.port===(Mj(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){const[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function T8(e,t){if(!e.path)return e.error="URN can not be parsed",e;const r=e.path.match(j8);if(r){const n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];const s=`${n}:${t.nid||e.nid}`,o=Sy[s];e.path=void 0,o&&(e=o.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function R8(e,t){const r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),s=`${r}:${t.nid||n}`,o=Sy[s];o&&(e=o.serialize(e,t));const i=e,l=e.nss;return i.path=`${n||t.nid}:${l}`,t.skipEscape=!0,i}function I8(e,t){const r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!N8.test(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function A8(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t}const Lj={scheme:"http",domainHost:!0,parse:Dj,serialize:zj},O8={scheme:"https",domainHost:Lj.domainHost,parse:Dj,serialize:zj},Fu={scheme:"ws",domainHost:!0,parse:$8,serialize:P8},M8={scheme:"wss",domainHost:Fu.domainHost,parse:Fu.parse,serialize:Fu.serialize},D8={scheme:"urn",parse:T8,serialize:R8,skipNormalize:!0},z8={scheme:"urn:uuid",parse:I8,serialize:A8,skipNormalize:!0},Sy={http:Lj,https:O8,ws:Fu,wss:M8,urn:D8,"urn:uuid":z8};var L8=Sy;const{normalizeIPv6:F8,normalizeIPv4:U8,removeDotSegments:ll,recomposeAuthority:q8,normalizeComponentEncoding:uu}=E8,ky=L8;function V8(e,t){return typeof e=="string"?e=jn(as(e,t),t):typeof e=="object"&&(e=as(jn(e,t),t)),e}function H8(e,t,r){const n=Object.assign({scheme:"null"},r),s=Fj(as(e,n),as(t,n),n,!0);return jn(s,{...n,skipEscape:!0})}function Fj(e,t,r,n){const s={};return n||(e=as(jn(e,r),r),t=as(jn(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=ll(t.path||""),s.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=ll(t.path||""),s.query=t.query):(t.path?(t.path.charAt(0)==="/"?s.path=ll(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?s.path="/"+t.path:e.path?s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:s.path=t.path,s.path=ll(s.path)),s.query=t.query):(s.path=e.path,t.query!==void 0?s.query=t.query:s.query=e.query),s.userinfo=e.userinfo,s.host=e.host,s.port=e.port),s.scheme=e.scheme),s.fragment=t.fragment,s}function K8(e,t,r){return typeof e=="string"?(e=unescape(e),e=jn(uu(as(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=jn(uu(e,!0),{...r,skipEscape:!0})),typeof t=="string"?(t=unescape(t),t=jn(uu(as(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=jn(uu(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function jn(e,t){const r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),s=[],o=ky[(n.scheme||r.scheme||"").toLowerCase()];o&&o.serialize&&o.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&s.push(r.scheme,":");const i=q8(r);if(i!==void 0&&(n.reference!=="suffix"&&s.push("//"),s.push(i),r.path&&r.path.charAt(0)!=="/"&&s.push("/")),r.path!==void 0){let l=r.path;!n.absolutePath&&(!o||!o.absolutePath)&&(l=ll(l)),i===void 0&&(l=l.replace(/^\/\//u,"/%2F")),s.push(l)}return r.query!==void 0&&s.push("?",r.query),r.fragment!==void 0&&s.push("#",r.fragment),s.join("")}const B8=Array.from({length:127},(e,t)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(t)));function W8(e){let t=0;for(let r=0,n=e.length;r<n;++r)if(t=e.charCodeAt(r),t>126||B8[t])return!0;return!1}const Z8=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function as(e,t){const r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=e.indexOf("%")!==-1;let o=!1;r.reference==="suffix"&&(e=(r.scheme?r.scheme+":":"")+"//"+e);const i=e.match(Z8);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host){const c=U8(n.host);if(c.isIPV4===!1){const u=F8(c.host);n.host=u.host.toLowerCase(),o=u.isIPV6}else n.host=c.host,o=!0}n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");const l=ky[(r.scheme||n.scheme||"").toLowerCase()];if(!r.unicodeSupport&&(!l||!l.unicodeSupport)&&n.host&&(r.domainHost||l&&l.domainHost)&&o===!1&&W8(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(c){n.error=n.error||"Host's domain name can not be converted to ASCII: "+c}(!l||l&&!l.skipNormalize)&&(s&&n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),s&&n.host!==void 0&&(n.host=unescape(n.host)),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),l&&l.parse&&l.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}const Cy={SCHEMES:ky,normalize:V8,resolve:H8,resolveComponents:Fj,equal:K8,serialize:jn,parse:as};qf.exports=Cy;qf.exports.default=Cy;qf.exports.fastUri=Cy;var G8=qf.exports;Object.defineProperty(_y,"__esModule",{value:!0});const Uj=G8;Uj.code='require("ajv/dist/runtime/uri").default';_y.default=Uj;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=ln;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=je;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const n=kc,s=Ra,o=Jo,i=hr,l=je,c=Mt,u=Ct,d=se,f=m8,g=_y,v=(D,T)=>new RegExp(D,T);v.code="new RegExp";const b=["removeAdditional","useDefaults","coerceTypes"],h=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),w={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},p={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},m=200;function x(D){var T,q,j,S,N,M,H,G,me,ne,ue,ye,Be,pt,Y,de,ee,$e,oe,Oe,Me,De,Pr,Tr,Rr;const mt=D.strict,ir=(T=D.code)===null||T===void 0?void 0:T.optimize,ho=ir===!0||ir===void 0?1:ir||0,fs=(j=(q=D.code)===null||q===void 0?void 0:q.regExp)!==null&&j!==void 0?j:v,si=(S=D.uriResolver)!==null&&S!==void 0?S:g.default;return{strictSchema:(M=(N=D.strictSchema)!==null&&N!==void 0?N:mt)!==null&&M!==void 0?M:!0,strictNumbers:(G=(H=D.strictNumbers)!==null&&H!==void 0?H:mt)!==null&&G!==void 0?G:!0,strictTypes:(ne=(me=D.strictTypes)!==null&&me!==void 0?me:mt)!==null&&ne!==void 0?ne:"log",strictTuples:(ye=(ue=D.strictTuples)!==null&&ue!==void 0?ue:mt)!==null&&ye!==void 0?ye:"log",strictRequired:(pt=(Be=D.strictRequired)!==null&&Be!==void 0?Be:mt)!==null&&pt!==void 0?pt:!1,code:D.code?{...D.code,optimize:ho,regExp:fs}:{optimize:ho,regExp:fs},loopRequired:(Y=D.loopRequired)!==null&&Y!==void 0?Y:m,loopEnum:(de=D.loopEnum)!==null&&de!==void 0?de:m,meta:(ee=D.meta)!==null&&ee!==void 0?ee:!0,messages:($e=D.messages)!==null&&$e!==void 0?$e:!0,inlineRefs:(oe=D.inlineRefs)!==null&&oe!==void 0?oe:!0,schemaId:(Oe=D.schemaId)!==null&&Oe!==void 0?Oe:"$id",addUsedSchema:(Me=D.addUsedSchema)!==null&&Me!==void 0?Me:!0,validateSchema:(De=D.validateSchema)!==null&&De!==void 0?De:!0,validateFormats:(Pr=D.validateFormats)!==null&&Pr!==void 0?Pr:!0,unicodeRegExp:(Tr=D.unicodeRegExp)!==null&&Tr!==void 0?Tr:!0,int32range:(Rr=D.int32range)!==null&&Rr!==void 0?Rr:!0,uriResolver:si}}class _{constructor(T={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,T=this.opts={...T,...x(T)};const{es5:q,lines:j}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:h,es5:q,lines:j}),this.logger=O(T.logger);const S=T.validateFormats;T.validateFormats=!1,this.RULES=(0,o.getRules)(),C.call(this,w,T,"NOT SUPPORTED"),C.call(this,p,T,"DEPRECATED","warn"),this._metaOpts=U.call(this),T.formats&&I.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),T.keywords&&E.call(this,T.keywords),typeof T.meta=="object"&&this.addMetaSchema(T.meta),k.call(this),T.validateFormats=S}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:T,meta:q,schemaId:j}=this.opts;let S=f;j==="id"&&(S={...f},S.id=S.$id,delete S.$id),q&&T&&this.addMetaSchema(S,S[j],!1)}defaultMeta(){const{meta:T,schemaId:q}=this.opts;return this.opts.defaultMeta=typeof T=="object"?T[q]||T:void 0}validate(T,q){let j;if(typeof T=="string"){if(j=this.getSchema(T),!j)throw new Error(`no schema with key or ref "${T}"`)}else j=this.compile(T);const S=j(q);return"$async"in j||(this.errors=j.errors),S}compile(T,q){const j=this._addSchema(T,q);return j.validate||this._compileSchemaEnv(j)}compileAsync(T,q){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:j}=this.opts;return S.call(this,T,q);async function S(ne,ue){await N.call(this,ne.$schema);const ye=this._addSchema(ne,ue);return ye.validate||M.call(this,ye)}async function N(ne){ne&&!this.getSchema(ne)&&await S.call(this,{$ref:ne},!0)}async function M(ne){try{return this._compileSchemaEnv(ne)}catch(ue){if(!(ue instanceof s.default))throw ue;return H.call(this,ue),await G.call(this,ue.missingSchema),M.call(this,ne)}}function H({missingSchema:ne,missingRef:ue}){if(this.refs[ne])throw new Error(`AnySchema ${ne} is loaded but ${ue} cannot be resolved`)}async function G(ne){const ue=await me.call(this,ne);this.refs[ne]||await N.call(this,ue.$schema),this.refs[ne]||this.addSchema(ue,ne,q)}async function me(ne){const ue=this._loading[ne];if(ue)return ue;try{return await(this._loading[ne]=j(ne))}finally{delete this._loading[ne]}}}addSchema(T,q,j,S=this.opts.validateSchema){if(Array.isArray(T)){for(const M of T)this.addSchema(M,void 0,j,S);return this}let N;if(typeof T=="object"){const{schemaId:M}=this.opts;if(N=T[M],N!==void 0&&typeof N!="string")throw new Error(`schema ${M} must be string`)}return q=(0,c.normalizeId)(q||N),this._checkUnique(q),this.schemas[q]=this._addSchema(T,j,q,S,!0),this}addMetaSchema(T,q,j=this.opts.validateSchema){return this.addSchema(T,q,!0,j),this}validateSchema(T,q){if(typeof T=="boolean")return!0;let j;if(j=T.$schema,j!==void 0&&typeof j!="string")throw new Error("$schema must be a string");if(j=j||this.opts.defaultMeta||this.defaultMeta(),!j)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const S=this.validate(j,T);if(!S&&q){const N="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(N);else throw new Error(N)}return S}getSchema(T){let q;for(;typeof(q=$.call(this,T))=="string";)T=q;if(q===void 0){const{schemaId:j}=this.opts,S=new i.SchemaEnv({schema:{},schemaId:j});if(q=i.resolveSchema.call(this,S,T),!q)return;this.refs[T]=q}return q.validate||this._compileSchemaEnv(q)}removeSchema(T){if(T instanceof RegExp)return this._removeAllSchemas(this.schemas,T),this._removeAllSchemas(this.refs,T),this;switch(typeof T){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const q=$.call(this,T);return typeof q=="object"&&this._cache.delete(q.schema),delete this.schemas[T],delete this.refs[T],this}case"object":{const q=T;this._cache.delete(q);let j=T[this.opts.schemaId];return j&&(j=(0,c.normalizeId)(j),delete this.schemas[j],delete this.refs[j]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(T){for(const q of T)this.addKeyword(q);return this}addKeyword(T,q){let j;if(typeof T=="string")j=T,typeof q=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),q.keyword=j);else if(typeof T=="object"&&q===void 0){if(q=T,j=q.keyword,Array.isArray(j)&&!j.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(z.call(this,j,q),!q)return(0,d.eachItem)(j,N=>K.call(this,N)),this;W.call(this,q);const S={...q,type:(0,u.getJSONTypes)(q.type),schemaType:(0,u.getJSONTypes)(q.schemaType)};return(0,d.eachItem)(j,S.type.length===0?N=>K.call(this,N,S):N=>S.type.forEach(M=>K.call(this,N,S,M))),this}getKeyword(T){const q=this.RULES.all[T];return typeof q=="object"?q.definition:!!q}removeKeyword(T){const{RULES:q}=this;delete q.keywords[T],delete q.all[T];for(const j of q.rules){const S=j.rules.findIndex(N=>N.keyword===T);S>=0&&j.rules.splice(S,1)}return this}addFormat(T,q){return typeof q=="string"&&(q=new RegExp(q)),this.formats[T]=q,this}errorsText(T=this.errors,{separator:q=", ",dataVar:j="data"}={}){return!T||T.length===0?"No errors":T.map(S=>`${j}${S.instancePath} ${S.message}`).reduce((S,N)=>S+q+N)}$dataMetaSchema(T,q){const j=this.RULES.all;T=JSON.parse(JSON.stringify(T));for(const S of q){const N=S.split("/").slice(1);let M=T;for(const H of N)M=M[H];for(const H in j){const G=j[H];if(typeof G!="object")continue;const{$data:me}=G.definition,ne=M[H];me&&ne&&(M[H]=V(ne))}}return T}_removeAllSchemas(T,q){for(const j in T){const S=T[j];(!q||q.test(j))&&(typeof S=="string"?delete T[j]:S&&!S.meta&&(this._cache.delete(S.schema),delete T[j]))}}_addSchema(T,q,j,S=this.opts.validateSchema,N=this.opts.addUsedSchema){let M;const{schemaId:H}=this.opts;if(typeof T=="object")M=T[H];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof T!="boolean")throw new Error("schema must be object or boolean")}let G=this._cache.get(T);if(G!==void 0)return G;j=(0,c.normalizeId)(M||j);const me=c.getSchemaRefs.call(this,T,j);return G=new i.SchemaEnv({schema:T,schemaId:H,meta:q,baseId:j,localRefs:me}),this._cache.set(G.schema,G),N&&!j.startsWith("#")&&(j&&this._checkUnique(j),this.refs[j]=G),S&&this.validateSchema(T,!0),G}_checkUnique(T){if(this.schemas[T]||this.refs[T])throw new Error(`schema with key or id "${T}" already exists`)}_compileSchemaEnv(T){if(T.meta?this._compileMetaSchema(T):i.compileSchema.call(this,T),!T.validate)throw new Error("ajv implementation error");return T.validate}_compileMetaSchema(T){const q=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,T)}finally{this.opts=q}}}_.ValidationError=n.default,_.MissingRefError=s.default,e.default=_;function C(D,T,q,j="error"){for(const S in D){const N=S;N in T&&this.logger[j](`${q}: option ${S}. ${D[N]}`)}}function $(D){return D=(0,c.normalizeId)(D),this.schemas[D]||this.refs[D]}function k(){const D=this.opts.schemas;if(D)if(Array.isArray(D))this.addSchema(D);else for(const T in D)this.addSchema(D[T],T)}function I(){for(const D in this.opts.formats){const T=this.opts.formats[D];T&&this.addFormat(D,T)}}function E(D){if(Array.isArray(D)){this.addVocabulary(D);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const T in D){const q=D[T];q.keyword||(q.keyword=T),this.addKeyword(q)}}function U(){const D={...this.opts};for(const T of b)delete D[T];return D}const P={log(){},warn(){},error(){}};function O(D){if(D===!1)return P;if(D===void 0)return console;if(D.log&&D.warn&&D.error)return D;throw new Error("logger must implement log, warn and error methods")}const L=/^[a-z_$][a-z0-9_$:-]*$/i;function z(D,T){const{RULES:q}=this;if((0,d.eachItem)(D,j=>{if(q.keywords[j])throw new Error(`Keyword ${j} is already defined`);if(!L.test(j))throw new Error(`Keyword ${j} has invalid name`)}),!!T&&T.$data&&!("code"in T||"validate"in T))throw new Error('$data keyword must have "code" or "validate" function')}function K(D,T,q){var j;const S=T==null?void 0:T.post;if(q&&S)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:N}=this;let M=S?N.post:N.rules.find(({type:G})=>G===q);if(M||(M={type:q,rules:[]},N.rules.push(M)),N.keywords[D]=!0,!T)return;const H={keyword:D,definition:{...T,type:(0,u.getJSONTypes)(T.type),schemaType:(0,u.getJSONTypes)(T.schemaType)}};T.before?Z.call(this,M,H,T.before):M.rules.push(H),N.all[D]=H,(j=T.implements)===null||j===void 0||j.forEach(G=>this.addKeyword(G))}function Z(D,T,q){const j=D.rules.findIndex(S=>S.keyword===q);j>=0?D.rules.splice(j,0,T):(D.rules.push(T),this.logger.warn(`rule ${q} is not defined`))}function W(D){let{metaSchema:T}=D;T!==void 0&&(D.$data&&this.opts.$data&&(T=V(T)),D.validateSchema=this.compile(T,!0))}const F={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function V(D){return{anyOf:[D,F]}}})(ej);var Ey={},Ny={},jy={};Object.defineProperty(jy,"__esModule",{value:!0});const Q8={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};jy.default=Q8;var Yo={};Object.defineProperty(Yo,"__esModule",{value:!0});Yo.callRef=Yo.getValidate=void 0;const J8=Ra,eb=Pe,cr=je,di=Mn,tb=hr,du=se,Y8={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:o,validateName:i,opts:l,self:c}=n,{root:u}=o;if((r==="#"||r==="#/")&&s===u.baseId)return f();const d=tb.resolveRef.call(c,u,s,r);if(d===void 0)throw new J8.default(n.opts.uriResolver,s,r);if(d instanceof tb.SchemaEnv)return g(d);return v(d);function f(){if(o===u)return Uu(e,i,o,o.$async);const b=t.scopeValue("root",{ref:u});return Uu(e,(0,cr._)`${b}.validate`,u,u.$async)}function g(b){const h=qj(e,b);Uu(e,h,b,b.$async)}function v(b){const h=t.scopeValue("schema",l.code.source===!0?{ref:b,code:(0,cr.stringify)(b)}:{ref:b}),w=t.name("valid"),p=e.subschema({schema:b,dataTypes:[],schemaPath:cr.nil,topSchemaRef:h,errSchemaPath:r},w);e.mergeEvaluated(p),e.ok(w)}}};function qj(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,cr._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Yo.getValidate=qj;function Uu(e,t,r,n){const{gen:s,it:o}=e,{allErrors:i,schemaEnv:l,opts:c}=o,u=c.passContext?di.default.this:cr.nil;n?d():f();function d(){if(!l.$async)throw new Error("async schema referenced by sync schema");const b=s.let("valid");s.try(()=>{s.code((0,cr._)`await ${(0,eb.callValidateCode)(e,t,u)}`),v(t),i||s.assign(b,!0)},h=>{s.if((0,cr._)`!(${h} instanceof ${o.ValidationError})`,()=>s.throw(h)),g(h),i||s.assign(b,!1)}),e.ok(b)}function f(){e.result((0,eb.callValidateCode)(e,t,u),()=>v(t),()=>g(t))}function g(b){const h=(0,cr._)`${b}.errors`;s.assign(di.default.vErrors,(0,cr._)`${di.default.vErrors} === null ? ${h} : ${di.default.vErrors}.concat(${h})`),s.assign(di.default.errors,(0,cr._)`${di.default.vErrors}.length`)}function v(b){var h;if(!o.opts.unevaluated)return;const w=(h=r==null?void 0:r.validate)===null||h===void 0?void 0:h.evaluated;if(o.props!==!0)if(w&&!w.dynamicProps)w.props!==void 0&&(o.props=du.mergeEvaluated.props(s,w.props,o.props));else{const p=s.var("props",(0,cr._)`${b}.evaluated.props`);o.props=du.mergeEvaluated.props(s,p,o.props,cr.Name)}if(o.items!==!0)if(w&&!w.dynamicItems)w.items!==void 0&&(o.items=du.mergeEvaluated.items(s,w.items,o.items));else{const p=s.var("items",(0,cr._)`${b}.evaluated.items`);o.items=du.mergeEvaluated.items(s,p,o.items,cr.Name)}}}Yo.callRef=Uu;Yo.default=Y8;Object.defineProperty(Ny,"__esModule",{value:!0});const X8=jy,eq=Yo,tq=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",X8.default,eq.default];Ny.default=tq;var $y={},Py={};Object.defineProperty(Py,"__esModule",{value:!0});const qd=je,vs=qd.operators,Vd={maximum:{okStr:"<=",ok:vs.LTE,fail:vs.GT},minimum:{okStr:">=",ok:vs.GTE,fail:vs.LT},exclusiveMaximum:{okStr:"<",ok:vs.LT,fail:vs.GTE},exclusiveMinimum:{okStr:">",ok:vs.GT,fail:vs.LTE}},rq={message:({keyword:e,schemaCode:t})=>(0,qd.str)`must be ${Vd[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,qd._)`{comparison: ${Vd[e].okStr}, limit: ${t}}`},nq={keyword:Object.keys(Vd),type:"number",schemaType:"number",$data:!0,error:rq,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,qd._)`${r} ${Vd[t].fail} ${n} || isNaN(${r})`)}};Py.default=nq;var Ty={};Object.defineProperty(Ty,"__esModule",{value:!0});const Cl=je,sq={message:({schemaCode:e})=>(0,Cl.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,Cl._)`{multipleOf: ${e}}`},oq={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:sq,code(e){const{gen:t,data:r,schemaCode:n,it:s}=e,o=s.opts.multipleOfPrecision,i=t.let("res"),l=o?(0,Cl._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:(0,Cl._)`${i} !== parseInt(${i})`;e.fail$data((0,Cl._)`(${n} === 0 || (${i} = ${r}/${n}, ${l}))`)}};Ty.default=oq;var Ry={},Iy={};Object.defineProperty(Iy,"__esModule",{value:!0});function Vj(e){const t=e.length;let r=0,n=0,s;for(;n<t;)r++,s=e.charCodeAt(n++),s>=55296&&s<=56319&&n<t&&(s=e.charCodeAt(n),(s&64512)===56320&&n++);return r}Iy.default=Vj;Vj.code='require("ajv/dist/runtime/ucs2length").default';Object.defineProperty(Ry,"__esModule",{value:!0});const So=je,iq=se,aq=Iy,lq={message({keyword:e,schemaCode:t}){const r=e==="maxLength"?"more":"fewer";return(0,So.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,So._)`{limit: ${e}}`},cq={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:lq,code(e){const{keyword:t,data:r,schemaCode:n,it:s}=e,o=t==="maxLength"?So.operators.GT:So.operators.LT,i=s.opts.unicode===!1?(0,So._)`${r}.length`:(0,So._)`${(0,iq.useFunc)(e.gen,aq.default)}(${r})`;e.fail$data((0,So._)`${i} ${o} ${n}`)}};Ry.default=cq;var Ay={};Object.defineProperty(Ay,"__esModule",{value:!0});const uq=Pe,Hd=je,dq={message:({schemaCode:e})=>(0,Hd.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,Hd._)`{pattern: ${e}}`},fq={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:dq,code(e){const{data:t,$data:r,schema:n,schemaCode:s,it:o}=e,i=o.opts.unicodeRegExp?"u":"",l=r?(0,Hd._)`(new RegExp(${s}, ${i}))`:(0,uq.usePattern)(e,n);e.fail$data((0,Hd._)`!${l}.test(${t})`)}};Ay.default=fq;var Oy={};Object.defineProperty(Oy,"__esModule",{value:!0});const El=je,hq={message({keyword:e,schemaCode:t}){const r=e==="maxProperties"?"more":"fewer";return(0,El.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,El._)`{limit: ${e}}`},pq={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:hq,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?El.operators.GT:El.operators.LT;e.fail$data((0,El._)`Object.keys(${r}).length ${s} ${n}`)}};Oy.default=pq;var My={};Object.defineProperty(My,"__esModule",{value:!0});const Qa=Pe,Nl=je,mq=se,gq={message:({params:{missingProperty:e}})=>(0,Nl.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Nl._)`{missingProperty: ${e}}`},vq={keyword:"required",type:"object",schemaType:"array",$data:!0,error:gq,code(e){const{gen:t,schema:r,schemaCode:n,data:s,$data:o,it:i}=e,{opts:l}=i;if(!o&&r.length===0)return;const c=r.length>=l.loopRequired;if(i.allErrors?u():d(),l.strictRequired){const v=e.parentSchema.properties,{definedProperties:b}=e.it;for(const h of r)if((v==null?void 0:v[h])===void 0&&!b.has(h)){const w=i.schemaEnv.baseId+i.errSchemaPath,p=`required property "${h}" is not defined at "${w}" (strictRequired)`;(0,mq.checkStrictMode)(i,p,i.opts.strictRequired)}}function u(){if(c||o)e.block$data(Nl.nil,f);else for(const v of r)(0,Qa.checkReportMissingProp)(e,v)}function d(){const v=t.let("missing");if(c||o){const b=t.let("valid",!0);e.block$data(b,()=>g(v,b)),e.ok(b)}else t.if((0,Qa.checkMissingProp)(e,r,v)),(0,Qa.reportMissingProp)(e,v),t.else()}function f(){t.forOf("prop",n,v=>{e.setParams({missingProperty:v}),t.if((0,Qa.noPropertyInData)(t,s,v,l.ownProperties),()=>e.error())})}function g(v,b){e.setParams({missingProperty:v}),t.forOf(v,n,()=>{t.assign(b,(0,Qa.propertyInData)(t,s,v,l.ownProperties)),t.if((0,Nl.not)(b),()=>{e.error(),t.break()})},Nl.nil)}}};My.default=vq;var Dy={};Object.defineProperty(Dy,"__esModule",{value:!0});const jl=je,yq={message({keyword:e,schemaCode:t}){const r=e==="maxItems"?"more":"fewer";return(0,jl.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,jl._)`{limit: ${e}}`},wq={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:yq,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?jl.operators.GT:jl.operators.LT;e.fail$data((0,jl._)`${r}.length ${s} ${n}`)}};Dy.default=wq;var zy={},Cc={};Object.defineProperty(Cc,"__esModule",{value:!0});const Hj=gj;Hj.code='require("ajv/dist/runtime/equal").default';Cc.default=Hj;Object.defineProperty(zy,"__esModule",{value:!0});const Zh=Ct,It=je,xq=se,bq=Cc,_q={message:({params:{i:e,j:t}})=>(0,It.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,It._)`{i: ${e}, j: ${t}}`},Sq={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:_q,code(e){const{gen:t,data:r,$data:n,schema:s,parentSchema:o,schemaCode:i,it:l}=e;if(!n&&!s)return;const c=t.let("valid"),u=o.items?(0,Zh.getSchemaTypes)(o.items):[];e.block$data(c,d,(0,It._)`${i} === false`),e.ok(c);function d(){const b=t.let("i",(0,It._)`${r}.length`),h=t.let("j");e.setParams({i:b,j:h}),t.assign(c,!0),t.if((0,It._)`${b} > 1`,()=>(f()?g:v)(b,h))}function f(){return u.length>0&&!u.some(b=>b==="object"||b==="array")}function g(b,h){const w=t.name("item"),p=(0,Zh.checkDataTypes)(u,w,l.opts.strictNumbers,Zh.DataType.Wrong),m=t.const("indices",(0,It._)`{}`);t.for((0,It._)`;${b}--;`,()=>{t.let(w,(0,It._)`${r}[${b}]`),t.if(p,(0,It._)`continue`),u.length>1&&t.if((0,It._)`typeof ${w} == "string"`,(0,It._)`${w} += "_"`),t.if((0,It._)`typeof ${m}[${w}] == "number"`,()=>{t.assign(h,(0,It._)`${m}[${w}]`),e.error(),t.assign(c,!1).break()}).code((0,It._)`${m}[${w}] = ${b}`)})}function v(b,h){const w=(0,xq.useFunc)(t,bq.default),p=t.name("outer");t.label(p).for((0,It._)`;${b}--;`,()=>t.for((0,It._)`${h} = ${b}; ${h}--;`,()=>t.if((0,It._)`${w}(${r}[${b}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(p)})))}}};zy.default=Sq;var Ly={};Object.defineProperty(Ly,"__esModule",{value:!0});const Ym=je,kq=se,Cq=Cc,Eq={message:"must be equal to constant",params:({schemaCode:e})=>(0,Ym._)`{allowedValue: ${e}}`},Nq={keyword:"const",$data:!0,error:Eq,code(e){const{gen:t,data:r,$data:n,schemaCode:s,schema:o}=e;n||o&&typeof o=="object"?e.fail$data((0,Ym._)`!${(0,kq.useFunc)(t,Cq.default)}(${r}, ${s})`):e.fail((0,Ym._)`${o} !== ${r}`)}};Ly.default=Nq;var Fy={};Object.defineProperty(Fy,"__esModule",{value:!0});const cl=je,jq=se,$q=Cc,Pq={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,cl._)`{allowedValues: ${e}}`},Tq={keyword:"enum",schemaType:"array",$data:!0,error:Pq,code(e){const{gen:t,data:r,$data:n,schema:s,schemaCode:o,it:i}=e;if(!n&&s.length===0)throw new Error("enum must have non-empty array");const l=s.length>=i.opts.loopEnum;let c;const u=()=>c??(c=(0,jq.useFunc)(t,$q.default));let d;if(l||n)d=t.let("valid"),e.block$data(d,f);else{if(!Array.isArray(s))throw new Error("ajv implementation error");const v=t.const("vSchema",o);d=(0,cl.or)(...s.map((b,h)=>g(v,h)))}e.pass(d);function f(){t.assign(d,!1),t.forOf("v",o,v=>t.if((0,cl._)`${u()}(${r}, ${v})`,()=>t.assign(d,!0).break()))}function g(v,b){const h=s[b];return typeof h=="object"&&h!==null?(0,cl._)`${u()}(${r}, ${v}[${b}])`:(0,cl._)`${r} === ${h}`}}};Fy.default=Tq;Object.defineProperty($y,"__esModule",{value:!0});const Rq=Py,Iq=Ty,Aq=Ry,Oq=Ay,Mq=Oy,Dq=My,zq=Dy,Lq=zy,Fq=Ly,Uq=Fy,qq=[Rq.default,Iq.default,Aq.default,Oq.default,Mq.default,Dq.default,zq.default,Lq.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Fq.default,Uq.default];$y.default=qq;var Uy={},Ia={};Object.defineProperty(Ia,"__esModule",{value:!0});Ia.validateAdditionalItems=void 0;const ko=je,Xm=se,Vq={message:({params:{len:e}})=>(0,ko.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,ko._)`{limit: ${e}}`},Hq={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Vq,code(e){const{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Xm.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Kj(e,n)}};function Kj(e,t){const{gen:r,schema:n,data:s,keyword:o,it:i}=e;i.items=!0;const l=r.const("len",(0,ko._)`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,ko._)`${l} <= ${t.length}`);else if(typeof n=="object"&&!(0,Xm.alwaysValidSchema)(i,n)){const u=r.var("valid",(0,ko._)`${l} <= ${t.length}`);r.if((0,ko.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,l,d=>{e.subschema({keyword:o,dataProp:d,dataPropType:Xm.Type.Num},u),i.allErrors||r.if((0,ko.not)(u),()=>r.break())})}}Ia.validateAdditionalItems=Kj;Ia.default=Hq;var qy={},Aa={};Object.defineProperty(Aa,"__esModule",{value:!0});Aa.validateTuple=void 0;const rb=je,qu=se,Kq=Pe,Bq={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return Bj(e,"additionalItems",t);r.items=!0,!(0,qu.alwaysValidSchema)(r,t)&&e.ok((0,Kq.validateArray)(e))}};function Bj(e,t,r=e.schema){const{gen:n,parentSchema:s,data:o,keyword:i,it:l}=e;d(s),l.opts.unevaluated&&r.length&&l.items!==!0&&(l.items=qu.mergeEvaluated.items(n,r.length,l.items));const c=n.name("valid"),u=n.const("len",(0,rb._)`${o}.length`);r.forEach((f,g)=>{(0,qu.alwaysValidSchema)(l,f)||(n.if((0,rb._)`${u} > ${g}`,()=>e.subschema({keyword:i,schemaProp:g,dataProp:g},c)),e.ok(c))});function d(f){const{opts:g,errSchemaPath:v}=l,b=r.length,h=b===f.minItems&&(b===f.maxItems||f[t]===!1);if(g.strictTuples&&!h){const w=`"${i}" is ${b}-tuple, but minItems or maxItems/${t} are not specified or different at path "${v}"`;(0,qu.checkStrictMode)(l,w,g.strictTuples)}}}Aa.validateTuple=Bj;Aa.default=Bq;Object.defineProperty(qy,"__esModule",{value:!0});const Wq=Aa,Zq={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,Wq.validateTuple)(e,"items")};qy.default=Zq;var Vy={};Object.defineProperty(Vy,"__esModule",{value:!0});const nb=je,Gq=se,Qq=Pe,Jq=Ia,Yq={message:({params:{len:e}})=>(0,nb.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,nb._)`{limit: ${e}}`},Xq={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Yq,code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;n.items=!0,!(0,Gq.alwaysValidSchema)(n,t)&&(s?(0,Jq.validateAdditionalItems)(e,s):e.ok((0,Qq.validateArray)(e)))}};Vy.default=Xq;var Hy={};Object.defineProperty(Hy,"__esModule",{value:!0});const Ar=je,fu=se,eV={message:({params:{min:e,max:t}})=>t===void 0?(0,Ar.str)`must contain at least ${e} valid item(s)`:(0,Ar.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Ar._)`{minContains: ${e}}`:(0,Ar._)`{minContains: ${e}, maxContains: ${t}}`},tV={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:eV,code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;let i,l;const{minContains:c,maxContains:u}=n;o.opts.next?(i=c===void 0?1:c,l=u):i=1;const d=t.const("len",(0,Ar._)`${s}.length`);if(e.setParams({min:i,max:l}),l===void 0&&i===0){(0,fu.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(l!==void 0&&i>l){(0,fu.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,fu.alwaysValidSchema)(o,r)){let h=(0,Ar._)`${d} >= ${i}`;l!==void 0&&(h=(0,Ar._)`${h} && ${d} <= ${l}`),e.pass(h);return}o.items=!0;const f=t.name("valid");l===void 0&&i===1?v(f,()=>t.if(f,()=>t.break())):i===0?(t.let(f,!0),l!==void 0&&t.if((0,Ar._)`${s}.length > 0`,g)):(t.let(f,!1),g()),e.result(f,()=>e.reset());function g(){const h=t.name("_valid"),w=t.let("count",0);v(h,()=>t.if(h,()=>b(w)))}function v(h,w){t.forRange("i",0,d,p=>{e.subschema({keyword:"contains",dataProp:p,dataPropType:fu.Type.Num,compositeRule:!0},h),w()})}function b(h){t.code((0,Ar._)`${h}++`),l===void 0?t.if((0,Ar._)`${h} >= ${i}`,()=>t.assign(f,!0).break()):(t.if((0,Ar._)`${h} > ${l}`,()=>t.assign(f,!1).break()),i===1?t.assign(f,!0):t.if((0,Ar._)`${h} >= ${i}`,()=>t.assign(f,!0)))}}};Hy.default=tV;var Wj={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=je,r=se,n=Pe;e.error={message:({params:{property:c,depsCount:u,deps:d}})=>{const f=u===1?"property":"properties";return(0,t.str)`must have ${f} ${d} when property ${c} is present`},params:({params:{property:c,depsCount:u,deps:d,missingProperty:f}})=>(0,t._)`{property: ${c},
|
|
418
|
+
missingProperty: ${f},
|
|
419
|
+
depsCount: ${u},
|
|
420
|
+
deps: ${d}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(c){const[u,d]=o(c);i(c,u),l(c,d)}};function o({schema:c}){const u={},d={};for(const f in c){if(f==="__proto__")continue;const g=Array.isArray(c[f])?u:d;g[f]=c[f]}return[u,d]}function i(c,u=c.schema){const{gen:d,data:f,it:g}=c;if(Object.keys(u).length===0)return;const v=d.let("missing");for(const b in u){const h=u[b];if(h.length===0)continue;const w=(0,n.propertyInData)(d,f,b,g.opts.ownProperties);c.setParams({property:b,depsCount:h.length,deps:h.join(", ")}),g.allErrors?d.if(w,()=>{for(const p of h)(0,n.checkReportMissingProp)(c,p)}):(d.if((0,t._)`${w} && (${(0,n.checkMissingProp)(c,h,v)})`),(0,n.reportMissingProp)(c,v),d.else())}}e.validatePropertyDeps=i;function l(c,u=c.schema){const{gen:d,data:f,keyword:g,it:v}=c,b=d.name("valid");for(const h in u)(0,r.alwaysValidSchema)(v,u[h])||(d.if((0,n.propertyInData)(d,f,h,v.opts.ownProperties),()=>{const w=c.subschema({keyword:g,schemaProp:h},b);c.mergeValidEvaluated(w,b)},()=>d.var(b,!0)),c.ok(b))}e.validateSchemaDeps=l,e.default=s})(Wj);var Ky={};Object.defineProperty(Ky,"__esModule",{value:!0});const Zj=je,rV=se,nV={message:"property name must be valid",params:({params:e})=>(0,Zj._)`{propertyName: ${e.propertyName}}`},sV={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:nV,code(e){const{gen:t,schema:r,data:n,it:s}=e;if((0,rV.alwaysValidSchema)(s,r))return;const o=t.name("valid");t.forIn("key",n,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),t.if((0,Zj.not)(o),()=>{e.error(!0),s.allErrors||t.break()})}),e.ok(o)}};Ky.default=sV;var Vf={};Object.defineProperty(Vf,"__esModule",{value:!0});const hu=Pe,Wr=je,oV=Mn,pu=se,iV={message:"must NOT have additional properties",params:({params:e})=>(0,Wr._)`{additionalProperty: ${e.additionalProperty}}`},aV={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:iV,code(e){const{gen:t,schema:r,parentSchema:n,data:s,errsCount:o,it:i}=e;if(!o)throw new Error("ajv implementation error");const{allErrors:l,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,pu.alwaysValidSchema)(i,r))return;const u=(0,hu.allSchemaProperties)(n.properties),d=(0,hu.allSchemaProperties)(n.patternProperties);f(),e.ok((0,Wr._)`${o} === ${oV.default.errors}`);function f(){t.forIn("key",s,w=>{!u.length&&!d.length?b(w):t.if(g(w),()=>b(w))})}function g(w){let p;if(u.length>8){const m=(0,pu.schemaRefOrVal)(i,n.properties,"properties");p=(0,hu.isOwnProperty)(t,m,w)}else u.length?p=(0,Wr.or)(...u.map(m=>(0,Wr._)`${w} === ${m}`)):p=Wr.nil;return d.length&&(p=(0,Wr.or)(p,...d.map(m=>(0,Wr._)`${(0,hu.usePattern)(e,m)}.test(${w})`))),(0,Wr.not)(p)}function v(w){t.code((0,Wr._)`delete ${s}[${w}]`)}function b(w){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){v(w);return}if(r===!1){e.setParams({additionalProperty:w}),e.error(),l||t.break();return}if(typeof r=="object"&&!(0,pu.alwaysValidSchema)(i,r)){const p=t.name("valid");c.removeAdditional==="failing"?(h(w,p,!1),t.if((0,Wr.not)(p),()=>{e.reset(),v(w)})):(h(w,p),l||t.if((0,Wr.not)(p),()=>t.break()))}}function h(w,p,m){const x={keyword:"additionalProperties",dataProp:w,dataPropType:pu.Type.Str};m===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(x,p)}}};Vf.default=aV;var By={};Object.defineProperty(By,"__esModule",{value:!0});const lV=ln,sb=Pe,Gh=se,ob=Vf,cV={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&ob.default.code(new lV.KeywordCxt(o,ob.default,"additionalProperties"));const i=(0,sb.allSchemaProperties)(r);for(const f of i)o.definedProperties.add(f);o.opts.unevaluated&&i.length&&o.props!==!0&&(o.props=Gh.mergeEvaluated.props(t,(0,Gh.toHash)(i),o.props));const l=i.filter(f=>!(0,Gh.alwaysValidSchema)(o,r[f]));if(l.length===0)return;const c=t.name("valid");for(const f of l)u(f)?d(f):(t.if((0,sb.propertyInData)(t,s,f,o.opts.ownProperties)),d(f),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(f),e.ok(c);function u(f){return o.opts.useDefaults&&!o.compositeRule&&r[f].default!==void 0}function d(f){e.subschema({keyword:"properties",schemaProp:f,dataProp:f},c)}}};By.default=cV;var Wy={};Object.defineProperty(Wy,"__esModule",{value:!0});const ib=Pe,mu=je,ab=se,lb=se,uV={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:s,it:o}=e,{opts:i}=o,l=(0,ib.allSchemaProperties)(r),c=l.filter(h=>(0,ab.alwaysValidSchema)(o,r[h]));if(l.length===0||c.length===l.length&&(!o.opts.unevaluated||o.props===!0))return;const u=i.strictSchema&&!i.allowMatchingProperties&&s.properties,d=t.name("valid");o.props!==!0&&!(o.props instanceof mu.Name)&&(o.props=(0,lb.evaluatedPropsToName)(t,o.props));const{props:f}=o;g();function g(){for(const h of l)u&&v(h),o.allErrors?b(h):(t.var(d,!0),b(h),t.if(d))}function v(h){for(const w in u)new RegExp(h).test(w)&&(0,ab.checkStrictMode)(o,`property ${w} matches pattern ${h} (use allowMatchingProperties)`)}function b(h){t.forIn("key",n,w=>{t.if((0,mu._)`${(0,ib.usePattern)(e,h)}.test(${w})`,()=>{const p=c.includes(h);p||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:w,dataPropType:lb.Type.Str},d),o.opts.unevaluated&&f!==!0?t.assign((0,mu._)`${f}[${w}]`,!0):!p&&!o.allErrors&&t.if((0,mu.not)(d),()=>t.break())})})}}};Wy.default=uV;var Zy={};Object.defineProperty(Zy,"__esModule",{value:!0});const dV=se,fV={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,dV.alwaysValidSchema)(n,r)){e.fail();return}const s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Zy.default=fV;var Gy={};Object.defineProperty(Gy,"__esModule",{value:!0});const hV=Pe,pV={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:hV.validateUnion,error:{message:"must match a schema in anyOf"}};Gy.default=pV;var Qy={};Object.defineProperty(Qy,"__esModule",{value:!0});const Vu=je,mV=se,gV={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Vu._)`{passingSchemas: ${e.passing}}`},vV={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:gV,code(e){const{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;const o=r,i=t.let("valid",!1),l=t.let("passing",null),c=t.name("_valid");e.setParams({passing:l}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){o.forEach((d,f)=>{let g;(0,mV.alwaysValidSchema)(s,d)?t.var(c,!0):g=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},c),f>0&&t.if((0,Vu._)`${c} && ${i}`).assign(i,!1).assign(l,(0,Vu._)`[${l}, ${f}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(l,f),g&&e.mergeEvaluated(g,Vu.Name)})})}}};Qy.default=vV;var Jy={};Object.defineProperty(Jy,"__esModule",{value:!0});const yV=se,wV={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const s=t.name("valid");r.forEach((o,i)=>{if((0,yV.alwaysValidSchema)(n,o))return;const l=e.subschema({keyword:"allOf",schemaProp:i},s);e.ok(s),e.mergeEvaluated(l)})}};Jy.default=wV;var Yy={};Object.defineProperty(Yy,"__esModule",{value:!0});const Kd=je,Gj=se,xV={message:({params:e})=>(0,Kd.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Kd._)`{failingKeyword: ${e.ifClause}}`},bV={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:xV,code(e){const{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Gj.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const s=cb(n,"then"),o=cb(n,"else");if(!s&&!o)return;const i=t.let("valid",!0),l=t.name("_valid");if(c(),e.reset(),s&&o){const d=t.let("ifClause");e.setParams({ifClause:d}),t.if(l,u("then",d),u("else",d))}else s?t.if(l,u("then")):t.if((0,Kd.not)(l),u("else"));e.pass(i,()=>e.error(!0));function c(){const d=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);e.mergeEvaluated(d)}function u(d,f){return()=>{const g=e.subschema({keyword:d},l);t.assign(i,l),e.mergeValidEvaluated(g,i),f?t.assign(f,(0,Kd._)`${d}`):e.setParams({ifClause:d})}}}};function cb(e,t){const r=e.schema[t];return r!==void 0&&!(0,Gj.alwaysValidSchema)(e,r)}Yy.default=bV;var Xy={};Object.defineProperty(Xy,"__esModule",{value:!0});const _V=se,SV={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,_V.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Xy.default=SV;Object.defineProperty(Uy,"__esModule",{value:!0});const kV=Ia,CV=qy,EV=Aa,NV=Vy,jV=Hy,$V=Wj,PV=Ky,TV=Vf,RV=By,IV=Wy,AV=Zy,OV=Gy,MV=Qy,DV=Jy,zV=Yy,LV=Xy;function FV(e=!1){const t=[AV.default,OV.default,MV.default,DV.default,zV.default,LV.default,PV.default,TV.default,$V.default,RV.default,IV.default];return e?t.push(CV.default,NV.default):t.push(kV.default,EV.default),t.push(jV.default),t}Uy.default=FV;var e0={},t0={};Object.defineProperty(t0,"__esModule",{value:!0});const wt=je,UV={message:({schemaCode:e})=>(0,wt.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,wt._)`{format: ${e}}`},qV={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:UV,code(e,t){const{gen:r,data:n,$data:s,schema:o,schemaCode:i,it:l}=e,{opts:c,errSchemaPath:u,schemaEnv:d,self:f}=l;if(!c.validateFormats)return;s?g():v();function g(){const b=r.scopeValue("formats",{ref:f.formats,code:c.code.formats}),h=r.const("fDef",(0,wt._)`${b}[${i}]`),w=r.let("fType"),p=r.let("format");r.if((0,wt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(w,(0,wt._)`${h}.type || "string"`).assign(p,(0,wt._)`${h}.validate`),()=>r.assign(w,(0,wt._)`"string"`).assign(p,h)),e.fail$data((0,wt.or)(m(),x()));function m(){return c.strictSchema===!1?wt.nil:(0,wt._)`${i} && !${p}`}function x(){const _=d.$async?(0,wt._)`(${h}.async ? await ${p}(${n}) : ${p}(${n}))`:(0,wt._)`${p}(${n})`,C=(0,wt._)`(typeof ${p} == "function" ? ${_} : ${p}.test(${n}))`;return(0,wt._)`${p} && ${p} !== true && ${w} === ${t} && !${C}`}}function v(){const b=f.formats[o];if(!b){m();return}if(b===!0)return;const[h,w,p]=x(b);h===t&&e.pass(_());function m(){if(c.strictSchema===!1){f.logger.warn(C());return}throw new Error(C());function C(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function x(C){const $=C instanceof RegExp?(0,wt.regexpCode)(C):c.code.formats?(0,wt._)`${c.code.formats}${(0,wt.getProperty)(o)}`:void 0,k=r.scopeValue("formats",{key:o,ref:C,code:$});return typeof C=="object"&&!(C instanceof RegExp)?[C.type||"string",C.validate,(0,wt._)`${k}.validate`]:["string",C,k]}function _(){if(typeof b=="object"&&!(b instanceof RegExp)&&b.async){if(!d.$async)throw new Error("async format in sync schema");return(0,wt._)`await ${p}(${n})`}return typeof w=="function"?(0,wt._)`${p}(${n})`:(0,wt._)`${p}.test(${n})`}}}};t0.default=qV;Object.defineProperty(e0,"__esModule",{value:!0});const VV=t0,HV=[VV.default];e0.default=HV;var xa={};Object.defineProperty(xa,"__esModule",{value:!0});xa.contentVocabulary=xa.metadataVocabulary=void 0;xa.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];xa.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(Ey,"__esModule",{value:!0});const KV=Ny,BV=$y,WV=Uy,ZV=e0,ub=xa,GV=[KV.default,BV.default,(0,WV.default)(),ZV.default,ub.metadataVocabulary,ub.contentVocabulary];Ey.default=GV;var r0={},Hf={};Object.defineProperty(Hf,"__esModule",{value:!0});Hf.DiscrError=void 0;var db;(function(e){e.Tag="tag",e.Mapping="mapping"})(db||(Hf.DiscrError=db={}));Object.defineProperty(r0,"__esModule",{value:!0});const vi=je,eg=Hf,fb=hr,QV=Ra,JV=se,YV={message:({params:{discrError:e,tagName:t}})=>e===eg.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,vi._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},XV={keyword:"discriminator",type:"object",schemaType:"object",error:YV,code(e){const{gen:t,data:r,schema:n,parentSchema:s,it:o}=e,{oneOf:i}=s;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");const l=n.propertyName;if(typeof l!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");const c=t.let("valid",!1),u=t.const("tag",(0,vi._)`${r}${(0,vi.getProperty)(l)}`);t.if((0,vi._)`typeof ${u} == "string"`,()=>d(),()=>e.error(!1,{discrError:eg.DiscrError.Tag,tag:u,tagName:l})),e.ok(c);function d(){const v=g();t.if(!1);for(const b in v)t.elseIf((0,vi._)`${u} === ${b}`),t.assign(c,f(v[b]));t.else(),e.error(!1,{discrError:eg.DiscrError.Mapping,tag:u,tagName:l}),t.endIf()}function f(v){const b=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:v},b);return e.mergeEvaluated(h,vi.Name),b}function g(){var v;const b={},h=p(s);let w=!0;for(let _=0;_<i.length;_++){let C=i[_];if(C!=null&&C.$ref&&!(0,JV.schemaHasRulesButRef)(C,o.self.RULES)){const k=C.$ref;if(C=fb.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,k),C instanceof fb.SchemaEnv&&(C=C.schema),C===void 0)throw new QV.default(o.opts.uriResolver,o.baseId,k)}const $=(v=C==null?void 0:C.properties)===null||v===void 0?void 0:v[l];if(typeof $!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${l}"`);w=w&&(h||p(C)),m($,_)}if(!w)throw new Error(`discriminator: "${l}" must be required`);return b;function p({required:_}){return Array.isArray(_)&&_.includes(l)}function m(_,C){if(_.const)x(_.const,C);else if(_.enum)for(const $ of _.enum)x($,C);else throw new Error(`discriminator: "properties/${l}" must have "const" or "enum"`)}function x(_,C){if(typeof _!="string"||_ in b)throw new Error(`discriminator: "${l}" values must be unique strings`);b[_]=C}}}};r0.default=XV;const eH="http://json-schema.org/draft-07/schema#",tH="http://json-schema.org/draft-07/schema#",rH="Core schema meta-schema",nH={schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},sH=["object","boolean"],oH={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},iH={$schema:eH,$id:tH,title:rH,definitions:nH,type:sH,properties:oH,default:!0};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;const r=ej,n=Ey,s=r0,o=iH,i=["/properties"],l="http://json-schema.org/draft-07/schema";class c extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(b=>this.addVocabulary(b)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const b=this.opts.$data?this.$dataMetaSchema(o,i):o;this.addMetaSchema(b,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}t.Ajv=c,e.exports=t=c,e.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=ln;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=je;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var f=kc;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var g=Ra;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return g.default}})})(Wm,Wm.exports);var Qj=Wm.exports;const aH=Bd(Qj);var tg={exports:{}},Jj={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(P,O){return{validate:P,compare:O}}e.fullFormats={date:t(o,i),time:t(c(!0),u),"date-time":t(g(!0),v),"iso-time":t(c(),d),"iso-date-time":t(g(),b),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:p,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:U,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:x,int32:{type:"number",validate:$},int64:{type:"number",validate:k},float:{type:"number",validate:I},double:{type:"number",validate:I},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,i),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,v),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,d),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,b),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function r(P){return P%4===0&&(P%100!==0||P%400===0)}const n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,s=[0,31,28,31,30,31,30,31,31,30,31,30,31];function o(P){const O=n.exec(P);if(!O)return!1;const L=+O[1],z=+O[2],K=+O[3];return z>=1&&z<=12&&K>=1&&K<=(z===2&&r(L)?29:s[z])}function i(P,O){if(P&&O)return P>O?1:P<O?-1:0}const l=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(P){return function(L){const z=l.exec(L);if(!z)return!1;const K=+z[1],Z=+z[2],W=+z[3],F=z[4],V=z[5]==="-"?-1:1,D=+(z[6]||0),T=+(z[7]||0);if(D>23||T>59||P&&!F)return!1;if(K<=23&&Z<=59&&W<60)return!0;const q=Z-T*V,j=K-D*V-(q<0?1:0);return(j===23||j===-1)&&(q===59||q===-1)&&W<61}}function u(P,O){if(!(P&&O))return;const L=new Date("2020-01-01T"+P).valueOf(),z=new Date("2020-01-01T"+O).valueOf();if(L&&z)return L-z}function d(P,O){if(!(P&&O))return;const L=l.exec(P),z=l.exec(O);if(L&&z)return P=L[1]+L[2]+L[3],O=z[1]+z[2]+z[3],P>O?1:P<O?-1:0}const f=/t|\s/i;function g(P){const O=c(P);return function(z){const K=z.split(f);return K.length===2&&o(K[0])&&O(K[1])}}function v(P,O){if(!(P&&O))return;const L=new Date(P).valueOf(),z=new Date(O).valueOf();if(L&&z)return L-z}function b(P,O){if(!(P&&O))return;const[L,z]=P.split(f),[K,Z]=O.split(f),W=i(L,K);if(W!==void 0)return W||u(z,Z)}const h=/\/|:/,w=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function p(P){return h.test(P)&&w.test(P)}const m=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function x(P){return m.lastIndex=0,m.test(P)}const _=-2147483648,C=2**31-1;function $(P){return Number.isInteger(P)&&P<=C&&P>=_}function k(P){return Number.isInteger(P)}function I(){return!0}const E=/[^\\]\\Z/;function U(P){if(E.test(P))return!1;try{return new RegExp(P),!0}catch{return!1}}})(Jj);var Yj={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const t=Qj,r=je,n=r.operators,s={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},o={message:({keyword:l,schemaCode:c})=>(0,r.str)`should be ${s[l].okStr} ${c}`,params:({keyword:l,schemaCode:c})=>(0,r._)`{comparison: ${s[l].okStr}, limit: ${c}}`};e.formatLimitDefinition={keyword:Object.keys(s),type:"string",schemaType:"string",$data:!0,error:o,code(l){const{gen:c,data:u,schemaCode:d,keyword:f,it:g}=l,{opts:v,self:b}=g;if(!v.validateFormats)return;const h=new t.KeywordCxt(g,b.RULES.all.format.definition,"format");h.$data?w():p();function w(){const x=c.scopeValue("formats",{ref:b.formats,code:v.code.formats}),_=c.const("fmt",(0,r._)`${x}[${h.schemaCode}]`);l.fail$data((0,r.or)((0,r._)`typeof ${_} != "object"`,(0,r._)`${_} instanceof RegExp`,(0,r._)`typeof ${_}.compare != "function"`,m(_)))}function p(){const x=h.schema,_=b.formats[x];if(!_||_===!0)return;if(typeof _!="object"||_ instanceof RegExp||typeof _.compare!="function")throw new Error(`"${f}": format "${x}" does not define "compare" function`);const C=c.scopeValue("formats",{key:x,ref:_,code:v.code.formats?(0,r._)`${v.code.formats}${(0,r.getProperty)(x)}`:void 0});l.fail$data(m(C))}function m(x){return(0,r._)`${x}.compare(${u}, ${d}) ${s[f].fail} 0`}},dependencies:["format"]};const i=l=>(l.addKeyword(e.formatLimitDefinition),l);e.default=i})(Yj);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=Jj,n=Yj,s=je,o=new s.Name("fullFormats"),i=new s.Name("fastFormats"),l=(u,d={keywords:!0})=>{if(Array.isArray(d))return c(u,d,r.fullFormats,o),u;const[f,g]=d.mode==="fast"?[r.fastFormats,i]:[r.fullFormats,o],v=d.formats||r.formatNames;return c(u,v,f,g),d.keywords&&(0,n.default)(u),u};l.get=(u,d="full")=>{const g=(d==="fast"?r.fastFormats:r.fullFormats)[u];if(!g)throw new Error(`Unknown format "${u}"`);return g};function c(u,d,f,g){var v,b;(v=(b=u.opts.code).formats)!==null&&v!==void 0||(b.formats=(0,s._)`require("ajv-formats/dist/formats").${g}`);for(const h of d)u.addFormat(h,f[h])}e.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l})(tg,tg.exports);var lH=tg.exports;const cH=Bd(lH);function uH(){const e=new aH({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return cH(e),e}class dH{constructor(t){this._ajv=t??uH()}getValidator(t){const r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}}class fH{constructor(t){this._client=t}async*callToolStream(t,r=_c,n){const s=this._client,o={...n,task:(n==null?void 0:n.task)??(s.isToolTask(t.name)?{}:void 0)},i=s.requestStream({method:"tools/call",params:t},r,o),l=s.getToolOutputValidator(t.name);for await(const c of i){if(c.type==="result"&&l){const u=c.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new ve(Se.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{const d=l(u.structuredContent);if(!d.valid){yield{type:"error",error:new ve(Se.InvalidParams,`Structured content does not match the tool's output schema: ${d.errorMessage}`)};return}}catch(d){if(d instanceof ve){yield{type:"error",error:d};return}yield{type:"error",error:new ve(Se.InvalidParams,`Failed to validate structured content: ${d instanceof Error?d.message:String(d)}`)};return}}yield c}}async getTask(t,r){return this._client.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._client.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._client.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._client.cancelTask({taskId:t},r)}requestStream(t,r,n){return this._client.requestStream(t,r,n)}}function hH(e,t,r){var n;if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!((n=e.tools)!=null&&n.call))throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break}}function pH(e,t,r){var n,s;if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!((n=e.sampling)!=null&&n.createMessage))throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!((s=e.elicitation)!=null&&s.create))throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break}}function Hu(e,t){if(!(!e||t===null||typeof t!="object")){if(e.type==="object"&&e.properties&&typeof e.properties=="object"){const r=t,n=e.properties;for(const s of Object.keys(n)){const o=n[s];r[s]===void 0&&Object.prototype.hasOwnProperty.call(o,"default")&&(r[s]=o.default),r[s]!==void 0&&Hu(o,r[s])}}if(Array.isArray(e.anyOf))for(const r of e.anyOf)typeof r!="boolean"&&Hu(r,t);if(Array.isArray(e.oneOf))for(const r of e.oneOf)typeof r!="boolean"&&Hu(r,t)}}function mH(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};const t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}class gH extends m9{constructor(t,r){super(r),this._clientInfo=t,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=(r==null?void 0:r.capabilities)??{},this._jsonSchemaValidator=(r==null?void 0:r.jsonSchemaValidator)??new dH,r!=null&&r.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(t){var r,n,s,o,i,l;t.tools&&((n=(r=this._serverCapabilities)==null?void 0:r.tools)!=null&&n.listChanged)&&this._setupListChangedHandler("tools",DN,t.tools,async()=>(await this.listTools()).tools),t.prompts&&((o=(s=this._serverCapabilities)==null?void 0:s.prompts)!=null&&o.listChanged)&&this._setupListChangedHandler("prompts",ON,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&((l=(i=this._serverCapabilities)==null?void 0:i.resources)!=null&&l.listChanged)&&this._setupListChangedHandler("resources",AN,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new fH(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=g9(this._capabilities,t)}setRequestHandler(t,r){var l;const n=XN(t),s=n==null?void 0:n.method;if(!s)throw new Error("Schema is missing a method literal");let o;if(zf(s)){const c=s,u=(l=c._zod)==null?void 0:l.def;o=(u==null?void 0:u.value)??c.value}else{const c=s,u=c._def;o=(u==null?void 0:u.value)??c.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");const i=o;if(i==="elicitation/create"){const c=async(u,d)=>{var x,_;const f=ks(qN,u);if(!f.success){const C=f.error instanceof Error?f.error.message:String(f.error);throw new ve(Se.InvalidParams,`Invalid elicitation request: ${C}`)}const{params:g}=f.data;g.mode=g.mode??"form";const{supportsFormMode:v,supportsUrlMode:b}=mH(this._capabilities.elicitation);if(g.mode==="form"&&!v)throw new ve(Se.InvalidParams,"Client does not support form-mode elicitation requests");if(g.mode==="url"&&!b)throw new ve(Se.InvalidParams,"Client does not support URL-mode elicitation requests");const h=await Promise.resolve(r(u,d));if(g.task){const C=ks(Jl,h);if(!C.success){const $=C.error instanceof Error?C.error.message:String(C.error);throw new ve(Se.InvalidParams,`Invalid task creation result: ${$}`)}return C.data}const w=ks(VN,h);if(!w.success){const C=w.error instanceof Error?w.error.message:String(w.error);throw new ve(Se.InvalidParams,`Invalid elicitation result: ${C}`)}const p=w.data,m=g.mode==="form"?g.requestedSchema:void 0;if(g.mode==="form"&&p.action==="accept"&&p.content&&m&&(_=(x=this._capabilities.elicitation)==null?void 0:x.form)!=null&&_.applyDefaults)try{Hu(m,p.content)}catch{}return p};return super.setRequestHandler(t,c)}if(i==="sampling/createMessage"){const c=async(u,d)=>{const f=ks(LN,u);if(!f.success){const p=f.error instanceof Error?f.error.message:String(f.error);throw new ve(Se.InvalidParams,`Invalid sampling request: ${p}`)}const{params:g}=f.data,v=await Promise.resolve(r(u,d));if(g.task){const p=ks(Jl,v);if(!p.success){const m=p.error instanceof Error?p.error.message:String(p.error);throw new ve(Se.InvalidParams,`Invalid task creation result: ${m}`)}return p.data}const h=g.tools||g.toolChoice?UN:FN,w=ks(h,v);if(!w.success){const p=w.error instanceof Error?w.error.message:String(w.error);throw new ve(Se.InvalidParams,`Invalid sampling result: ${p}`)}return w.data};return super.setRequestHandler(t,c)}return super.setRequestHandler(t,r)}assertCapability(t,r){var n;if(!((n=this._serverCapabilities)!=null&&n[t]))throw new Error(`Server does not support ${t} (required for ${r})`)}async connect(t,r){if(await super.connect(t),t.sessionId===void 0)try{const n=await this.request({method:"initialize",params:{protocolVersion:Of,capabilities:this._capabilities,clientInfo:this._clientInfo}},NN,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!WF.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,t.setProtocolVersion&&t.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(t){var r,n,s,o,i;switch(t){case"logging/setLevel":if(!((r=this._serverCapabilities)!=null&&r.logging))throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!((n=this._serverCapabilities)!=null&&n.prompts))throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!((s=this._serverCapabilities)!=null&&s.resources))throw new Error(`Server does not support resources (required for ${t})`);if(t==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${t})`);break;case"tools/call":case"tools/list":if(!((o=this._serverCapabilities)!=null&&o.tools))throw new Error(`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!((i=this._serverCapabilities)!=null&&i.completions))throw new Error(`Server does not support completions (required for ${t})`);break}}assertNotificationCapability(t){var r;switch(t){case"notifications/roots/list_changed":if(!((r=this._capabilities.roots)!=null&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${t})`);break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${t})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${t})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${t})`);break}}assertTaskCapability(t){var r,n;hH((n=(r=this._serverCapabilities)==null?void 0:r.tasks)==null?void 0:n.requests,t,"Server")}assertTaskHandlerCapability(t){var r;this._capabilities&&pH((r=this._capabilities.tasks)==null?void 0:r.requests,t,"Client")}async ping(t){return this.request({method:"ping"},Ti,t)}async complete(t,r){return this.request({method:"completion/complete",params:t},HN,r)}async setLoggingLevel(t,r){return this.request({method:"logging/setLevel",params:{level:t}},Ti,r)}async getPrompt(t,r){return this.request({method:"prompts/get",params:t},ay,r)}async listPrompts(t,r){return this.request({method:"prompts/list",params:t},Rd,r)}async listResources(t,r){return this.request({method:"resources/list",params:t},Td,r)}async listResourceTemplates(t,r){return this.request({method:"resources/templates/list",params:t},IN,r)}async readResource(t,r){return this.request({method:"resources/read",params:t},ry,r)}async subscribeResource(t,r){return this.request({method:"resources/subscribe",params:t},Ti,r)}async unsubscribeResource(t,r){return this.request({method:"resources/unsubscribe",params:t},Ti,r)}async callTool(t,r=_c,n){if(this.isToolTaskRequired(t.name))throw new ve(Se.InvalidRequest,`Tool "${t.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const s=await this.request({method:"tools/call",params:t},r,n),o=this.getToolOutputValidator(t.name);if(o){if(!s.structuredContent&&!s.isError)throw new ve(Se.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(s.structuredContent)try{const i=o(s.structuredContent);if(!i.valid)throw new ve(Se.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof ve?i:new ve(Se.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return s}isToolTask(t){var r,n,s,o;return(o=(s=(n=(r=this._serverCapabilities)==null?void 0:r.tasks)==null?void 0:n.requests)==null?void 0:s.tools)!=null&&o.call?this._cachedKnownTaskTools.has(t):!1}isToolTaskRequired(t){return this._cachedRequiredTaskTools.has(t)}cacheToolMetadata(t){var r;this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const n of t){if(n.outputSchema){const o=this._jsonSchemaValidator.getValidator(n.outputSchema);this._cachedToolOutputValidators.set(n.name,o)}const s=(r=n.execution)==null?void 0:r.taskSupport;(s==="required"||s==="optional")&&this._cachedKnownTaskTools.add(n.name),s==="required"&&this._cachedRequiredTaskTools.add(n.name)}}getToolOutputValidator(t){return this._cachedToolOutputValidators.get(t)}async listTools(t,r){const n=await this.request({method:"tools/list",params:t},ly,r);return this.cacheToolMetadata(n.tools),n}_setupListChangedHandler(t,r,n,s){const o=UU.safeParse(n);if(!o.success)throw new Error(`Invalid ${t} listChanged options: ${o.error.message}`);if(typeof n.onChanged!="function")throw new Error(`Invalid ${t} listChanged options: onChanged must be a function`);const{autoRefresh:i,debounceMs:l}=o.data,{onChanged:c}=n,u=async()=>{if(!i){c(null,null);return}try{const f=await s();c(null,f)}catch(f){const g=f instanceof Error?f:new Error(String(f));c(g,null)}},d=()=>{if(l){const f=this._listChangedDebounceTimers.get(t);f&&clearTimeout(f);const g=setTimeout(u,l);this._listChangedDebounceTimers.set(t,g)}else u()};this.setNotificationHandler(r,d)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function Ja(e,t){if(!e)throw new Error(t)}var hb=3e3,vH=5e3,Qh=5*60*1e3;function yH(e){const{url:t,clientName:r,clientUri:n,callbackUrl:s=typeof window<"u"?Pi(new URL("/oauth/callback",window.location.origin).toString()):"/oauth/callback",storageKeyPrefix:o="mcp:auth",clientConfig:i={},customHeaders:l={},autoRetry:c=!1,autoReconnect:u=hb,transportType:d="auto",preventAutoAuth:f=!1,onPopupWindow:g}=e,[v,b]=y.useState("discovering"),[h,w]=y.useState([]),[p,m]=y.useState([]),[x,_]=y.useState([]),[C,$]=y.useState([]),[k,I]=y.useState(void 0),[E,U]=y.useState([]),[P,O]=y.useState(void 0),L=y.useRef(null),z=y.useRef(null),K=y.useRef(null),Z=y.useRef(!1),W=y.useRef(!0),F=y.useRef(0),V=y.useRef(null),D=y.useRef(v),T=y.useRef(u),q=y.useRef(null);y.useEffect(()=>{D.current=v,T.current=u},[v,u]);const j=y.useCallback((Y,de,...ee)=>{const $e=ee.length>0?`${de} ${ee.map(oe=>JSON.stringify(oe)).join(" ")}`:de;console[Y](`[useMcp] ${$e}`),W.current&&U(oe=>[...oe.slice(-100),{level:Y,message:$e,timestamp:Date.now()}])},[]),S=y.useCallback(async(Y=!1)=>{Y||j("info","Disconnecting..."),Z.current=!1,V.current&&clearTimeout(V.current),V.current=null;const de=z.current;if(L.current=null,z.current=null,W.current&&!Y&&(b("discovering"),w([]),m([]),_([]),$([]),I(void 0),O(void 0)),de)try{await de.close(),Y||j("debug","Transport closed")}catch(ee){Y||j("warn","Error closing transport:",ee)}},[j]),N=y.useCallback((Y,de)=>{var ee;if(j("error",Y,de??""),W.current){b("failed"),I(Y);const $e=(ee=K.current)==null?void 0:ee.getLastAttemptedAuthUrl();$e&&(O($e),j("info","Manual authentication URL may be available.",$e))}Z.current=!1},[j]),M=y.useCallback(async()=>{if(Z.current){j("debug","Connection attempt already in progress.");return}if(!W.current){j("debug","Connect called after unmount, aborting.");return}Z.current=!0,F.current+=1,I(void 0),O(void 0),q.current=null,b("discovering"),j("info",`Connecting attempt #${F.current} to ${t}...`),K.current||(K.current=new px(t,{storageKeyPrefix:o,clientName:r,clientUri:n,callbackUrl:s,preventAutoAuth:f,onPopupWindow:g}),j("debug","BrowserOAuthClientProvider initialized in connect.")),L.current||(L.current=new gH({name:i.name||"use-mcp-react-client",version:i.version||"0.1.0"},{capabilities:{}}),j("debug","MCP Client initialized in connect."));const Y=async ee=>{j("info",`Attempting connection with ${ee.toUpperCase()} transport...`),D.current!=="authenticating"&&b("connecting");let $e;try{Ja(K.current,"Auth Provider must be initialized"),Ja(L.current,"Client must be initialized"),z.current&&(await z.current.close().catch(De=>j("warn",`Error closing previous transport: ${De.message}`)),z.current=null);const oe={authProvider:K.current,requestInit:{headers:{Accept:"application/json, text/event-stream",...l}}},Oe=Pi(t),Me=new URL(Oe);j("debug",`Creating ${ee.toUpperCase()} transport for URL: ${Me.toString()}`),j("debug","Transport options:",{authProvider:!!K.current,headers:l,url:Me.toString()}),ee==="http"?(j("debug","Creating StreamableHTTPClientTransport..."),$e=new f9(Me,oe),j("debug","StreamableHTTPClientTransport created successfully")):(j("debug","Creating SSEClientTransport..."),$e=new c9(Me,oe),j("debug","SSEClientTransport created successfully")),z.current=$e,j("debug",`${ee.toUpperCase()} transport created and assigned to ref.`)}catch(oe){return N(`Failed to create ${ee.toUpperCase()} transport: ${oe instanceof Error?oe.message:String(oe)}`,oe instanceof Error?oe:void 0),"failed"}$e.onmessage=oe=>{var Oe,Me;j("debug",`[Transport] Received: ${JSON.stringify(oe)}`),(Me=(Oe=L.current)==null?void 0:Oe.handleMessage)==null||Me.call(Oe,oe)},$e.onerror=oe=>{j("warn",`Transport error event (${ee.toUpperCase()}):`,oe),j("debug","Error details:",{message:oe.message,stack:oe.stack,name:oe.name,cause:oe.cause}),N(`Transport error (${ee.toUpperCase()}): ${oe.message}`,oe)},$e.onclose=()=>{if(!W.current||Z.current)return;j("info",`Transport connection closed (${q.current||"unknown"} type).`);const oe=D.current,Oe=T.current;if(oe==="ready"&&Oe){const Me=typeof Oe=="number"?Oe:hb;j("info",`Attempting to reconnect in ${Me}ms...`),b("connecting"),setTimeout(()=>{W.current&&M()},Me)}else oe!=="failed"&&oe!=="authenticating"&&N("Connection closed unexpectedly.")};try{j("info",`Connecting client via ${ee.toUpperCase()}...`),j("debug","About to call client.connect() with transport instance"),j("debug",`Transport instance type: ${$e.constructor.name}`),await L.current.connect($e),j("info",`Client connected via ${ee.toUpperCase()}. Loading tools, resources, and prompts...`),q.current=ee,b("loading");const oe=await L.current.request({method:"tools/list"},ly);let Oe={resources:[],resourceTemplates:[]};try{Oe=await L.current.request({method:"resources/list"},Td)}catch(De){j("debug","Server does not support resources/list method",De)}let Me={prompts:[]};try{Me=await L.current.request({method:"prompts/list"},Rd)}catch(De){j("debug","Server does not support prompts/list method",De)}if(W.current){w(oe.tools),m(Oe.resources),_(Array.isArray(Oe.resourceTemplates)?Oe.resourceTemplates:[]),$(Me.prompts);const De=[`Loaded ${oe.tools.length} tools`];return(Oe.resources.length>0||Oe.resourceTemplates&&Oe.resourceTemplates.length>0)&&(De.push(`${Oe.resources.length} resources`),Array.isArray(Oe.resourceTemplates)&&Oe.resourceTemplates.length>0&&De.push(`${Oe.resourceTemplates.length} resource templates`)),Me.prompts.length>0&&De.push(`${Me.prompts.length} prompts`),j("info",De.join(", ")+"."),b("ready"),F.current=0,"success"}else return"failed"}catch(oe){j("debug",`Client connect error via ${ee.toUpperCase()}:`,oe),j("debug","Connect error details:",{message:oe instanceof Error?oe.message:String(oe),stack:oe instanceof Error?oe.stack:"N/A",name:oe instanceof Error?oe.name:"Unknown",cause:oe instanceof Error?oe.cause:void 0});const Oe=oe instanceof Error?oe:new Error(String(oe)),Me=Oe.message,De=Me.includes("404")||Me.includes("Not Found"),Pr=Me.includes("405")||Me.includes("Method Not Allowed"),Tr=Me==="Failed to fetch"||Me==="NetworkError when attempting to fetch resource."||Me==="Load failed";if(ee==="http"&&(De||Pr||Tr))return j("warn",`HTTP transport failed (${Tr?"CORS":De?"404":"405"}).`),"fallback";if(Oe instanceof br||Me.includes("Unauthorized")||Me.includes("401")){j("info","Authentication required."),Ja(K.current,"Auth Provider not available for auth flow");const Rr=await K.current.tokens();if(f&&!Rr)return j("info","Authentication required but auto-auth prevented. User action needed."),b("pending_auth"),"auth_redirect";D.current!=="authenticating"&&D.current!=="pending_auth"&&(b("authenticating"),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{},Qh));try{const mt=await sn(K.current,{serverUrl:t});if(!W.current)return"failed";if(mt==="AUTHORIZED")return j("info","Authentication successful via existing token or refresh. Re-attempting connection..."),V.current&&clearTimeout(V.current),Z.current=!1,M(),"failed";if(mt==="REDIRECT")return j("info","Redirecting for authentication. Waiting for callback..."),"auth_redirect"}catch(mt){return W.current&&(V.current&&clearTimeout(V.current),N(`Failed to initiate authentication: ${mt instanceof Error?mt.message:String(mt)}`,mt instanceof Error?mt:void 0)),"failed"}}return N(`Failed to connect via ${ee.toUpperCase()}: ${Me}`,Oe),"failed"}};let de="failed";if(console.log({transportType:d}),d==="sse")j("debug","Using SSE-only transport mode"),de=await Y("sse");else if(d==="http")j("debug","Using HTTP-only transport mode"),de=await Y("http");else{j("debug","Using auto transport mode (HTTP with SSE fallback)");const ee=await Y("http");if(ee==="fallback"&&W.current&&D.current!=="authenticating"){j("info","HTTP failed, attempting SSE fallback...");const $e=await Y("sse");de=$e,$e==="failed"&&W.current}else de=ee}(de==="success"||de==="failed")&&(Z.current=!1),j("debug",`Connection sequence finished with status: ${de}`)},[j,N,S,sn,t,o,r,n,s,i.name,i.version]),H=y.useCallback(async(Y,de)=>{if(D.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${v}). Cannot call tool "${Y}".`);j("info",`Calling tool: ${Y}`,de);try{const ee=await L.current.request({method:"tools/call",params:{name:Y,arguments:de}},_c);return j("info",`Tool "${Y}" call successful:`,ee),ee}catch(ee){j("error",`Error calling tool "${Y}": ${ee instanceof Error?ee.message:String(ee)}`,ee);const $e=ee instanceof Error?ee:new Error(String(ee));if($e instanceof br||$e.message.includes("Unauthorized")||$e.message.includes("401")){j("warn","Tool call unauthorized, attempting re-authentication..."),b("authenticating"),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{},Qh);try{Ja(K.current,"Auth Provider not available for tool re-auth");const oe=await sn(K.current,{serverUrl:t});if(!W.current)return;oe==="AUTHORIZED"?(j("info","Re-authentication successful. Retrying tool call is recommended, or reconnecting."),V.current&&clearTimeout(V.current),Z.current=!1,M()):oe==="REDIRECT"&&j("info","Redirecting for re-authentication for tool call.")}catch(oe){if(!W.current)return;V.current&&clearTimeout(V.current),N(`Re-authentication failed: ${oe instanceof Error?oe.message:String(oe)}`,oe instanceof Error?oe:void 0)}}if(D.current!=="authenticating")throw ee;return}},[v,t,j,N,M]),G=y.useCallback(()=>{D.current==="failed"?(j("info","Retry requested..."),M()):j("warn",`Retry called but state is not 'failed' (state: ${D.current}). Ignoring.`)},[j,M]),me=y.useCallback(async()=>{var de;j("info","Manual authentication requested...");const Y=D.current;if(Y==="failed")j("info","Attempting to reconnect and authenticate via retry..."),G();else if(Y==="pending_auth"){j("info","Proceeding with authentication from pending state..."),b("authenticating"),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{},Qh);try{Ja(K.current,"Auth Provider not available for manual auth");const ee=await sn(K.current,{serverUrl:t});if(!W.current)return;ee==="AUTHORIZED"?(j("info","Manual authentication successful. Re-attempting connection..."),V.current&&clearTimeout(V.current),Z.current=!1,M()):ee==="REDIRECT"&&j("info","Redirecting for manual authentication. Waiting for callback...")}catch(ee){if(!W.current)return;V.current&&clearTimeout(V.current),N(`Manual authentication failed: ${ee instanceof Error?ee.message:String(ee)}`,ee instanceof Error?ee:void 0)}}else if(Y==="authenticating"){j("warn","Already attempting authentication. Check for blocked popups or wait for timeout.");const ee=(de=K.current)==null?void 0:de.getLastAttemptedAuthUrl();ee&&!P&&(O(ee),j("info","Manual authentication URL retrieved:",ee))}else j("info",`Client not in a state requiring manual authentication trigger (state: ${Y}). If needed, try disconnecting and reconnecting.`)},[j,G,P,t,N,M]),ne=y.useCallback(()=>{if(K.current){const Y=K.current.clearStorage();j("info",`Cleared ${Y} item(s) from localStorage for ${t}.`),O(void 0),S()}else j("warn","Auth provider not initialized, cannot clear storage.")},[t,j,S]),ue=y.useCallback(async()=>{if(D.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${v}). Cannot list resources.`);j("info","Listing resources...");try{const Y=await L.current.request({method:"resources/list"},Td);W.current&&(m(Y.resources),_(Array.isArray(Y.resourceTemplates)?Y.resourceTemplates:[]),j("info",`Listed ${Y.resources.length} resources, ${Array.isArray(Y.resourceTemplates)?Y.resourceTemplates.length:0} resource templates.`))}catch(Y){throw j("error",`Error listing resources: ${Y instanceof Error?Y.message:String(Y)}`,Y),Y}},[v,j]),ye=y.useCallback(async Y=>{if(D.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${v}). Cannot read resource "${Y}".`);j("info",`Reading resource: ${Y}`);try{const de=await L.current.request({method:"resources/read",params:{uri:Y}},ry);return j("info",`Resource "${Y}" read successfully`),de}catch(de){throw j("error",`Error reading resource "${Y}": ${de instanceof Error?de.message:String(de)}`,de),de}},[v,j]),Be=y.useCallback(async()=>{if(D.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${v}). Cannot list prompts.`);j("info","Listing prompts...");try{const Y=await L.current.request({method:"prompts/list"},Rd);W.current&&($(Y.prompts),j("info",`Listed ${Y.prompts.length} prompts.`))}catch(Y){throw j("error",`Error listing prompts: ${Y instanceof Error?Y.message:String(Y)}`,Y),Y}},[v,j]),pt=y.useCallback(async(Y,de)=>{if(D.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${v}). Cannot get prompt "${Y}".`);j("info",`Getting prompt: ${Y}`,de);try{const ee=await L.current.request({method:"prompts/get",params:{name:Y,arguments:de}},ay);return j("info",`Prompt "${Y}" retrieved successfully`),ee}catch(ee){throw j("error",`Error getting prompt "${Y}": ${ee instanceof Error?ee.message:String(ee)}`,ee),ee}},[v,j]);return y.useEffect(()=>{const Y=de=>{var ee;de.origin===window.location.origin&&((ee=de.data)==null?void 0:ee.type)==="mcp_auth_callback"&&(j("info","Received auth callback message.",de.data),V.current&&clearTimeout(V.current),de.data.success?(j("info","Authentication successful via popup. Reconnecting client..."),Z.current=!1,M()):N(`Authentication failed in callback: ${de.data.error||"Unknown reason."}`))};return window.addEventListener("message",Y),j("debug","Auth callback message listener added."),()=>{window.removeEventListener("message",Y),j("debug","Auth callback message listener removed."),V.current&&clearTimeout(V.current)}},[j,N,M]),y.useEffect(()=>(W.current=!0,j("debug","useMcp mounted, initiating connection."),F.current=0,(!K.current||K.current.serverUrl!==t)&&(K.current=new px(t,{storageKeyPrefix:o,clientName:r,clientUri:n,callbackUrl:s,preventAutoAuth:f,onPopupWindow:g}),j("debug","BrowserOAuthClientProvider initialized/updated on mount/option change.")),M(),()=>{W.current=!1,j("debug","useMcp unmounting, disconnecting."),S(!0)}),[t,o,s,r,n,i.name,i.version,M,S]),y.useEffect(()=>{let Y=null;if(v==="failed"&&c&&F.current>0){const de=typeof c=="number"?c:vH;j("info",`Connection failed, auto-retrying in ${de}ms...`),Y=setTimeout(()=>{W.current&&D.current==="failed"&&G()},de)}return()=>{Y&&clearTimeout(Y)}},[v,c,G,j]),{state:v,tools:h,resources:p,resourceTemplates:x,prompts:C,error:k,log:E,authUrl:P,callTool:H,listResources:ue,readResource:ye,listPrompts:Be,getPrompt:pt,retry:G,disconnect:S,authenticate:me,clearStorage:ne}}function wH({service:e,autoConnect:t=!1,onConnected:r,onError:n}){const{toast:s}=Ut(),{state:o,tools:i,resources:l,prompts:c,error:u,authUrl:d,callTool:f,readResource:g,listResources:v,getPrompt:b,listPrompts:h,retry:w,disconnect:p,authenticate:m,clearStorage:x}=yH({url:e.url,clientName:"AgentDeck",clientUri:window.location.origin,callbackUrl:`${window.location.origin}/oauth/callback`,storageKeyPrefix:`mcp:auth:${e.id}`,autoRetry:3,autoReconnect:5e3,transportType:"auto",preventAutoAuth:!t}),_=o==="ready",C=o==="connecting"||o==="loading",$=o==="authenticating"||o==="pending_auth",k=o==="failed";return vn.useEffect(()=>{_&&r&&(r(),s({title:"Connected to MCP service",description:`Successfully connected to ${e.name}`}))},[_,r,e.name,s]),vn.useEffect(()=>{k&&u&&n&&(n(u),s({title:"MCP connection failed",description:u,variant:"destructive"}))},[k,u,n,s]),{isConnected:_,isConnecting:C,isAuthenticating:$,hasError:k,error:u,tools:i,resources:l,prompts:c,connect:()=>{w()},disconnect:p,retry:w,authenticate:m,callTool:async(L,z)=>{try{return await f(L,z)}catch(K){const Z=K instanceof Error?K.message:"Unknown error";throw s({title:"Tool call failed",description:Z,variant:"destructive"}),K}},readResource:async L=>{try{return await g(L)}catch(z){const K=z instanceof Error?z.message:"Unknown error";throw s({title:"Resource read failed",description:K,variant:"destructive"}),z}},listResources:async()=>{try{await v()}catch(L){const z=L instanceof Error?L.message:"Unknown error";throw s({title:"Resource listing failed",description:z,variant:"destructive"}),L}},getPrompt:async(L,z)=>{try{return await b(L,z)}catch(K){const Z=K instanceof Error?K.message:"Unknown error";throw s({title:"Prompt retrieval failed",description:Z,variant:"destructive"}),K}},listPrompts:async()=>{try{await h()}catch(L){const z=L instanceof Error?L.message:"Unknown error";throw s({title:"Prompt listing failed",description:z,variant:"destructive"}),L}},authUrl:d,clearStorage:x}}function xH(){const[e,t]=y.useState("https://api.githubcopilot.com/mcp"),[r,n]=y.useState("get_me"),[s,o]=y.useState("{}"),[i,l]=y.useState(""),c={id:"test-mcp-service",name:"Test MCP Service",url:e,registeredAt:new Date().toISOString(),updatedAt:new Date().toISOString()},{isConnected:u,isConnecting:d,isAuthenticating:f,hasError:g,error:v,tools:b,resources:h,prompts:w,connect:p,disconnect:m,retry:x,authenticate:_,callTool:C,authUrl:$,clearStorage:k}=wH({service:c,autoConnect:!1,onConnected:()=>{console.log("Connected to test MCP service")},onError:P=>{console.error("Test MCP service error:",P)}}),E=d?{status:"connecting",icon:Mw,color:"text-yellow-500"}:f?{status:"authenticating",icon:Yc,color:"text-blue-500"}:u?{status:"connected",icon:im,color:"text-green-500"}:g?{status:"error",icon:Aw,color:"text-red-500"}:{status:"disconnected",icon:Aw,color:"text-gray-500"},U=async()=>{try{let P={};s.trim()&&(P=JSON.parse(s));const O=await C(r,P);l(JSON.stringify(O,null,2))}catch(P){l(`Error: ${P instanceof Error?P.message:"Unknown error"}`)}};return a.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-3xl font-bold mb-2",children:"use-mcp Integration Test"}),a.jsx("p",{className:"text-muted-foreground",children:"Testing the new use-mcp library integration with OAuth support"})]}),a.jsxs(_s,{children:[a.jsxs(yo,{children:[a.jsxs(wo,{className:"flex items-center gap-2",children:[a.jsx(E.icon,{className:`w-5 h-5 ${E.color}`}),"Connection Status: ",E.status]}),a.jsx(Ou,{children:"Current connection state and available actions"})]}),a.jsxs(Ss,{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(Ie,{children:"Service URL"}),a.jsx(He,{value:e,onChange:P=>t(P.target.value),placeholder:"Enter MCP service URL"})]}),a.jsxs("div",{className:"flex gap-2",children:[!u&&!d&&a.jsx(ie,{onClick:p,children:"Connect"}),u&&a.jsx(ie,{onClick:m,variant:"outline",children:"Disconnect"}),g&&a.jsxs(ie,{onClick:x,variant:"outline",children:[a.jsx(Mw,{className:"w-4 h-4 mr-1"}),"Retry"]}),$&&!u&&a.jsxs(ie,{onClick:_,variant:"outline",children:[a.jsx(Yc,{className:"w-4 h-4 mr-1"}),"Authenticate"]})]})]}),v&&a.jsxs("div",{className:"flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md",children:[a.jsx(Fk,{className:"w-4 h-4 text-destructive"}),a.jsx("span",{className:"text-sm text-destructive",children:v})]})]})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[a.jsxs(_s,{children:[a.jsx(yo,{children:a.jsxs(wo,{className:"flex items-center gap-2",children:[a.jsx(cv,{className:"w-4 h-4"}),"Tools (",b.length,")"]})}),a.jsx(Ss,{children:b.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:u?"No tools available":"Connect to see tools"}):a.jsxs("div",{className:"space-y-2",children:[b.slice(0,5).map((P,O)=>a.jsx("div",{className:"text-sm",children:a.jsx(pn,{variant:"outline",className:"text-xs",children:P.name})},O)),b.length>5&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["+",b.length-5," more tools"]})]})})]}),a.jsxs(_s,{children:[a.jsx(yo,{children:a.jsxs(wo,{children:["Resources (",h.length,")"]})}),a.jsx(Ss,{children:a.jsx("p",{className:"text-sm text-muted-foreground",children:u?`${h.length} resources available`:"Connect to see resources"})})]}),a.jsxs(_s,{children:[a.jsx(yo,{children:a.jsxs(wo,{children:["Prompts (",w.length,")"]})}),a.jsx(Ss,{children:a.jsx("p",{className:"text-sm text-muted-foreground",children:u?`${w.length} prompts available`:"Connect to see prompts"})})]})]}),u&&a.jsxs(_s,{children:[a.jsxs(yo,{children:[a.jsx(wo,{children:"Test Tool Call"}),a.jsx(Ou,{children:"Test calling a tool on the connected MCP service"})]}),a.jsxs(Ss,{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ie,{htmlFor:"toolName",children:"Tool Name"}),a.jsx(He,{id:"toolName",value:r,onChange:P=>n(P.target.value),placeholder:"e.g., get_me"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ie,{htmlFor:"toolArgs",children:"Arguments (JSON)"}),a.jsx(He,{id:"toolArgs",value:s,onChange:P=>o(P.target.value),placeholder:'{"key": "value"}'})]})]}),a.jsxs(ie,{onClick:U,disabled:!u,children:[a.jsx(ZR,{className:"w-4 h-4 mr-1"}),"Call Tool"]}),i&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(Ie,{children:"Result"}),a.jsx(Bn,{value:i,readOnly:!0,rows:10,className:"font-mono text-sm"})]})]})]}),$&&a.jsxs(_s,{children:[a.jsxs(yo,{children:[a.jsxs(wo,{className:"flex items-center gap-2",children:[a.jsx(Yc,{className:"w-4 h-4"}),"OAuth Authentication"]}),a.jsx(Ou,{children:"This service requires OAuth authentication"})]}),a.jsxs(Ss,{className:"space-y-4",children:[a.jsx("div",{className:"p-3 bg-blue-50 border border-blue-200 rounded-md",children:a.jsx("p",{className:"text-sm text-blue-800",children:'This MCP service requires OAuth authentication. Click the "Authenticate" button above to start the OAuth flow.'})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ie,{onClick:_,variant:"outline",children:[a.jsx(Yc,{className:"w-4 h-4 mr-1"}),"Start OAuth Flow"]}),a.jsx(ie,{onClick:k,variant:"outline",children:"Clear OAuth Data"})]})]})]})]})}function bH(){return a.jsxs(s2,{children:[a.jsx(Zc,{path:"/",component:LD}),a.jsx(Zc,{path:"/oauth/callback",component:qD}),a.jsx(Zc,{path:"/mcp-test",component:xH}),a.jsx(Zc,{component:UD})]})}function _H(){return a.jsx(C2,{client:F2,children:a.jsxs(yO,{children:[a.jsx(AI,{}),a.jsx(bH,{})]})})}MS(document.getElementById("root")).render(a.jsx(y.StrictMode,{children:a.jsx(_H,{})}));
|