@agent-deck/backend 1.2.9 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/cli-runtime.d.ts +40 -0
- package/dist/cli-runtime.d.ts.map +1 -1
- package/dist/cli-runtime.js +67 -0
- package/dist/cli-runtime.js.map +1 -1
- package/dist/lib/agent-deck-context.d.ts +1 -1
- package/dist/lib/agent-deck-context.d.ts.map +1 -1
- package/dist/lib/agent-deck-context.js +7 -26
- package/dist/lib/agent-deck-context.js.map +1 -1
- package/dist/mcp-server.d.ts +9 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +64 -835
- package/dist/mcp-server.js.map +1 -1
- package/dist/mcp-session-binding.d.ts +3 -4
- package/dist/mcp-session-binding.d.ts.map +1 -1
- package/dist/mcp-session-binding.js +3 -10
- package/dist/mcp-session-binding.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/routes/scope.d.ts.map +1 -1
- package/dist/routes/scope.js +29 -59
- package/dist/routes/scope.js.map +1 -1
- package/dist/scope/badge.d.ts +3 -0
- package/dist/scope/badge.d.ts.map +1 -0
- package/dist/scope/badge.js +23 -0
- package/dist/scope/badge.js.map +1 -0
- package/dist/scope/live-display-registry.d.ts +7 -1
- package/dist/scope/live-display-registry.d.ts.map +1 -1
- package/dist/scope/live-display-registry.js +22 -2
- package/dist/scope/live-display-registry.js.map +1 -1
- package/package.json +2 -2
- package/static-ui/assets/index-CQoBRW1p.js +409 -0
- package/static-ui/assets/index-wleyGzod.css +1 -0
- package/static-ui/index.html +2 -2
- package/static-ui/assets/index-BnvBkGNu.js +0 -404
- package/static-ui/assets/index-D2upmaZj.css +0 -1
|
@@ -1,404 +0,0 @@
|
|
|
1
|
-
var Dj=Object.defineProperty;var Xy=e=>{throw TypeError(e)};var zj=(e,t,r)=>t in e?Dj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Dn=(e,t,r)=>zj(e,typeof t!="symbol"?t+"":t,r),qf=(e,t,r)=>t.has(e)||Xy("Cannot "+r);var R=(e,t,r)=>(qf(e,t,"read from private field"),r?r.call(e):t.get(e)),me=(e,t,r)=>t.has(e)?Xy("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),ne=(e,t,r,n)=>(qf(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ne=(e,t,r)=>(qf(e,t,"access private method"),r);var Nc=(e,t,r,n)=>({set _(s){ne(e,t,s,r)},get _(){return R(e,t,n)}});function Lj(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 Hd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wb={exports:{}},Kd={},xb={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 oc=Symbol.for("react.element"),Fj=Symbol.for("react.portal"),Uj=Symbol.for("react.fragment"),qj=Symbol.for("react.strict_mode"),Vj=Symbol.for("react.profiler"),Hj=Symbol.for("react.provider"),Kj=Symbol.for("react.context"),Bj=Symbol.for("react.forward_ref"),Wj=Symbol.for("react.suspense"),Zj=Symbol.for("react.memo"),Gj=Symbol.for("react.lazy"),e0=Symbol.iterator;function Qj(e){return e===null||typeof e!="object"?null:(e=e0&&e[e0]||e["@@iterator"],typeof e=="function"?e:null)}var bb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_b=Object.assign,Sb={};function Sa(e,t,r){this.props=e,this.context=t,this.refs=Sb,this.updater=r||bb}Sa.prototype.isReactComponent={};Sa.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")};Sa.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function kb(){}kb.prototype=Sa.prototype;function Xm(e,t,r){this.props=e,this.context=t,this.refs=Sb,this.updater=r||bb}var eg=Xm.prototype=new kb;eg.constructor=Xm;_b(eg,Sa.prototype);eg.isPureReactComponent=!0;var t0=Array.isArray,Cb=Object.prototype.hasOwnProperty,tg={current:null},Eb={key:!0,ref:!0,__self:!0,__source:!0};function Nb(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)Cb.call(t,n)&&!Eb.hasOwnProperty(n)&&(s[n]=t[n]);var a=arguments.length-2;if(a===1)s.children=r;else if(1<a){for(var c=Array(a),u=0;u<a;u++)c[u]=arguments[u+2];s.children=c}if(e&&e.defaultProps)for(n in a=e.defaultProps,a)s[n]===void 0&&(s[n]=a[n]);return{$$typeof:oc,type:e,key:o,ref:i,props:s,_owner:tg.current}}function Jj(e,t){return{$$typeof:oc,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function rg(e){return typeof e=="object"&&e!==null&&e.$$typeof===oc}function Yj(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var r0=/\/+/g;function Vf(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Yj(""+e.key):t.toString(36)}function hu(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 oc:case Fj:i=!0}}if(i)return i=e,s=s(i),e=n===""?"."+Vf(i,0):n,t0(s)?(r="",e!=null&&(r=e.replace(r0,"$&/")+"/"),hu(s,t,r,"",function(u){return u})):s!=null&&(rg(s)&&(s=Jj(s,r+(!s.key||i&&i.key===s.key?"":(""+s.key).replace(r0,"$&/")+"/")+e)),t.push(s)),1;if(i=0,n=n===""?".":n+":",t0(e))for(var a=0;a<e.length;a++){o=e[a];var c=n+Vf(o,a);i+=hu(o,t,r,c,s)}else if(c=Qj(e),typeof c=="function")for(e=c.call(e),a=0;!(o=e.next()).done;)o=o.value,c=n+Vf(o,a++),i+=hu(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 jc(e,t,r){if(e==null)return e;var n=[],s=0;return hu(e,n,"","",function(o){return t.call(r,o,s++)}),n}function Xj(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 rr={current:null},pu={transition:null},e$={ReactCurrentDispatcher:rr,ReactCurrentBatchConfig:pu,ReactCurrentOwner:tg};function jb(){throw Error("act(...) is not supported in production builds of React.")}Re.Children={map:jc,forEach:function(e,t,r){jc(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return jc(e,function(){t++}),t},toArray:function(e){return jc(e,function(t){return t})||[]},only:function(e){if(!rg(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Re.Component=Sa;Re.Fragment=Uj;Re.Profiler=Vj;Re.PureComponent=Xm;Re.StrictMode=qj;Re.Suspense=Wj;Re.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=e$;Re.act=jb;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=_b({},e.props),s=e.key,o=e.ref,i=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,i=tg.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(c in t)Cb.call(t,c)&&!Eb.hasOwnProperty(c)&&(n[c]=t[c]===void 0&&a!==void 0?a[c]:t[c])}var c=arguments.length-2;if(c===1)n.children=r;else if(1<c){a=Array(c);for(var u=0;u<c;u++)a[u]=arguments[u+2];n.children=a}return{$$typeof:oc,type:e.type,key:s,ref:o,props:n,_owner:i}};Re.createContext=function(e){return e={$$typeof:Kj,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Hj,_context:e},e.Consumer=e};Re.createElement=Nb;Re.createFactory=function(e){var t=Nb.bind(null,e);return t.type=e,t};Re.createRef=function(){return{current:null}};Re.forwardRef=function(e){return{$$typeof:Bj,render:e}};Re.isValidElement=rg;Re.lazy=function(e){return{$$typeof:Gj,_payload:{_status:-1,_result:e},_init:Xj}};Re.memo=function(e,t){return{$$typeof:Zj,type:e,compare:t===void 0?null:t}};Re.startTransition=function(e){var t=pu.transition;pu.transition={};try{e()}finally{pu.transition=t}};Re.unstable_act=jb;Re.useCallback=function(e,t){return rr.current.useCallback(e,t)};Re.useContext=function(e){return rr.current.useContext(e)};Re.useDebugValue=function(){};Re.useDeferredValue=function(e){return rr.current.useDeferredValue(e)};Re.useEffect=function(e,t){return rr.current.useEffect(e,t)};Re.useId=function(){return rr.current.useId()};Re.useImperativeHandle=function(e,t,r){return rr.current.useImperativeHandle(e,t,r)};Re.useInsertionEffect=function(e,t){return rr.current.useInsertionEffect(e,t)};Re.useLayoutEffect=function(e,t){return rr.current.useLayoutEffect(e,t)};Re.useMemo=function(e,t){return rr.current.useMemo(e,t)};Re.useReducer=function(e,t,r){return rr.current.useReducer(e,t,r)};Re.useRef=function(e){return rr.current.useRef(e)};Re.useState=function(e){return rr.current.useState(e)};Re.useSyncExternalStore=function(e,t,r){return rr.current.useSyncExternalStore(e,t,r)};Re.useTransition=function(){return rr.current.useTransition()};Re.version="18.3.1";xb.exports=Re;var w=xb.exports;const yn=Hd(w),ng=Lj({__proto__:null,default:yn},[w]);/**
|
|
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 t$=w,r$=Symbol.for("react.element"),n$=Symbol.for("react.fragment"),s$=Object.prototype.hasOwnProperty,o$=t$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i$={key:!0,ref:!0,__self:!0,__source:!0};function $b(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)s$.call(t,n)&&!i$.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:r$,type:e,key:o,ref:i,props:s,_owner:o$.current}}Kd.Fragment=n$;Kd.jsx=$b;Kd.jsxs=$b;wb.exports=Kd;var l=wb.exports,Pb={exports:{}},Nr={},Tb={exports:{}},Rb={};/**
|
|
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(q,V){var z=q.length;q.push(V);e:for(;0<z;){var I=z-1>>>1,F=q[I];if(0<s(F,V))q[I]=V,q[z]=F,z=I;else break e}}function r(q){return q.length===0?null:q[0]}function n(q){if(q.length===0)return null;var V=q[0],z=q.pop();if(z!==V){q[0]=z;e:for(var I=0,F=q.length,N=F>>>1;I<N;){var _=2*(I+1)-1,E=q[_],D=_+1,K=q[D];if(0>s(E,z))D<F&&0>s(K,E)?(q[I]=K,q[D]=z,I=D):(q[I]=E,q[_]=z,I=_);else if(D<F&&0>s(K,z))q[I]=K,q[D]=z,I=D;else break e}}return V}function s(q,V){var z=q.sortIndex-V.sortIndex;return z!==0?z:q.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,a=i.now();e.unstable_now=function(){return i.now()-a}}var c=[],u=[],d=1,f=null,g=3,y=!1,b=!1,m=!1,v=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,p=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(q){for(var V=r(u);V!==null;){if(V.callback===null)n(u);else if(V.startTime<=q)n(u),V.sortIndex=V.expirationTime,t(c,V);else break;V=r(u)}}function S(q){if(m=!1,x(q),!b)if(r(c)!==null)b=!0,H(C);else{var V=r(u);V!==null&&G(S,V.startTime-q)}}function C(q,V){b=!1,m&&(m=!1,h(O),O=-1),y=!0;var z=g;try{for(x(V),f=r(c);f!==null&&(!(f.expirationTime>V)||q&&!j());){var I=f.callback;if(typeof I=="function"){f.callback=null,g=f.priorityLevel;var F=I(f.expirationTime<=V);V=e.unstable_now(),typeof F=="function"?f.callback=F:f===r(c)&&n(c),x(V)}else n(c);f=r(c)}if(f!==null)var N=!0;else{var _=r(u);_!==null&&G(S,_.startTime-V),N=!1}return N}finally{f=null,g=z,y=!1}}var T=!1,$=null,O=-1,M=5,U=-1;function j(){return!(e.unstable_now()-U<M)}function k(){if($!==null){var q=e.unstable_now();U=q;var V=!0;try{V=$(!0,q)}finally{V?L():(T=!1,$=null)}}else T=!1}var L;if(typeof p=="function")L=function(){p(k)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,B=P.port2;P.port1.onmessage=k,L=function(){B.postMessage(null)}}else L=function(){v(k,0)};function H(q){$=q,T||(T=!0,L())}function G(q,V){O=v(function(){q(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(q){q.callback=null},e.unstable_continueExecution=function(){b||y||(b=!0,H(C))},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return r(c)},e.unstable_next=function(q){switch(g){case 1:case 2:case 3:var V=3;break;default:V=g}var z=g;g=V;try{return q()}finally{g=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(q,V){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var z=g;g=q;try{return V()}finally{g=z}},e.unstable_scheduleCallback=function(q,V,z){var I=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?I+z:I):z=I,q){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=z+F,q={id:d++,callback:V,priorityLevel:q,startTime:z,expirationTime:F,sortIndex:-1},z>I?(q.sortIndex=z,t(u,q),r(c)===null&&q===r(u)&&(m?(h(O),O=-1):m=!0,G(S,z-I))):(q.sortIndex=F,t(c,q),b||y||(b=!0,H(C))),q},e.unstable_shouldYield=j,e.unstable_wrapCallback=function(q){var V=g;return function(){var z=g;g=V;try{return q.apply(this,arguments)}finally{g=z}}}})(Rb);Tb.exports=Rb;var a$=Tb.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 l$=w,Er=a$;function Q(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 Ib=new Set,Tl={};function ri(e,t){aa(e,t),aa(e+"Capture",t)}function aa(e,t){for(Tl[e]=t,e=0;e<t.length;e++)Ib.add(t[e])}var es=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Zh=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]*$/,n0={},s0={};function u$(e){return Zh.call(s0,e)?!0:Zh.call(n0,e)?!1:c$.test(e)?s0[e]=!0:(n0[e]=!0,!1)}function d$(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 f$(e,t,r,n){if(t===null||typeof t>"u"||d$(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 nr(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 nr(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 nr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Lt[e]=new nr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Lt[e]=new nr(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 nr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Lt[e]=new nr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Lt[e]=new nr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Lt[e]=new nr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Lt[e]=new nr(e,5,!1,e.toLowerCase(),null,!1,!1)});var sg=/[\-:]([a-z])/g;function og(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(sg,og);Lt[t]=new nr(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(sg,og);Lt[t]=new nr(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(sg,og);Lt[t]=new nr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Lt[e]=new nr(e,1,!1,e.toLowerCase(),null,!1,!1)});Lt.xlinkHref=new nr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Lt[e]=new nr(e,1,!1,e.toLowerCase(),null,!0,!0)});function ig(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")&&(f$(t,r,s,n)&&(r=null),n||s===null?u$(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 as=l$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,$c=Symbol.for("react.element"),xi=Symbol.for("react.portal"),bi=Symbol.for("react.fragment"),ag=Symbol.for("react.strict_mode"),Gh=Symbol.for("react.profiler"),Ab=Symbol.for("react.provider"),Ob=Symbol.for("react.context"),lg=Symbol.for("react.forward_ref"),Qh=Symbol.for("react.suspense"),Jh=Symbol.for("react.suspense_list"),cg=Symbol.for("react.memo"),ys=Symbol.for("react.lazy"),Mb=Symbol.for("react.offscreen"),o0=Symbol.iterator;function Fa(e){return e===null||typeof e!="object"?null:(e=o0&&e[o0]||e["@@iterator"],typeof e=="function"?e:null)}var dt=Object.assign,Hf;function el(e){if(Hf===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);Hf=t&&t[1]||""}return`
|
|
34
|
-
`+Hf+e}var Kf=!1;function Bf(e,t){if(!e||Kf)return"";Kf=!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,a=o.length-1;1<=i&&0<=a&&s[i]!==o[a];)a--;for(;1<=i&&0<=a;i--,a--)if(s[i]!==o[a]){if(i!==1||a!==1)do if(i--,a--,0>a||s[i]!==o[a]){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<=a);break}}}finally{Kf=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?el(e):""}function h$(e){switch(e.tag){case 5:return el(e.type);case 16:return el("Lazy");case 13:return el("Suspense");case 19:return el("SuspenseList");case 0:case 2:case 15:return e=Bf(e.type,!1),e;case 11:return e=Bf(e.type.render,!1),e;case 1:return e=Bf(e.type,!0),e;default:return""}}function Yh(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 bi:return"Fragment";case xi:return"Portal";case Gh:return"Profiler";case ag:return"StrictMode";case Qh:return"Suspense";case Jh:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ob:return(e.displayName||"Context")+".Consumer";case Ab:return(e._context.displayName||"Context")+".Provider";case lg:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case cg:return t=e.displayName||null,t!==null?t:Yh(e.type)||"Memo";case ys:t=e._payload,e=e._init;try{return Yh(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 Yh(t);case 8:return t===ag?"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 Js(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Db(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function m$(e){var t=Db(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 Pc(e){e._valueTracker||(e._valueTracker=m$(e))}function zb(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=Db(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function qu(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 Xh(e,t){var r=t.checked;return dt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function i0(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=Js(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 Lb(e,t){t=t.checked,t!=null&&ig(e,"checked",t,!1)}function ep(e,t){Lb(e,t);var r=Js(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")?tp(e,t.type,r):t.hasOwnProperty("defaultValue")&&tp(e,t.type,Js(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function a0(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 tp(e,t,r){(t!=="number"||qu(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var tl=Array.isArray;function Oi(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=""+Js(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 rp(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Q(91));return dt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function l0(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(Q(92));if(tl(r)){if(1<r.length)throw Error(Q(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:Js(r)}}function Fb(e,t){var r=Js(t.value),n=Js(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 c0(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Ub(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 np(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Ub(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Tc,qb=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(Tc=Tc||document.createElement("div"),Tc.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Tc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Rl(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var fl={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},g$=["Webkit","ms","Moz","O"];Object.keys(fl).forEach(function(e){g$.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fl[t]=fl[e]})});function Vb(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||fl.hasOwnProperty(e)&&fl[e]?(""+t).trim():t+"px"}function Hb(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,s=Vb(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,s):e[r]=s}}var v$=dt({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 sp(e,t){if(t){if(v$[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Q(62))}}function op(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 ip=null;function ug(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ap=null,Mi=null,Di=null;function u0(e){if(e=lc(e)){if(typeof ap!="function")throw Error(Q(280));var t=e.stateNode;t&&(t=Qd(t),ap(e.stateNode,e.type,t))}}function Kb(e){Mi?Di?Di.push(e):Di=[e]:Mi=e}function Bb(){if(Mi){var e=Mi,t=Di;if(Di=Mi=null,u0(e),t)for(e=0;e<t.length;e++)u0(t[e])}}function Wb(e,t){return e(t)}function Zb(){}var Wf=!1;function Gb(e,t,r){if(Wf)return e(t,r);Wf=!0;try{return Wb(e,t,r)}finally{Wf=!1,(Mi!==null||Di!==null)&&(Zb(),Bb())}}function Il(e,t){var r=e.stateNode;if(r===null)return null;var n=Qd(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(Q(231,t,typeof r));return r}var lp=!1;if(es)try{var Ua={};Object.defineProperty(Ua,"passive",{get:function(){lp=!0}}),window.addEventListener("test",Ua,Ua),window.removeEventListener("test",Ua,Ua)}catch{lp=!1}function y$(e,t,r,n,s,o,i,a,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(r,u)}catch(d){this.onError(d)}}var hl=!1,Vu=null,Hu=!1,cp=null,w$={onError:function(e){hl=!0,Vu=e}};function x$(e,t,r,n,s,o,i,a,c){hl=!1,Vu=null,y$.apply(w$,arguments)}function b$(e,t,r,n,s,o,i,a,c){if(x$.apply(this,arguments),hl){if(hl){var u=Vu;hl=!1,Vu=null}else throw Error(Q(198));Hu||(Hu=!0,cp=u)}}function ni(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 Qb(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 d0(e){if(ni(e)!==e)throw Error(Q(188))}function _$(e){var t=e.alternate;if(!t){if(t=ni(e),t===null)throw Error(Q(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 d0(s),e;if(o===n)return d0(s),t;o=o.sibling}throw Error(Q(188))}if(r.return!==n.return)r=s,n=o;else{for(var i=!1,a=s.child;a;){if(a===r){i=!0,r=s,n=o;break}if(a===n){i=!0,n=s,r=o;break}a=a.sibling}if(!i){for(a=o.child;a;){if(a===r){i=!0,r=o,n=s;break}if(a===n){i=!0,n=o,r=s;break}a=a.sibling}if(!i)throw Error(Q(189))}}if(r.alternate!==n)throw Error(Q(190))}if(r.tag!==3)throw Error(Q(188));return r.stateNode.current===r?e:t}function Jb(e){return e=_$(e),e!==null?Yb(e):null}function Yb(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Yb(e);if(t!==null)return t;e=e.sibling}return null}var Xb=Er.unstable_scheduleCallback,f0=Er.unstable_cancelCallback,S$=Er.unstable_shouldYield,k$=Er.unstable_requestPaint,yt=Er.unstable_now,C$=Er.unstable_getCurrentPriorityLevel,dg=Er.unstable_ImmediatePriority,e_=Er.unstable_UserBlockingPriority,Ku=Er.unstable_NormalPriority,E$=Er.unstable_LowPriority,t_=Er.unstable_IdlePriority,Bd=null,Pn=null;function N$(e){if(Pn&&typeof Pn.onCommitFiberRoot=="function")try{Pn.onCommitFiberRoot(Bd,e,void 0,(e.current.flags&128)===128)}catch{}}var sn=Math.clz32?Math.clz32:P$,j$=Math.log,$$=Math.LN2;function P$(e){return e>>>=0,e===0?32:31-(j$(e)/$$|0)|0}var Rc=64,Ic=4194304;function rl(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 Bu(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 a=i&~s;a!==0?n=rl(a):(o&=i,o!==0&&(n=rl(o)))}else i=r&~s,i!==0?n=rl(i):o!==0&&(n=rl(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-sn(t),s=1<<r,n|=e[r],t&=~s;return n}function T$(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 R$(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,s=e.expirationTimes,o=e.pendingLanes;0<o;){var i=31-sn(o),a=1<<i,c=s[i];c===-1?(!(a&r)||a&n)&&(s[i]=T$(a,t)):c<=t&&(e.expiredLanes|=a),o&=~a}}function up(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function r_(){var e=Rc;return Rc<<=1,!(Rc&4194240)&&(Rc=64),e}function Zf(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function ic(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-sn(t),e[t]=r}function I$(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-sn(r),o=1<<s;t[s]=0,n[s]=-1,e[s]=-1,r&=~o}}function fg(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-sn(r),s=1<<n;s&t|e[n]&t&&(e[n]|=t),r&=~s}}var qe=0;function n_(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var s_,hg,o_,i_,a_,dp=!1,Ac=[],Ls=null,Fs=null,Us=null,Al=new Map,Ol=new Map,Ss=[],A$="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 h0(e,t){switch(e){case"focusin":case"focusout":Ls=null;break;case"dragenter":case"dragleave":Fs=null;break;case"mouseover":case"mouseout":Us=null;break;case"pointerover":case"pointerout":Al.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ol.delete(t.pointerId)}}function qa(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=lc(t),t!==null&&hg(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function O$(e,t,r,n,s){switch(t){case"focusin":return Ls=qa(Ls,e,t,r,n,s),!0;case"dragenter":return Fs=qa(Fs,e,t,r,n,s),!0;case"mouseover":return Us=qa(Us,e,t,r,n,s),!0;case"pointerover":var o=s.pointerId;return Al.set(o,qa(Al.get(o)||null,e,t,r,n,s)),!0;case"gotpointercapture":return o=s.pointerId,Ol.set(o,qa(Ol.get(o)||null,e,t,r,n,s)),!0}return!1}function l_(e){var t=jo(e.target);if(t!==null){var r=ni(t);if(r!==null){if(t=r.tag,t===13){if(t=Qb(r),t!==null){e.blockedOn=t,a_(e.priority,function(){o_(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 mu(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=fp(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);ip=n,r.target.dispatchEvent(n),ip=null}else return t=lc(r),t!==null&&hg(t),e.blockedOn=r,!1;t.shift()}return!0}function p0(e,t,r){mu(e)&&r.delete(t)}function M$(){dp=!1,Ls!==null&&mu(Ls)&&(Ls=null),Fs!==null&&mu(Fs)&&(Fs=null),Us!==null&&mu(Us)&&(Us=null),Al.forEach(p0),Ol.forEach(p0)}function Va(e,t){e.blockedOn===t&&(e.blockedOn=null,dp||(dp=!0,Er.unstable_scheduleCallback(Er.unstable_NormalPriority,M$)))}function Ml(e){function t(s){return Va(s,e)}if(0<Ac.length){Va(Ac[0],e);for(var r=1;r<Ac.length;r++){var n=Ac[r];n.blockedOn===e&&(n.blockedOn=null)}}for(Ls!==null&&Va(Ls,e),Fs!==null&&Va(Fs,e),Us!==null&&Va(Us,e),Al.forEach(t),Ol.forEach(t),r=0;r<Ss.length;r++)n=Ss[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<Ss.length&&(r=Ss[0],r.blockedOn===null);)l_(r),r.blockedOn===null&&Ss.shift()}var zi=as.ReactCurrentBatchConfig,Wu=!0;function D$(e,t,r,n){var s=qe,o=zi.transition;zi.transition=null;try{qe=1,pg(e,t,r,n)}finally{qe=s,zi.transition=o}}function z$(e,t,r,n){var s=qe,o=zi.transition;zi.transition=null;try{qe=4,pg(e,t,r,n)}finally{qe=s,zi.transition=o}}function pg(e,t,r,n){if(Wu){var s=fp(e,t,r,n);if(s===null)sh(e,t,n,Zu,r),h0(e,n);else if(O$(s,e,t,r,n))n.stopPropagation();else if(h0(e,n),t&4&&-1<A$.indexOf(e)){for(;s!==null;){var o=lc(s);if(o!==null&&s_(o),o=fp(e,t,r,n),o===null&&sh(e,t,n,Zu,r),o===s)break;s=o}s!==null&&n.stopPropagation()}else sh(e,t,n,null,r)}}var Zu=null;function fp(e,t,r,n){if(Zu=null,e=ug(n),e=jo(e),e!==null)if(t=ni(e),t===null)e=null;else if(r=t.tag,r===13){if(e=Qb(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 Zu=e,null}function c_(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(C$()){case dg:return 1;case e_:return 4;case Ku:case E$:return 16;case t_:return 536870912;default:return 16}default:return 16}}var Os=null,mg=null,gu=null;function u_(){if(gu)return gu;var e,t=mg,r=t.length,n,s="value"in Os?Os.value:Os.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 gu=s.slice(e,1<n?1-n:void 0)}function vu(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 Oc(){return!0}function m0(){return!1}function jr(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 a in e)e.hasOwnProperty(a)&&(r=e[a],this[a]=r?r(o):o[a]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Oc:m0,this.isPropagationStopped=m0,this}return dt(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=Oc)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Oc)},persist:function(){},isPersistent:Oc}),t}var ka={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gg=jr(ka),ac=dt({},ka,{view:0,detail:0}),L$=jr(ac),Gf,Qf,Ha,Wd=dt({},ac,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vg,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!==Ha&&(Ha&&e.type==="mousemove"?(Gf=e.screenX-Ha.screenX,Qf=e.screenY-Ha.screenY):Qf=Gf=0,Ha=e),Gf)},movementY:function(e){return"movementY"in e?e.movementY:Qf}}),g0=jr(Wd),F$=dt({},Wd,{dataTransfer:0}),U$=jr(F$),q$=dt({},ac,{relatedTarget:0}),Jf=jr(q$),V$=dt({},ka,{animationName:0,elapsedTime:0,pseudoElement:0}),H$=jr(V$),K$=dt({},ka,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),B$=jr(K$),W$=dt({},ka,{data:0}),v0=jr(W$),Z$={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},G$={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"},Q$={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function J$(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Q$[e])?!!t[e]:!1}function vg(){return J$}var Y$=dt({},ac,{key:function(e){if(e.key){var t=Z$[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=vu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?G$[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vg,charCode:function(e){return e.type==="keypress"?vu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?vu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),X$=jr(Y$),eP=dt({},Wd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),y0=jr(eP),tP=dt({},ac,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vg}),rP=jr(tP),nP=dt({},ka,{propertyName:0,elapsedTime:0,pseudoElement:0}),sP=jr(nP),oP=dt({},Wd,{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}),iP=jr(oP),aP=[9,13,27,32],yg=es&&"CompositionEvent"in window,pl=null;es&&"documentMode"in document&&(pl=document.documentMode);var lP=es&&"TextEvent"in window&&!pl,d_=es&&(!yg||pl&&8<pl&&11>=pl),w0=" ",x0=!1;function f_(e,t){switch(e){case"keyup":return aP.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function h_(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var _i=!1;function cP(e,t){switch(e){case"compositionend":return h_(t);case"keypress":return t.which!==32?null:(x0=!0,w0);case"textInput":return e=t.data,e===w0&&x0?null:e;default:return null}}function uP(e,t){if(_i)return e==="compositionend"||!yg&&f_(e,t)?(e=u_(),gu=mg=Os=null,_i=!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 d_&&t.locale!=="ko"?null:t.data;default:return null}}var dP={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 b0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!dP[e.type]:t==="textarea"}function p_(e,t,r,n){Kb(n),t=Gu(t,"onChange"),0<t.length&&(r=new gg("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var ml=null,Dl=null;function fP(e){C_(e,0)}function Zd(e){var t=Ci(e);if(zb(t))return e}function hP(e,t){if(e==="change")return t}var m_=!1;if(es){var Yf;if(es){var Xf="oninput"in document;if(!Xf){var _0=document.createElement("div");_0.setAttribute("oninput","return;"),Xf=typeof _0.oninput=="function"}Yf=Xf}else Yf=!1;m_=Yf&&(!document.documentMode||9<document.documentMode)}function S0(){ml&&(ml.detachEvent("onpropertychange",g_),Dl=ml=null)}function g_(e){if(e.propertyName==="value"&&Zd(Dl)){var t=[];p_(t,Dl,e,ug(e)),Gb(fP,t)}}function pP(e,t,r){e==="focusin"?(S0(),ml=t,Dl=r,ml.attachEvent("onpropertychange",g_)):e==="focusout"&&S0()}function mP(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Zd(Dl)}function gP(e,t){if(e==="click")return Zd(t)}function vP(e,t){if(e==="input"||e==="change")return Zd(t)}function yP(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ln=typeof Object.is=="function"?Object.is:yP;function zl(e,t){if(ln(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(!Zh.call(t,s)||!ln(e[s],t[s]))return!1}return!0}function k0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function C0(e,t){var r=k0(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=k0(r)}}function v_(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?v_(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function y_(){for(var e=window,t=qu();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=qu(e.document)}return t}function wg(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 wP(e){var t=y_(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&v_(r.ownerDocument.documentElement,r)){if(n!==null&&wg(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=C0(r,o);var i=C0(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 xP=es&&"documentMode"in document&&11>=document.documentMode,Si=null,hp=null,gl=null,pp=!1;function E0(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;pp||Si==null||Si!==qu(n)||(n=Si,"selectionStart"in n&&wg(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}),gl&&zl(gl,n)||(gl=n,n=Gu(hp,"onSelect"),0<n.length&&(t=new gg("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=Si)))}function Mc(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var ki={animationend:Mc("Animation","AnimationEnd"),animationiteration:Mc("Animation","AnimationIteration"),animationstart:Mc("Animation","AnimationStart"),transitionend:Mc("Transition","TransitionEnd")},eh={},w_={};es&&(w_=document.createElement("div").style,"AnimationEvent"in window||(delete ki.animationend.animation,delete ki.animationiteration.animation,delete ki.animationstart.animation),"TransitionEvent"in window||delete ki.transitionend.transition);function Gd(e){if(eh[e])return eh[e];if(!ki[e])return e;var t=ki[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in w_)return eh[e]=t[r];return e}var x_=Gd("animationend"),b_=Gd("animationiteration"),__=Gd("animationstart"),S_=Gd("transitionend"),k_=new Map,N0="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 no(e,t){k_.set(e,t),ri(t,[e])}for(var th=0;th<N0.length;th++){var rh=N0[th],bP=rh.toLowerCase(),_P=rh[0].toUpperCase()+rh.slice(1);no(bP,"on"+_P)}no(x_,"onAnimationEnd");no(b_,"onAnimationIteration");no(__,"onAnimationStart");no("dblclick","onDoubleClick");no("focusin","onFocus");no("focusout","onBlur");no(S_,"onTransitionEnd");aa("onMouseEnter",["mouseout","mouseover"]);aa("onMouseLeave",["mouseout","mouseover"]);aa("onPointerEnter",["pointerout","pointerover"]);aa("onPointerLeave",["pointerout","pointerover"]);ri("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ri("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ri("onBeforeInput",["compositionend","keypress","textInput","paste"]);ri("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ri("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ri("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var nl="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(" "),SP=new Set("cancel close invalid load scroll toggle".split(" ").concat(nl));function j0(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,b$(n,t,void 0,e),e.currentTarget=null}function C_(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 a=n[i],c=a.instance,u=a.currentTarget;if(a=a.listener,c!==o&&s.isPropagationStopped())break e;j0(s,a,u),o=c}else for(i=0;i<n.length;i++){if(a=n[i],c=a.instance,u=a.currentTarget,a=a.listener,c!==o&&s.isPropagationStopped())break e;j0(s,a,u),o=c}}}if(Hu)throw e=cp,Hu=!1,cp=null,e}function Qe(e,t){var r=t[wp];r===void 0&&(r=t[wp]=new Set);var n=e+"__bubble";r.has(n)||(E_(t,e,2,!1),r.add(n))}function nh(e,t,r){var n=0;t&&(n|=4),E_(r,e,n,t)}var Dc="_reactListening"+Math.random().toString(36).slice(2);function Ll(e){if(!e[Dc]){e[Dc]=!0,Ib.forEach(function(r){r!=="selectionchange"&&(SP.has(r)||nh(r,!1,e),nh(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Dc]||(t[Dc]=!0,nh("selectionchange",!1,t))}}function E_(e,t,r,n){switch(c_(t)){case 1:var s=D$;break;case 4:s=z$;break;default:s=pg}r=s.bind(null,t,r,e),s=void 0,!lp||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 sh(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 a=n.stateNode.containerInfo;if(a===s||a.nodeType===8&&a.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(;a!==null;){if(i=jo(a),i===null)return;if(c=i.tag,c===5||c===6){n=o=i;continue e}a=a.parentNode}}n=n.return}Gb(function(){var u=o,d=ug(r),f=[];e:{var g=k_.get(e);if(g!==void 0){var y=gg,b=e;switch(e){case"keypress":if(vu(r)===0)break e;case"keydown":case"keyup":y=X$;break;case"focusin":b="focus",y=Jf;break;case"focusout":b="blur",y=Jf;break;case"beforeblur":case"afterblur":y=Jf;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":y=g0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":y=U$;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":y=rP;break;case x_:case b_:case __:y=H$;break;case S_:y=sP;break;case"scroll":y=L$;break;case"wheel":y=iP;break;case"copy":case"cut":case"paste":y=B$;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":y=y0}var m=(t&4)!==0,v=!m&&e==="scroll",h=m?g!==null?g+"Capture":null:g;m=[];for(var p=u,x;p!==null;){x=p;var S=x.stateNode;if(x.tag===5&&S!==null&&(x=S,h!==null&&(S=Il(p,h),S!=null&&m.push(Fl(p,S,x)))),v)break;p=p.return}0<m.length&&(g=new y(g,b,null,r,d),f.push({event:g,listeners:m}))}}if(!(t&7)){e:{if(g=e==="mouseover"||e==="pointerover",y=e==="mouseout"||e==="pointerout",g&&r!==ip&&(b=r.relatedTarget||r.fromElement)&&(jo(b)||b[ts]))break e;if((y||g)&&(g=d.window===d?d:(g=d.ownerDocument)?g.defaultView||g.parentWindow:window,y?(b=r.relatedTarget||r.toElement,y=u,b=b?jo(b):null,b!==null&&(v=ni(b),b!==v||b.tag!==5&&b.tag!==6)&&(b=null)):(y=null,b=u),y!==b)){if(m=g0,S="onMouseLeave",h="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(m=y0,S="onPointerLeave",h="onPointerEnter",p="pointer"),v=y==null?g:Ci(y),x=b==null?g:Ci(b),g=new m(S,p+"leave",y,r,d),g.target=v,g.relatedTarget=x,S=null,jo(d)===u&&(m=new m(h,p+"enter",b,r,d),m.target=x,m.relatedTarget=v,S=m),v=S,y&&b)t:{for(m=y,h=b,p=0,x=m;x;x=ai(x))p++;for(x=0,S=h;S;S=ai(S))x++;for(;0<p-x;)m=ai(m),p--;for(;0<x-p;)h=ai(h),x--;for(;p--;){if(m===h||h!==null&&m===h.alternate)break t;m=ai(m),h=ai(h)}m=null}else m=null;y!==null&&$0(f,g,y,m,!1),b!==null&&v!==null&&$0(f,v,b,m,!0)}}e:{if(g=u?Ci(u):window,y=g.nodeName&&g.nodeName.toLowerCase(),y==="select"||y==="input"&&g.type==="file")var C=hP;else if(b0(g))if(m_)C=vP;else{C=mP;var T=pP}else(y=g.nodeName)&&y.toLowerCase()==="input"&&(g.type==="checkbox"||g.type==="radio")&&(C=gP);if(C&&(C=C(e,u))){p_(f,C,r,d);break e}T&&T(e,g,u),e==="focusout"&&(T=g._wrapperState)&&T.controlled&&g.type==="number"&&tp(g,"number",g.value)}switch(T=u?Ci(u):window,e){case"focusin":(b0(T)||T.contentEditable==="true")&&(Si=T,hp=u,gl=null);break;case"focusout":gl=hp=Si=null;break;case"mousedown":pp=!0;break;case"contextmenu":case"mouseup":case"dragend":pp=!1,E0(f,r,d);break;case"selectionchange":if(xP)break;case"keydown":case"keyup":E0(f,r,d)}var $;if(yg)e:{switch(e){case"compositionstart":var O="onCompositionStart";break e;case"compositionend":O="onCompositionEnd";break e;case"compositionupdate":O="onCompositionUpdate";break e}O=void 0}else _i?f_(e,r)&&(O="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(O="onCompositionStart");O&&(d_&&r.locale!=="ko"&&(_i||O!=="onCompositionStart"?O==="onCompositionEnd"&&_i&&($=u_()):(Os=d,mg="value"in Os?Os.value:Os.textContent,_i=!0)),T=Gu(u,O),0<T.length&&(O=new v0(O,e,null,r,d),f.push({event:O,listeners:T}),$?O.data=$:($=h_(r),$!==null&&(O.data=$)))),($=lP?cP(e,r):uP(e,r))&&(u=Gu(u,"onBeforeInput"),0<u.length&&(d=new v0("onBeforeInput","beforeinput",null,r,d),f.push({event:d,listeners:u}),d.data=$))}C_(f,t)})}function Fl(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Gu(e,t){for(var r=t+"Capture",n=[];e!==null;){var s=e,o=s.stateNode;s.tag===5&&o!==null&&(s=o,o=Il(e,r),o!=null&&n.unshift(Fl(e,o,s)),o=Il(e,t),o!=null&&n.push(Fl(e,o,s))),e=e.return}return n}function ai(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function $0(e,t,r,n,s){for(var o=t._reactName,i=[];r!==null&&r!==n;){var a=r,c=a.alternate,u=a.stateNode;if(c!==null&&c===n)break;a.tag===5&&u!==null&&(a=u,s?(c=Il(r,o),c!=null&&i.unshift(Fl(r,c,a))):s||(c=Il(r,o),c!=null&&i.push(Fl(r,c,a)))),r=r.return}i.length!==0&&e.push({event:t,listeners:i})}var kP=/\r\n?/g,CP=/\u0000|\uFFFD/g;function P0(e){return(typeof e=="string"?e:""+e).replace(kP,`
|
|
38
|
-
`).replace(CP,"")}function zc(e,t,r){if(t=P0(t),P0(e)!==t&&r)throw Error(Q(425))}function Qu(){}var mp=null,gp=null;function vp(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 yp=typeof setTimeout=="function"?setTimeout:void 0,EP=typeof clearTimeout=="function"?clearTimeout:void 0,T0=typeof Promise=="function"?Promise:void 0,NP=typeof queueMicrotask=="function"?queueMicrotask:typeof T0<"u"?function(e){return T0.resolve(null).then(e).catch(jP)}:yp;function jP(e){setTimeout(function(){throw e})}function oh(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),Ml(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=s}while(r);Ml(t)}function qs(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 R0(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 Ca=Math.random().toString(36).slice(2),_n="__reactFiber$"+Ca,Ul="__reactProps$"+Ca,ts="__reactContainer$"+Ca,wp="__reactEvents$"+Ca,$P="__reactListeners$"+Ca,PP="__reactHandles$"+Ca;function jo(e){var t=e[_n];if(t)return t;for(var r=e.parentNode;r;){if(t=r[ts]||r[_n]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=R0(e);e!==null;){if(r=e[_n])return r;e=R0(e)}return t}e=r,r=e.parentNode}return null}function lc(e){return e=e[_n]||e[ts],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ci(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Q(33))}function Qd(e){return e[Ul]||null}var xp=[],Ei=-1;function so(e){return{current:e}}function Xe(e){0>Ei||(e.current=xp[Ei],xp[Ei]=null,Ei--)}function We(e,t){Ei++,xp[Ei]=e.current,e.current=t}var Ys={},Zt=so(Ys),pr=so(!1),qo=Ys;function la(e,t){var r=e.type.contextTypes;if(!r)return Ys;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 mr(e){return e=e.childContextTypes,e!=null}function Ju(){Xe(pr),Xe(Zt)}function I0(e,t,r){if(Zt.current!==Ys)throw Error(Q(168));We(Zt,t),We(pr,r)}function N_(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(Q(108,p$(e)||"Unknown",s));return dt({},r,n)}function Yu(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ys,qo=Zt.current,We(Zt,e),We(pr,pr.current),!0}function A0(e,t,r){var n=e.stateNode;if(!n)throw Error(Q(169));r?(e=N_(e,t,qo),n.__reactInternalMemoizedMergedChildContext=e,Xe(pr),Xe(Zt),We(Zt,e)):Xe(pr),We(pr,r)}var qn=null,Jd=!1,ih=!1;function j_(e){qn===null?qn=[e]:qn.push(e)}function TP(e){Jd=!0,j_(e)}function oo(){if(!ih&&qn!==null){ih=!0;var e=0,t=qe;try{var r=qn;for(qe=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}qn=null,Jd=!1}catch(s){throw qn!==null&&(qn=qn.slice(e+1)),Xb(dg,oo),s}finally{qe=t,ih=!1}}return null}var Ni=[],ji=0,Xu=null,ed=0,Or=[],Mr=0,Vo=null,Wn=1,Zn="";function wo(e,t){Ni[ji++]=ed,Ni[ji++]=Xu,Xu=e,ed=t}function $_(e,t,r){Or[Mr++]=Wn,Or[Mr++]=Zn,Or[Mr++]=Vo,Vo=e;var n=Wn;e=Zn;var s=32-sn(n)-1;n&=~(1<<s),r+=1;var o=32-sn(t)+s;if(30<o){var i=s-s%5;o=(n&(1<<i)-1).toString(32),n>>=i,s-=i,Wn=1<<32-sn(t)+s|r<<s|n,Zn=o+e}else Wn=1<<o|r<<s|n,Zn=e}function xg(e){e.return!==null&&(wo(e,1),$_(e,1,0))}function bg(e){for(;e===Xu;)Xu=Ni[--ji],Ni[ji]=null,ed=Ni[--ji],Ni[ji]=null;for(;e===Vo;)Vo=Or[--Mr],Or[Mr]=null,Zn=Or[--Mr],Or[Mr]=null,Wn=Or[--Mr],Or[Mr]=null}var kr=null,Sr=null,nt=!1,en=null;function P_(e,t){var r=Dr(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 O0(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,kr=e,Sr=qs(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,kr=e,Sr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=Vo!==null?{id:Wn,overflow:Zn}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=Dr(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,kr=e,Sr=null,!0):!1;default:return!1}}function bp(e){return(e.mode&1)!==0&&(e.flags&128)===0}function _p(e){if(nt){var t=Sr;if(t){var r=t;if(!O0(e,t)){if(bp(e))throw Error(Q(418));t=qs(r.nextSibling);var n=kr;t&&O0(e,t)?P_(n,r):(e.flags=e.flags&-4097|2,nt=!1,kr=e)}}else{if(bp(e))throw Error(Q(418));e.flags=e.flags&-4097|2,nt=!1,kr=e}}}function M0(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;kr=e}function Lc(e){if(e!==kr)return!1;if(!nt)return M0(e),nt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!vp(e.type,e.memoizedProps)),t&&(t=Sr)){if(bp(e))throw T_(),Error(Q(418));for(;t;)P_(e,t),t=qs(t.nextSibling)}if(M0(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Q(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){Sr=qs(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}Sr=null}}else Sr=kr?qs(e.stateNode.nextSibling):null;return!0}function T_(){for(var e=Sr;e;)e=qs(e.nextSibling)}function ca(){Sr=kr=null,nt=!1}function _g(e){en===null?en=[e]:en.push(e)}var RP=as.ReactCurrentBatchConfig;function Ka(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(Q(309));var n=r.stateNode}if(!n)throw Error(Q(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 a=s.refs;i===null?delete a[o]:a[o]=i},t._stringRef=o,t)}if(typeof e!="string")throw Error(Q(284));if(!r._owner)throw Error(Q(290,e))}return e}function Fc(e,t){throw e=Object.prototype.toString.call(t),Error(Q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function D0(e){var t=e._init;return t(e._payload)}function R_(e){function t(h,p){if(e){var x=h.deletions;x===null?(h.deletions=[p],h.flags|=16):x.push(p)}}function r(h,p){if(!e)return null;for(;p!==null;)t(h,p),p=p.sibling;return null}function n(h,p){for(h=new Map;p!==null;)p.key!==null?h.set(p.key,p):h.set(p.index,p),p=p.sibling;return h}function s(h,p){return h=Bs(h,p),h.index=0,h.sibling=null,h}function o(h,p,x){return h.index=x,e?(x=h.alternate,x!==null?(x=x.index,x<p?(h.flags|=2,p):x):(h.flags|=2,p)):(h.flags|=1048576,p)}function i(h){return e&&h.alternate===null&&(h.flags|=2),h}function a(h,p,x,S){return p===null||p.tag!==6?(p=hh(x,h.mode,S),p.return=h,p):(p=s(p,x),p.return=h,p)}function c(h,p,x,S){var C=x.type;return C===bi?d(h,p,x.props.children,S,x.key):p!==null&&(p.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===ys&&D0(C)===p.type)?(S=s(p,x.props),S.ref=Ka(h,p,x),S.return=h,S):(S=ku(x.type,x.key,x.props,null,h.mode,S),S.ref=Ka(h,p,x),S.return=h,S)}function u(h,p,x,S){return p===null||p.tag!==4||p.stateNode.containerInfo!==x.containerInfo||p.stateNode.implementation!==x.implementation?(p=ph(x,h.mode,S),p.return=h,p):(p=s(p,x.children||[]),p.return=h,p)}function d(h,p,x,S,C){return p===null||p.tag!==7?(p=Uo(x,h.mode,S,C),p.return=h,p):(p=s(p,x),p.return=h,p)}function f(h,p,x){if(typeof p=="string"&&p!==""||typeof p=="number")return p=hh(""+p,h.mode,x),p.return=h,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case $c:return x=ku(p.type,p.key,p.props,null,h.mode,x),x.ref=Ka(h,null,p),x.return=h,x;case xi:return p=ph(p,h.mode,x),p.return=h,p;case ys:var S=p._init;return f(h,S(p._payload),x)}if(tl(p)||Fa(p))return p=Uo(p,h.mode,x,null),p.return=h,p;Fc(h,p)}return null}function g(h,p,x,S){var C=p!==null?p.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return C!==null?null:a(h,p,""+x,S);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case $c:return x.key===C?c(h,p,x,S):null;case xi:return x.key===C?u(h,p,x,S):null;case ys:return C=x._init,g(h,p,C(x._payload),S)}if(tl(x)||Fa(x))return C!==null?null:d(h,p,x,S,null);Fc(h,x)}return null}function y(h,p,x,S,C){if(typeof S=="string"&&S!==""||typeof S=="number")return h=h.get(x)||null,a(p,h,""+S,C);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case $c:return h=h.get(S.key===null?x:S.key)||null,c(p,h,S,C);case xi:return h=h.get(S.key===null?x:S.key)||null,u(p,h,S,C);case ys:var T=S._init;return y(h,p,x,T(S._payload),C)}if(tl(S)||Fa(S))return h=h.get(x)||null,d(p,h,S,C,null);Fc(p,S)}return null}function b(h,p,x,S){for(var C=null,T=null,$=p,O=p=0,M=null;$!==null&&O<x.length;O++){$.index>O?(M=$,$=null):M=$.sibling;var U=g(h,$,x[O],S);if(U===null){$===null&&($=M);break}e&&$&&U.alternate===null&&t(h,$),p=o(U,p,O),T===null?C=U:T.sibling=U,T=U,$=M}if(O===x.length)return r(h,$),nt&&wo(h,O),C;if($===null){for(;O<x.length;O++)$=f(h,x[O],S),$!==null&&(p=o($,p,O),T===null?C=$:T.sibling=$,T=$);return nt&&wo(h,O),C}for($=n(h,$);O<x.length;O++)M=y($,h,O,x[O],S),M!==null&&(e&&M.alternate!==null&&$.delete(M.key===null?O:M.key),p=o(M,p,O),T===null?C=M:T.sibling=M,T=M);return e&&$.forEach(function(j){return t(h,j)}),nt&&wo(h,O),C}function m(h,p,x,S){var C=Fa(x);if(typeof C!="function")throw Error(Q(150));if(x=C.call(x),x==null)throw Error(Q(151));for(var T=C=null,$=p,O=p=0,M=null,U=x.next();$!==null&&!U.done;O++,U=x.next()){$.index>O?(M=$,$=null):M=$.sibling;var j=g(h,$,U.value,S);if(j===null){$===null&&($=M);break}e&&$&&j.alternate===null&&t(h,$),p=o(j,p,O),T===null?C=j:T.sibling=j,T=j,$=M}if(U.done)return r(h,$),nt&&wo(h,O),C;if($===null){for(;!U.done;O++,U=x.next())U=f(h,U.value,S),U!==null&&(p=o(U,p,O),T===null?C=U:T.sibling=U,T=U);return nt&&wo(h,O),C}for($=n(h,$);!U.done;O++,U=x.next())U=y($,h,O,U.value,S),U!==null&&(e&&U.alternate!==null&&$.delete(U.key===null?O:U.key),p=o(U,p,O),T===null?C=U:T.sibling=U,T=U);return e&&$.forEach(function(k){return t(h,k)}),nt&&wo(h,O),C}function v(h,p,x,S){if(typeof x=="object"&&x!==null&&x.type===bi&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case $c:e:{for(var C=x.key,T=p;T!==null;){if(T.key===C){if(C=x.type,C===bi){if(T.tag===7){r(h,T.sibling),p=s(T,x.props.children),p.return=h,h=p;break e}}else if(T.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===ys&&D0(C)===T.type){r(h,T.sibling),p=s(T,x.props),p.ref=Ka(h,T,x),p.return=h,h=p;break e}r(h,T);break}else t(h,T);T=T.sibling}x.type===bi?(p=Uo(x.props.children,h.mode,S,x.key),p.return=h,h=p):(S=ku(x.type,x.key,x.props,null,h.mode,S),S.ref=Ka(h,p,x),S.return=h,h=S)}return i(h);case xi:e:{for(T=x.key;p!==null;){if(p.key===T)if(p.tag===4&&p.stateNode.containerInfo===x.containerInfo&&p.stateNode.implementation===x.implementation){r(h,p.sibling),p=s(p,x.children||[]),p.return=h,h=p;break e}else{r(h,p);break}else t(h,p);p=p.sibling}p=ph(x,h.mode,S),p.return=h,h=p}return i(h);case ys:return T=x._init,v(h,p,T(x._payload),S)}if(tl(x))return b(h,p,x,S);if(Fa(x))return m(h,p,x,S);Fc(h,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,p!==null&&p.tag===6?(r(h,p.sibling),p=s(p,x),p.return=h,h=p):(r(h,p),p=hh(x,h.mode,S),p.return=h,h=p),i(h)):r(h,p)}return v}var ua=R_(!0),I_=R_(!1),td=so(null),rd=null,$i=null,Sg=null;function kg(){Sg=$i=rd=null}function Cg(e){var t=td.current;Xe(td),e._currentValue=t}function Sp(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 Li(e,t){rd=e,Sg=$i=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(hr=!0),e.firstContext=null)}function Lr(e){var t=e._currentValue;if(Sg!==e)if(e={context:e,memoizedValue:t,next:null},$i===null){if(rd===null)throw Error(Q(308));$i=e,rd.dependencies={lanes:0,firstContext:e}}else $i=$i.next=e;return t}var $o=null;function Eg(e){$o===null?$o=[e]:$o.push(e)}function A_(e,t,r,n){var s=t.interleaved;return s===null?(r.next=r,Eg(t)):(r.next=s.next,s.next=r),t.interleaved=r,rs(e,n)}function rs(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 ws=!1;function Ng(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function O_(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 Vs(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,De&2){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,rs(e,r)}return s=n.interleaved,s===null?(t.next=t,Eg(n)):(t.next=s.next,s.next=t),n.interleaved=t,rs(e,r)}function yu(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,fg(e,r)}}function z0(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 nd(e,t,r,n){var s=e.updateQueue;ws=!1;var o=s.firstBaseUpdate,i=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var c=a,u=c.next;c.next=null,i===null?o=u:i.next=u,i=c;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==i&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=c))}if(o!==null){var f=s.baseState;i=0,d=u=c=null,a=o;do{var g=a.lane,y=a.eventTime;if((n&g)===g){d!==null&&(d=d.next={eventTime:y,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var b=e,m=a;switch(g=t,y=r,m.tag){case 1:if(b=m.payload,typeof b=="function"){f=b.call(y,f,g);break e}f=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=m.payload,g=typeof b=="function"?b.call(y,f,g):b,g==null)break e;f=dt({},f,g);break e;case 2:ws=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,g=s.effects,g===null?s.effects=[a]:g.push(a))}else y={eventTime:y,lane:g,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=y,c=f):d=d.next=y,i|=g;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;g=a,a=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);Ko|=i,e.lanes=i,e.memoizedState=f}}function L0(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(Q(191,s));s.call(n)}}}var cc={},Tn=so(cc),ql=so(cc),Vl=so(cc);function Po(e){if(e===cc)throw Error(Q(174));return e}function jg(e,t){switch(We(Vl,t),We(ql,e),We(Tn,cc),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:np(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=np(t,e)}Xe(Tn),We(Tn,t)}function da(){Xe(Tn),Xe(ql),Xe(Vl)}function M_(e){Po(Vl.current);var t=Po(Tn.current),r=np(t,e.type);t!==r&&(We(ql,e),We(Tn,r))}function $g(e){ql.current===e&&(Xe(Tn),Xe(ql))}var at=so(0);function sd(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 ah=[];function Pg(){for(var e=0;e<ah.length;e++)ah[e]._workInProgressVersionPrimary=null;ah.length=0}var wu=as.ReactCurrentDispatcher,lh=as.ReactCurrentBatchConfig,Ho=0,ct=null,_t=null,Pt=null,od=!1,vl=!1,Hl=0,IP=0;function Ht(){throw Error(Q(321))}function Tg(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!ln(e[r],t[r]))return!1;return!0}function Rg(e,t,r,n,s,o){if(Ho=o,ct=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,wu.current=e===null||e.memoizedState===null?DP:zP,e=r(n,s),vl){o=0;do{if(vl=!1,Hl=0,25<=o)throw Error(Q(301));o+=1,Pt=_t=null,t.updateQueue=null,wu.current=LP,e=r(n,s)}while(vl)}if(wu.current=id,t=_t!==null&&_t.next!==null,Ho=0,Pt=_t=ct=null,od=!1,t)throw Error(Q(300));return e}function Ig(){var e=Hl!==0;return Hl=0,e}function gn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pt===null?ct.memoizedState=Pt=e:Pt=Pt.next=e,Pt}function Fr(){if(_t===null){var e=ct.alternate;e=e!==null?e.memoizedState:null}else e=_t.next;var t=Pt===null?ct.memoizedState:Pt.next;if(t!==null)Pt=t,_t=e;else{if(e===null)throw Error(Q(310));_t=e,e={memoizedState:_t.memoizedState,baseState:_t.baseState,baseQueue:_t.baseQueue,queue:_t.queue,next:null},Pt===null?ct.memoizedState=Pt=e:Pt=Pt.next=e}return Pt}function Kl(e,t){return typeof t=="function"?t(e):t}function ch(e){var t=Fr(),r=t.queue;if(r===null)throw Error(Q(311));r.lastRenderedReducer=e;var n=_t,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 a=i=null,c=null,u=o;do{var d=u.lane;if((Ho&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?(a=c=f,i=n):c=c.next=f,ct.lanes|=d,Ko|=d}u=u.next}while(u!==null&&u!==o);c===null?i=n:c.next=a,ln(n,t.memoizedState)||(hr=!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,ct.lanes|=o,Ko|=o,s=s.next;while(s!==e)}else s===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function uh(e){var t=Fr(),r=t.queue;if(r===null)throw Error(Q(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);ln(o,t.memoizedState)||(hr=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),r.lastRenderedState=o}return[o,n]}function D_(){}function z_(e,t){var r=ct,n=Fr(),s=t(),o=!ln(n.memoizedState,s);if(o&&(n.memoizedState=s,hr=!0),n=n.queue,Ag(U_.bind(null,r,n,e),[e]),n.getSnapshot!==t||o||Pt!==null&&Pt.memoizedState.tag&1){if(r.flags|=2048,Bl(9,F_.bind(null,r,n,s,t),void 0,null),Tt===null)throw Error(Q(349));Ho&30||L_(r,t,s)}return s}function L_(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=ct.updateQueue,t===null?(t={lastEffect:null,stores:null},ct.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function F_(e,t,r,n){t.value=r,t.getSnapshot=n,q_(t)&&V_(e)}function U_(e,t,r){return r(function(){q_(t)&&V_(e)})}function q_(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!ln(e,r)}catch{return!0}}function V_(e){var t=rs(e,1);t!==null&&on(t,e,1,-1)}function F0(e){var t=gn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Kl,lastRenderedState:e},t.queue=e,e=e.dispatch=MP.bind(null,ct,e),[t.memoizedState,e]}function Bl(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=ct.updateQueue,t===null?(t={lastEffect:null,stores:null},ct.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 H_(){return Fr().memoizedState}function xu(e,t,r,n){var s=gn();ct.flags|=e,s.memoizedState=Bl(1|t,r,void 0,n===void 0?null:n)}function Yd(e,t,r,n){var s=Fr();n=n===void 0?null:n;var o=void 0;if(_t!==null){var i=_t.memoizedState;if(o=i.destroy,n!==null&&Tg(n,i.deps)){s.memoizedState=Bl(t,r,o,n);return}}ct.flags|=e,s.memoizedState=Bl(1|t,r,o,n)}function U0(e,t){return xu(8390656,8,e,t)}function Ag(e,t){return Yd(2048,8,e,t)}function K_(e,t){return Yd(4,2,e,t)}function B_(e,t){return Yd(4,4,e,t)}function W_(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 Z_(e,t,r){return r=r!=null?r.concat([e]):null,Yd(4,4,W_.bind(null,t,e),r)}function Og(){}function G_(e,t){var r=Fr();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Tg(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function Q_(e,t){var r=Fr();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Tg(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function J_(e,t,r){return Ho&21?(ln(r,t)||(r=r_(),ct.lanes|=r,Ko|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,hr=!0),e.memoizedState=r)}function AP(e,t){var r=qe;qe=r!==0&&4>r?r:4,e(!0);var n=lh.transition;lh.transition={};try{e(!1),t()}finally{qe=r,lh.transition=n}}function Y_(){return Fr().memoizedState}function OP(e,t,r){var n=Ks(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},X_(e))eS(t,r);else if(r=A_(e,t,r,n),r!==null){var s=tr();on(r,e,n,s),tS(r,t,n)}}function MP(e,t,r){var n=Ks(e),s={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(X_(e))eS(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,a=o(i,r);if(s.hasEagerState=!0,s.eagerState=a,ln(a,i)){var c=t.interleaved;c===null?(s.next=s,Eg(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}r=A_(e,t,s,n),r!==null&&(s=tr(),on(r,e,n,s),tS(r,t,n))}}function X_(e){var t=e.alternate;return e===ct||t!==null&&t===ct}function eS(e,t){vl=od=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function tS(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,fg(e,r)}}var id={readContext:Lr,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},DP={readContext:Lr,useCallback:function(e,t){return gn().memoizedState=[e,t===void 0?null:t],e},useContext:Lr,useEffect:U0,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,xu(4194308,4,W_.bind(null,t,e),r)},useLayoutEffect:function(e,t){return xu(4194308,4,e,t)},useInsertionEffect:function(e,t){return xu(4,2,e,t)},useMemo:function(e,t){var r=gn();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=gn();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=OP.bind(null,ct,e),[n.memoizedState,e]},useRef:function(e){var t=gn();return e={current:e},t.memoizedState=e},useState:F0,useDebugValue:Og,useDeferredValue:function(e){return gn().memoizedState=e},useTransition:function(){var e=F0(!1),t=e[0];return e=AP.bind(null,e[1]),gn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=ct,s=gn();if(nt){if(r===void 0)throw Error(Q(407));r=r()}else{if(r=t(),Tt===null)throw Error(Q(349));Ho&30||L_(n,t,r)}s.memoizedState=r;var o={value:r,getSnapshot:t};return s.queue=o,U0(U_.bind(null,n,o,e),[e]),n.flags|=2048,Bl(9,F_.bind(null,n,o,r,t),void 0,null),r},useId:function(){var e=gn(),t=Tt.identifierPrefix;if(nt){var r=Zn,n=Wn;r=(n&~(1<<32-sn(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=Hl++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=IP++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},zP={readContext:Lr,useCallback:G_,useContext:Lr,useEffect:Ag,useImperativeHandle:Z_,useInsertionEffect:K_,useLayoutEffect:B_,useMemo:Q_,useReducer:ch,useRef:H_,useState:function(){return ch(Kl)},useDebugValue:Og,useDeferredValue:function(e){var t=Fr();return J_(t,_t.memoizedState,e)},useTransition:function(){var e=ch(Kl)[0],t=Fr().memoizedState;return[e,t]},useMutableSource:D_,useSyncExternalStore:z_,useId:Y_,unstable_isNewReconciler:!1},LP={readContext:Lr,useCallback:G_,useContext:Lr,useEffect:Ag,useImperativeHandle:Z_,useInsertionEffect:K_,useLayoutEffect:B_,useMemo:Q_,useReducer:uh,useRef:H_,useState:function(){return uh(Kl)},useDebugValue:Og,useDeferredValue:function(e){var t=Fr();return _t===null?t.memoizedState=e:J_(t,_t.memoizedState,e)},useTransition:function(){var e=uh(Kl)[0],t=Fr().memoizedState;return[e,t]},useMutableSource:D_,useSyncExternalStore:z_,useId:Y_,unstable_isNewReconciler:!1};function Gr(e,t){if(e&&e.defaultProps){t=dt({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function kp(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:dt({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var Xd={isMounted:function(e){return(e=e._reactInternals)?ni(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=tr(),s=Ks(e),o=Qn(n,s);o.payload=t,r!=null&&(o.callback=r),t=Vs(e,o,s),t!==null&&(on(t,e,s,n),yu(t,e,s))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=tr(),s=Ks(e),o=Qn(n,s);o.tag=1,o.payload=t,r!=null&&(o.callback=r),t=Vs(e,o,s),t!==null&&(on(t,e,s,n),yu(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=tr(),n=Ks(e),s=Qn(r,n);s.tag=2,t!=null&&(s.callback=t),t=Vs(e,s,n),t!==null&&(on(t,e,n,r),yu(t,e,n))}};function q0(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?!zl(r,n)||!zl(s,o):!0}function rS(e,t,r){var n=!1,s=Ys,o=t.contextType;return typeof o=="object"&&o!==null?o=Lr(o):(s=mr(t)?qo:Zt.current,n=t.contextTypes,o=(n=n!=null)?la(e,s):Ys),t=new t(r,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Xd,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=o),t}function V0(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&&Xd.enqueueReplaceState(t,t.state,null)}function Cp(e,t,r,n){var s=e.stateNode;s.props=r,s.state=e.memoizedState,s.refs={},Ng(e);var o=t.contextType;typeof o=="object"&&o!==null?s.context=Lr(o):(o=mr(t)?qo:Zt.current,s.context=la(e,o)),s.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(kp(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&&Xd.enqueueReplaceState(s,s.state,null),nd(e,r,s,n),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function fa(e,t){try{var r="",n=t;do r+=h$(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 dh(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function Ep(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var FP=typeof WeakMap=="function"?WeakMap:Map;function nS(e,t,r){r=Qn(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){ld||(ld=!0,Mp=n),Ep(e,t)},r}function sS(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(){Ep(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(r.callback=function(){Ep(e,t),typeof n!="function"&&(Hs===null?Hs=new Set([this]):Hs.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),r}function H0(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new FP;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=eT.bind(null,e,t,r),t.then(e,e))}function K0(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 B0(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,Vs(r,t,1))),r.lanes|=1),e)}var UP=as.ReactCurrentOwner,hr=!1;function Yt(e,t,r,n){t.child=e===null?I_(t,null,r,n):ua(t,e.child,r,n)}function W0(e,t,r,n,s){r=r.render;var o=t.ref;return Li(t,s),n=Rg(e,t,r,n,o,s),r=Ig(),e!==null&&!hr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ns(e,t,s)):(nt&&r&&xg(t),t.flags|=1,Yt(e,t,n,s),t.child)}function Z0(e,t,r,n,s){if(e===null){var o=r.type;return typeof o=="function"&&!Vg(o)&&o.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=o,oS(e,t,o,n,s)):(e=ku(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:zl,r(i,n)&&e.ref===t.ref)return ns(e,t,s)}return t.flags|=1,e=Bs(o,n),e.ref=t.ref,e.return=t,t.child=e}function oS(e,t,r,n,s){if(e!==null){var o=e.memoizedProps;if(zl(o,n)&&e.ref===t.ref)if(hr=!1,t.pendingProps=n=o,(e.lanes&s)!==0)e.flags&131072&&(hr=!0);else return t.lanes=e.lanes,ns(e,t,s)}return Np(e,t,r,n,s)}function iS(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},We(Ti,xr),xr|=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,We(Ti,xr),xr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=o!==null?o.baseLanes:r,We(Ti,xr),xr|=n}else o!==null?(n=o.baseLanes|r,t.memoizedState=null):n=r,We(Ti,xr),xr|=n;return Yt(e,t,s,r),t.child}function aS(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Np(e,t,r,n,s){var o=mr(r)?qo:Zt.current;return o=la(t,o),Li(t,s),r=Rg(e,t,r,n,o,s),n=Ig(),e!==null&&!hr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,ns(e,t,s)):(nt&&n&&xg(t),t.flags|=1,Yt(e,t,r,s),t.child)}function G0(e,t,r,n,s){if(mr(r)){var o=!0;Yu(t)}else o=!1;if(Li(t,s),t.stateNode===null)bu(e,t),rS(t,r,n),Cp(t,r,n,s),n=!0;else if(e===null){var i=t.stateNode,a=t.memoizedProps;i.props=a;var c=i.context,u=r.contextType;typeof u=="object"&&u!==null?u=Lr(u):(u=mr(r)?qo:Zt.current,u=la(t,u));var d=r.getDerivedStateFromProps,f=typeof d=="function"||typeof i.getSnapshotBeforeUpdate=="function";f||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a!==n||c!==u)&&V0(t,i,n,u),ws=!1;var g=t.memoizedState;i.state=g,nd(t,n,i,s),c=t.memoizedState,a!==n||g!==c||pr.current||ws?(typeof d=="function"&&(kp(t,r,d,n),c=t.memoizedState),(a=ws||q0(t,r,a,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=a):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{i=t.stateNode,O_(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:Gr(t.type,a),i.props=u,f=t.pendingProps,g=i.context,c=r.contextType,typeof c=="object"&&c!==null?c=Lr(c):(c=mr(r)?qo:Zt.current,c=la(t,c));var y=r.getDerivedStateFromProps;(d=typeof y=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a!==f||g!==c)&&V0(t,i,n,c),ws=!1,g=t.memoizedState,i.state=g,nd(t,n,i,s);var b=t.memoizedState;a!==f||g!==b||pr.current||ws?(typeof y=="function"&&(kp(t,r,y,n),b=t.memoizedState),(u=ws||q0(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"||a===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===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"||a===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&g===e.memoizedState||(t.flags|=1024),n=!1)}return jp(e,t,r,n,o,s)}function jp(e,t,r,n,s,o){aS(e,t);var i=(t.flags&128)!==0;if(!n&&!i)return s&&A0(t,r,!1),ns(e,t,o);n=t.stateNode,UP.current=t;var a=i&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&i?(t.child=ua(t,e.child,null,o),t.child=ua(t,null,a,o)):Yt(e,t,a,o),t.memoizedState=n.state,s&&A0(t,r,!0),t.child}function lS(e){var t=e.stateNode;t.pendingContext?I0(e,t.pendingContext,t.pendingContext!==t.context):t.context&&I0(e,t.context,!1),jg(e,t.containerInfo)}function Q0(e,t,r,n,s){return ca(),_g(s),t.flags|=256,Yt(e,t,r,n),t.child}var $p={dehydrated:null,treeContext:null,retryLane:0};function Pp(e){return{baseLanes:e,cachePool:null,transitions:null}}function cS(e,t,r){var n=t.pendingProps,s=at.current,o=!1,i=(t.flags&128)!==0,a;if((a=i)||(a=e!==null&&e.memoizedState===null?!1:(s&2)!==0),a?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),We(at,s&1),e===null)return _p(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=rf(i,n,0,null),e=Uo(e,n,r,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Pp(r),t.memoizedState=$p,e):Mg(t,i));if(s=e.memoizedState,s!==null&&(a=s.dehydrated,a!==null))return qP(e,t,i,n,a,s,r);if(o){o=n.fallback,i=t.mode,s=e.child,a=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=Bs(s,c),n.subtreeFlags=s.subtreeFlags&14680064),a!==null?o=Bs(a,o):(o=Uo(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?Pp(r):{baseLanes:i.baseLanes|r,cachePool:null,transitions:i.transitions},o.memoizedState=i,o.childLanes=e.childLanes&~r,t.memoizedState=$p,n}return o=e.child,e=o.sibling,n=Bs(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 Mg(e,t){return t=rf({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Uc(e,t,r,n){return n!==null&&_g(n),ua(t,e.child,null,r),e=Mg(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function qP(e,t,r,n,s,o,i){if(r)return t.flags&256?(t.flags&=-257,n=dh(Error(Q(422))),Uc(e,t,i,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=n.fallback,s=t.mode,n=rf({mode:"visible",children:n.children},s,0,null),o=Uo(o,s,i,null),o.flags|=2,n.return=t,o.return=t,n.sibling=o,t.child=n,t.mode&1&&ua(t,e.child,null,i),t.child.memoizedState=Pp(i),t.memoizedState=$p,o);if(!(t.mode&1))return Uc(e,t,i,null);if(s.data==="$!"){if(n=s.nextSibling&&s.nextSibling.dataset,n)var a=n.dgst;return n=a,o=Error(Q(419)),n=dh(o,n,void 0),Uc(e,t,i,n)}if(a=(i&e.childLanes)!==0,hr||a){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,rs(e,s),on(n,e,s,-1))}return qg(),n=dh(Error(Q(421))),Uc(e,t,i,n)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=tT.bind(null,e),s._reactRetry=t,null):(e=o.treeContext,Sr=qs(s.nextSibling),kr=t,nt=!0,en=null,e!==null&&(Or[Mr++]=Wn,Or[Mr++]=Zn,Or[Mr++]=Vo,Wn=e.id,Zn=e.overflow,Vo=t),t=Mg(t,n.children),t.flags|=4096,t)}function J0(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),Sp(e.return,t,r)}function fh(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 uS(e,t,r){var n=t.pendingProps,s=n.revealOrder,o=n.tail;if(Yt(e,t,n.children,r),n=at.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&&J0(e,r,t);else if(e.tag===19)J0(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(We(at,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&&sd(e)===null&&(s=r),r=r.sibling;r=s,r===null?(s=t.child,t.child=null):(s=r.sibling,r.sibling=null),fh(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&&sd(e)===null){t.child=s;break}e=s.sibling,s.sibling=r,r=s,s=e}fh(t,!0,r,null,o);break;case"together":fh(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function bu(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ns(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),Ko|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Q(153));if(t.child!==null){for(e=t.child,r=Bs(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=Bs(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function VP(e,t,r){switch(t.tag){case 3:lS(t),ca();break;case 5:M_(t);break;case 1:mr(t.type)&&Yu(t);break;case 4:jg(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,s=t.memoizedProps.value;We(td,n._currentValue),n._currentValue=s;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(We(at,at.current&1),t.flags|=128,null):r&t.child.childLanes?cS(e,t,r):(We(at,at.current&1),e=ns(e,t,r),e!==null?e.sibling:null);We(at,at.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return uS(e,t,r);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),We(at,at.current),n)break;return null;case 22:case 23:return t.lanes=0,iS(e,t,r)}return ns(e,t,r)}var dS,Tp,fS,hS;dS=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}};Tp=function(){};fS=function(e,t,r,n){var s=e.memoizedProps;if(s!==n){e=t.stateNode,Po(Tn.current);var o=null;switch(r){case"input":s=Xh(e,s),n=Xh(e,n),o=[];break;case"select":s=dt({},s,{value:void 0}),n=dt({},n,{value:void 0}),o=[];break;case"textarea":s=rp(e,s),n=rp(e,n),o=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=Qu)}sp(r,n);var i;r=null;for(u in s)if(!n.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var a=s[u];for(i in a)a.hasOwnProperty(i)&&(r||(r={}),r[i]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Tl.hasOwnProperty(u)?o||(o=[]):(o=o||[]).push(u,null));for(u in n){var c=n[u];if(a=s!=null?s[u]:void 0,n.hasOwnProperty(u)&&c!==a&&(c!=null||a!=null))if(u==="style")if(a){for(i in a)!a.hasOwnProperty(i)||c&&c.hasOwnProperty(i)||(r||(r={}),r[i]="");for(i in c)c.hasOwnProperty(i)&&a[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,a=a?a.__html:void 0,c!=null&&a!==c&&(o=o||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(o=o||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Tl.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&Qe("scroll",e),o||a===c||(o=[])):(o=o||[]).push(u,c))}r&&(o=o||[]).push("style",r);var u=o;(t.updateQueue=u)&&(t.flags|=4)}};hS=function(e,t,r,n){r!==n&&(t.flags|=4)};function Ba(e,t){if(!nt)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 HP(e,t,r){var n=t.pendingProps;switch(bg(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 mr(t.type)&&Ju(),Kt(t),null;case 3:return n=t.stateNode,da(),Xe(pr),Xe(Zt),Pg(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Lc(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,en!==null&&(Lp(en),en=null))),Tp(e,t),Kt(t),null;case 5:$g(t);var s=Po(Vl.current);if(r=t.type,e!==null&&t.stateNode!=null)fS(e,t,r,n,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(Q(166));return Kt(t),null}if(e=Po(Tn.current),Lc(t)){n=t.stateNode,r=t.type;var o=t.memoizedProps;switch(n[_n]=t,n[Ul]=o,e=(t.mode&1)!==0,r){case"dialog":Qe("cancel",n),Qe("close",n);break;case"iframe":case"object":case"embed":Qe("load",n);break;case"video":case"audio":for(s=0;s<nl.length;s++)Qe(nl[s],n);break;case"source":Qe("error",n);break;case"img":case"image":case"link":Qe("error",n),Qe("load",n);break;case"details":Qe("toggle",n);break;case"input":i0(n,o),Qe("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!o.multiple},Qe("invalid",n);break;case"textarea":l0(n,o),Qe("invalid",n)}sp(r,o),s=null;for(var i in o)if(o.hasOwnProperty(i)){var a=o[i];i==="children"?typeof a=="string"?n.textContent!==a&&(o.suppressHydrationWarning!==!0&&zc(n.textContent,a,e),s=["children",a]):typeof a=="number"&&n.textContent!==""+a&&(o.suppressHydrationWarning!==!0&&zc(n.textContent,a,e),s=["children",""+a]):Tl.hasOwnProperty(i)&&a!=null&&i==="onScroll"&&Qe("scroll",n)}switch(r){case"input":Pc(n),a0(n,o,!0);break;case"textarea":Pc(n),c0(n);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(n.onclick=Qu)}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=Ub(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[_n]=t,e[Ul]=n,dS(e,t,!1,!1),t.stateNode=e;e:{switch(i=op(r,n),r){case"dialog":Qe("cancel",e),Qe("close",e),s=n;break;case"iframe":case"object":case"embed":Qe("load",e),s=n;break;case"video":case"audio":for(s=0;s<nl.length;s++)Qe(nl[s],e);s=n;break;case"source":Qe("error",e),s=n;break;case"img":case"image":case"link":Qe("error",e),Qe("load",e),s=n;break;case"details":Qe("toggle",e),s=n;break;case"input":i0(e,n),s=Xh(e,n),Qe("invalid",e);break;case"option":s=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},s=dt({},n,{value:void 0}),Qe("invalid",e);break;case"textarea":l0(e,n),s=rp(e,n),Qe("invalid",e);break;default:s=n}sp(r,s),a=s;for(o in a)if(a.hasOwnProperty(o)){var c=a[o];o==="style"?Hb(e,c):o==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&qb(e,c)):o==="children"?typeof c=="string"?(r!=="textarea"||c!=="")&&Rl(e,c):typeof c=="number"&&Rl(e,""+c):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Tl.hasOwnProperty(o)?c!=null&&o==="onScroll"&&Qe("scroll",e):c!=null&&ig(e,o,c,i))}switch(r){case"input":Pc(e),a0(e,n,!1);break;case"textarea":Pc(e),c0(e);break;case"option":n.value!=null&&e.setAttribute("value",""+Js(n.value));break;case"select":e.multiple=!!n.multiple,o=n.value,o!=null?Oi(e,!!n.multiple,o,!1):n.defaultValue!=null&&Oi(e,!!n.multiple,n.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Qu)}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)hS(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(Q(166));if(r=Po(Vl.current),Po(Tn.current),Lc(t)){if(n=t.stateNode,r=t.memoizedProps,n[_n]=t,(o=n.nodeValue!==r)&&(e=kr,e!==null))switch(e.tag){case 3:zc(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&zc(n.nodeValue,r,(e.mode&1)!==0)}o&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[_n]=t,t.stateNode=n}return Kt(t),null;case 13:if(Xe(at),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(nt&&Sr!==null&&t.mode&1&&!(t.flags&128))T_(),ca(),t.flags|=98560,o=!1;else if(o=Lc(t),n!==null&&n.dehydrated!==null){if(e===null){if(!o)throw Error(Q(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(Q(317));o[_n]=t}else ca(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Kt(t),o=!1}else en!==null&&(Lp(en),en=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||at.current&1?Et===0&&(Et=3):qg())),t.updateQueue!==null&&(t.flags|=4),Kt(t),null);case 4:return da(),Tp(e,t),e===null&&Ll(t.stateNode.containerInfo),Kt(t),null;case 10:return Cg(t.type._context),Kt(t),null;case 17:return mr(t.type)&&Ju(),Kt(t),null;case 19:if(Xe(at),o=t.memoizedState,o===null)return Kt(t),null;if(n=(t.flags&128)!==0,i=o.rendering,i===null)if(n)Ba(o,!1);else{if(Et!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=sd(e),i!==null){for(t.flags|=128,Ba(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 We(at,at.current&1|2),t.child}e=e.sibling}o.tail!==null&&yt()>ha&&(t.flags|=128,n=!0,Ba(o,!1),t.lanes=4194304)}else{if(!n)if(e=sd(i),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Ba(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!nt)return Kt(t),null}else 2*yt()-o.renderingStartTime>ha&&r!==1073741824&&(t.flags|=128,n=!0,Ba(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=yt(),t.sibling=null,r=at.current,We(at,n?r&1|2:r&1),t):(Kt(t),null);case 22:case 23:return Ug(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?xr&1073741824&&(Kt(t),t.subtreeFlags&6&&(t.flags|=8192)):Kt(t),null;case 24:return null;case 25:return null}throw Error(Q(156,t.tag))}function KP(e,t){switch(bg(t),t.tag){case 1:return mr(t.type)&&Ju(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return da(),Xe(pr),Xe(Zt),Pg(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return $g(t),null;case 13:if(Xe(at),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));ca()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Xe(at),null;case 4:return da(),null;case 10:return Cg(t.type._context),null;case 22:case 23:return Ug(),null;case 24:return null;default:return null}}var qc=!1,Wt=!1,BP=typeof WeakSet=="function"?WeakSet:Set,ae=null;function Pi(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){mt(e,t,n)}else r.current=null}function Rp(e,t,r){try{r()}catch(n){mt(e,t,n)}}var Y0=!1;function WP(e,t){if(mp=Wu,e=y_(),wg(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,a=-1,c=-1,u=0,d=0,f=e,g=null;t:for(;;){for(var y;f!==r||s!==0&&f.nodeType!==3||(a=i+s),f!==o||n!==0&&f.nodeType!==3||(c=i+n),f.nodeType===3&&(i+=f.nodeValue.length),(y=f.firstChild)!==null;)g=f,f=y;for(;;){if(f===e)break t;if(g===r&&++u===s&&(a=i),g===o&&++d===n&&(c=i),(y=f.nextSibling)!==null)break;f=g,g=f.parentNode}f=y}r=a===-1||c===-1?null:{start:a,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(gp={focusedElem:e,selectionRange:r},Wu=!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 m=b.memoizedProps,v=b.memoizedState,h=t.stateNode,p=h.getSnapshotBeforeUpdate(t.elementType===t.type?m:Gr(t.type,m),v);h.__reactInternalSnapshotBeforeUpdate=p}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(Q(163))}}catch(S){mt(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,ae=e;break}ae=t.return}return b=Y0,Y0=!1,b}function yl(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&&Rp(t,r,o)}s=s.next}while(s!==n)}}function ef(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 Ip(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 pS(e){var t=e.alternate;t!==null&&(e.alternate=null,pS(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[_n],delete t[Ul],delete t[wp],delete t[$P],delete t[PP])),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 mS(e){return e.tag===5||e.tag===3||e.tag===4}function X0(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||mS(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 Ap(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=Qu));else if(n!==4&&(e=e.child,e!==null))for(Ap(e,t,r),e=e.sibling;e!==null;)Ap(e,t,r),e=e.sibling}function Op(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(Op(e,t,r),e=e.sibling;e!==null;)Op(e,t,r),e=e.sibling}var At=null,Xr=!1;function ds(e,t,r){for(r=r.child;r!==null;)gS(e,t,r),r=r.sibling}function gS(e,t,r){if(Pn&&typeof Pn.onCommitFiberUnmount=="function")try{Pn.onCommitFiberUnmount(Bd,r)}catch{}switch(r.tag){case 5:Wt||Pi(r,t);case 6:var n=At,s=Xr;At=null,ds(e,t,r),At=n,Xr=s,At!==null&&(Xr?(e=At,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):At.removeChild(r.stateNode));break;case 18:At!==null&&(Xr?(e=At,r=r.stateNode,e.nodeType===8?oh(e.parentNode,r):e.nodeType===1&&oh(e,r),Ml(e)):oh(At,r.stateNode));break;case 4:n=At,s=Xr,At=r.stateNode.containerInfo,Xr=!0,ds(e,t,r),At=n,Xr=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)&&Rp(r,t,i),s=s.next}while(s!==n)}ds(e,t,r);break;case 1:if(!Wt&&(Pi(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(a){mt(r,t,a)}ds(e,t,r);break;case 21:ds(e,t,r);break;case 22:r.mode&1?(Wt=(n=Wt)||r.memoizedState!==null,ds(e,t,r),Wt=n):ds(e,t,r);break;default:ds(e,t,r)}}function ew(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new BP),t.forEach(function(n){var s=rT.bind(null,e,n);r.has(n)||(r.add(n),n.then(s,s))})}}function Hr(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,a=i;e:for(;a!==null;){switch(a.tag){case 5:At=a.stateNode,Xr=!1;break e;case 3:At=a.stateNode.containerInfo,Xr=!0;break e;case 4:At=a.stateNode.containerInfo,Xr=!0;break e}a=a.return}if(At===null)throw Error(Q(160));gS(o,i,s),At=null,Xr=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){mt(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)vS(t,e),t=t.sibling}function vS(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Hr(t,e),pn(e),n&4){try{yl(3,e,e.return),ef(3,e)}catch(m){mt(e,e.return,m)}try{yl(5,e,e.return)}catch(m){mt(e,e.return,m)}}break;case 1:Hr(t,e),pn(e),n&512&&r!==null&&Pi(r,r.return);break;case 5:if(Hr(t,e),pn(e),n&512&&r!==null&&Pi(r,r.return),e.flags&32){var s=e.stateNode;try{Rl(s,"")}catch(m){mt(e,e.return,m)}}if(n&4&&(s=e.stateNode,s!=null)){var o=e.memoizedProps,i=r!==null?r.memoizedProps:o,a=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{a==="input"&&o.type==="radio"&&o.name!=null&&Lb(s,o),op(a,i);var u=op(a,o);for(i=0;i<c.length;i+=2){var d=c[i],f=c[i+1];d==="style"?Hb(s,f):d==="dangerouslySetInnerHTML"?qb(s,f):d==="children"?Rl(s,f):ig(s,d,f,u)}switch(a){case"input":ep(s,o);break;case"textarea":Fb(s,o);break;case"select":var g=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!o.multiple;var y=o.value;y!=null?Oi(s,!!o.multiple,y,!1):g!==!!o.multiple&&(o.defaultValue!=null?Oi(s,!!o.multiple,o.defaultValue,!0):Oi(s,!!o.multiple,o.multiple?[]:"",!1))}s[Ul]=o}catch(m){mt(e,e.return,m)}}break;case 6:if(Hr(t,e),pn(e),n&4){if(e.stateNode===null)throw Error(Q(162));s=e.stateNode,o=e.memoizedProps;try{s.nodeValue=o}catch(m){mt(e,e.return,m)}}break;case 3:if(Hr(t,e),pn(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{Ml(t.containerInfo)}catch(m){mt(e,e.return,m)}break;case 4:Hr(t,e),pn(e);break;case 13:Hr(t,e),pn(e),s=e.child,s.flags&8192&&(o=s.memoizedState!==null,s.stateNode.isHidden=o,!o||s.alternate!==null&&s.alternate.memoizedState!==null||(Lg=yt())),n&4&&ew(e);break;case 22:if(d=r!==null&&r.memoizedState!==null,e.mode&1?(Wt=(u=Wt)||d,Hr(t,e),Wt=u):Hr(t,e),pn(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,y=g.child,g.tag){case 0:case 11:case 14:case 15:yl(4,g,g.return);break;case 1:Pi(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(m){mt(n,r,m)}}break;case 5:Pi(g,g.return);break;case 22:if(g.memoizedState!==null){rw(f);continue}}y!==null?(y.return=g,ae=y):rw(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"):(a=f.stateNode,c=f.memoizedProps.style,i=c!=null&&c.hasOwnProperty("display")?c.display:null,a.style.display=Vb("display",i))}catch(m){mt(e,e.return,m)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(m){mt(e,e.return,m)}}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:Hr(t,e),pn(e),n&4&&ew(e);break;case 21:break;default:Hr(t,e),pn(e)}}function pn(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(mS(r)){var n=r;break e}r=r.return}throw Error(Q(160))}switch(n.tag){case 5:var s=n.stateNode;n.flags&32&&(Rl(s,""),n.flags&=-33);var o=X0(e);Op(e,o,s);break;case 3:case 4:var i=n.stateNode.containerInfo,a=X0(e);Ap(e,a,i);break;default:throw Error(Q(161))}}catch(c){mt(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ZP(e,t,r){ae=e,yS(e)}function yS(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||qc;if(!i){var a=s.alternate,c=a!==null&&a.memoizedState!==null||Wt;a=qc;var u=Wt;if(qc=i,(Wt=c)&&!u)for(ae=s;ae!==null;)i=ae,c=i.child,i.tag===22&&i.memoizedState!==null?nw(s):c!==null?(c.return=i,ae=c):nw(s);for(;o!==null;)ae=o,yS(o),o=o.sibling;ae=s,qc=a,Wt=u}tw(e)}else s.subtreeFlags&8772&&o!==null?(o.return=s,ae=o):tw(e)}}function tw(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||ef(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:Gr(t.type,r.memoizedProps);n.componentDidUpdate(s,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&L0(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}L0(t,i,r)}break;case 5:var a=t.stateNode;if(r===null&&t.flags&4){r=a;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&&Ml(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Q(163))}Wt||t.flags&512&&Ip(t)}catch(g){mt(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 rw(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 nw(e){for(;ae!==null;){var t=ae;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{ef(4,t)}catch(c){mt(t,r,c)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var s=t.return;try{n.componentDidMount()}catch(c){mt(t,s,c)}}var o=t.return;try{Ip(t)}catch(c){mt(t,o,c)}break;case 5:var i=t.return;try{Ip(t)}catch(c){mt(t,i,c)}}}catch(c){mt(t,t.return,c)}if(t===e){ae=null;break}var a=t.sibling;if(a!==null){a.return=t.return,ae=a;break}ae=t.return}}var GP=Math.ceil,ad=as.ReactCurrentDispatcher,Dg=as.ReactCurrentOwner,zr=as.ReactCurrentBatchConfig,De=0,Tt=null,wt=null,zt=0,xr=0,Ti=so(0),Et=0,Wl=null,Ko=0,tf=0,zg=0,wl=null,ur=null,Lg=0,ha=1/0,Un=null,ld=!1,Mp=null,Hs=null,Vc=!1,Ms=null,cd=0,xl=0,Dp=null,_u=-1,Su=0;function tr(){return De&6?yt():_u!==-1?_u:_u=yt()}function Ks(e){return e.mode&1?De&2&&zt!==0?zt&-zt:RP.transition!==null?(Su===0&&(Su=r_()),Su):(e=qe,e!==0||(e=window.event,e=e===void 0?16:c_(e.type)),e):1}function on(e,t,r,n){if(50<xl)throw xl=0,Dp=null,Error(Q(185));ic(e,r,n),(!(De&2)||e!==Tt)&&(e===Tt&&(!(De&2)&&(tf|=r),Et===4&&ks(e,zt)),gr(e,n),r===1&&De===0&&!(t.mode&1)&&(ha=yt()+500,Jd&&oo()))}function gr(e,t){var r=e.callbackNode;R$(e,t);var n=Bu(e,e===Tt?zt:0);if(n===0)r!==null&&f0(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&f0(r),t===1)e.tag===0?TP(sw.bind(null,e)):j_(sw.bind(null,e)),NP(function(){!(De&6)&&oo()}),r=null;else{switch(n_(n)){case 1:r=dg;break;case 4:r=e_;break;case 16:r=Ku;break;case 536870912:r=t_;break;default:r=Ku}r=ES(r,wS.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function wS(e,t){if(_u=-1,Su=0,De&6)throw Error(Q(327));var r=e.callbackNode;if(Fi()&&e.callbackNode!==r)return null;var n=Bu(e,e===Tt?zt:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=ud(e,n);else{t=n;var s=De;De|=2;var o=bS();(Tt!==e||zt!==t)&&(Un=null,ha=yt()+500,Fo(e,t));do try{YP();break}catch(a){xS(e,a)}while(!0);kg(),ad.current=o,De=s,wt!==null?t=0:(Tt=null,zt=0,t=Et)}if(t!==0){if(t===2&&(s=up(e),s!==0&&(n=s,t=zp(e,s))),t===1)throw r=Wl,Fo(e,0),ks(e,n),gr(e,yt()),r;if(t===6)ks(e,n);else{if(s=e.current.alternate,!(n&30)&&!QP(s)&&(t=ud(e,n),t===2&&(o=up(e),o!==0&&(n=o,t=zp(e,o))),t===1))throw r=Wl,Fo(e,0),ks(e,n),gr(e,yt()),r;switch(e.finishedWork=s,e.finishedLanes=n,t){case 0:case 1:throw Error(Q(345));case 2:xo(e,ur,Un);break;case 3:if(ks(e,n),(n&130023424)===n&&(t=Lg+500-yt(),10<t)){if(Bu(e,0)!==0)break;if(s=e.suspendedLanes,(s&n)!==n){tr(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=yp(xo.bind(null,e,ur,Un),t);break}xo(e,ur,Un);break;case 4:if(ks(e,n),(n&4194240)===n)break;for(t=e.eventTimes,s=-1;0<n;){var i=31-sn(n);o=1<<i,i=t[i],i>s&&(s=i),n&=~o}if(n=s,n=yt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*GP(n/1960))-n,10<n){e.timeoutHandle=yp(xo.bind(null,e,ur,Un),n);break}xo(e,ur,Un);break;case 5:xo(e,ur,Un);break;default:throw Error(Q(329))}}}return gr(e,yt()),e.callbackNode===r?wS.bind(null,e):null}function zp(e,t){var r=wl;return e.current.memoizedState.isDehydrated&&(Fo(e,t).flags|=256),e=ud(e,t),e!==2&&(t=ur,ur=r,t!==null&&Lp(t)),e}function Lp(e){ur===null?ur=e:ur.push.apply(ur,e)}function QP(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(!ln(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 ks(e,t){for(t&=~zg,t&=~tf,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-sn(t),n=1<<r;e[r]=-1,t&=~n}}function sw(e){if(De&6)throw Error(Q(327));Fi();var t=Bu(e,0);if(!(t&1))return gr(e,yt()),null;var r=ud(e,t);if(e.tag!==0&&r===2){var n=up(e);n!==0&&(t=n,r=zp(e,n))}if(r===1)throw r=Wl,Fo(e,0),ks(e,t),gr(e,yt()),r;if(r===6)throw Error(Q(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,xo(e,ur,Un),gr(e,yt()),null}function Fg(e,t){var r=De;De|=1;try{return e(t)}finally{De=r,De===0&&(ha=yt()+500,Jd&&oo())}}function Bo(e){Ms!==null&&Ms.tag===0&&!(De&6)&&Fi();var t=De;De|=1;var r=zr.transition,n=qe;try{if(zr.transition=null,qe=1,e)return e()}finally{qe=n,zr.transition=r,De=t,!(De&6)&&oo()}}function Ug(){xr=Ti.current,Xe(Ti)}function Fo(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,EP(r)),wt!==null)for(r=wt.return;r!==null;){var n=r;switch(bg(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&Ju();break;case 3:da(),Xe(pr),Xe(Zt),Pg();break;case 5:$g(n);break;case 4:da();break;case 13:Xe(at);break;case 19:Xe(at);break;case 10:Cg(n.type._context);break;case 22:case 23:Ug()}r=r.return}if(Tt=e,wt=e=Bs(e.current,null),zt=xr=t,Et=0,Wl=null,zg=tf=Ko=0,ur=wl=null,$o!==null){for(t=0;t<$o.length;t++)if(r=$o[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}$o=null}return e}function xS(e,t){do{var r=wt;try{if(kg(),wu.current=id,od){for(var n=ct.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}od=!1}if(Ho=0,Pt=_t=ct=null,vl=!1,Hl=0,Dg.current=null,r===null||r.return===null){Et=1,Wl=t,wt=null;break}e:{var o=e,i=r.return,a=r,c=t;if(t=zt,a.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=a,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 y=K0(i);if(y!==null){y.flags&=-257,B0(y,i,a,o,t),y.mode&1&&H0(o,u,t),t=y,c=u;var b=t.updateQueue;if(b===null){var m=new Set;m.add(c),t.updateQueue=m}else b.add(c);break e}else{if(!(t&1)){H0(o,u,t),qg();break e}c=Error(Q(426))}}else if(nt&&a.mode&1){var v=K0(i);if(v!==null){!(v.flags&65536)&&(v.flags|=256),B0(v,i,a,o,t),_g(fa(c,a));break e}}o=c=fa(c,a),Et!==4&&(Et=2),wl===null?wl=[o]:wl.push(o),o=i;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var h=nS(o,c,t);z0(o,h);break e;case 1:a=c;var p=o.type,x=o.stateNode;if(!(o.flags&128)&&(typeof p.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Hs===null||!Hs.has(x)))){o.flags|=65536,t&=-t,o.lanes|=t;var S=sS(o,a,t);z0(o,S);break e}}o=o.return}while(o!==null)}SS(r)}catch(C){t=C,wt===r&&r!==null&&(wt=r=r.return);continue}break}while(!0)}function bS(){var e=ad.current;return ad.current=id,e===null?id:e}function qg(){(Et===0||Et===3||Et===2)&&(Et=4),Tt===null||!(Ko&268435455)&&!(tf&268435455)||ks(Tt,zt)}function ud(e,t){var r=De;De|=2;var n=bS();(Tt!==e||zt!==t)&&(Un=null,Fo(e,t));do try{JP();break}catch(s){xS(e,s)}while(!0);if(kg(),De=r,ad.current=n,wt!==null)throw Error(Q(261));return Tt=null,zt=0,Et}function JP(){for(;wt!==null;)_S(wt)}function YP(){for(;wt!==null&&!S$();)_S(wt)}function _S(e){var t=CS(e.alternate,e,xr);e.memoizedProps=e.pendingProps,t===null?SS(e):wt=t,Dg.current=null}function SS(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=KP(r,t),r!==null){r.flags&=32767,wt=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Et=6,wt=null;return}}else if(r=HP(r,t,xr),r!==null){wt=r;return}if(t=t.sibling,t!==null){wt=t;return}wt=t=e}while(t!==null);Et===0&&(Et=5)}function xo(e,t,r){var n=qe,s=zr.transition;try{zr.transition=null,qe=1,XP(e,t,r,n)}finally{zr.transition=s,qe=n}return null}function XP(e,t,r,n){do Fi();while(Ms!==null);if(De&6)throw Error(Q(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(Q(177));e.callbackNode=null,e.callbackPriority=0;var o=r.lanes|r.childLanes;if(I$(e,o),e===Tt&&(wt=Tt=null,zt=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||Vc||(Vc=!0,ES(Ku,function(){return Fi(),null})),o=(r.flags&15990)!==0,r.subtreeFlags&15990||o){o=zr.transition,zr.transition=null;var i=qe;qe=1;var a=De;De|=4,Dg.current=null,WP(e,r),vS(r,e),wP(gp),Wu=!!mp,gp=mp=null,e.current=r,ZP(r),k$(),De=a,qe=i,zr.transition=o}else e.current=r;if(Vc&&(Vc=!1,Ms=e,cd=s),o=e.pendingLanes,o===0&&(Hs=null),N$(r.stateNode),gr(e,yt()),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(ld)throw ld=!1,e=Mp,Mp=null,e;return cd&1&&e.tag!==0&&Fi(),o=e.pendingLanes,o&1?e===Dp?xl++:(xl=0,Dp=e):xl=0,oo(),null}function Fi(){if(Ms!==null){var e=n_(cd),t=zr.transition,r=qe;try{if(zr.transition=null,qe=16>e?16:e,Ms===null)var n=!1;else{if(e=Ms,Ms=null,cd=0,De&6)throw Error(Q(331));var s=De;for(De|=4,ae=e.current;ae!==null;){var o=ae,i=o.child;if(ae.flags&16){var a=o.deletions;if(a!==null){for(var c=0;c<a.length;c++){var u=a[c];for(ae=u;ae!==null;){var d=ae;switch(d.tag){case 0:case 11:case 15:yl(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,y=d.return;if(pS(d),d===u){ae=null;break}if(g!==null){g.return=y,ae=g;break}ae=y}}}var b=o.alternate;if(b!==null){var m=b.child;if(m!==null){b.child=null;do{var v=m.sibling;m.sibling=null,m=v}while(m!==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:yl(9,o,o.return)}var h=o.sibling;if(h!==null){h.return=o.return,ae=h;break e}ae=o.return}}var p=e.current;for(ae=p;ae!==null;){i=ae;var x=i.child;if(i.subtreeFlags&2064&&x!==null)x.return=i,ae=x;else e:for(i=p;ae!==null;){if(a=ae,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:ef(9,a)}}catch(C){mt(a,a.return,C)}if(a===i){ae=null;break e}var S=a.sibling;if(S!==null){S.return=a.return,ae=S;break e}ae=a.return}}if(De=s,oo(),Pn&&typeof Pn.onPostCommitFiberRoot=="function")try{Pn.onPostCommitFiberRoot(Bd,e)}catch{}n=!0}return n}finally{qe=r,zr.transition=t}}return!1}function ow(e,t,r){t=fa(r,t),t=nS(e,t,1),e=Vs(e,t,1),t=tr(),e!==null&&(ic(e,1,t),gr(e,t))}function mt(e,t,r){if(e.tag===3)ow(e,e,r);else for(;t!==null;){if(t.tag===3){ow(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Hs===null||!Hs.has(n))){e=fa(r,e),e=sS(t,e,1),t=Vs(t,e,1),e=tr(),t!==null&&(ic(t,1,e),gr(t,e));break}}t=t.return}}function eT(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=tr(),e.pingedLanes|=e.suspendedLanes&r,Tt===e&&(zt&r)===r&&(Et===4||Et===3&&(zt&130023424)===zt&&500>yt()-Lg?Fo(e,0):zg|=r),gr(e,t)}function kS(e,t){t===0&&(e.mode&1?(t=Ic,Ic<<=1,!(Ic&130023424)&&(Ic=4194304)):t=1);var r=tr();e=rs(e,t),e!==null&&(ic(e,t,r),gr(e,r))}function tT(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),kS(e,r)}function rT(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(Q(314))}n!==null&&n.delete(t),kS(e,r)}var CS;CS=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||pr.current)hr=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return hr=!1,VP(e,t,r);hr=!!(e.flags&131072)}else hr=!1,nt&&t.flags&1048576&&$_(t,ed,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;bu(e,t),e=t.pendingProps;var s=la(t,Zt.current);Li(t,r),s=Rg(null,t,n,e,s,r);var o=Ig();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,mr(n)?(o=!0,Yu(t)):o=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Ng(t),s.updater=Xd,t.stateNode=s,s._reactInternals=t,Cp(t,n,e,r),t=jp(null,t,n,!0,o,r)):(t.tag=0,nt&&o&&xg(t),Yt(null,t,s,r),t=t.child),t;case 16:n=t.elementType;e:{switch(bu(e,t),e=t.pendingProps,s=n._init,n=s(n._payload),t.type=n,s=t.tag=sT(n),e=Gr(n,e),s){case 0:t=Np(null,t,n,e,r);break e;case 1:t=G0(null,t,n,e,r);break e;case 11:t=W0(null,t,n,e,r);break e;case 14:t=Z0(null,t,n,Gr(n.type,e),r);break e}throw Error(Q(306,n,""))}return t;case 0:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Gr(n,s),Np(e,t,n,s,r);case 1:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Gr(n,s),G0(e,t,n,s,r);case 3:e:{if(lS(t),e===null)throw Error(Q(387));n=t.pendingProps,o=t.memoizedState,s=o.element,O_(e,t),nd(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=fa(Error(Q(423)),t),t=Q0(e,t,n,r,s);break e}else if(n!==s){s=fa(Error(Q(424)),t),t=Q0(e,t,n,r,s);break e}else for(Sr=qs(t.stateNode.containerInfo.firstChild),kr=t,nt=!0,en=null,r=I_(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(ca(),n===s){t=ns(e,t,r);break e}Yt(e,t,n,r)}t=t.child}return t;case 5:return M_(t),e===null&&_p(t),n=t.type,s=t.pendingProps,o=e!==null?e.memoizedProps:null,i=s.children,vp(n,s)?i=null:o!==null&&vp(n,o)&&(t.flags|=32),aS(e,t),Yt(e,t,i,r),t.child;case 6:return e===null&&_p(t),null;case 13:return cS(e,t,r);case 4:return jg(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=ua(t,null,n,r):Yt(e,t,n,r),t.child;case 11:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Gr(n,s),W0(e,t,n,s,r);case 7:return Yt(e,t,t.pendingProps,r),t.child;case 8:return Yt(e,t,t.pendingProps.children,r),t.child;case 12:return Yt(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,We(td,n._currentValue),n._currentValue=i,o!==null)if(ln(o.value,i)){if(o.children===s.children&&!pr.current){t=ns(e,t,r);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){i=o.child;for(var c=a.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),Sp(o.return,r,t),a.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(Q(341));i.lanes|=r,a=i.alternate,a!==null&&(a.lanes|=r),Sp(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}Yt(e,t,s.children,r),t=t.child}return t;case 9:return s=t.type,n=t.pendingProps.children,Li(t,r),s=Lr(s),n=n(s),t.flags|=1,Yt(e,t,n,r),t.child;case 14:return n=t.type,s=Gr(n,t.pendingProps),s=Gr(n.type,s),Z0(e,t,n,s,r);case 15:return oS(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:Gr(n,s),bu(e,t),t.tag=1,mr(n)?(e=!0,Yu(t)):e=!1,Li(t,r),rS(t,n,s),Cp(t,n,s,r),jp(null,t,n,!0,e,r);case 19:return uS(e,t,r);case 22:return iS(e,t,r)}throw Error(Q(156,t.tag))};function ES(e,t){return Xb(e,t)}function nT(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 Dr(e,t,r,n){return new nT(e,t,r,n)}function Vg(e){return e=e.prototype,!(!e||!e.isReactComponent)}function sT(e){if(typeof e=="function")return Vg(e)?1:0;if(e!=null){if(e=e.$$typeof,e===lg)return 11;if(e===cg)return 14}return 2}function Bs(e,t){var r=e.alternate;return r===null?(r=Dr(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 ku(e,t,r,n,s,o){var i=2;if(n=e,typeof e=="function")Vg(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case bi:return Uo(r.children,s,o,t);case ag:i=8,s|=8;break;case Gh:return e=Dr(12,r,t,s|2),e.elementType=Gh,e.lanes=o,e;case Qh:return e=Dr(13,r,t,s),e.elementType=Qh,e.lanes=o,e;case Jh:return e=Dr(19,r,t,s),e.elementType=Jh,e.lanes=o,e;case Mb:return rf(r,s,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ab:i=10;break e;case Ob:i=9;break e;case lg:i=11;break e;case cg:i=14;break e;case ys:i=16,n=null;break e}throw Error(Q(130,e==null?e:typeof e,""))}return t=Dr(i,r,t,s),t.elementType=e,t.type=n,t.lanes=o,t}function Uo(e,t,r,n){return e=Dr(7,e,n,t),e.lanes=r,e}function rf(e,t,r,n){return e=Dr(22,e,n,t),e.elementType=Mb,e.lanes=r,e.stateNode={isHidden:!1},e}function hh(e,t,r){return e=Dr(6,e,null,t),e.lanes=r,e}function ph(e,t,r){return t=Dr(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function oT(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=Zf(0),this.expirationTimes=Zf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zf(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Hg(e,t,r,n,s,o,i,a,c){return e=new oT(e,t,r,a,c),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Dr(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ng(o),e}function iT(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:xi,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function NS(e){if(!e)return Ys;e=e._reactInternals;e:{if(ni(e)!==e||e.tag!==1)throw Error(Q(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(mr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Q(171))}if(e.tag===1){var r=e.type;if(mr(r))return N_(e,r,t)}return t}function jS(e,t,r,n,s,o,i,a,c){return e=Hg(r,n,!0,e,s,o,i,a,c),e.context=NS(null),r=e.current,n=tr(),s=Ks(r),o=Qn(n,s),o.callback=t??null,Vs(r,o,s),e.current.lanes=s,ic(e,s,n),gr(e,n),e}function nf(e,t,r,n){var s=t.current,o=tr(),i=Ks(s);return r=NS(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=Vs(s,t,i),e!==null&&(on(e,s,i,o),yu(e,s,i)),i}function dd(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 iw(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function Kg(e,t){iw(e,t),(e=e.alternate)&&iw(e,t)}function aT(){return null}var $S=typeof reportError=="function"?reportError:function(e){console.error(e)};function Bg(e){this._internalRoot=e}sf.prototype.render=Bg.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Q(409));nf(e,t,null,null)};sf.prototype.unmount=Bg.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Bo(function(){nf(null,e,null,null)}),t[ts]=null}};function sf(e){this._internalRoot=e}sf.prototype.unstable_scheduleHydration=function(e){if(e){var t=i_();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Ss.length&&t!==0&&t<Ss[r].priority;r++);Ss.splice(r,0,e),r===0&&l_(e)}};function Wg(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function of(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function aw(){}function lT(e,t,r,n,s){if(s){if(typeof n=="function"){var o=n;n=function(){var u=dd(i);o.call(u)}}var i=jS(t,n,e,0,null,!1,!1,"",aw);return e._reactRootContainer=i,e[ts]=i.current,Ll(e.nodeType===8?e.parentNode:e),Bo(),i}for(;s=e.lastChild;)e.removeChild(s);if(typeof n=="function"){var a=n;n=function(){var u=dd(c);a.call(u)}}var c=Hg(e,0,!1,null,null,!1,!1,"",aw);return e._reactRootContainer=c,e[ts]=c.current,Ll(e.nodeType===8?e.parentNode:e),Bo(function(){nf(t,c,r,n)}),c}function af(e,t,r,n,s){var o=r._reactRootContainer;if(o){var i=o;if(typeof s=="function"){var a=s;s=function(){var c=dd(i);a.call(c)}}nf(t,i,e,s)}else i=lT(r,t,e,s,n);return dd(i)}s_=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=rl(t.pendingLanes);r!==0&&(fg(t,r|1),gr(t,yt()),!(De&6)&&(ha=yt()+500,oo()))}break;case 13:Bo(function(){var n=rs(e,1);if(n!==null){var s=tr();on(n,e,1,s)}}),Kg(e,1)}};hg=function(e){if(e.tag===13){var t=rs(e,134217728);if(t!==null){var r=tr();on(t,e,134217728,r)}Kg(e,134217728)}};o_=function(e){if(e.tag===13){var t=Ks(e),r=rs(e,t);if(r!==null){var n=tr();on(r,e,t,n)}Kg(e,t)}};i_=function(){return qe};a_=function(e,t){var r=qe;try{return qe=e,t()}finally{qe=r}};ap=function(e,t,r){switch(t){case"input":if(ep(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=Qd(n);if(!s)throw Error(Q(90));zb(n),ep(n,s)}}}break;case"textarea":Fb(e,r);break;case"select":t=r.value,t!=null&&Oi(e,!!r.multiple,t,!1)}};Wb=Fg;Zb=Bo;var cT={usingClientEntryPoint:!1,Events:[lc,Ci,Qd,Kb,Bb,Fg]},Wa={findFiberByHostInstance:jo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},uT={bundleType:Wa.bundleType,version:Wa.version,rendererPackageName:Wa.rendererPackageName,rendererConfig:Wa.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:as.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Jb(e),e===null?null:e.stateNode},findFiberByHostInstance:Wa.findFiberByHostInstance||aT,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hc.isDisabled&&Hc.supportsFiber)try{Bd=Hc.inject(uT),Pn=Hc}catch{}}Nr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=cT;Nr.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Wg(t))throw Error(Q(200));return iT(e,t,null,r)};Nr.createRoot=function(e,t){if(!Wg(e))throw Error(Q(299));var r=!1,n="",s=$S;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=Hg(e,1,!1,null,null,r,!1,n,s),e[ts]=t.current,Ll(e.nodeType===8?e.parentNode:e),new Bg(t)};Nr.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(Q(188)):(e=Object.keys(e).join(","),Error(Q(268,e)));return e=Jb(t),e=e===null?null:e.stateNode,e};Nr.flushSync=function(e){return Bo(e)};Nr.hydrate=function(e,t,r){if(!of(t))throw Error(Q(200));return af(null,e,t,!0,r)};Nr.hydrateRoot=function(e,t,r){if(!Wg(e))throw Error(Q(405));var n=r!=null&&r.hydratedSources||null,s=!1,o="",i=$S;if(r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(o=r.identifierPrefix),r.onRecoverableError!==void 0&&(i=r.onRecoverableError)),t=jS(t,null,e,1,r??null,s,!1,o,i),e[ts]=t.current,Ll(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 sf(t)};Nr.render=function(e,t,r){if(!of(t))throw Error(Q(200));return af(null,e,t,!1,r)};Nr.unmountComponentAtNode=function(e){if(!of(e))throw Error(Q(40));return e._reactRootContainer?(Bo(function(){af(null,null,e,!1,function(){e._reactRootContainer=null,e[ts]=null})}),!0):!1};Nr.unstable_batchedUpdates=Fg;Nr.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!of(r))throw Error(Q(200));if(e==null||e._reactInternals===void 0)throw Error(Q(38));return af(e,t,r,!1,n)};Nr.version="18.3.1-next-f1338f8080-20240426";function PS(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(PS)}catch(e){console.error(e)}}PS(),Pb.exports=Nr;var si=Pb.exports;const dT=Hd(si);var TS,lw=si;TS=lw.createRoot,lw.hydrateRoot;function fT(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var r,n,s,o,i=[],a="",c=e.split("/");for(c[0]||c.shift();s=c.shift();)r=s[0],r==="*"?(i.push(r),a+=s[1]==="?"?"(?:/(.*))?":"/(.*)"):r===":"?(n=s.indexOf("?",1),o=s.indexOf(".",1),i.push(s.substring(1,~n?n:~o?o:s.length)),a+=~n&&!~o?"(?:/([^/]+?))?":"/([^/]+?)",~o&&(a+=(~n?"?":"")+"\\"+s.substring(o))):a+="/"+s;return{keys:i,pattern:new RegExp("^"+a+(t?"(?=$|/)":"/?$"),"i")}}var RS={exports:{}},IS={};/**
|
|
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 pa=w;function hT(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var pT=typeof Object.is=="function"?Object.is:hT,mT=pa.useState,gT=pa.useEffect,vT=pa.useLayoutEffect,yT=pa.useDebugValue;function wT(e,t){var r=t(),n=mT({inst:{value:r,getSnapshot:t}}),s=n[0].inst,o=n[1];return vT(function(){s.value=r,s.getSnapshot=t,mh(s)&&o({inst:s})},[e,r,t]),gT(function(){return mh(s)&&o({inst:s}),e(function(){mh(s)&&o({inst:s})})},[e]),yT(r),r}function mh(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!pT(e,r)}catch{return!0}}function xT(e,t){return t()}var bT=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?xT:wT;IS.useSyncExternalStore=pa.useSyncExternalStore!==void 0?pa.useSyncExternalStore:bT;RS.exports=IS;var _T=RS.exports;const ST=ng.useInsertionEffect,kT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",CT=kT?w.useLayoutEffect:w.useEffect,ET=ST||CT,AS=e=>{const t=w.useRef([e,(...r)=>t[0](...r)]).current;return ET(()=>{t[0]=e}),t[1]},NT="popstate",Zg="pushState",Gg="replaceState",jT="hashchange",cw=[NT,Zg,Gg,jT],$T=e=>{for(const t of cw)addEventListener(t,e);return()=>{for(const t of cw)removeEventListener(t,e)}},OS=(e,t)=>_T.useSyncExternalStore($T,e,t),PT=()=>location.search,TT=({ssrSearch:e=""}={})=>OS(PT,()=>e),uw=()=>location.pathname,RT=({ssrPath:e}={})=>OS(uw,e?()=>e:uw),IT=(e,{replace:t=!1,state:r=null}={})=>history[t?Gg:Zg](r,"",e),AT=(e={})=>[RT(e),IT],dw=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[dw]>"u"){for(const e of[Zg,Gg]){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,dw,{value:!0})}const OT=(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())?"~"+t:t.slice(e.length)||"/",MS=(e="")=>e==="/"?"":e,MT=(e,t)=>e[0]==="~"?e.slice(1):MS(t)+e,DT=(e="",t)=>OT(fw(MS(e)),fw(t)),fw=e=>{try{return decodeURI(e)}catch{return e}},DS={hook:AT,searchHook:TT,parser:fT,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e},zS=w.createContext(DS),uc=()=>w.useContext(zS),LS={},FS=w.createContext(LS),zT=()=>w.useContext(FS),lf=e=>{const[t,r]=e.hook(e);return[DT(e.base,t),AS((n,s)=>r(MT(n,e.base),s))]},LT=()=>lf(uc()),US=(e,t,r,n)=>{const{pattern:s,keys:o}=t instanceof RegExp?{keys:!1,pattern:t}:e(t||"*",n),i=s.exec(r)||[],[a,...c]=i;return a!==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?[a]:[]]:[!1,null]},FT=({children:e,...t})=>{var d,f;const r=uc(),n=t.hook?DS: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 a=w.useRef({}),c=a.current,u=c;for(let g in n){const y=g==="base"?n[g]+(t[g]||""):t[g]||n[g];c===u&&y!==u[g]&&(a.current=u={...u}),u[g]=y,(y!==n[g]||y!==s[g])&&(s=u)}return w.createElement(zS.Provider,{value:s,children:e})},hw=({children:e,component:t},r)=>t?w.createElement(t,{params:r}):typeof e=="function"?e(r):e,UT=e=>{let t=w.useRef(LS);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},Kc=({path:e,nest:t,match:r,...n})=>{const s=uc(),[o]=lf(s),[i,a,c]=r??US(s.parser,e,o,t),u=UT({...zT(),...a});if(!i)return null;const d=c?w.createElement(FT,{base:c},hw(n,u)):hw(n,u);return w.createElement(FS.Provider,{value:u,children:d})};w.forwardRef((e,t)=>{const r=uc(),[n,s]=lf(r),{to:o="",href:i=o,onClick:a,asChild:c,children:u,className:d,replace:f,state:g,...y}=e,b=AS(v=>{v.ctrlKey||v.metaKey||v.altKey||v.shiftKey||v.button!==0||(a==null||a(v),v.defaultPrevented||(v.preventDefault(),s(i,e)))}),m=r.hrefs(i[0]==="~"?i.slice(1):r.base+i,r);return c&&w.isValidElement(u)?w.cloneElement(u,{onClick:b,href:m}):w.createElement("a",{...y,onClick:b,href:m,className:d!=null&&d.call?d(n===i):d,children:u,ref:t})});const qS=e=>Array.isArray(e)?e.flatMap(t=>qS(t&&t.type===w.Fragment?t.props.children:t)):[e],qT=({children:e,location:t})=>{const r=uc(),[n]=lf(r);for(const s of qS(e)){let o=0;if(w.isValidElement(s)&&(o=US(r.parser,s.props.path,t||n,s.props.nest))[0])return w.cloneElement(s,{match:o})}return null};var Ea=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(){}},Wo=typeof window>"u"||"Deno"in globalThis;function er(){}function VT(e,t){return typeof e=="function"?e(t):e}function Fp(e){return typeof e=="number"&&e>=0&&e!==1/0}function VS(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ws(e,t){return typeof e=="function"?e(t):e}function Ar(e,t){return typeof e=="function"?e(t):e}function pw(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:o,queryKey:i,stale:a}=e;if(i){if(n){if(t.queryHash!==Qg(i,t.options))return!1}else if(!Zl(t.queryKey,i))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||o&&!o(t))}function mw(e,t){const{exact:r,status:n,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(r){if(Zo(t.options.mutationKey)!==Zo(o))return!1}else if(!Zl(t.options.mutationKey,o))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function Qg(e,t){return((t==null?void 0:t.queryKeyHashFn)||Zo)(e)}function Zo(e){return JSON.stringify(e,(t,r)=>Up(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Zl(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Zl(e[r],t[r])):!1}function HS(e,t){if(e===t)return e;const r=gw(e)&&gw(t);if(r||Up(e)&&Up(t)){const n=r?e:Object.keys(e),s=n.length,o=r?t:Object.keys(t),i=o.length,a=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?(a[f]=void 0,u++):(a[f]=HS(e[f],t[f]),a[f]===e[f]&&e[f]!==void 0&&u++)}return s===i&&u===s?e:a}return t}function fd(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 gw(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Up(e){if(!vw(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!vw(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function vw(e){return Object.prototype.toString.call(e)==="[object Object]"}function HT(e){return new Promise(t=>{setTimeout(t,e)})}function qp(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?HS(e,t):t}function KT(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function BT(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Jg=Symbol();function KS(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Jg?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function BS(e,t){return typeof e=="function"?e(...t):!!e}var Ro,Es,Zi,cb,WT=(cb=class extends Ea{constructor(){super();me(this,Ro);me(this,Es);me(this,Zi);ne(this,Zi,t=>{if(!Wo&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){R(this,Es)||this.setEventListener(R(this,Zi))}onUnsubscribe(){var t;this.hasListeners()||((t=R(this,Es))==null||t.call(this),ne(this,Es,void 0))}setEventListener(t){var r;ne(this,Zi,t),(r=R(this,Es))==null||r.call(this),ne(this,Es,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){R(this,Ro)!==t&&(ne(this,Ro,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof R(this,Ro)=="boolean"?R(this,Ro):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Ro=new WeakMap,Es=new WeakMap,Zi=new WeakMap,cb),Yg=new WT,Gi,Ns,Qi,ub,ZT=(ub=class extends Ea{constructor(){super();me(this,Gi,!0);me(this,Ns);me(this,Qi);ne(this,Qi,t=>{if(!Wo&&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,Ns)||this.setEventListener(R(this,Qi))}onUnsubscribe(){var t;this.hasListeners()||((t=R(this,Ns))==null||t.call(this),ne(this,Ns,void 0))}setEventListener(t){var r;ne(this,Qi,t),(r=R(this,Ns))==null||r.call(this),ne(this,Ns,t(this.setOnline.bind(this)))}setOnline(t){R(this,Gi)!==t&&(ne(this,Gi,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return R(this,Gi)}},Gi=new WeakMap,Ns=new WeakMap,Qi=new WeakMap,ub),hd=new ZT;function Vp(){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 GT(e){return Math.min(1e3*2**e,3e4)}function WS(e){return(e??"online")==="online"?hd.isOnline():!0}var ZS=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function GS(e){let t=!1,r=0,n;const s=Vp(),o=()=>s.status!=="pending",i=m=>{var v;o()||(g(new ZS(m)),(v=e.abort)==null||v.call(e))},a=()=>{t=!0},c=()=>{t=!1},u=()=>Yg.isFocused()&&(e.networkMode==="always"||hd.isOnline())&&e.canRun(),d=()=>WS(e.networkMode)&&e.canRun(),f=m=>{o()||(n==null||n(),s.resolve(m))},g=m=>{o()||(n==null||n(),s.reject(m))},y=()=>new Promise(m=>{var v;n=h=>{(o()||u())&&m(h)},(v=e.onPause)==null||v.call(e)}).then(()=>{var m;n=void 0,o()||(m=e.onContinue)==null||m.call(e)}),b=()=>{if(o())return;let m;const v=r===0?e.initialPromise:void 0;try{m=v??e.fn()}catch(h){m=Promise.reject(h)}Promise.resolve(m).then(f).catch(h=>{var T;if(o())return;const p=e.retry??(Wo?0:3),x=e.retryDelay??GT,S=typeof x=="function"?x(r,h):x,C=p===!0||typeof p=="number"&&r<p||typeof p=="function"&&p(r,h);if(t||!C){g(h);return}r++,(T=e.onFail)==null||T.call(e,r,h),HT(S).then(()=>u()?void 0:y()).then(()=>{t?g(h):b()})})};return{promise:s,status:()=>s.status,cancel:i,continue:()=>(n==null||n(),s),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?b():y().then(b),s)}}var QT=e=>setTimeout(e,0);function JT(){let e=[],t=0,r=a=>{a()},n=a=>{a()},s=QT;const o=a=>{t?e.push(a):s(()=>{r(a)})},i=()=>{const a=e;e=[],a.length&&s(()=>{n(()=>{a.forEach(c=>{r(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||i()}return c},batchCalls:a=>(...c)=>{o(()=>{a(...c)})},schedule:o,setNotifyFunction:a=>{r=a},setBatchNotifyFunction:a=>{n=a},setScheduler:a=>{s=a}}}var kt=JT(),Io,db,QS=(db=class{constructor(){me(this,Io)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Fp(this.gcTime)&&ne(this,Io,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Wo?1/0:5*60*1e3))}clearGcTimeout(){R(this,Io)&&(clearTimeout(R(this,Io)),ne(this,Io,void 0))}},Io=new WeakMap,db),Ji,Yi,Rr,Ao,$t,tc,Oo,Jr,Ln,fb,YT=(fb=class extends QS{constructor(t){super();me(this,Jr);me(this,Ji);me(this,Yi);me(this,Rr);me(this,Ao);me(this,$t);me(this,tc);me(this,Oo);ne(this,Oo,!1),ne(this,tc,t.defaultOptions),this.setOptions(t.options),this.observers=[],ne(this,Ao,t.client),ne(this,Rr,R(this,Ao).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ne(this,Ji,XT(this.options)),this.state=t.state??R(this,Ji),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,tc),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&R(this,Rr).remove(this)}setData(t,r){const n=qp(this.state.data,t,this.options);return Ne(this,Jr,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,Jr,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(er).catch(er):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(R(this,Ji))}isActive(){return this.observers.some(t=>Ar(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Jg||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Ws(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:!VS(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,Rr).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,Oo)?R(this,$t).cancel({revert:!0}):R(this,$t).cancelRetry()),this.scheduleGc()),R(this,Rr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ne(this,Jr,Ln).call(this,{type:"invalidate"})}async fetch(t,r){var c,u,d,f,g,y,b,m,v,h,p,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 S=this.observers.find(C=>C.options.queryFn);S&&this.setOptions(S.options)}const n=new AbortController,s=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(ne(this,Oo,!0),n.signal)})},o=()=>{const S=KS(this.options,r),T=(()=>{const $={client:R(this,Ao),queryKey:this.queryKey,meta:this.meta};return s($),$})();return ne(this,Oo,!1),this.options.persister?this.options.persister(S,T,this):S(T)},a=(()=>{const S={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:R(this,Ao),state:this.state,fetchFn:o};return s(S),S})();(u=this.options.behavior)==null||u.onFetch(a,this),ne(this,Yi,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&Ne(this,Jr,Ln).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),ne(this,$t,GS({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,abort:n.abort.bind(n),onFail:(S,C)=>{Ne(this,Jr,Ln).call(this,{type:"failed",failureCount:S,error:C})},onPause:()=>{Ne(this,Jr,Ln).call(this,{type:"pause"})},onContinue:()=>{Ne(this,Jr,Ln).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const S=await R(this,$t).start();if(S===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(S),(y=(g=R(this,Rr).config).onSuccess)==null||y.call(g,S,this),(m=(b=R(this,Rr).config).onSettled)==null||m.call(b,S,this.state.error,this),S}catch(S){if(S instanceof ZS){if(S.silent)return R(this,$t).promise;if(S.revert){if(this.setState({...R(this,Yi),fetchStatus:"idle"}),this.state.data===void 0)throw S;return this.state.data}}throw Ne(this,Jr,Ln).call(this,{type:"error",error:S}),(h=(v=R(this,Rr).config).onError)==null||h.call(v,S,this),(x=(p=R(this,Rr).config).onSettled)==null||x.call(p,this.state.data,S,this),S}finally{this.scheduleGc()}}},Ji=new WeakMap,Yi=new WeakMap,Rr=new WeakMap,Ao=new WeakMap,$t=new WeakMap,tc=new WeakMap,Oo=new WeakMap,Jr=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,...JS(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 ne(this,Yi,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),kt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),R(this,Rr).notify({query:this,type:"updated",action:t})})},fb);function JS(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:WS(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function XT(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 wn,hb,eR=(hb=class extends Ea{constructor(t={}){super();me(this,wn);this.config=t,ne(this,wn,new Map)}build(t,r,n){const s=r.queryKey,o=r.queryHash??Qg(s,r);let i=this.get(o);return i||(i=new YT({client:t,queryKey:s,queryHash:o,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(i)),i}add(t){R(this,wn).has(t.queryHash)||(R(this,wn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=R(this,wn).get(t.queryHash);r&&(t.destroy(),r===t&&R(this,wn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){kt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return R(this,wn).get(t)}getAll(){return[...R(this,wn).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>pw(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>pw(t,n)):r}notify(t){kt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){kt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){kt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},wn=new WeakMap,hb),xn,Qt,Mo,bn,gs,pb,tR=(pb=class extends QS{constructor(t){super();me(this,bn);me(this,xn);me(this,Qt);me(this,Mo);this.mutationId=t.mutationId,ne(this,Qt,t.mutationCache),ne(this,xn,[]),this.state=t.state||YS(),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,xn).includes(t)||(R(this,xn).push(t),this.clearGcTimeout(),R(this,Qt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ne(this,xn,R(this,xn).filter(r=>r!==t)),this.scheduleGc(),R(this,Qt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){R(this,xn).length||(this.state.status==="pending"?this.scheduleGc():R(this,Qt).remove(this))}continue(){var t;return((t=R(this,Mo))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,a,c,u,d,f,g,y,b,m,v,h,p,x,S,C,T,$,O;const r=()=>{Ne(this,bn,gs).call(this,{type:"continue"})};ne(this,Mo,GS({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(M,U)=>{Ne(this,bn,gs).call(this,{type:"failed",failureCount:M,error:U})},onPause:()=>{Ne(this,bn,gs).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>R(this,Qt).canRun(this)}));const n=this.state.status==="pending",s=!R(this,Mo).canStart();try{if(n)r();else{Ne(this,bn,gs).call(this,{type:"pending",variables:t,isPaused:s}),await((i=(o=R(this,Qt).config).onMutate)==null?void 0:i.call(o,t,this));const U=await((c=(a=this.options).onMutate)==null?void 0:c.call(a,t));U!==this.state.context&&Ne(this,bn,gs).call(this,{type:"pending",context:U,variables:t,isPaused:s})}const M=await R(this,Mo).start();return await((d=(u=R(this,Qt).config).onSuccess)==null?void 0:d.call(u,M,t,this.state.context,this)),await((g=(f=this.options).onSuccess)==null?void 0:g.call(f,M,t,this.state.context)),await((b=(y=R(this,Qt).config).onSettled)==null?void 0:b.call(y,M,null,this.state.variables,this.state.context,this)),await((v=(m=this.options).onSettled)==null?void 0:v.call(m,M,null,t,this.state.context)),Ne(this,bn,gs).call(this,{type:"success",data:M}),M}catch(M){try{throw await((p=(h=R(this,Qt).config).onError)==null?void 0:p.call(h,M,t,this.state.context,this)),await((S=(x=this.options).onError)==null?void 0:S.call(x,M,t,this.state.context)),await((T=(C=R(this,Qt).config).onSettled)==null?void 0:T.call(C,void 0,M,this.state.variables,this.state.context,this)),await((O=($=this.options).onSettled)==null?void 0:O.call($,void 0,M,t,this.state.context)),M}finally{Ne(this,bn,gs).call(this,{type:"error",error:M})}}finally{R(this,Qt).runNext(this)}}},xn=new WeakMap,Qt=new WeakMap,Mo=new WeakMap,bn=new WeakSet,gs=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),kt.batch(()=>{R(this,xn).forEach(n=>{n.onMutationUpdate(t)}),R(this,Qt).notify({mutation:this,type:"updated",action:t})})},pb);function YS(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Vn,Yr,rc,mb,rR=(mb=class extends Ea{constructor(t={}){super();me(this,Vn);me(this,Yr);me(this,rc);this.config=t,ne(this,Vn,new Set),ne(this,Yr,new Map),ne(this,rc,0)}build(t,r,n){const s=new tR({mutationCache:this,mutationId:++Nc(this,rc)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){R(this,Vn).add(t);const r=Bc(t);if(typeof r=="string"){const n=R(this,Yr).get(r);n?n.push(t):R(this,Yr).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(R(this,Vn).delete(t)){const r=Bc(t);if(typeof r=="string"){const n=R(this,Yr).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,Yr).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Bc(t);if(typeof r=="string"){const n=R(this,Yr).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=Bc(t);if(typeof r=="string"){const s=(n=R(this,Yr).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(){kt.batch(()=>{R(this,Vn).forEach(t=>{this.notify({type:"removed",mutation:t})}),R(this,Vn).clear(),R(this,Yr).clear()})}getAll(){return Array.from(R(this,Vn))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>mw(r,n))}findAll(t={}){return this.getAll().filter(r=>mw(t,r))}notify(t){kt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return kt.batch(()=>Promise.all(t.map(r=>r.continue().catch(er))))}},Vn=new WeakMap,Yr=new WeakMap,rc=new WeakMap,mb);function Bc(e){var t;return(t=e.options.scope)==null?void 0:t.id}function yw(e){return{onFetch:(t,r)=>{var d,f,g,y,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=((y=t.state.data)==null?void 0:y.pages)||[],i=((b=t.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let m=!1;const v=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(t.signal.aborted?m=!0:t.signal.addEventListener("abort",()=>{m=!0}),t.signal)})},h=KS(t.options,t.fetchOptions),p=async(x,S,C)=>{if(m)return Promise.reject();if(S==null&&x.pages.length)return Promise.resolve(x);const $=(()=>{const j={client:t.client,queryKey:t.queryKey,pageParam:S,direction:C?"backward":"forward",meta:t.options.meta};return v(j),j})(),O=await h($),{maxPages:M}=t.options,U=C?BT:KT;return{pages:U(x.pages,O,M),pageParams:U(x.pageParams,S,M)}};if(s&&o.length){const x=s==="backward",S=x?nR:ww,C={pages:o,pageParams:i},T=S(n,C);a=await p(C,T,x)}else{const x=e??o.length;do{const S=c===0?i[0]??n.initialPageParam:ww(n,a);if(c>0&&S==null)break;a=await p(a,S),c++}while(c<x)}return a};t.options.persister?t.fetchFn=()=>{var m,v;return(v=(m=t.options).persister)==null?void 0:v.call(m,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=u}}}function ww(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 nR(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 pt,js,$s,Xi,ea,Ps,ta,ra,gb,sR=(gb=class{constructor(e={}){me(this,pt);me(this,js);me(this,$s);me(this,Xi);me(this,ea);me(this,Ps);me(this,ta);me(this,ra);ne(this,pt,e.queryCache||new eR),ne(this,js,e.mutationCache||new rR),ne(this,$s,e.defaultOptions||{}),ne(this,Xi,new Map),ne(this,ea,new Map),ne(this,Ps,0)}mount(){Nc(this,Ps)._++,R(this,Ps)===1&&(ne(this,ta,Yg.subscribe(async e=>{e&&(await this.resumePausedMutations(),R(this,pt).onFocus())})),ne(this,ra,hd.subscribe(async e=>{e&&(await this.resumePausedMutations(),R(this,pt).onOnline())})))}unmount(){var e,t;Nc(this,Ps)._--,R(this,Ps)===0&&((e=R(this,ta))==null||e.call(this),ne(this,ta,void 0),(t=R(this,ra))==null||t.call(this),ne(this,ra,void 0))}isFetching(e){return R(this,pt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return R(this,js).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=R(this,pt).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=R(this,pt).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Ws(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return R(this,pt).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,pt).get(n.queryHash),o=s==null?void 0:s.state.data,i=VT(t,o);if(i!==void 0)return R(this,pt).build(this,n).setData(i,{...r,manual:!0})}setQueriesData(e,t,r){return kt.batch(()=>R(this,pt).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,pt).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=R(this,pt);kt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=R(this,pt);return kt.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=kt.batch(()=>R(this,pt).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(er).catch(er)}invalidateQueries(e,t={}){return kt.batch(()=>(R(this,pt).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=kt.batch(()=>R(this,pt).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,r);return r.throwOnError||(o=o.catch(er)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(n).then(er)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=R(this,pt).build(this,t);return r.isStaleByTime(Ws(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(er).catch(er)}fetchInfiniteQuery(e){return e.behavior=yw(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(er).catch(er)}ensureInfiniteQueryData(e){return e.behavior=yw(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return hd.isOnline()?R(this,js).resumePausedMutations():Promise.resolve()}getQueryCache(){return R(this,pt)}getMutationCache(){return R(this,js)}getDefaultOptions(){return R(this,$s)}setDefaultOptions(e){ne(this,$s,e)}setQueryDefaults(e,t){R(this,Xi).set(Zo(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...R(this,Xi).values()],r={};return t.forEach(n=>{Zl(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){R(this,ea).set(Zo(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...R(this,ea).values()],r={};return t.forEach(n=>{Zl(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...R(this,$s).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Qg(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===Jg&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...R(this,$s).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){R(this,pt).clear(),R(this,js).clear()}},pt=new WeakMap,js=new WeakMap,$s=new WeakMap,Xi=new WeakMap,ea=new WeakMap,Ps=new WeakMap,ta=new WeakMap,ra=new WeakMap,gb),or,Ae,nc,Jt,Do,na,Hn,Ts,sc,sa,oa,zo,Lo,Rs,ia,Ue,sl,Hp,Kp,Bp,Wp,Zp,Gp,Qp,XS,vb,oR=(vb=class extends Ea{constructor(t,r){super();me(this,Ue);me(this,or);me(this,Ae);me(this,nc);me(this,Jt);me(this,Do);me(this,na);me(this,Hn);me(this,Ts);me(this,sc);me(this,sa);me(this,oa);me(this,zo);me(this,Lo);me(this,Rs);me(this,ia,new Set);this.options=r,ne(this,or,t),ne(this,Ts,null),ne(this,Hn,Vp()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(R(this,Ae).addObserver(this),xw(R(this,Ae),this.options)?Ne(this,Ue,sl).call(this):this.updateResult(),Ne(this,Ue,Wp).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Jp(R(this,Ae),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Jp(R(this,Ae),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ne(this,Ue,Zp).call(this),Ne(this,Ue,Gp).call(this),R(this,Ae).removeObserver(this)}setOptions(t){const r=this.options,n=R(this,Ae);if(this.options=R(this,or).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ar(this.options.enabled,R(this,Ae))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ne(this,Ue,Qp).call(this),R(this,Ae).setOptions(this.options),r._defaulted&&!fd(this.options,r)&&R(this,or).getQueryCache().notify({type:"observerOptionsUpdated",query:R(this,Ae),observer:this});const s=this.hasListeners();s&&bw(R(this,Ae),n,this.options,r)&&Ne(this,Ue,sl).call(this),this.updateResult(),s&&(R(this,Ae)!==n||Ar(this.options.enabled,R(this,Ae))!==Ar(r.enabled,R(this,Ae))||Ws(this.options.staleTime,R(this,Ae))!==Ws(r.staleTime,R(this,Ae)))&&Ne(this,Ue,Hp).call(this);const o=Ne(this,Ue,Kp).call(this);s&&(R(this,Ae)!==n||Ar(this.options.enabled,R(this,Ae))!==Ar(r.enabled,R(this,Ae))||o!==R(this,Rs))&&Ne(this,Ue,Bp).call(this,o)}getOptimisticResult(t){const r=R(this,or).getQueryCache().build(R(this,or),t),n=this.createResult(r,t);return aR(this,n)&&(ne(this,Jt,n),ne(this,na,this.options),ne(this,Do,R(this,Ae).state)),n}getCurrentResult(){return R(this,Jt)}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,ia).add(t)}getCurrentQuery(){return R(this,Ae)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=R(this,or).defaultQueryOptions(t),n=R(this,or).getQueryCache().build(R(this,or),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return Ne(this,Ue,sl).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),R(this,Jt)))}createResult(t,r){var M;const n=R(this,Ae),s=this.options,o=R(this,Jt),i=R(this,Do),a=R(this,na),u=t!==n?t.state:R(this,nc),{state:d}=t;let f={...d},g=!1,y;if(r._optimisticResults){const U=this.hasListeners(),j=!U&&xw(t,r),k=U&&bw(t,n,r,s);(j||k)&&(f={...f,...JS(d.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:b,errorUpdatedAt:m,status:v}=f;y=f.data;let h=!1;if(r.placeholderData!==void 0&&y===void 0&&v==="pending"){let U;o!=null&&o.isPlaceholderData&&r.placeholderData===(a==null?void 0:a.placeholderData)?(U=o.data,h=!0):U=typeof r.placeholderData=="function"?r.placeholderData((M=R(this,oa))==null?void 0:M.state.data,R(this,oa)):r.placeholderData,U!==void 0&&(v="success",y=qp(o==null?void 0:o.data,U,r),g=!0)}if(r.select&&y!==void 0&&!h)if(o&&y===(i==null?void 0:i.data)&&r.select===R(this,sc))y=R(this,sa);else try{ne(this,sc,r.select),y=r.select(y),y=qp(o==null?void 0:o.data,y,r),ne(this,sa,y),ne(this,Ts,null)}catch(U){ne(this,Ts,U)}R(this,Ts)&&(b=R(this,Ts),y=R(this,sa),m=Date.now(),v="error");const p=f.fetchStatus==="fetching",x=v==="pending",S=v==="error",C=x&&p,T=y!==void 0,O={status:v,fetchStatus:f.fetchStatus,isPending:x,isSuccess:v==="success",isError:S,isInitialLoading:C,isLoading:C,data:y,dataUpdatedAt:f.dataUpdatedAt,error:b,errorUpdatedAt:m,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:p,isRefetching:p&&!x,isLoadingError:S&&!T,isPaused:f.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:S&&T,isStale:Xg(t,r),refetch:this.refetch,promise:R(this,Hn),isEnabled:Ar(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const U=L=>{O.status==="error"?L.reject(O.error):O.data!==void 0&&L.resolve(O.data)},j=()=>{const L=ne(this,Hn,O.promise=Vp());U(L)},k=R(this,Hn);switch(k.status){case"pending":t.queryHash===n.queryHash&&U(k);break;case"fulfilled":(O.status==="error"||O.data!==k.value)&&j();break;case"rejected":(O.status!=="error"||O.error!==k.reason)&&j();break}}return O}updateResult(){const t=R(this,Jt),r=this.createResult(R(this,Ae),this.options);if(ne(this,Do,R(this,Ae).state),ne(this,na,this.options),R(this,Do).data!==void 0&&ne(this,oa,R(this,Ae)),fd(r,t))return;ne(this,Jt,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,o=typeof s=="function"?s():s;if(o==="all"||!o&&!R(this,ia).size)return!0;const i=new Set(o??R(this,ia));return this.options.throwOnError&&i.add("error"),Object.keys(R(this,Jt)).some(a=>{const c=a;return R(this,Jt)[c]!==t[c]&&i.has(c)})};Ne(this,Ue,XS).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ne(this,Ue,Wp).call(this)}},or=new WeakMap,Ae=new WeakMap,nc=new WeakMap,Jt=new WeakMap,Do=new WeakMap,na=new WeakMap,Hn=new WeakMap,Ts=new WeakMap,sc=new WeakMap,sa=new WeakMap,oa=new WeakMap,zo=new WeakMap,Lo=new WeakMap,Rs=new WeakMap,ia=new WeakMap,Ue=new WeakSet,sl=function(t){Ne(this,Ue,Qp).call(this);let r=R(this,Ae).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(er)),r},Hp=function(){Ne(this,Ue,Zp).call(this);const t=Ws(this.options.staleTime,R(this,Ae));if(Wo||R(this,Jt).isStale||!Fp(t))return;const n=VS(R(this,Jt).dataUpdatedAt,t)+1;ne(this,zo,setTimeout(()=>{R(this,Jt).isStale||this.updateResult()},n))},Kp=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(R(this,Ae)):this.options.refetchInterval)??!1},Bp=function(t){Ne(this,Ue,Gp).call(this),ne(this,Rs,t),!(Wo||Ar(this.options.enabled,R(this,Ae))===!1||!Fp(R(this,Rs))||R(this,Rs)===0)&&ne(this,Lo,setInterval(()=>{(this.options.refetchIntervalInBackground||Yg.isFocused())&&Ne(this,Ue,sl).call(this)},R(this,Rs)))},Wp=function(){Ne(this,Ue,Hp).call(this),Ne(this,Ue,Bp).call(this,Ne(this,Ue,Kp).call(this))},Zp=function(){R(this,zo)&&(clearTimeout(R(this,zo)),ne(this,zo,void 0))},Gp=function(){R(this,Lo)&&(clearInterval(R(this,Lo)),ne(this,Lo,void 0))},Qp=function(){const t=R(this,or).getQueryCache().build(R(this,or),this.options);if(t===R(this,Ae))return;const r=R(this,Ae);ne(this,Ae,t),ne(this,nc,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},XS=function(t){kt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(R(this,Jt))}),R(this,or).getQueryCache().notify({query:R(this,Ae),type:"observerResultsUpdated"})})},vb);function iR(e,t){return Ar(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function xw(e,t){return iR(e,t)||e.state.data!==void 0&&Jp(e,t,t.refetchOnMount)}function Jp(e,t,r){if(Ar(t.enabled,e)!==!1&&Ws(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Xg(e,t)}return!1}function bw(e,t,r,n){return(e!==t||Ar(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Xg(e,r)}function Xg(e,t){return Ar(t.enabled,e)!==!1&&e.isStaleByTime(Ws(t.staleTime,e))}function aR(e,t){return!fd(e.getCurrentResult(),t)}var Is,As,ir,Kn,Xn,Cu,Yp,yb,lR=(yb=class extends Ea{constructor(r,n){super();me(this,Xn);me(this,Is);me(this,As);me(this,ir);me(this,Kn);ne(this,Is,r),this.setOptions(n),this.bindMethods(),Ne(this,Xn,Cu).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,Is).defaultMutationOptions(r),fd(this.options,n)||R(this,Is).getMutationCache().notify({type:"observerOptionsUpdated",mutation:R(this,ir),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&Zo(n.mutationKey)!==Zo(this.options.mutationKey)?this.reset():((s=R(this,ir))==null?void 0:s.state.status)==="pending"&&R(this,ir).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=R(this,ir))==null||r.removeObserver(this)}onMutationUpdate(r){Ne(this,Xn,Cu).call(this),Ne(this,Xn,Yp).call(this,r)}getCurrentResult(){return R(this,As)}reset(){var r;(r=R(this,ir))==null||r.removeObserver(this),ne(this,ir,void 0),Ne(this,Xn,Cu).call(this),Ne(this,Xn,Yp).call(this)}mutate(r,n){var s;return ne(this,Kn,n),(s=R(this,ir))==null||s.removeObserver(this),ne(this,ir,R(this,Is).getMutationCache().build(R(this,Is),this.options)),R(this,ir).addObserver(this),R(this,ir).execute(r)}},Is=new WeakMap,As=new WeakMap,ir=new WeakMap,Kn=new WeakMap,Xn=new WeakSet,Cu=function(){var n;const r=((n=R(this,ir))==null?void 0:n.state)??YS();ne(this,As,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},Yp=function(r){kt.batch(()=>{var n,s,o,i,a,c,u,d;if(R(this,Kn)&&this.hasListeners()){const f=R(this,As).variables,g=R(this,As).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=(a=R(this,Kn)).onError)==null||c.call(a,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,As))})})},yb),ek=w.createContext(void 0),vr=e=>{const t=w.useContext(ek);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},cR=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(ek.Provider,{value:e,children:t})),tk=w.createContext(!1),uR=()=>w.useContext(tk);tk.Provider;function dR(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var fR=w.createContext(dR()),hR=()=>w.useContext(fR),pR=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},mR=e=>{w.useEffect(()=>{e.clearReset()},[e])},gR=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||BS(r,[e.error,n])),vR=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))}},yR=(e,t)=>e.isLoading&&e.isFetching&&!t,wR=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,_w=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function xR(e,t,r){var f,g,y,b,m;const n=uR(),s=hR(),o=vr(),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",vR(i),pR(i,s),mR(s);const a=!o.getQueryCache().get(i.queryHash),[c]=w.useState(()=>new t(o,i)),u=c.getOptimisticResult(i),d=!n&&e.subscribed!==!1;if(w.useSyncExternalStore(w.useCallback(v=>{const h=d?c.subscribe(kt.batchCalls(v)):er;return c.updateResult(),h},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),w.useEffect(()=>{c.setOptions(i)},[i,c]),wR(i,u))throw _w(i,c,s);if(gR({result:u,errorResetBoundary:s,throwOnError:i.throwOnError,query:o.getQueryCache().get(i.queryHash),suspense:i.suspense}))throw u.error;if((b=(y=o.getDefaultOptions().queries)==null?void 0:y._experimental_afterQuery)==null||b.call(y,i,u),i.experimental_prefetchInRender&&!Wo&&yR(u,n)){const v=a?_w(i,c,s):(m=o.getQueryCache().get(i.queryHash))==null?void 0:m.promise;v==null||v.catch(er).finally(()=>{c.updateResult()})}return i.notifyOnChangeProps?u:c.trackResult(u)}function dr(e,t){return xR(e,oR)}function Ct(e,t){const r=vr(),[n]=w.useState(()=>new lR(r,e));w.useEffect(()=>{n.setOptions(e)},[n,e]);const s=w.useSyncExternalStore(w.useCallback(i=>n.subscribe(kt.batchCalls(i)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),o=w.useCallback((i,a)=>{n.mutate(i,a).catch(er)},[n]);if(s.error&&BS(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}const bR="x-agent-deck-client",_R="dashboard",rk={[bR]:_R};async function nk(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:{...rk,...r?{"Content-Type":"application/json"}:{}},body:r?JSON.stringify(r):void 0});return await nk(n),n}const SR=({on401:e})=>async({queryKey:t})=>{const r=t.join("/"),n=await fetch(r,{headers:rk});return await nk(n),await n.json()},kR=new sR({defaultOptions:{queries:{queryFn:SR({on401:"throw"}),refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0,gcTime:10*60*1e3,retry:!1},mutations:{retry:!1}}}),CR=1,ER=1e6;let gh=0;function NR(){return gh=(gh+1)%Number.MAX_SAFE_INTEGER,gh.toString()}const vh=new Map,Sw=e=>{if(vh.has(e))return;const t=setTimeout(()=>{vh.delete(e),bl({type:"REMOVE_TOAST",toastId:e})},ER);vh.set(e,t)},jR=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,CR)};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?Sw(r):e.toasts.forEach(n=>{Sw(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)}}},Eu=[];let Nu={toasts:[]};function bl(e){Nu=jR(Nu,e),Eu.forEach(t=>{t(Nu)})}function $R({...e}){const t=NR(),r=s=>bl({type:"UPDATE_TOAST",toast:{...s,id:t}}),n=()=>bl({type:"DISMISS_TOAST",toastId:t});return bl({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||n()}}}),{id:t,dismiss:n,update:r}}function sr(){const[e,t]=w.useState(Nu);return w.useEffect(()=>(Eu.push(t),()=>{const r=Eu.indexOf(t);r>-1&&Eu.splice(r,1)}),[e]),{...e,toast:$R,dismiss:r=>bl({type:"DISMISS_TOAST",toastId:r})}}function ve(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 kw(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function sk(...e){return t=>{let r=!1;const n=e.map(s=>{const o=kw(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():kw(e[s],null)}}}}function He(...e){return w.useCallback(sk(...e),e)}function PR(e,t){const r=w.createContext(t),n=o=>{const{children:i,...a}=o,c=w.useMemo(()=>a,Object.values(a));return l.jsx(r.Provider,{value:c,children:i})};n.displayName=e+"Provider";function s(o){const i=w.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 ls(e,t=[]){let r=[];function n(o,i){const a=w.createContext(i),c=r.length;r=[...r,i];const u=f=>{var h;const{scope:g,children:y,...b}=f,m=((h=g==null?void 0:g[e])==null?void 0:h[c])||a,v=w.useMemo(()=>b,Object.values(b));return l.jsx(m.Provider,{value:v,children:y})};u.displayName=o+"Provider";function d(f,g){var m;const y=((m=g==null?void 0:g[e])==null?void 0:m[c])||a,b=w.useContext(y);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=>w.createContext(i));return function(a){const c=(a==null?void 0:a[e])||o;return w.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return s.scopeName=e,[n,TR(s,...t)]}function TR(...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((a,{useScope:c,scopeName:u})=>{const f=c(o)[`__scope${u}`];return{...a,...f}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return r.scopeName=t.scopeName,r}function ma(e){const t=IR(e),r=w.forwardRef((n,s)=>{const{children:o,...i}=n,a=w.Children.toArray(o),c=a.find(OR);if(c){const u=c.props.children,d=a.map(f=>f===c?w.Children.count(u)>1?w.Children.only(null):w.isValidElement(u)?u.props.children:null:f);return l.jsx(t,{...i,ref:s,children:w.isValidElement(u)?w.cloneElement(u,void 0,d):null})}return l.jsx(t,{...i,ref:s,children:o})});return r.displayName=`${e}.Slot`,r}var RR=ma("Slot");function IR(e){const t=w.forwardRef((r,n)=>{const{children:s,...o}=r;if(w.isValidElement(s)){const i=DR(s),a=MR(o,s.props);return s.type!==w.Fragment&&(a.ref=n?sk(n,i):i),w.cloneElement(s,a)}return w.Children.count(s)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ok=Symbol("radix.slottable");function AR(e){const t=({children:r})=>l.jsx(l.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=ok,t}function OR(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ok}function MR(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]=(...a)=>{const c=o(...a);return s(...a),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...o}:n==="className"&&(r[n]=[s,o].filter(Boolean).join(" "))}return{...e,...r}}function DR(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 ev(e){const t=e+"CollectionProvider",[r,n]=ls(t),[s,o]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:v,children:h}=m,p=yn.useRef(null),x=yn.useRef(new Map).current;return l.jsx(s,{scope:v,itemMap:x,collectionRef:p,children:h})};i.displayName=t;const a=e+"CollectionSlot",c=ma(a),u=yn.forwardRef((m,v)=>{const{scope:h,children:p}=m,x=o(a,h),S=He(v,x.collectionRef);return l.jsx(c,{ref:S,children:p})});u.displayName=a;const d=e+"CollectionItemSlot",f="data-radix-collection-item",g=ma(d),y=yn.forwardRef((m,v)=>{const{scope:h,children:p,...x}=m,S=yn.useRef(null),C=He(v,S),T=o(d,h);return yn.useEffect(()=>(T.itemMap.set(S,{ref:S,...x}),()=>void T.itemMap.delete(S))),l.jsx(g,{[f]:"",ref:C,children:p})});y.displayName=d;function b(m){const v=o(e+"CollectionConsumer",m);return yn.useCallback(()=>{const p=v.collectionRef.current;if(!p)return[];const x=Array.from(p.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((T,$)=>x.indexOf(T.ref.current)-x.indexOf($.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:u,ItemSlot:y},b,n]}var zR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_e=zR.reduce((e,t)=>{const r=ma(`Primitive.${t}`),n=w.forwardRef((s,o)=>{const{asChild:i,...a}=s,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function ik(e,t){e&&si.flushSync(()=>e.dispatchEvent(t))}function Ur(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function LR(e,t=globalThis==null?void 0:globalThis.document){const r=Ur(e);w.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 FR="DismissableLayer",Xp="dismissableLayer.update",UR="dismissableLayer.pointerDownOutside",qR="dismissableLayer.focusOutside",Cw,ak=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),dc=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,onDismiss:a,...c}=e,u=w.useContext(ak),[d,f]=w.useState(null),g=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=w.useState({}),b=He(t,$=>f($)),m=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),h=m.indexOf(v),p=d?m.indexOf(d):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,S=p>=h,C=HR($=>{const O=$.target,M=[...u.branches].some(U=>U.contains(O));!S||M||(s==null||s($),i==null||i($),$.defaultPrevented||a==null||a())},g),T=KR($=>{const O=$.target;[...u.branches].some(U=>U.contains(O))||(o==null||o($),i==null||i($),$.defaultPrevented||a==null||a())},g);return LR($=>{p===u.layers.size-1&&(n==null||n($),!$.defaultPrevented&&a&&($.preventDefault(),a()))},g),w.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Cw=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Ew(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=Cw)}},[d,g,r,u]),w.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Ew())},[d,u]),w.useEffect(()=>{const $=()=>y({});return document.addEventListener(Xp,$),()=>document.removeEventListener(Xp,$)},[]),l.jsx(_e.div,{...c,ref:b,style:{pointerEvents:x?S?"auto":"none":void 0,...e.style},onFocusCapture:ve(e.onFocusCapture,T.onFocusCapture),onBlurCapture:ve(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:ve(e.onPointerDownCapture,C.onPointerDownCapture)})});dc.displayName=FR;var VR="DismissableLayerBranch",lk=w.forwardRef((e,t)=>{const r=w.useContext(ak),n=w.useRef(null),s=He(t,n);return w.useEffect(()=>{const o=n.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),l.jsx(_e.div,{...e,ref:s})});lk.displayName=VR;function HR(e,t=globalThis==null?void 0:globalThis.document){const r=Ur(e),n=w.useRef(!1),s=w.useRef(()=>{});return w.useEffect(()=>{const o=a=>{if(a.target&&!n.current){let c=function(){ck(UR,r,u,{discrete:!0})};const u={originalEvent:a};a.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 KR(e,t=globalThis==null?void 0:globalThis.document){const r=Ur(e),n=w.useRef(!1);return w.useEffect(()=>{const s=o=>{o.target&&!n.current&&ck(qR,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 Ew(){const e=new CustomEvent(Xp);document.dispatchEvent(e)}function ck(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?ik(s,o):s.dispatchEvent(o)}var BR=dc,WR=lk,Ft=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},ZR="Portal",cf=w.forwardRef((e,t)=>{var a;const{container:r,...n}=e,[s,o]=w.useState(!1);Ft(()=>o(!0),[]);const i=r||s&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?dT.createPortal(l.jsx(_e.div,{...n,ref:t}),i):null});cf.displayName=ZR;function GR(e,t){return w.useReducer((r,n)=>t[r][n]??r,e)}var io=e=>{const{present:t,children:r}=e,n=QR(t),s=typeof r=="function"?r({present:n.isPresent}):w.Children.only(r),o=He(n.ref,JR(s));return typeof r=="function"||n.isPresent?w.cloneElement(s,{ref:o}):null};io.displayName="Presence";function QR(e){const[t,r]=w.useState(),n=w.useRef(null),s=w.useRef(e),o=w.useRef("none"),i=e?"mounted":"unmounted",[a,c]=GR(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const u=Wc(n.current);o.current=a==="mounted"?u:"none"},[a]),Ft(()=>{const u=n.current,d=s.current;if(d!==e){const g=o.current,y=Wc(u);e?c("MOUNT"):y==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&g!==y?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),Ft(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=y=>{const m=Wc(n.current).includes(CSS.escape(y.animationName));if(y.target===t&&m&&(c("ANIMATION_END"),!s.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},g=y=>{y.target===t&&(o.current=Wc(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(a),ref:w.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function Wc(e){return(e==null?void 0:e.animationName)||"none"}function JR(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 YR=ng[" useInsertionEffect ".trim().toString()]||Ft;function Go({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,o,i]=XR({defaultProp:t,onChange:r}),a=e!==void 0,c=a?e:s;{const d=w.useRef(e!==void 0);w.useEffect(()=>{const f=d.current;f!==a&&console.warn(`${n} is changing from ${f?"controlled":"uncontrolled"} to ${a?"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=a},[a,n])}const u=w.useCallback(d=>{var f;if(a){const g=e2(d)?d(e):d;g!==e&&((f=i.current)==null||f.call(i,g))}else o(d)},[a,e,o,i]);return[c,u]}function XR({defaultProp:e,onChange:t}){const[r,n]=w.useState(e),s=w.useRef(r),o=w.useRef(t);return YR(()=>{o.current=t},[t]),w.useEffect(()=>{var i;s.current!==r&&((i=o.current)==null||i.call(o,r),s.current=r)},[r,s]),[r,n,o]}function e2(e){return typeof e=="function"}var uk=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"}),t2="VisuallyHidden",uf=w.forwardRef((e,t)=>l.jsx(_e.span,{...e,ref:t,style:{...uk,...e.style}}));uf.displayName=t2;var r2=uf,tv="ToastProvider",[rv,n2,s2]=ev("Toast"),[dk,DV]=ls("Toast",[s2]),[o2,df]=dk(tv),fk=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:o=50,children:i}=e,[a,c]=w.useState(null),[u,d]=w.useState(0),f=w.useRef(!1),g=w.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${tv}\`. Expected non-empty \`string\`.`),l.jsx(rv.Provider,{scope:t,children:l.jsx(o2,{scope:t,label:r,duration:n,swipeDirection:s,swipeThreshold:o,toastCount:u,viewport:a,onViewportChange:c,onToastAdd:w.useCallback(()=>d(y=>y+1),[]),onToastRemove:w.useCallback(()=>d(y=>y-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:g,children:i})})};fk.displayName=tv;var hk="ToastViewport",i2=["F8"],em="toast.viewportPause",tm="toast.viewportResume",pk=w.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=i2,label:s="Notifications ({hotkey})",...o}=e,i=df(hk,r),a=n2(r),c=w.useRef(null),u=w.useRef(null),d=w.useRef(null),f=w.useRef(null),g=He(t,f,i.onViewportChange),y=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=i.toastCount>0;w.useEffect(()=>{const v=h=>{var x;n.length!==0&&n.every(S=>h[S]||h.code===S)&&((x=f.current)==null||x.focus())};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[n]),w.useEffect(()=>{const v=c.current,h=f.current;if(b&&v&&h){const p=()=>{if(!i.isClosePausedRef.current){const T=new CustomEvent(em);h.dispatchEvent(T),i.isClosePausedRef.current=!0}},x=()=>{if(i.isClosePausedRef.current){const T=new CustomEvent(tm);h.dispatchEvent(T),i.isClosePausedRef.current=!1}},S=T=>{!v.contains(T.relatedTarget)&&x()},C=()=>{v.contains(document.activeElement)||x()};return v.addEventListener("focusin",p),v.addEventListener("focusout",S),v.addEventListener("pointermove",p),v.addEventListener("pointerleave",C),window.addEventListener("blur",p),window.addEventListener("focus",x),()=>{v.removeEventListener("focusin",p),v.removeEventListener("focusout",S),v.removeEventListener("pointermove",p),v.removeEventListener("pointerleave",C),window.removeEventListener("blur",p),window.removeEventListener("focus",x)}}},[b,i.isClosePausedRef]);const m=w.useCallback(({tabbingDirection:v})=>{const p=a().map(x=>{const S=x.ref.current,C=[S,...w2(S)];return v==="forwards"?C:C.reverse()});return(v==="forwards"?p.reverse():p).flat()},[a]);return w.useEffect(()=>{const v=f.current;if(v){const h=p=>{var C,T,$;const x=p.altKey||p.ctrlKey||p.metaKey;if(p.key==="Tab"&&!x){const O=document.activeElement,M=p.shiftKey;if(p.target===v&&M){(C=u.current)==null||C.focus();return}const k=m({tabbingDirection:M?"backwards":"forwards"}),L=k.findIndex(P=>P===O);yh(k.slice(L+1))?p.preventDefault():M?(T=u.current)==null||T.focus():($=d.current)==null||$.focus()}};return v.addEventListener("keydown",h),()=>v.removeEventListener("keydown",h)}},[a,m]),l.jsxs(WR,{ref:c,role:"region","aria-label":s.replace("{hotkey}",y),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&l.jsx(rm,{ref:u,onFocusFromOutsideViewport:()=>{const v=m({tabbingDirection:"forwards"});yh(v)}}),l.jsx(rv.Slot,{scope:r,children:l.jsx(_e.ol,{tabIndex:-1,...o,ref:g})}),b&&l.jsx(rm,{ref:d,onFocusFromOutsideViewport:()=>{const v=m({tabbingDirection:"backwards"});yh(v)}})]})});pk.displayName=hk;var mk="ToastFocusProxy",rm=w.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=e,o=df(mk,r);return l.jsx(uf,{tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:i=>{var u;const a=i.relatedTarget;!((u=o.viewport)!=null&&u.contains(a))&&n()}})});rm.displayName=mk;var fc="Toast",a2="toast.swipeStart",l2="toast.swipeMove",c2="toast.swipeCancel",u2="toast.swipeEnd",gk=w.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:o,...i}=e,[a,c]=Go({prop:n,defaultProp:s??!0,onChange:o,caller:fc});return l.jsx(io,{present:r||a,children:l.jsx(h2,{open:a,...i,ref:t,onClose:()=>c(!1),onPause:Ur(e.onPause),onResume:Ur(e.onResume),onSwipeStart:ve(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ve(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:ve(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:ve(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)})})})});gk.displayName=fc;var[d2,f2]=dk(fc,{onClose(){}}),h2=w.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:s,open:o,onClose:i,onEscapeKeyDown:a,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:g,onSwipeEnd:y,...b}=e,m=df(fc,r),[v,h]=w.useState(null),p=He(t,P=>h(P)),x=w.useRef(null),S=w.useRef(null),C=s||m.duration,T=w.useRef(0),$=w.useRef(C),O=w.useRef(0),{onToastAdd:M,onToastRemove:U}=m,j=Ur(()=>{var B;(v==null?void 0:v.contains(document.activeElement))&&((B=m.viewport)==null||B.focus()),i()}),k=w.useCallback(P=>{!P||P===1/0||(window.clearTimeout(O.current),T.current=new Date().getTime(),O.current=window.setTimeout(j,P))},[j]);w.useEffect(()=>{const P=m.viewport;if(P){const B=()=>{k($.current),u==null||u()},H=()=>{const G=new Date().getTime()-T.current;$.current=$.current-G,window.clearTimeout(O.current),c==null||c()};return P.addEventListener(em,H),P.addEventListener(tm,B),()=>{P.removeEventListener(em,H),P.removeEventListener(tm,B)}}},[m.viewport,C,c,u,k]),w.useEffect(()=>{o&&!m.isClosePausedRef.current&&k(C)},[o,C,m.isClosePausedRef,k]),w.useEffect(()=>(M(),()=>U()),[M,U]);const L=w.useMemo(()=>v?Sk(v):null,[v]);return m.viewport?l.jsxs(l.Fragment,{children:[L&&l.jsx(p2,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite",children:L}),l.jsx(d2,{scope:r,onClose:j,children:si.createPortal(l.jsx(rv.ItemSlot,{scope:r,children:l.jsx(BR,{asChild:!0,onEscapeKeyDown:ve(a,()=>{m.isFocusedToastEscapeKeyDownRef.current||j(),m.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(_e.li,{tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":m.swipeDirection,...b,ref:p,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ve(e.onKeyDown,P=>{P.key==="Escape"&&(a==null||a(P.nativeEvent),P.nativeEvent.defaultPrevented||(m.isFocusedToastEscapeKeyDownRef.current=!0,j()))}),onPointerDown:ve(e.onPointerDown,P=>{P.button===0&&(x.current={x:P.clientX,y:P.clientY})}),onPointerMove:ve(e.onPointerMove,P=>{if(!x.current)return;const B=P.clientX-x.current.x,H=P.clientY-x.current.y,G=!!S.current,q=["left","right"].includes(m.swipeDirection),V=["left","up"].includes(m.swipeDirection)?Math.min:Math.max,z=q?V(0,B):0,I=q?0:V(0,H),F=P.pointerType==="touch"?10:2,N={x:z,y:I},_={originalEvent:P,delta:N};G?(S.current=N,Zc(l2,f,_,{discrete:!1})):Nw(N,m.swipeDirection,F)?(S.current=N,Zc(a2,d,_,{discrete:!1}),P.target.setPointerCapture(P.pointerId)):(Math.abs(B)>F||Math.abs(H)>F)&&(x.current=null)}),onPointerUp:ve(e.onPointerUp,P=>{const B=S.current,H=P.target;if(H.hasPointerCapture(P.pointerId)&&H.releasePointerCapture(P.pointerId),S.current=null,x.current=null,B){const G=P.currentTarget,q={originalEvent:P,delta:B};Nw(B,m.swipeDirection,m.swipeThreshold)?Zc(u2,y,q,{discrete:!0}):Zc(c2,g,q,{discrete:!0}),G.addEventListener("click",V=>V.preventDefault(),{once:!0})}})})})}),m.viewport)})]}):null}),p2=e=>{const{__scopeToast:t,children:r,...n}=e,s=df(fc,t),[o,i]=w.useState(!1),[a,c]=w.useState(!1);return v2(()=>i(!0)),w.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:l.jsx(cf,{asChild:!0,children:l.jsx(uf,{...n,children:o&&l.jsxs(l.Fragment,{children:[s.label," ",r]})})})},m2="ToastTitle",vk=w.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(_e.div,{...n,ref:t})});vk.displayName=m2;var g2="ToastDescription",yk=w.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(_e.div,{...n,ref:t})});yk.displayName=g2;var wk="ToastAction",xk=w.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?l.jsx(_k,{altText:r,asChild:!0,children:l.jsx(nv,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${wk}\`. Expected non-empty \`string\`.`),null)});xk.displayName=wk;var bk="ToastClose",nv=w.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,s=f2(bk,r);return l.jsx(_k,{asChild:!0,children:l.jsx(_e.button,{type:"button",...n,ref:t,onClick:ve(e.onClick,s.onClose)})})});nv.displayName=bk;var _k=w.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...s}=e;return l.jsx(_e.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:t})});function Sk(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),y2(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(...Sk(n))}}),t}function Zc(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?ik(s,o):s.dispatchEvent(o)}var Nw=(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 v2(e=()=>{}){const t=Ur(e);Ft(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function y2(e){return e.nodeType===e.ELEMENT_NODE}function w2(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 yh(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var x2=fk,kk=pk,Ck=gk,Ek=vk,Nk=yk,jk=xk,$k=nv;function Pk(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=Pk(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Tk(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Pk(e))&&(n&&(n+=" "),n+=t);return n}const jw=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,$w=Tk,ff=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return $w(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=jw(d)||jw(f);return s[u][g]}),a=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,...y}=d;return Object.entries(y).every(b=>{let[m,v]=b;return Array.isArray(v)?v.includes({...o,...a}[m]):{...o,...a}[m]===v})?[...u,f,g]:u},[]);return $w(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 b2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Rk=(...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 _2={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 S2=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:o,iconNode:i,...a},c)=>w.createElement("svg",{ref:c,..._2,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Rk("lucide",s),...a},[...i.map(([u,d])=>w.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 ze=(e,t)=>{const r=w.forwardRef(({className:n,...s},o)=>w.createElement(S2,{ref:o,iconNode:t,className:Rk(`lucide-${b2(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 k2=ze("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 Ik=ze("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 sv=ze("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 C2=ze("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 wh=ze("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 Ak=ze("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 ov=ze("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 E2=ze("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 N2=ze("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 j2=ze("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 Ok=ze("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 nm=ze("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 Pw=ze("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 $2=ze("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 Mk=ze("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 Tw=ze("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 Gn=ze("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"}]]);/**
|
|
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 P2=ze("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
|
|
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 sm=ze("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"}]]);/**
|
|
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 Gc=ze("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"}]]);/**
|
|
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 om=ze("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"}]]);/**
|
|
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 T2=ze("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"}]]);/**
|
|
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 Rw=ze("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
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 R2=ze("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
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 Ds=ze("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
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 Dk=ze("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
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 pd=ze("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"}]]);/**
|
|
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 I2=ze("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
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 hf=ze("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"}]]);/**
|
|
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 tn=ze("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"}]]);/**
|
|
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 A2=ze("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"}]]);/**
|
|
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 md=ze("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"}]]);/**
|
|
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 gd=ze("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),iv="-",O2=e=>{const t=D2(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{const a=i.split(iv);return a[0]===""&&a.length!==1&&a.shift(),zk(a,t)||M2(i)},getConflictingClassGroupIds:(i,a)=>{const c=r[i]||[];return a&&n[i]?[...c,...n[i]]:c}}},zk=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),s=n?zk(e.slice(1),n):void 0;if(s)return s;if(t.validators.length===0)return;const o=e.join(iv);return(i=t.validators.find(({validator:a})=>a(o)))==null?void 0:i.classGroupId},Iw=/^\[(.+)\]$/,M2=e=>{if(Iw.test(e)){const t=Iw.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},D2=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return L2(Object.entries(e.classGroups),r).forEach(([o,i])=>{im(i,n,o,t)}),n},im=(e,t,r,n)=>{e.forEach(s=>{if(typeof s=="string"){const o=s===""?t:Aw(t,s);o.classGroupId=r;return}if(typeof s=="function"){if(z2(s)){im(s(n),t,r,n);return}t.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([o,i])=>{im(i,Aw(t,o),r,n)})})},Aw=(e,t)=>{let r=e;return t.split(iv).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},z2=e=>e.isThemeGetter,L2=(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,a])=>[t+i,a])):o);return[r,s]}):e,F2=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)}}},Lk="!",U2=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,s=t[0],o=t.length,i=a=>{const c=[];let u=0,d=0,f;for(let v=0;v<a.length;v++){let h=a[v];if(u===0){if(h===s&&(n||a.slice(v,v+o)===t)){c.push(a.slice(d,v)),d=v+o;continue}if(h==="/"){f=v;continue}}h==="["?u++:h==="]"&&u--}const g=c.length===0?a:a.substring(d),y=g.startsWith(Lk),b=y?g.substring(1):g,m=f&&f>d?f-d:void 0;return{modifiers:c,hasImportantModifier:y,baseClassName:b,maybePostfixModifierPosition:m}};return r?a=>r({className:a,parseClassName:i}):i},q2=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},V2=e=>({cache:F2(e.cacheSize),parseClassName:U2(e),...O2(e)}),H2=/\s+/,K2=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s}=t,o=[],i=e.trim().split(H2);let a="";for(let c=i.length-1;c>=0;c-=1){const u=i[c],{modifiers:d,hasImportantModifier:f,baseClassName:g,maybePostfixModifierPosition:y}=r(u);let b=!!y,m=n(b?g.substring(0,y):g);if(!m){if(!b){a=u+(a.length>0?" "+a:a);continue}if(m=n(g),!m){a=u+(a.length>0?" "+a:a);continue}b=!1}const v=q2(d).join(":"),h=f?v+Lk:v,p=h+m;if(o.includes(p))continue;o.push(p);const x=s(m,b);for(let S=0;S<x.length;++S){const C=x[S];o.push(h+C)}a=u+(a.length>0?" "+a:a)}return a};function B2(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=Fk(t))&&(n&&(n+=" "),n+=r);return n}const Fk=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Fk(e[n]))&&(r&&(r+=" "),r+=t);return r};function W2(e,...t){let r,n,s,o=i;function i(c){const u=t.reduce((d,f)=>f(d),e());return r=V2(u),n=r.cache.get,s=r.cache.set,o=a,a(c)}function a(c){const u=n(c);if(u)return u;const d=K2(c,r);return s(c,d),d}return function(){return o(B2.apply(null,arguments))}}const Ge=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},Uk=/^\[(?:([a-z-]+):)?(.+)\]$/i,Z2=/^\d+\/\d+$/,G2=new Set(["px","full","screen"]),Q2=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,J2=/\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$/,Y2=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,X2=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,eI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,zn=e=>Ui(e)||G2.has(e)||Z2.test(e),fs=e=>Na(e,"length",lI),Ui=e=>!!e&&!Number.isNaN(Number(e)),xh=e=>Na(e,"number",Ui),Za=e=>!!e&&Number.isInteger(Number(e)),tI=e=>e.endsWith("%")&&Ui(e.slice(0,-1)),Ce=e=>Uk.test(e),hs=e=>Q2.test(e),rI=new Set(["length","size","percentage"]),nI=e=>Na(e,rI,qk),sI=e=>Na(e,"position",qk),oI=new Set(["image","url"]),iI=e=>Na(e,oI,uI),aI=e=>Na(e,"",cI),Ga=()=>!0,Na=(e,t,r)=>{const n=Uk.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},lI=e=>J2.test(e)&&!Y2.test(e),qk=()=>!1,cI=e=>X2.test(e),uI=e=>eI.test(e),dI=()=>{const e=Ge("colors"),t=Ge("spacing"),r=Ge("blur"),n=Ge("brightness"),s=Ge("borderColor"),o=Ge("borderRadius"),i=Ge("borderSpacing"),a=Ge("borderWidth"),c=Ge("contrast"),u=Ge("grayscale"),d=Ge("hueRotate"),f=Ge("invert"),g=Ge("gap"),y=Ge("gradientColorStops"),b=Ge("gradientColorStopPositions"),m=Ge("inset"),v=Ge("margin"),h=Ge("opacity"),p=Ge("padding"),x=Ge("saturate"),S=Ge("scale"),C=Ge("sepia"),T=Ge("skew"),$=Ge("space"),O=Ge("translate"),M=()=>["auto","contain","none"],U=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",Ce,t],k=()=>[Ce,t],L=()=>["",zn,fs],P=()=>["auto",Ui,Ce],B=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],H=()=>["solid","dashed","dotted","double","none"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],q=()=>["start","end","center","between","around","evenly","stretch"],V=()=>["","0",Ce],z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>[Ui,Ce];return{cacheSize:500,separator:":",theme:{colors:[Ga],spacing:[zn,fs],blur:["none","",hs,Ce],brightness:I(),borderColor:[e],borderRadius:["none","","full",hs,Ce],borderSpacing:k(),borderWidth:L(),contrast:I(),grayscale:V(),hueRotate:I(),invert:V(),gap:k(),gradientColorStops:[e],gradientColorStopPositions:[tI,fs],inset:j(),margin:j(),opacity:I(),padding:k(),saturate:I(),scale:I(),sepia:V(),skew:I(),space:k(),translate:k()},classGroups:{aspect:[{aspect:["auto","square","video",Ce]}],container:["container"],columns:[{columns:[hs]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"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:[...B(),Ce]}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Za,Ce]}],basis:[{basis:j()}],"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",Za,Ce]}],"grid-cols":[{"grid-cols":[Ga]}],"col-start-end":[{col:["auto",{span:["full",Za,Ce]},Ce]}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":[Ga]}],"row-start-end":[{row:["auto",{span:[Za,Ce]},Ce]}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"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",...q()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...q(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...q(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[p]}],px:[{px:[p]}],py:[{py:[p]}],ps:[{ps:[p]}],pe:[{pe:[p]}],pt:[{pt:[p]}],pr:[{pr:[p]}],pb:[{pb:[p]}],pl:[{pl:[p]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[$]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[$]}],"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:[hs]},hs]}],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",hs,fs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",xh]}],"font-family":[{font:[Ga]}],"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",Ui,xh]}],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":[h]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[h]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",zn,fs]}],"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:k()}],"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":[h]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...B(),sI]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",nI]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},iI]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],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:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[h]}],"border-style":[{border:[...H(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[h]}],"divide-style":[{divide:H()}],"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:["",...H()]}],"outline-offset":[{"outline-offset":[zn,Ce]}],"outline-w":[{outline:[zn,fs]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:L()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[h]}],"ring-offset-w":[{"ring-offset":[zn,fs]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",hs,aI]}],"shadow-color":[{shadow:[Ga]}],opacity:[{opacity:[h]}],"mix-blend":[{"mix-blend":[...G(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":G()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",hs,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":[h]}],"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:I()}],ease:[{ease:["linear","in","out","in-out",Ce]}],delay:[{delay:I()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ce]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[Za,Ce]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"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":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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,fs,xh]}],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"]}}},fI=W2(dI);function be(...e){return fI(Tk(e))}const hI=x2,Vk=w.forwardRef(({className:e,...t},r)=>l.jsx(kk,{ref:r,className:be("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}));Vk.displayName=kk.displayName;const pI=ff("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"}}),Hk=w.forwardRef(({className:e,variant:t,...r},n)=>l.jsx(Ck,{ref:n,className:be(pI({variant:t}),e),...r}));Hk.displayName=Ck.displayName;const mI=w.forwardRef(({className:e,...t},r)=>l.jsx(jk,{ref:r,className:be("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}));mI.displayName=jk.displayName;const Kk=w.forwardRef(({className:e,...t},r)=>l.jsx($k,{ref:r,className:be("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:l.jsx(gd,{className:"h-4 w-4"})}));Kk.displayName=$k.displayName;const Bk=w.forwardRef(({className:e,...t},r)=>l.jsx(Ek,{ref:r,className:be("text-sm font-semibold",e),...t}));Bk.displayName=Ek.displayName;const Wk=w.forwardRef(({className:e,...t},r)=>l.jsx(Nk,{ref:r,className:be("text-sm opacity-90",e),...t}));Wk.displayName=Nk.displayName;function gI(){const{toasts:e}=sr();return l.jsxs(hI,{children:[e.map(function({id:t,title:r,description:n,action:s,...o}){return l.jsxs(Hk,{...o,children:[l.jsxs("div",{className:"grid gap-1",children:[r&&l.jsx(Bk,{children:r}),n&&l.jsx(Wk,{children:n})]}),s,l.jsx(Kk,{})]},t)}),l.jsx(Vk,{})]})}var vI=ng[" useId ".trim().toString()]||(()=>{}),yI=0;function Zs(e){const[t,r]=w.useState(vI());return Ft(()=>{r(n=>n??String(yI++))},[e]),t?`radix-${t}`:""}const wI=["top","right","bottom","left"],Xs=Math.min,br=Math.max,vd=Math.round,Qc=Math.floor,Rn=e=>({x:e,y:e}),xI={left:"right",right:"left",bottom:"top",top:"bottom"},bI={start:"end",end:"start"};function am(e,t,r){return br(e,Xs(t,r))}function ss(e,t){return typeof e=="function"?e(t):e}function os(e){return e.split("-")[0]}function ja(e){return e.split("-")[1]}function av(e){return e==="x"?"y":"x"}function lv(e){return e==="y"?"height":"width"}const _I=new Set(["top","bottom"]);function Nn(e){return _I.has(os(e))?"y":"x"}function cv(e){return av(Nn(e))}function SI(e,t,r){r===void 0&&(r=!1);const n=ja(e),s=cv(e),o=lv(s);let i=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=yd(i)),[i,yd(i)]}function kI(e){const t=yd(e);return[lm(e),t,lm(t)]}function lm(e){return e.replace(/start|end/g,t=>bI[t])}const Ow=["left","right"],Mw=["right","left"],CI=["top","bottom"],EI=["bottom","top"];function NI(e,t,r){switch(e){case"top":case"bottom":return r?t?Mw:Ow:t?Ow:Mw;case"left":case"right":return t?CI:EI;default:return[]}}function jI(e,t,r,n){const s=ja(e);let o=NI(os(e),r==="start",n);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(lm)))),o}function yd(e){return e.replace(/left|right|bottom|top/g,t=>xI[t])}function $I(e){return{top:0,right:0,bottom:0,left:0,...e}}function Zk(e){return typeof e!="number"?$I(e):{top:e,right:e,bottom:e,left:e}}function wd(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 Dw(e,t,r){let{reference:n,floating:s}=e;const o=Nn(t),i=cv(t),a=lv(i),c=os(t),u=o==="y",d=n.x+n.width/2-s.width/2,f=n.y+n.height/2-s.height/2,g=n[a]/2-s[a]/2;let y;switch(c){case"top":y={x:d,y:n.y-s.height};break;case"bottom":y={x:d,y:n.y+n.height};break;case"right":y={x:n.x+n.width,y:f};break;case"left":y={x:n.x-s.width,y:f};break;default:y={x:n.x,y:n.y}}switch(ja(t)){case"start":y[i]-=g*(r&&u?-1:1);break;case"end":y[i]+=g*(r&&u?-1:1);break}return y}const PI=async(e,t,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:o=[],platform:i}=r,a=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}=Dw(u,n,c),g=n,y={},b=0;for(let m=0;m<a.length;m++){const{name:v,fn:h}=a[m],{x:p,y:x,data:S,reset:C}=await h({x:d,y:f,initialPlacement:n,placement:g,strategy:s,middlewareData:y,rects:u,platform:i,elements:{reference:e,floating:t}});d=p??d,f=x??f,y={...y,[v]:{...y[v],...S}},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}=Dw(u,g,c)),m=-1)}return{x:d,y:f,placement:g,strategy:s,middlewareData:y}};async function Gl(e,t){var r;t===void 0&&(t={});const{x:n,y:s,platform:o,rects:i,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:g=!1,padding:y=0}=ss(t,e),b=Zk(y),v=a[g?f==="floating"?"reference":"floating":f],h=wd(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(v)))==null||r?v:v.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),p=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(a.floating)),S=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=wd(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:p,offsetParent:x,strategy:c}):p);return{top:(h.top-C.top+b.top)/S.y,bottom:(C.bottom-h.bottom+b.bottom)/S.y,left:(h.left-C.left+b.left)/S.x,right:(C.right-h.right+b.right)/S.x}}const TI=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:s,rects:o,platform:i,elements:a,middlewareData:c}=t,{element:u,padding:d=0}=ss(e,t)||{};if(u==null)return{};const f=Zk(d),g={x:r,y:n},y=cv(s),b=lv(y),m=await i.getDimensions(u),v=y==="y",h=v?"top":"left",p=v?"bottom":"right",x=v?"clientHeight":"clientWidth",S=o.reference[b]+o.reference[y]-g[y]-o.floating[b],C=g[y]-o.reference[y],T=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let $=T?T[x]:0;(!$||!await(i.isElement==null?void 0:i.isElement(T)))&&($=a.floating[x]||o.floating[b]);const O=S/2-C/2,M=$/2-m[b]/2-1,U=Xs(f[h],M),j=Xs(f[p],M),k=U,L=$-m[b]-j,P=$/2-m[b]/2+O,B=am(k,P,L),H=!c.arrow&&ja(s)!=null&&P!==B&&o.reference[b]/2-(P<k?U:j)-m[b]/2<0,G=H?P<k?P-k:P-L:0;return{[y]:g[y]+G,data:{[y]:B,centerOffset:P-B-G,...H&&{alignmentOffset:G}},reset:H}}}),RI=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:a,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:m=!0,...v}=ss(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const h=os(s),p=Nn(a),x=os(a)===a,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=g||(x||!m?[yd(a)]:kI(a)),T=b!=="none";!g&&T&&C.push(...jI(a,m,b,S));const $=[a,...C],O=await Gl(t,v),M=[];let U=((n=o.flip)==null?void 0:n.overflows)||[];if(d&&M.push(O[h]),f){const P=SI(s,i,S);M.push(O[P[0]],O[P[1]])}if(U=[...U,{placement:s,overflows:M}],!M.every(P=>P<=0)){var j,k;const P=(((j=o.flip)==null?void 0:j.index)||0)+1,B=$[P];if(B&&(!(f==="alignment"?p!==Nn(B):!1)||U.every(q=>Nn(q.placement)===p?q.overflows[0]>0:!0)))return{data:{index:P,overflows:U},reset:{placement:B}};let H=(k=U.filter(G=>G.overflows[0]<=0).sort((G,q)=>G.overflows[1]-q.overflows[1])[0])==null?void 0:k.placement;if(!H)switch(y){case"bestFit":{var L;const G=(L=U.filter(q=>{if(T){const V=Nn(q.placement);return V===p||V==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(V=>V>0).reduce((V,z)=>V+z,0)]).sort((q,V)=>q[1]-V[1])[0])==null?void 0:L[0];G&&(H=G);break}case"initialPlacement":H=a;break}if(s!==H)return{reset:{placement:H}}}return{}}}};function zw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Lw(e){return wI.some(t=>e[t]>=0)}const II=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...s}=ss(e,t);switch(n){case"referenceHidden":{const o=await Gl(t,{...s,elementContext:"reference"}),i=zw(o,r.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Lw(i)}}}case"escaped":{const o=await Gl(t,{...s,altBoundary:!0}),i=zw(o,r.floating);return{data:{escapedOffsets:i,escaped:Lw(i)}}}default:return{}}}}},Gk=new Set(["left","top"]);async function AI(e,t){const{placement:r,platform:n,elements:s}=e,o=await(n.isRTL==null?void 0:n.isRTL(s.floating)),i=os(r),a=ja(r),c=Nn(r)==="y",u=Gk.has(i)?-1:1,d=o&&c?-1:1,f=ss(t,e);let{mainAxis:g,crossAxis:y,alignmentAxis:b}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof b=="number"&&(y=a==="end"?b*-1:b),c?{x:y*d,y:g*u}:{x:g*u,y:y*d}}const OI=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:a}=t,c=await AI(t,e);return i===((r=a.offset)==null?void 0:r.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:i}}}}},MI=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:a={fn:v=>{let{x:h,y:p}=v;return{x:h,y:p}}},...c}=ss(e,t),u={x:r,y:n},d=await Gl(t,c),f=Nn(os(s)),g=av(f);let y=u[g],b=u[f];if(o){const v=g==="y"?"top":"left",h=g==="y"?"bottom":"right",p=y+d[v],x=y-d[h];y=am(p,y,x)}if(i){const v=f==="y"?"top":"left",h=f==="y"?"bottom":"right",p=b+d[v],x=b-d[h];b=am(p,b,x)}const m=a.fn({...t,[g]:y,[f]:b});return{...m,data:{x:m.x-r,y:m.y-n,enabled:{[g]:o,[f]:i}}}}}},DI=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:s,rects:o,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=ss(e,t),d={x:r,y:n},f=Nn(s),g=av(f);let y=d[g],b=d[f];const m=ss(a,t),v=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const x=g==="y"?"height":"width",S=o.reference[g]-o.floating[x]+v.mainAxis,C=o.reference[g]+o.reference[x]-v.mainAxis;y<S?y=S:y>C&&(y=C)}if(u){var h,p;const x=g==="y"?"width":"height",S=Gk.has(os(s)),C=o.reference[f]-o.floating[x]+(S&&((h=i.offset)==null?void 0:h[f])||0)+(S?0:v.crossAxis),T=o.reference[f]+o.reference[x]+(S?0:((p=i.offset)==null?void 0:p[f])||0)-(S?v.crossAxis:0);b<C?b=C:b>T&&(b=T)}return{[g]:y,[f]:b}}}},zI=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:a}=t,{apply:c=()=>{},...u}=ss(e,t),d=await Gl(t,u),f=os(s),g=ja(s),y=Nn(s)==="y",{width:b,height:m}=o.floating;let v,h;f==="top"||f==="bottom"?(v=f,h=g===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(h=f,v=g==="end"?"top":"bottom");const p=m-d.top-d.bottom,x=b-d.left-d.right,S=Xs(m-d[v],p),C=Xs(b-d[h],x),T=!t.middlewareData.shift;let $=S,O=C;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(O=x),(n=t.middlewareData.shift)!=null&&n.enabled.y&&($=p),T&&!g){const U=br(d.left,0),j=br(d.right,0),k=br(d.top,0),L=br(d.bottom,0);y?O=b-2*(U!==0||j!==0?U+j:br(d.left,d.right)):$=m-2*(k!==0||L!==0?k+L:br(d.top,d.bottom))}await c({...t,availableWidth:O,availableHeight:$});const M=await i.getDimensions(a.floating);return b!==M.width||m!==M.height?{reset:{rects:!0}}:{}}}};function pf(){return typeof window<"u"}function $a(e){return Qk(e)?(e.nodeName||"").toLowerCase():"#document"}function Cr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function An(e){var t;return(t=(Qk(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Qk(e){return pf()?e instanceof Node||e instanceof Cr(e).Node:!1}function cn(e){return pf()?e instanceof Element||e instanceof Cr(e).Element:!1}function In(e){return pf()?e instanceof HTMLElement||e instanceof Cr(e).HTMLElement:!1}function Fw(e){return!pf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Cr(e).ShadowRoot}const LI=new Set(["inline","contents"]);function hc(e){const{overflow:t,overflowX:r,overflowY:n,display:s}=un(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!LI.has(s)}const FI=new Set(["table","td","th"]);function UI(e){return FI.has($a(e))}const qI=[":popover-open",":modal"];function mf(e){return qI.some(t=>{try{return e.matches(t)}catch{return!1}})}const VI=["transform","translate","scale","rotate","perspective"],HI=["transform","translate","scale","rotate","perspective","filter"],KI=["paint","layout","strict","content"];function uv(e){const t=dv(),r=cn(e)?un(e):e;return VI.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)||HI.some(n=>(r.willChange||"").includes(n))||KI.some(n=>(r.contain||"").includes(n))}function BI(e){let t=eo(e);for(;In(t)&&!ga(t);){if(uv(t))return t;if(mf(t))return null;t=eo(t)}return null}function dv(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const WI=new Set(["html","body","#document"]);function ga(e){return WI.has($a(e))}function un(e){return Cr(e).getComputedStyle(e)}function gf(e){return cn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function eo(e){if($a(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Fw(e)&&e.host||An(e);return Fw(t)?t.host:t}function Jk(e){const t=eo(e);return ga(t)?e.ownerDocument?e.ownerDocument.body:e.body:In(t)&&hc(t)?t:Jk(t)}function Ql(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const s=Jk(e),o=s===((n=e.ownerDocument)==null?void 0:n.body),i=Cr(s);if(o){const a=cm(i);return t.concat(i,i.visualViewport||[],hc(s)?s:[],a&&r?Ql(a):[])}return t.concat(s,Ql(s,[],r))}function cm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Yk(e){const t=un(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const s=In(e),o=s?e.offsetWidth:r,i=s?e.offsetHeight:n,a=vd(r)!==o||vd(n)!==i;return a&&(r=o,n=i),{width:r,height:n,$:a}}function fv(e){return cn(e)?e:e.contextElement}function qi(e){const t=fv(e);if(!In(t))return Rn(1);const r=t.getBoundingClientRect(),{width:n,height:s,$:o}=Yk(t);let i=(o?vd(r.width):r.width)/n,a=(o?vd(r.height):r.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const ZI=Rn(0);function Xk(e){const t=Cr(e);return!dv()||!t.visualViewport?ZI:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function GI(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Cr(e)?!1:t}function Qo(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),o=fv(e);let i=Rn(1);t&&(n?cn(n)&&(i=qi(n)):i=qi(e));const a=GI(o,r,n)?Xk(o):Rn(0);let c=(s.left+a.x)/i.x,u=(s.top+a.y)/i.y,d=s.width/i.x,f=s.height/i.y;if(o){const g=Cr(o),y=n&&cn(n)?Cr(n):n;let b=g,m=cm(b);for(;m&&n&&y!==b;){const v=qi(m),h=m.getBoundingClientRect(),p=un(m),x=h.left+(m.clientLeft+parseFloat(p.paddingLeft))*v.x,S=h.top+(m.clientTop+parseFloat(p.paddingTop))*v.y;c*=v.x,u*=v.y,d*=v.x,f*=v.y,c+=x,u+=S,b=Cr(m),m=cm(b)}}return wd({width:d,height:f,x:c,y:u})}function vf(e,t){const r=gf(e).scrollLeft;return t?t.left+r:Qo(An(e)).left+r}function e1(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-vf(e,r),s=r.top+t.scrollTop;return{x:n,y:s}}function QI(e){let{elements:t,rect:r,offsetParent:n,strategy:s}=e;const o=s==="fixed",i=An(n),a=t?mf(t.floating):!1;if(n===i||a&&o)return r;let c={scrollLeft:0,scrollTop:0},u=Rn(1);const d=Rn(0),f=In(n);if((f||!f&&!o)&&(($a(n)!=="body"||hc(i))&&(c=gf(n)),In(n))){const y=Qo(n);u=qi(n),d.x=y.x+n.clientLeft,d.y=y.y+n.clientTop}const g=i&&!f&&!o?e1(i,c):Rn(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 JI(e){return Array.from(e.getClientRects())}function YI(e){const t=An(e),r=gf(e),n=e.ownerDocument.body,s=br(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=br(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+vf(e);const a=-r.scrollTop;return un(n).direction==="rtl"&&(i+=br(t.clientWidth,n.clientWidth)-s),{width:s,height:o,x:i,y:a}}const Uw=25;function XI(e,t){const r=Cr(e),n=An(e),s=r.visualViewport;let o=n.clientWidth,i=n.clientHeight,a=0,c=0;if(s){o=s.width,i=s.height;const d=dv();(!d||d&&t==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}const u=vf(n);if(u<=0){const d=n.ownerDocument,f=d.body,g=getComputedStyle(f),y=d.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,b=Math.abs(n.clientWidth-f.clientWidth-y);b<=Uw&&(o-=b)}else u<=Uw&&(o+=u);return{width:o,height:i,x:a,y:c}}const eA=new Set(["absolute","fixed"]);function tA(e,t){const r=Qo(e,!0,t==="fixed"),n=r.top+e.clientTop,s=r.left+e.clientLeft,o=In(e)?qi(e):Rn(1),i=e.clientWidth*o.x,a=e.clientHeight*o.y,c=s*o.x,u=n*o.y;return{width:i,height:a,x:c,y:u}}function qw(e,t,r){let n;if(t==="viewport")n=XI(e,r);else if(t==="document")n=YI(An(e));else if(cn(t))n=tA(t,r);else{const s=Xk(e);n={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return wd(n)}function t1(e,t){const r=eo(e);return r===t||!cn(r)||ga(r)?!1:un(r).position==="fixed"||t1(r,t)}function rA(e,t){const r=t.get(e);if(r)return r;let n=Ql(e,[],!1).filter(a=>cn(a)&&$a(a)!=="body"),s=null;const o=un(e).position==="fixed";let i=o?eo(e):e;for(;cn(i)&&!ga(i);){const a=un(i),c=uv(i);!c&&a.position==="fixed"&&(s=null),(o?!c&&!s:!c&&a.position==="static"&&!!s&&eA.has(s.position)||hc(i)&&!c&&t1(e,i))?n=n.filter(d=>d!==i):s=a,i=eo(i)}return t.set(e,n),n}function nA(e){let{element:t,boundary:r,rootBoundary:n,strategy:s}=e;const i=[...r==="clippingAncestors"?mf(t)?[]:rA(t,this._c):[].concat(r),n],a=i[0],c=i.reduce((u,d)=>{const f=qw(t,d,s);return u.top=br(f.top,u.top),u.right=Xs(f.right,u.right),u.bottom=Xs(f.bottom,u.bottom),u.left=br(f.left,u.left),u},qw(t,a,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function sA(e){const{width:t,height:r}=Yk(e);return{width:t,height:r}}function oA(e,t,r){const n=In(t),s=An(t),o=r==="fixed",i=Qo(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=Rn(0);function u(){c.x=vf(s)}if(n||!n&&!o)if(($a(t)!=="body"||hc(s))&&(a=gf(t)),n){const y=Qo(t,!0,o,t);c.x=y.x+t.clientLeft,c.y=y.y+t.clientTop}else s&&u();o&&!n&&s&&u();const d=s&&!n&&!o?e1(s,a):Rn(0),f=i.left+a.scrollLeft-c.x-d.x,g=i.top+a.scrollTop-c.y-d.y;return{x:f,y:g,width:i.width,height:i.height}}function bh(e){return un(e).position==="static"}function Vw(e,t){if(!In(e)||un(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return An(e)===r&&(r=r.ownerDocument.body),r}function r1(e,t){const r=Cr(e);if(mf(e))return r;if(!In(e)){let s=eo(e);for(;s&&!ga(s);){if(cn(s)&&!bh(s))return s;s=eo(s)}return r}let n=Vw(e,t);for(;n&&UI(n)&&bh(n);)n=Vw(n,t);return n&&ga(n)&&bh(n)&&!uv(n)?r:n||BI(e)||r}const iA=async function(e){const t=this.getOffsetParent||r1,r=this.getDimensions,n=await r(e.floating);return{reference:oA(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function aA(e){return un(e).direction==="rtl"}const lA={convertOffsetParentRelativeRectToViewportRelativeRect:QI,getDocumentElement:An,getClippingRect:nA,getOffsetParent:r1,getElementRects:iA,getClientRects:JI,getDimensions:sA,getScale:qi,isElement:cn,isRTL:aA};function n1(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function cA(e,t){let r=null,n;const s=An(e);function o(){var a;clearTimeout(n),(a=r)==null||a.disconnect(),r=null}function i(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();const u=e.getBoundingClientRect(),{left:d,top:f,width:g,height:y}=u;if(a||t(),!g||!y)return;const b=Qc(f),m=Qc(s.clientWidth-(d+g)),v=Qc(s.clientHeight-(f+y)),h=Qc(d),x={rootMargin:-b+"px "+-m+"px "+-v+"px "+-h+"px",threshold:br(0,Xs(1,c))||1};let S=!0;function C(T){const $=T[0].intersectionRatio;if($!==c){if(!S)return i();$?i(!1,$):n=setTimeout(()=>{i(!1,1e-7)},1e3)}$===1&&!n1(u,e.getBoundingClientRect())&&i(),S=!1}try{r=new IntersectionObserver(C,{...x,root:s.ownerDocument})}catch{r=new IntersectionObserver(C,x)}r.observe(e)}return i(!0),o}function uA(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=fv(e),d=s||o?[...u?Ql(u):[],...Ql(t)]:[];d.forEach(h=>{s&&h.addEventListener("scroll",r,{passive:!0}),o&&h.addEventListener("resize",r)});const f=u&&a?cA(u,r):null;let g=-1,y=null;i&&(y=new ResizeObserver(h=>{let[p]=h;p&&p.target===u&&y&&(y.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var x;(x=y)==null||x.observe(t)})),r()}),u&&!c&&y.observe(u),y.observe(t));let b,m=c?Qo(e):null;c&&v();function v(){const h=Qo(e);m&&!n1(m,h)&&r(),m=h,b=requestAnimationFrame(v)}return r(),()=>{var h;d.forEach(p=>{s&&p.removeEventListener("scroll",r),o&&p.removeEventListener("resize",r)}),f==null||f(),(h=y)==null||h.disconnect(),y=null,c&&cancelAnimationFrame(b)}}const dA=OI,fA=MI,hA=RI,pA=zI,mA=II,Hw=TI,gA=DI,vA=(e,t,r)=>{const n=new Map,s={platform:lA,...r},o={...s.platform,_c:n};return PI(e,t,{...s,platform:o})};var yA=typeof document<"u",wA=function(){},ju=yA?w.useLayoutEffect:wA;function xd(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(!xd(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)&&!xd(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function s1(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Kw(e,t){const r=s1(e);return Math.round(t*r)/r}function _h(e){const t=w.useRef(e);return ju(()=>{t.current=e}),t}function xA(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:o,floating:i}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[d,f]=w.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[g,y]=w.useState(n);xd(g,n)||y(n);const[b,m]=w.useState(null),[v,h]=w.useState(null),p=w.useCallback(q=>{q!==T.current&&(T.current=q,m(q))},[]),x=w.useCallback(q=>{q!==$.current&&($.current=q,h(q))},[]),S=o||b,C=i||v,T=w.useRef(null),$=w.useRef(null),O=w.useRef(d),M=c!=null,U=_h(c),j=_h(s),k=_h(u),L=w.useCallback(()=>{if(!T.current||!$.current)return;const q={placement:t,strategy:r,middleware:g};j.current&&(q.platform=j.current),vA(T.current,$.current,q).then(V=>{const z={...V,isPositioned:k.current!==!1};P.current&&!xd(O.current,z)&&(O.current=z,si.flushSync(()=>{f(z)}))})},[g,t,r,j,k]);ju(()=>{u===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,f(q=>({...q,isPositioned:!1})))},[u]);const P=w.useRef(!1);ju(()=>(P.current=!0,()=>{P.current=!1}),[]),ju(()=>{if(S&&(T.current=S),C&&($.current=C),S&&C){if(U.current)return U.current(S,C,L);L()}},[S,C,L,U,M]);const B=w.useMemo(()=>({reference:T,floating:$,setReference:p,setFloating:x}),[p,x]),H=w.useMemo(()=>({reference:S,floating:C}),[S,C]),G=w.useMemo(()=>{const q={position:r,left:0,top:0};if(!H.floating)return q;const V=Kw(H.floating,d.x),z=Kw(H.floating,d.y);return a?{...q,transform:"translate("+V+"px, "+z+"px)",...s1(H.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:V,top:z}},[r,a,H.floating,d.x,d.y]);return w.useMemo(()=>({...d,update:L,refs:B,elements:H,floatingStyles:G}),[d,L,B,H,G])}const bA=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?Hw({element:n.current,padding:s}).fn(r):{}:n?Hw({element:n,padding:s}).fn(r):{}}}},_A=(e,t)=>({...dA(e),options:[e,t]}),SA=(e,t)=>({...fA(e),options:[e,t]}),kA=(e,t)=>({...gA(e),options:[e,t]}),CA=(e,t)=>({...hA(e),options:[e,t]}),EA=(e,t)=>({...pA(e),options:[e,t]}),NA=(e,t)=>({...mA(e),options:[e,t]}),jA=(e,t)=>({...bA(e),options:[e,t]});var $A="Arrow",o1=w.forwardRef((e,t)=>{const{children:r,width:n=10,height:s=5,...o}=e;return l.jsx(_e.svg,{...o,ref:t,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});o1.displayName=$A;var PA=o1;function i1(e){const[t,r]=w.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,a;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,a=u.blockSize}else i=e.offsetWidth,a=e.offsetHeight;r({width:i,height:a})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var hv="Popper",[a1,yf]=ls(hv),[TA,l1]=a1(hv),c1=e=>{const{__scopePopper:t,children:r}=e,[n,s]=w.useState(null);return l.jsx(TA,{scope:t,anchor:n,onAnchorChange:s,children:r})};c1.displayName=hv;var u1="PopperAnchor",d1=w.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...s}=e,o=l1(u1,r),i=w.useRef(null),a=He(t,i),c=w.useRef(null);return w.useEffect(()=>{const u=c.current;c.current=(n==null?void 0:n.current)||i.current,u!==c.current&&o.onAnchorChange(c.current)}),n?null:l.jsx(_e.div,{...s,ref:a})});d1.displayName=u1;var pv="PopperContent",[RA,IA]=a1(pv),f1=w.forwardRef((e,t)=>{var K,Z,le,re,X,ge;const{__scopePopper:r,side:n="bottom",sideOffset:s=0,align:o="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:g=!1,updatePositionStrategy:y="optimized",onPlaced:b,...m}=e,v=l1(pv,r),[h,p]=w.useState(null),x=He(t,Le=>p(Le)),[S,C]=w.useState(null),T=i1(S),$=(T==null?void 0:T.width)??0,O=(T==null?void 0:T.height)??0,M=n+(o!=="center"?"-"+o:""),U=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},j=Array.isArray(u)?u:[u],k=j.length>0,L={padding:U,boundary:j.filter(OA),altBoundary:k},{refs:P,floatingStyles:B,placement:H,isPositioned:G,middlewareData:q}=xA({strategy:"fixed",placement:M,whileElementsMounted:(...Le)=>uA(...Le,{animationFrame:y==="always"}),elements:{reference:v.anchor},middleware:[_A({mainAxis:s+O,alignmentAxis:i}),c&&SA({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?kA():void 0,...L}),c&&CA({...L}),EA({...L,apply:({elements:Le,rects:gt,availableWidth:Y,availableHeight:pe})=>{const{width:J,height:Me}=gt.reference,ie=Le.floating.style;ie.setProperty("--radix-popper-available-width",`${Y}px`),ie.setProperty("--radix-popper-available-height",`${pe}px`),ie.setProperty("--radix-popper-anchor-width",`${J}px`),ie.setProperty("--radix-popper-anchor-height",`${Me}px`)}}),S&&jA({element:S,padding:a}),MA({arrowWidth:$,arrowHeight:O}),g&&NA({strategy:"referenceHidden",...L})]}),[V,z]=m1(H),I=Ur(b);Ft(()=>{G&&(I==null||I())},[G,I]);const F=(K=q.arrow)==null?void 0:K.x,N=(Z=q.arrow)==null?void 0:Z.y,_=((le=q.arrow)==null?void 0:le.centerOffset)!==0,[E,D]=w.useState();return Ft(()=>{h&&D(window.getComputedStyle(h).zIndex)},[h]),l.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:G?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:E,"--radix-popper-transform-origin":[(re=q.transformOrigin)==null?void 0:re.x,(X=q.transformOrigin)==null?void 0:X.y].join(" "),...((ge=q.hide)==null?void 0:ge.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(RA,{scope:r,placedSide:V,onArrowChange:C,arrowX:F,arrowY:N,shouldHideArrow:_,children:l.jsx(_e.div,{"data-side":V,"data-align":z,...m,ref:x,style:{...m.style,animation:G?void 0:"none"}})})})});f1.displayName=pv;var h1="PopperArrow",AA={top:"bottom",right:"left",bottom:"top",left:"right"},p1=w.forwardRef(function(t,r){const{__scopePopper:n,...s}=t,o=IA(h1,n),i=AA[o.placedSide];return l.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:l.jsx(PA,{...s,ref:r,style:{...s.style,display:"block"}})})});p1.displayName=h1;function OA(e){return e!==null}var MA=e=>({name:"transformOrigin",options:e,fn(t){var v,h,p;const{placement:r,rects:n,middlewareData:s}=t,i=((v=s.arrow)==null?void 0:v.centerOffset)!==0,a=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,d]=m1(r),f={start:"0%",center:"50%",end:"100%"}[d],g=(((h=s.arrow)==null?void 0:h.x)??0)+a/2,y=(((p=s.arrow)==null?void 0:p.y)??0)+c/2;let b="",m="";return u==="bottom"?(b=i?f:`${g}px`,m=`${-c}px`):u==="top"?(b=i?f:`${g}px`,m=`${n.floating.height+c}px`):u==="right"?(b=`${-c}px`,m=i?f:`${y}px`):u==="left"&&(b=`${n.floating.width+c}px`,m=i?f:`${y}px`),{data:{x:b,y:m}}}});function m1(e){const[t,r="center"]=e.split("-");return[t,r]}var DA=c1,g1=d1,v1=f1,y1=p1,[wf,zV]=ls("Tooltip",[yf]),mv=yf(),w1="TooltipProvider",zA=700,Bw="tooltip.open",[LA,x1]=wf(w1),b1=e=>{const{__scopeTooltip:t,delayDuration:r=zA,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:o}=e,i=w.useRef(!0),a=w.useRef(!1),c=w.useRef(0);return w.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),l.jsx(LA,{scope:t,isOpenDelayedRef:i,delayDuration:r,onOpen:w.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,n)},[n]),isPointerInTransitRef:a,onPointerInTransitChange:w.useCallback(u=>{a.current=u},[]),disableHoverableContent:s,children:o})};b1.displayName=w1;var _1="Tooltip",[LV,xf]=wf(_1),um="TooltipTrigger",FA=w.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=xf(um,r),o=x1(um,r),i=mv(r),a=w.useRef(null),c=He(t,a,s.onTriggerChange),u=w.useRef(!1),d=w.useRef(!1),f=w.useCallback(()=>u.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),l.jsx(g1,{asChild:!0,...i,children:l.jsx(_e.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:ve(e.onPointerMove,g=>{g.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:ve(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:ve(e.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:ve(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:ve(e.onBlur,s.onClose),onClick:ve(e.onClick,s.onClose)})})});FA.displayName=um;var UA="TooltipPortal",[FV,qA]=wf(UA,{forceMount:void 0}),va="TooltipContent",S1=w.forwardRef((e,t)=>{const r=qA(va,e.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...o}=e,i=xf(va,e.__scopeTooltip);return l.jsx(io,{present:n||i.open,children:i.disableHoverableContent?l.jsx(k1,{side:s,...o,ref:t}):l.jsx(VA,{side:s,...o,ref:t})})}),VA=w.forwardRef((e,t)=>{const r=xf(va,e.__scopeTooltip),n=x1(va,e.__scopeTooltip),s=w.useRef(null),o=He(t,s),[i,a]=w.useState(null),{trigger:c,onClose:u}=r,d=s.current,{onPointerInTransitChange:f}=n,g=w.useCallback(()=>{a(null),f(!1)},[f]),y=w.useCallback((b,m)=>{const v=b.currentTarget,h={x:b.clientX,y:b.clientY},p=ZA(h,v.getBoundingClientRect()),x=GA(h,p),S=QA(m.getBoundingClientRect()),C=YA([...x,...S]);a(C),f(!0)},[f]);return w.useEffect(()=>()=>g(),[g]),w.useEffect(()=>{if(c&&d){const b=v=>y(v,d),m=v=>y(v,c);return c.addEventListener("pointerleave",b),d.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",b),d.removeEventListener("pointerleave",m)}}},[c,d,y,g]),w.useEffect(()=>{if(i){const b=m=>{const v=m.target,h={x:m.clientX,y:m.clientY},p=(c==null?void 0:c.contains(v))||(d==null?void 0:d.contains(v)),x=!JA(h,i);p?g():x&&(g(),u())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,d,i,u,g]),l.jsx(k1,{...e,ref:o})}),[HA,KA]=wf(_1,{isInside:!1}),BA=AR("TooltipContent"),k1=w.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:i,...a}=e,c=xf(va,r),u=mv(r),{onClose:d}=c;return w.useEffect(()=>(document.addEventListener(Bw,d),()=>document.removeEventListener(Bw,d)),[d]),w.useEffect(()=>{if(c.trigger){const f=g=>{const y=g.target;y!=null&&y.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),l.jsx(dc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:l.jsxs(v1,{"data-state":c.stateAttribute,...u,...a,ref:t,style:{...a.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:[l.jsx(BA,{children:n}),l.jsx(HA,{scope:r,isInside:!0,children:l.jsx(r2,{id:c.contentId,role:"tooltip",children:s||n})})]})})});S1.displayName=va;var C1="TooltipArrow",WA=w.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=mv(r);return KA(C1,r).isInside?null:l.jsx(y1,{...s,...n,ref:t})});WA.displayName=C1;function ZA(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 GA(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 QA(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 JA(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 a=t[o],c=t[i],u=a.x,d=a.y,f=c.x,g=c.y;d>n!=g>n&&r<(f-u)*(n-d)/(g-d)+u&&(s=!s)}return s}function YA(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),XA(t)}function XA(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 eO=b1,E1=S1;const tO=eO,rO=w.forwardRef(({className:e,sideOffset:t=4,...r},n)=>l.jsx(E1,{ref:n,sideOffset:t,className:be("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}));rO.displayName=E1.displayName;const nO={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 sO(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))}:nO}const wr="#92E4DD",lr="#F9386D",Qr="#FFFFFF",Sn="bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900";function vn(e){return e.type==="mcp"||e.type==="local-mcp"?wr:e.cardColor??wr}function kn(e){return{borderColor:e,color:e,boxShadow:`0 0 20px ${e}20`}}const oO=ff("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"}}),ce=w.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...s},o)=>{const i=n?RR:"button";return l.jsx(i,{className:be(oO({variant:t,size:r,className:e})),ref:o,...s})});ce.displayName="Button";function Vi({warnings:e}){if(!(e!=null&&e.length))return null;const t=e.find(n=>n.severity==="error")??e[0],r=t.severity==="error";return l.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:[l.jsx(tn,{className:"h-2.5 w-2.5 shrink-0"}),l.jsx("span",{className:"max-w-[72px] truncate",children:t.message})]})}const Ww="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 iO(e){return e.iconUrl?e.iconUrl:null}function N1({service:e}){const t=vn(e),r=iO(e),[n,s]=w.useState(!1);return r&&!n?l.jsx("img",{src:r,alt:"",className:"w-7 h-7 object-contain rounded-sm",draggable:!1,onError:()=>s(!0)}):l.jsx("div",{style:{width:28,height:28,backgroundColor:t,WebkitMask:`url(${Ww}) no-repeat center / contain`,mask:`url(${Ww}) no-repeat center / contain`},"aria-hidden":!0})}function gv(e){return e?"ring-2 ring-inset ring-yellow-400/90 shadow-[0_0_10px_rgba(250,204,21,0.2)]":""}function vv(){return l.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 aO({service:e,onDragStart:t,onDragEnd:r,isInActiveDeck:n,onCardClick:s,isInCollection:o=!1,onMouseEnter:i,onMouseLeave:a,activeDeck:c,warnings:u}){const d=vr(),{toast:f}=sr(),g=vn(e),y=Ct({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:h=>{f({title:"Failed to add service",description:h.message,variant:"destructive"})}}),b=Ct({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:h=>{f({title:"Failed to delete service",description:h.message,variant:"destructive"})}}),m=h=>{h.stopPropagation(),y.mutate()},v=h=>{h.stopPropagation(),window.confirm(`Are you sure you want to delete ${e.name}? This action cannot be undone.`)&&b.mutate()};return l.jsx("div",{className:"relative group cursor-pointer",draggable:!n,onDragStart:h=>t(h,e),onDragEnd:r,onClick:()=>s==null?void 0:s(e),"data-testid":`card-${e.id}`,onMouseEnter:i,onMouseLeave:a,children:l.jsxs("div",{className:`
|
|
234
|
-
w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
|
|
235
|
-
transform transition-all duration-300 shadow-lg hover:shadow-2xl
|
|
236
|
-
bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
|
|
237
|
-
relative overflow-hidden
|
|
238
|
-
${gv(n)}
|
|
239
|
-
${o?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
|
|
240
|
-
`,style:{borderColor:g,boxShadow:`0 0 20px ${g}20`},children:[l.jsx(Vi,{warnings:u}),n&&l.jsx(vv,{}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:g},children:e.type==="mcp"?"RM":e.type==="local-mcp"?"LM":"A"})}),l.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:l.jsx("div",{className:"leading-none",style:{color:g},children:e.type==="mcp"?"RM":e.type==="local-mcp"?"LM":"A"})}),l.jsx("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-10",children:l.jsx(ce,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:v,title:`Delete ${e.name}`,children:l.jsx(hf,{className:"w-3 h-3"})})}),l.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[l.jsx("div",{className:"mb-2",style:{color:g},children:l.jsx(N1,{service:e})}),l.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}),l.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"})]}),l.jsx("div",{className:"absolute bottom-6 inset-x-1",children:l.jsx(ce,{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:m,disabled:n||y.isPending,"data-testid":`button-add-to-deck-${e.id}`,children:n?"IN DECK":"ADD"})}),l.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 lO=w.memo(aO);function cO(e){return e.iconUrl?e.iconUrl:null}function j1({credential:e,color:t}){const r=cO(e);return r?l.jsx("img",{src:r,alt:"",className:"h-7 w-7 object-contain rounded-sm",draggable:!1}):l.jsx(sm,{className:"h-7 w-7",strokeWidth:2.25,style:{color:t}})}function uO({credential:e,isInActiveDeck:t,activeDeck:r,isInCollection:n=!0,onDragStart:s,onDragEnd:o,onMouseEnter:i,onMouseLeave:a,onCardClick:c,warnings:u}){const d=vr(),{toast:f}=sr(),g=lr,y=Ct({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:m=>{f({title:"Failed to add to deck",description:m.message,variant:"destructive"})}}),b=Ct({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:m=>{f({title:"Failed to remove API key",description:m.message,variant:"destructive"})}});return l.jsx("div",{className:"relative group cursor-pointer",draggable:!t&&!!s,onDragStart:s?m=>s(m,e):void 0,onDragEnd:o,onClick:()=>c==null?void 0:c(e),"data-testid":`card-${e.id}`,onMouseEnter:i,onMouseLeave:a,children:l.jsxs("div",{className:`
|
|
241
|
-
w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
|
|
242
|
-
transform transition-all duration-300 shadow-lg hover:shadow-2xl
|
|
243
|
-
bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
|
|
244
|
-
relative overflow-hidden
|
|
245
|
-
${gv(t)}
|
|
246
|
-
${n?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
|
|
247
|
-
`,style:{borderColor:g,boxShadow:`0 0 20px ${g}20`},children:[l.jsx(Vi,{warnings:u}),t&&l.jsx(vv,{}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:g},children:"AK"})}),l.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:l.jsx("div",{className:"leading-none",style:{color:g},children:"AK"})}),l.jsx("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-10",children:l.jsx(ce,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:m=>{m.stopPropagation(),window.confirm(`Remove ${e.label} from your vault?`)&&b.mutate()},title:`Remove ${e.label}`,children:l.jsx(hf,{className:"w-3 h-3"})})}),l.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[l.jsx("div",{className:"mb-2",style:{color:g},children:l.jsx(j1,{credential:e,color:g})}),l.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}),l.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"})]}),l.jsx("div",{className:"absolute bottom-6 inset-x-1",children:l.jsx(ce,{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:m=>{m.stopPropagation(),y.mutate()},disabled:t||y.isPending||!r,"data-testid":`button-add-to-deck-${e.id}`,children:t?"IN DECK":"ADD"})}),l.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 dO=w.memo(uO);function fO({playbook:e,isInActiveDeck:t,activeDeck:r,isInCollection:n=!0,onDragStart:s,onDragEnd:o,onMouseEnter:i,onMouseLeave:a,onCardClick:c,warnings:u}){const d=vr(),{toast:f}=sr(),g=Qr,y=e.dependsOnCredentialIds.length+e.dependsOnServiceIds.length,b=Ct({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:v=>{f({title:"Failed to add playbook",description:v.message,variant:"destructive"})}}),m=Ct({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:v=>{f({title:"Failed to delete playbook",description:v.message,variant:"destructive"})}});return l.jsx("div",{className:"relative group cursor-pointer",draggable:!t&&!!s,onDragStart:s?v=>s(v,e):void 0,onDragEnd:o,onClick:()=>c==null?void 0:c(e),"data-testid":`card-${e.id}`,onMouseEnter:i,onMouseLeave:a,children:l.jsxs("div",{className:`
|
|
248
|
-
w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
|
|
249
|
-
transform transition-all duration-300 shadow-lg hover:shadow-2xl
|
|
250
|
-
bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
|
|
251
|
-
relative overflow-hidden
|
|
252
|
-
${gv(t)}
|
|
253
|
-
${n?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
|
|
254
|
-
`,style:{borderColor:g,boxShadow:`0 0 20px ${g}20`},children:[l.jsx(Vi,{warnings:u}),t&&l.jsx(vv,{}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:g},children:"PB"})}),l.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:l.jsx("div",{className:"leading-none",style:{color:g},children:"PB"})}),l.jsx("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-10",children:l.jsx(ce,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:v=>{v.stopPropagation(),window.confirm(`Delete playbook "${e.title}"?`)&&m.mutate()},title:`Delete ${e.title}`,children:l.jsx(hf,{className:"w-3 h-3"})})}),l.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[l.jsx("div",{className:"mb-2",style:{color:g},children:l.jsx(sv,{className:"h-7 w-7",strokeWidth:2.25})}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:g},children:e.title}),l.jsxs("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:g,borderColor:g},children:["Playbook",y>0?` · ${y} deps`:""]})]}),l.jsx("div",{className:"absolute bottom-6 inset-x-1",children:l.jsx(ce,{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:v=>{v.stopPropagation(),b.mutate()},disabled:t||b.isPending||!r,children:t?"IN DECK":"ADD"})}),l.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 hO=w.memo(fO),bd=128,pO=192,ya=48,mO=10,_d=12,Jc=64,Yc=4,Zw=14,$1=12,P1=1.08;function gO(e=$1,t=P1){const r=e*Math.PI/180,n=bd*Math.sin(r)+pO*Math.cos(r);return Math.ceil(n*t)+8}const Gw=gO();function T1(e,t=ya){return e===0?0:bd+Math.max(0,e-1)*(bd-t)}function vO(e=mO,t=ya,r=_d){return T1(e,t)+2*r}function yO(e,t=ya){return T1(e,t)+2*_d}const wO=vO();function xO(e,t,r,n=$1){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 bO(e){return{flexShrink:0,marginLeft:e===0?0:`-${ya}px`}}function _O(e,t,r){return r===e?999999:t-e}function SO({cardCount:e,children:t}){const r=w.useRef(null),n=w.useRef([]),s=w.useRef(0),o=w.useRef(void 0),[i,a]=w.useState(!1),[c,u]=w.useState(!1),[d,f]=w.useState(!1),[g,y]=w.useState(!1),[b,m]=w.useState(!1),v=w.useRef(!1),h=w.useRef(!1),[p,x]=w.useState(null),S=w.useRef(null);S.current=p;const C=w.useCallback(()=>{const j=r.current;if(!j)return;const k=j.getBoundingClientRect(),L=S.current;n.current.forEach((P,B)=>{if(!P)return;const H=P.getBoundingClientRect(),G=H.left+H.width/2,q=L===B?0:xO(G,k.left,k.width),V=L===B?P1:1;P.style.transform=`rotate(${q}deg) scale(${V})`,P.style.transformOrigin="center center",P.style.zIndex=String(_O(B,e,L))})},[e]),T=w.useCallback(j=>{const k=r.current;if(!k)return;const L=bd-ya;k.scrollBy({left:j==="left"?-L:L,behavior:"smooth"})},[]),$=w.useCallback(()=>{const j=r.current;if(!j)return;const L=yO(e,ya)>j.clientWidth+2;a(L),u(L&&j.scrollLeft>4),f(L&&j.scrollLeft+j.clientWidth<j.scrollWidth-4),C()},[e,C]);w.useLayoutEffect(()=>{const j=r.current;if(!j)return;$();const k=new ResizeObserver($);return k.observe(j),j.addEventListener("scroll",$,{passive:!0}),()=>{k.disconnect(),j.removeEventListener("scroll",$)}},[e,$]),w.useEffect(()=>{const j=()=>{const k=r.current,L=s.current;if(k&&L!==0){k.scrollLeft+=L,C();const H=k.scrollLeft>4,G=k.scrollLeft+k.clientWidth<k.scrollWidth-4;u(H),f(G)}const P=L<0,B=L>0;P!==v.current&&(v.current=P,y(P)),B!==h.current&&(h.current=B,m(B)),o.current=requestAnimationFrame(j)};return o.current=requestAnimationFrame(j),()=>{o.current!==void 0&&cancelAnimationFrame(o.current)}},[C]);const O=j=>{const k=r.current;if(!k||!i){s.current=0;return}const L=k.getBoundingClientRect(),P=j.clientX-L.left;if(P<Jc&&c){const B=1-P/Jc;s.current=-(Yc+B*(Zw-Yc))}else if(P>L.width-Jc&&d){const B=1-(L.width-P)/Jc;s.current=Yc+B*(Zw-Yc)}else s.current=0;C()},M=()=>{s.current=0,v.current=!1,h.current=!1,y(!1),m(!1)};if(w.useLayoutEffect(()=>{n.current.length=e,C()},[e,p,C]),e===0)return l.jsx(l.Fragment,{children:t});const U=(j,k)=>`absolute ${j==="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 ${k?"scale-110":"scale-100"}`;return l.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:O,onMouseLeave:M,children:[i&&c&&l.jsx("button",{type:"button",className:U("left",g),"aria-label":"Scroll deck left","data-testid":"deck-scroll-left",onClick:()=>T("left"),children:l.jsx(E2,{className:"h-6 w-6",strokeWidth:2.5})}),i&&d&&l.jsx("button",{type:"button",className:U("right",b),"aria-label":"Scroll deck right","data-testid":"deck-scroll-right",onClick:()=>T("right"),children:l.jsx(N2,{className:"h-6 w-6",strokeWidth:2.5})}),l.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:wO,maxWidth:"100%"},children:l.jsx("div",{className:"flex items-center justify-start isolate group/fan",style:{minHeight:Gw,paddingLeft:_d,paddingRight:_d},children:w.Children.map(t,(j,k)=>l.jsx("div",{ref:L=>{n.current[k]=L},className:"relative flex items-center justify-center transition-[transform,box-shadow] duration-500 will-change-transform",style:{...bO(k),minHeight:Gw},onMouseEnter:()=>x(k),onMouseLeave:()=>x(null),children:j},j&&typeof j=="object"&&"key"in j?j.key:k))})})]})}function kO({deck:e,services:t,credentials:r=[],playbooks:n=[],collectionWarnings:s,onDrop:o,onDragStart:i,onCredentialDragStart:a,onPlaybookDragStart:c,onDragEnd:u,onCardClick:d,onPlaybookClick:f,onCredentialClick:g}){const y=v=>{v.preventDefault(),o(v)},b=v=>{v.preventDefault()},m=t.length+r.length+n.length;return l.jsxs("div",{className:"flex h-full min-w-0 flex-col overflow-hidden",children:[l.jsx("div",{className:"mb-4 shrink-0 flex items-center justify-between",children:l.jsxs("h3",{className:"text-lg font-bold flex items-center",children:[l.jsx("i",{className:"fas fa-layer-group mr-2 text-blue-400"}),"Deck",l.jsx("span",{className:"ml-2 text-sm font-normal text-gray-400",children:e.name}),l.jsxs("span",{className:"ml-2 text-sm font-normal text-gray-400",children:["(",m," cards)"]})]})}),l.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:y,onDragOver:b,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:l.jsx("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden min-w-0",children:m===0?l.jsx("div",{className:"text-center",children:l.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:l.jsx(Ds,{className:"w-8 h-8 text-gray-500"})})}):l.jsxs(SO,{cardCount:m,children:[r.map((v,h)=>l.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:lr,boxShadow:`0 0 20px ${lr}20`},draggable:!0,onDragStart:p=>a(p,v,!0),onDragEnd:u,onClick:()=>g==null?void 0:g(v),"data-testid":`deck-card-${v.id}`,children:[l.jsx(Vi,{warnings:s==null?void 0:s.credentialWarnings.get(v.id)}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:lr},children:"AK"})}),l.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:l.jsx("div",{className:"leading-none",style:{color:lr},children:"AK"})}),l.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[l.jsx("div",{className:"mb-2",style:{color:lr},children:l.jsx(j1,{credential:v,color:lr})}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:lr},children:v.label}),l.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:lr,borderColor:lr},children:v.hasSecret?"API Key":"Missing key"})]})]},v.id)),n.map((v,h)=>l.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:Qr,boxShadow:`0 0 20px ${Qr}20`},draggable:!0,onDragStart:p=>c(p,v,!0),onDragEnd:u,onClick:()=>f==null?void 0:f(v),"data-testid":`deck-card-${v.id}`,children:[l.jsx(Vi,{warnings:s==null?void 0:s.playbookWarnings.get(v.id)}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:Qr},children:"PB"})}),l.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:l.jsx("div",{className:"leading-none",style:{color:Qr},children:"PB"})}),l.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[l.jsx("div",{className:"mb-2",style:{color:Qr},children:l.jsx(sv,{className:"h-7 w-7",strokeWidth:2.25})}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:Qr},children:v.title}),l.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:Qr,borderColor:Qr},children:"Playbook"})]})]},v.id)),t.map(v=>l.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:vn(v),boxShadow:`0 0 20px ${vn(v)}20`},draggable:!0,onDragStart:h=>i(h,v,!0),onDragEnd:u,onClick:()=>d==null?void 0:d(v),"data-testid":`deck-card-${v.id}`,children:[l.jsx(Vi,{warnings:s==null?void 0:s.serviceWarnings.get(v.id)}),l.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:l.jsx("div",{className:"leading-none",style:{color:vn(v)},children:v.type==="mcp"?"RM":v.type==="local-mcp"?"LM":"A"})}),l.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:l.jsx("div",{className:"leading-none",style:{color:vn(v)},children:v.type==="mcp"?"RM":v.type==="local-mcp"?"LM":"A"})}),l.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[l.jsx("div",{className:"mb-2",style:{color:vn(v)},children:l.jsx(N1,{service:v})}),l.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:vn(v)},children:v.name}),l.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:vn(v),borderColor:vn(v)},children:v.type==="mcp"?"Remote MCP":v.type==="local-mcp"?"Local MCP":"A2A"})]})]},v.id))]})})})]})}var Sh="focusScope.autoFocusOnMount",kh="focusScope.autoFocusOnUnmount",Qw={bubbles:!1,cancelable:!0},CO="FocusScope",yv=w.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...i}=e,[a,c]=w.useState(null),u=Ur(s),d=Ur(o),f=w.useRef(null),g=He(t,m=>c(m)),y=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(n){let m=function(x){if(y.paused||!a)return;const S=x.target;a.contains(S)?f.current=S:vs(f.current,{select:!0})},v=function(x){if(y.paused||!a)return;const S=x.relatedTarget;S!==null&&(a.contains(S)||vs(f.current,{select:!0}))},h=function(x){if(document.activeElement===document.body)for(const C of x)C.removedNodes.length>0&&vs(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",v);const p=new MutationObserver(h);return a&&p.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",v),p.disconnect()}}},[n,a,y.paused]),w.useEffect(()=>{if(a){Yw.add(y);const m=document.activeElement;if(!a.contains(m)){const h=new CustomEvent(Sh,Qw);a.addEventListener(Sh,u),a.dispatchEvent(h),h.defaultPrevented||(EO(TO(R1(a)),{select:!0}),document.activeElement===m&&vs(a))}return()=>{a.removeEventListener(Sh,u),setTimeout(()=>{const h=new CustomEvent(kh,Qw);a.addEventListener(kh,d),a.dispatchEvent(h),h.defaultPrevented||vs(m??document.body,{select:!0}),a.removeEventListener(kh,d),Yw.remove(y)},0)}}},[a,u,d,y]);const b=w.useCallback(m=>{if(!r&&!n||y.paused)return;const v=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,h=document.activeElement;if(v&&h){const p=m.currentTarget,[x,S]=NO(p);x&&S?!m.shiftKey&&h===S?(m.preventDefault(),r&&vs(x,{select:!0})):m.shiftKey&&h===x&&(m.preventDefault(),r&&vs(S,{select:!0})):h===p&&m.preventDefault()}},[r,n,y.paused]);return l.jsx(_e.div,{tabIndex:-1,...i,ref:g,onKeyDown:b})});yv.displayName=CO;function EO(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(vs(n,{select:t}),document.activeElement!==r)return}function NO(e){const t=R1(e),r=Jw(t,e),n=Jw(t.reverse(),e);return[r,n]}function R1(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 Jw(e,t){for(const r of e)if(!jO(r,{upTo:t}))return r}function jO(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 $O(e){return e instanceof HTMLInputElement&&"select"in e}function vs(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&$O(e)&&t&&e.select()}}var Yw=PO();function PO(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Xw(e,t),e.unshift(t)},remove(t){var r;e=Xw(e,t),(r=e[0])==null||r.resume()}}}function Xw(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function TO(e){return e.filter(t=>t.tagName!=="A")}var Ch=0;function I1(){w.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ex()),document.body.insertAdjacentElement("beforeend",e[1]??ex()),Ch++,()=>{Ch===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ch--}},[])}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 Cn=function(){return Cn=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},Cn.apply(this,arguments)};function A1(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 RO(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 $u="right-scroll-bar-position",Pu="width-before-scroll-bar",IO="with-scroll-bars-hidden",AO="--removed-body-scroll-bar-size";function Eh(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function OO(e,t){var r=w.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 MO=typeof window<"u"?w.useLayoutEffect:w.useEffect,tx=new WeakMap;function DO(e,t){var r=OO(null,function(n){return e.forEach(function(s){return Eh(s,n)})});return MO(function(){var n=tx.get(r);if(n){var s=new Set(n),o=new Set(e),i=r.current;s.forEach(function(a){o.has(a)||Eh(a,null)}),o.forEach(function(a){s.has(a)||Eh(a,i)})}tx.set(r,e)},[e]),r}function zO(e){return e}function LO(e,t){t===void 0&&(t=zO);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(a){return a!==i})}},assignSyncMedium:function(o){for(n=!0;r.length;){var i=r;r=[],i.forEach(o)}r={push:function(a){return o(a)},filter:function(){return r}}},assignMedium:function(o){n=!0;var i=[];if(r.length){var a=r;r=[],a.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 FO(e){e===void 0&&(e={});var t=LO(null);return t.options=Cn({async:!0,ssr:!1},e),t}var O1=function(e){var t=e.sideCar,r=A1(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 w.createElement(n,Cn({},r))};O1.isSideCarExport=!0;function UO(e,t){return e.useMedium(t),O1}var M1=FO(),Nh=function(){},bf=w.forwardRef(function(e,t){var r=w.useRef(null),n=w.useState({onScrollCapture:Nh,onWheelCapture:Nh,onTouchMoveCapture:Nh}),s=n[0],o=n[1],i=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,g=e.sideCar,y=e.noRelative,b=e.noIsolation,m=e.inert,v=e.allowPinchZoom,h=e.as,p=h===void 0?"div":h,x=e.gapMode,S=A1(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=g,T=DO([r,t]),$=Cn(Cn({},S),s);return w.createElement(w.Fragment,null,d&&w.createElement(C,{sideCar:M1,removeScrollBar:u,shards:f,noRelative:y,noIsolation:b,inert:m,setCallbacks:o,allowPinchZoom:!!v,lockRef:r,gapMode:x}),i?w.cloneElement(w.Children.only(a),Cn(Cn({},$),{ref:T})):w.createElement(p,Cn({},$,{className:c,ref:T}),a))});bf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};bf.classNames={fullWidth:Pu,zeroRight:$u};var qO=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function VO(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=qO();return t&&e.setAttribute("nonce",t),e}function HO(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function KO(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var BO=function(){var e=0,t=null;return{add:function(r){e==0&&(t=VO())&&(HO(t,r),KO(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},WO=function(){var e=BO();return function(t,r){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},D1=function(){var e=WO(),t=function(r){var n=r.styles,s=r.dynamic;return e(n,s),null};return t},ZO={left:0,top:0,right:0,gap:0},jh=function(e){return parseInt(e||"",10)||0},GO=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[jh(r),jh(n),jh(s)]},QO=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return ZO;var t=GO(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])}},JO=D1(),Hi="data-scroll-locked",YO=function(e,t,r,n){var s=e.left,o=e.top,i=e.right,a=e.gap;return r===void 0&&(r="margin"),`
|
|
255
|
-
.`.concat(IO,` {
|
|
256
|
-
overflow: hidden `).concat(n,`;
|
|
257
|
-
padding-right: `).concat(a,"px ").concat(n,`;
|
|
258
|
-
}
|
|
259
|
-
body[`).concat(Hi,`] {
|
|
260
|
-
overflow: hidden `).concat(n,`;
|
|
261
|
-
overscroll-behavior: contain;
|
|
262
|
-
`).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
|
|
263
|
-
padding-left: `.concat(s,`px;
|
|
264
|
-
padding-top: `).concat(o,`px;
|
|
265
|
-
padding-right: `).concat(i,`px;
|
|
266
|
-
margin-left:0;
|
|
267
|
-
margin-top:0;
|
|
268
|
-
margin-right: `).concat(a,"px ").concat(n,`;
|
|
269
|
-
`),r==="padding"&&"padding-right: ".concat(a,"px ").concat(n,";")].filter(Boolean).join(""),`
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
.`).concat($u,` {
|
|
273
|
-
right: `).concat(a,"px ").concat(n,`;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
.`).concat(Pu,` {
|
|
277
|
-
margin-right: `).concat(a,"px ").concat(n,`;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
.`).concat($u," .").concat($u,` {
|
|
281
|
-
right: 0 `).concat(n,`;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
.`).concat(Pu," .").concat(Pu,` {
|
|
285
|
-
margin-right: 0 `).concat(n,`;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
body[`).concat(Hi,`] {
|
|
289
|
-
`).concat(AO,": ").concat(a,`px;
|
|
290
|
-
}
|
|
291
|
-
`)},rx=function(){var e=parseInt(document.body.getAttribute(Hi)||"0",10);return isFinite(e)?e:0},XO=function(){w.useEffect(function(){return document.body.setAttribute(Hi,(rx()+1).toString()),function(){var e=rx()-1;e<=0?document.body.removeAttribute(Hi):document.body.setAttribute(Hi,e.toString())}},[])},eM=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=n===void 0?"margin":n;XO();var o=w.useMemo(function(){return QO(s)},[s]);return w.createElement(JO,{styles:YO(o,!t,s,r?"":"!important")})},dm=!1;if(typeof window<"u")try{var Xc=Object.defineProperty({},"passive",{get:function(){return dm=!0,!0}});window.addEventListener("test",Xc,Xc),window.removeEventListener("test",Xc,Xc)}catch{dm=!1}var li=dm?{passive:!1}:!1,tM=function(e){return e.tagName==="TEXTAREA"},z1=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!tM(e)&&r[t]==="visible")},rM=function(e){return z1(e,"overflowY")},nM=function(e){return z1(e,"overflowX")},nx=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=L1(e,n);if(s){var o=F1(e,n),i=o[1],a=o[2];if(i>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},sM=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},oM=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},L1=function(e,t){return e==="v"?rM(t):nM(t)},F1=function(e,t){return e==="v"?sM(t):oM(t)},iM=function(e,t){return e==="h"&&t==="rtl"?-1:1},aM=function(e,t,r,n,s){var o=iM(e,window.getComputedStyle(t).direction),i=o*n,a=r.target,c=t.contains(a),u=!1,d=i>0,f=0,g=0;do{if(!a)break;var y=F1(e,a),b=y[0],m=y[1],v=y[2],h=m-v-o*b;(b||h)&&L1(e,a)&&(f+=h,g+=b);var p=a.parentNode;a=p&&p.nodeType===Node.DOCUMENT_FRAGMENT_NODE?p.host:p}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&Math.abs(f)<1||!d&&Math.abs(g)<1)&&(u=!0),u},eu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},sx=function(e){return[e.deltaX,e.deltaY]},ox=function(e){return e&&"current"in e?e.current:e},lM=function(e,t){return e[0]===t[0]&&e[1]===t[1]},cM=function(e){return`
|
|
292
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
293
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
294
|
-
`)},uM=0,ci=[];function dM(e){var t=w.useRef([]),r=w.useRef([0,0]),n=w.useRef(),s=w.useState(uM++)[0],o=w.useState(D1)[0],i=w.useRef(e);w.useEffect(function(){i.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var m=RO([e.lockRef.current],(e.shards||[]).map(ox),!0).filter(Boolean);return m.forEach(function(v){return v.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),m.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=w.useCallback(function(m,v){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var h=eu(m),p=r.current,x="deltaX"in m?m.deltaX:p[0]-h[0],S="deltaY"in m?m.deltaY:p[1]-h[1],C,T=m.target,$=Math.abs(x)>Math.abs(S)?"h":"v";if("touches"in m&&$==="h"&&T.type==="range")return!1;var O=nx($,T);if(!O)return!0;if(O?C=$:(C=$==="v"?"h":"v",O=nx($,T)),!O)return!1;if(!n.current&&"changedTouches"in m&&(x||S)&&(n.current=C),!C)return!0;var M=n.current||C;return aM(M,v,m,M==="h"?x:S)},[]),c=w.useCallback(function(m){var v=m;if(!(!ci.length||ci[ci.length-1]!==o)){var h="deltaY"in v?sx(v):eu(v),p=t.current.filter(function(C){return C.name===v.type&&(C.target===v.target||v.target===C.shadowParent)&&lM(C.delta,h)})[0];if(p&&p.should){v.cancelable&&v.preventDefault();return}if(!p){var x=(i.current.shards||[]).map(ox).filter(Boolean).filter(function(C){return C.contains(v.target)}),S=x.length>0?a(v,x[0]):!i.current.noIsolation;S&&v.cancelable&&v.preventDefault()}}},[]),u=w.useCallback(function(m,v,h,p){var x={name:m,delta:v,target:h,should:p,shadowParent:fM(h)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(S){return S!==x})},1)},[]),d=w.useCallback(function(m){r.current=eu(m),n.current=void 0},[]),f=w.useCallback(function(m){u(m.type,sx(m),m.target,a(m,e.lockRef.current))},[]),g=w.useCallback(function(m){u(m.type,eu(m),m.target,a(m,e.lockRef.current))},[]);w.useEffect(function(){return ci.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:g}),document.addEventListener("wheel",c,li),document.addEventListener("touchmove",c,li),document.addEventListener("touchstart",d,li),function(){ci=ci.filter(function(m){return m!==o}),document.removeEventListener("wheel",c,li),document.removeEventListener("touchmove",c,li),document.removeEventListener("touchstart",d,li)}},[]);var y=e.removeScrollBar,b=e.inert;return w.createElement(w.Fragment,null,b?w.createElement(o,{styles:cM(s)}):null,y?w.createElement(eM,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function fM(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const hM=UO(M1,dM);var wv=w.forwardRef(function(e,t){return w.createElement(bf,Cn({},e,{ref:t,sideCar:hM}))});wv.classNames=bf.classNames;var pM=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ui=new WeakMap,tu=new WeakMap,ru={},$h=0,U1=function(e){return e&&(e.host||U1(e.parentNode))},mM=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=U1(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})},gM=function(e,t,r,n){var s=mM(t,Array.isArray(e)?e:[e]);ru[r]||(ru[r]=new WeakMap);var o=ru[r],i=[],a=new Set,c=new Set(s),u=function(f){!f||a.has(f)||(a.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(a.has(g))d(g);else try{var y=g.getAttribute(n),b=y!==null&&y!=="false",m=(ui.get(g)||0)+1,v=(o.get(g)||0)+1;ui.set(g,m),o.set(g,v),i.push(g),m===1&&b&&tu.set(g,!0),v===1&&g.setAttribute(r,"true"),b||g.setAttribute(n,"true")}catch(h){console.error("aria-hidden: cannot operate on ",g,h)}})};return d(t),a.clear(),$h++,function(){i.forEach(function(f){var g=ui.get(f)-1,y=o.get(f)-1;ui.set(f,g),o.set(f,y),g||(tu.has(f)||f.removeAttribute(n),tu.delete(f)),y||f.removeAttribute(r)}),$h--,$h||(ui=new WeakMap,ui=new WeakMap,tu=new WeakMap,ru={})}},q1=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),s=pM(e);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live], script"))),gM(n,s,r,"aria-hidden")):function(){return null}},_f="Dialog",[V1,UV]=ls(_f),[vM,dn]=V1(_f),H1=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,a=w.useRef(null),c=w.useRef(null),[u,d]=Go({prop:n,defaultProp:s??!1,onChange:o,caller:_f});return l.jsx(vM,{scope:t,triggerRef:a,contentRef:c,contentId:Zs(),titleId:Zs(),descriptionId:Zs(),open:u,onOpenChange:d,onOpenToggle:w.useCallback(()=>d(f=>!f),[d]),modal:i,children:r})};H1.displayName=_f;var K1="DialogTrigger",yM=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=dn(K1,r),o=He(t,s.triggerRef);return l.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:ve(e.onClick,s.onOpenToggle)})});yM.displayName=K1;var xv="DialogPortal",[wM,B1]=V1(xv,{forceMount:void 0}),W1=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,o=dn(xv,t);return l.jsx(wM,{scope:t,forceMount:r,children:w.Children.map(n,i=>l.jsx(io,{present:r||o.open,children:l.jsx(cf,{asChild:!0,container:s,children:i})}))})};W1.displayName=xv;var Sd="DialogOverlay",Z1=w.forwardRef((e,t)=>{const r=B1(Sd,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=dn(Sd,e.__scopeDialog);return o.modal?l.jsx(io,{present:n||o.open,children:l.jsx(bM,{...s,ref:t})}):null});Z1.displayName=Sd;var xM=ma("DialogOverlay.RemoveScroll"),bM=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=dn(Sd,r);return l.jsx(wv,{as:xM,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(_e.div,{"data-state":_v(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),Jo="DialogContent",G1=w.forwardRef((e,t)=>{const r=B1(Jo,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=dn(Jo,e.__scopeDialog);return l.jsx(io,{present:n||o.open,children:o.modal?l.jsx(_M,{...s,ref:t}):l.jsx(SM,{...s,ref:t})})});G1.displayName=Jo;var _M=w.forwardRef((e,t)=>{const r=dn(Jo,e.__scopeDialog),n=w.useRef(null),s=He(t,r.contentRef,n);return w.useEffect(()=>{const o=n.current;if(o)return q1(o)},[]),l.jsx(Q1,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ve(e.onCloseAutoFocus,o=>{var i;o.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ve(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&o.preventDefault()}),onFocusOutside:ve(e.onFocusOutside,o=>o.preventDefault())})}),SM=w.forwardRef((e,t)=>{const r=dn(Jo,e.__scopeDialog),n=w.useRef(!1),s=w.useRef(!1);return l.jsx(Q1,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,a;(i=e.onCloseAutoFocus)==null||i.call(e,o),o.defaultPrevented||(n.current||(a=r.triggerRef.current)==null||a.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()}})}),Q1=w.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=e,a=dn(Jo,r),c=w.useRef(null),u=He(t,c);return I1(),l.jsxs(l.Fragment,{children:[l.jsx(yv,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(dc,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":_v(a.open),...i,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(kM,{titleId:a.titleId}),l.jsx(EM,{contentRef:c,descriptionId:a.descriptionId})]})]})}),bv="DialogTitle",J1=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=dn(bv,r);return l.jsx(_e.h2,{id:s.titleId,...n,ref:t})});J1.displayName=bv;var Y1="DialogDescription",X1=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=dn(Y1,r);return l.jsx(_e.p,{id:s.descriptionId,...n,ref:t})});X1.displayName=Y1;var eC="DialogClose",tC=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=dn(eC,r);return l.jsx(_e.button,{type:"button",...n,ref:t,onClick:ve(e.onClick,()=>s.onOpenChange(!1))})});tC.displayName=eC;function _v(e){return e?"open":"closed"}var rC="DialogTitleWarning",[qV,nC]=PR(rC,{contentName:Jo,titleName:bv,docsSlug:"dialog"}),kM=({titleId:e})=>{const t=nC(rC),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
295
|
-
|
|
296
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
297
|
-
|
|
298
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return w.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},CM="DialogDescriptionWarning",EM=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${nC(CM).contentName}}.`;return w.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},NM=H1,jM=W1,sC=Z1,oC=G1,iC=J1,aC=X1,$M=tC;const oi=NM,PM=jM,lC=w.forwardRef(({className:e,...t},r)=>l.jsx(sC,{ref:r,className:be("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}));lC.displayName=sC.displayName;const ao=w.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(PM,{children:[l.jsx(lC,{}),l.jsxs(oC,{ref:n,className:be("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,l.jsxs($M,{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:[l.jsx(gd,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ao.displayName=oC.displayName;const lo=({className:e,...t})=>l.jsx("div",{className:be("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});lo.displayName="DialogHeader";const co=w.forwardRef(({className:e,...t},r)=>l.jsx(iC,{ref:r,className:be("text-lg font-semibold leading-none tracking-tight",e),...t}));co.displayName=iC.displayName;const Pa=w.forwardRef(({className:e,...t},r)=>l.jsx(aC,{ref:r,className:be("text-sm text-muted-foreground",e),...t}));Pa.displayName=aC.displayName;const Be=w.forwardRef(({className:e,type:t,...r},n)=>l.jsx("input",{type:t,className:be("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}));Be.displayName="Input";const Bn=w.forwardRef(({className:e,...t},r)=>l.jsx("textarea",{className:be("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 TM="Label",cC=w.forwardRef((e,t)=>l.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())}}));cC.displayName=TM;var uC=cC;const RM=ff("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Oe=w.forwardRef(({className:e,...t},r)=>l.jsx(uC,{ref:r,className:be(RM(),e),...t}));Oe.displayName=uC.displayName;var IM=w.createContext(void 0);function Sv(e){const t=w.useContext(IM);return e||t||"ltr"}var Ph="rovingFocusGroup.onEntryFocus",AM={bubbles:!1,cancelable:!0},pc="RovingFocusGroup",[fm,dC,OM]=ev(pc),[MM,fC]=ls(pc,[OM]),[DM,zM]=MM(pc),hC=w.forwardRef((e,t)=>l.jsx(fm.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(fm.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(LM,{...e,ref:t})})}));hC.displayName=pc;var LM=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,g=w.useRef(null),y=He(t,g),b=Sv(o),[m,v]=Go({prop:i,defaultProp:a??null,onChange:c,caller:pc}),[h,p]=w.useState(!1),x=Ur(u),S=dC(r),C=w.useRef(!1),[T,$]=w.useState(0);return w.useEffect(()=>{const O=g.current;if(O)return O.addEventListener(Ph,x),()=>O.removeEventListener(Ph,x)},[x]),l.jsx(DM,{scope:r,orientation:n,dir:b,loop:s,currentTabStopId:m,onItemFocus:w.useCallback(O=>v(O),[v]),onItemShiftTab:w.useCallback(()=>p(!0),[]),onFocusableItemAdd:w.useCallback(()=>$(O=>O+1),[]),onFocusableItemRemove:w.useCallback(()=>$(O=>O-1),[]),children:l.jsx(_e.div,{tabIndex:h||T===0?-1:0,"data-orientation":n,...f,ref:y,style:{outline:"none",...e.style},onMouseDown:ve(e.onMouseDown,()=>{C.current=!0}),onFocus:ve(e.onFocus,O=>{const M=!C.current;if(O.target===O.currentTarget&&M&&!h){const U=new CustomEvent(Ph,AM);if(O.currentTarget.dispatchEvent(U),!U.defaultPrevented){const j=S().filter(H=>H.focusable),k=j.find(H=>H.active),L=j.find(H=>H.id===m),B=[k,L,...j].filter(Boolean).map(H=>H.ref.current);gC(B,d)}}C.current=!1}),onBlur:ve(e.onBlur,()=>p(!1))})})}),pC="RovingFocusGroupItem",mC=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:o,children:i,...a}=e,c=Zs(),u=o||c,d=zM(pC,r),f=d.currentTabStopId===u,g=dC(r),{onFocusableItemAdd:y,onFocusableItemRemove:b,currentTabStopId:m}=d;return w.useEffect(()=>{if(n)return y(),()=>b()},[n,y,b]),l.jsx(fm.ItemSlot,{scope:r,id:u,focusable:n,active:s,children:l.jsx(_e.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:ve(e.onMouseDown,v=>{n?d.onItemFocus(u):v.preventDefault()}),onFocus:ve(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:ve(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){d.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const h=qM(v,d.orientation,d.dir);if(h!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let x=g().filter(S=>S.focusable).map(S=>S.ref.current);if(h==="last")x.reverse();else if(h==="prev"||h==="next"){h==="prev"&&x.reverse();const S=x.indexOf(v.currentTarget);x=d.loop?VM(x,S+1):x.slice(S+1)}setTimeout(()=>gC(x))}}),children:typeof i=="function"?i({isCurrentTabStop:f,hasTabStop:m!=null}):i})})});mC.displayName=pC;var FM={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function UM(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function qM(e,t,r){const n=UM(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return FM[n]}function gC(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function VM(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var HM=hC,KM=mC,Sf="Tabs",[BM,VV]=ls(Sf,[fC]),vC=fC(),[WM,kv]=BM(Sf),yC=w.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:s,defaultValue:o,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=Sv(a),[f,g]=Go({prop:n,onChange:s,defaultProp:o??"",caller:Sf});return l.jsx(WM,{scope:r,baseId:Zs(),value:f,onValueChange:g,orientation:i,dir:d,activationMode:c,children:l.jsx(_e.div,{dir:d,"data-orientation":i,...u,ref:t})})});yC.displayName=Sf;var wC="TabsList",xC=w.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...s}=e,o=kv(wC,r),i=vC(r);return l.jsx(HM,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:n,children:l.jsx(_e.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});xC.displayName=wC;var bC="TabsTrigger",_C=w.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:s=!1,...o}=e,i=kv(bC,r),a=vC(r),c=CC(i.baseId,n),u=EC(i.baseId,n),d=n===i.value;return l.jsx(KM,{asChild:!0,...a,focusable:!s,active:d,children:l.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:ve(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?i.onValueChange(n):f.preventDefault()}),onKeyDown:ve(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(n)}),onFocus:ve(e.onFocus,()=>{const f=i.activationMode!=="manual";!d&&!s&&f&&i.onValueChange(n)})})})});_C.displayName=bC;var SC="TabsContent",kC=w.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:s,children:o,...i}=e,a=kv(SC,r),c=CC(a.baseId,n),u=EC(a.baseId,n),d=n===a.value,f=w.useRef(d);return w.useEffect(()=>{const g=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(g)},[]),l.jsx(io,{present:s||d,children:({present:g})=>l.jsx(_e.div,{"data-state":d?"active":"inactive","data-orientation":a.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})})});kC.displayName=SC;function CC(e,t){return`${e}-trigger-${t}`}function EC(e,t){return`${e}-content-${t}`}var ZM=yC,NC=xC,jC=_C,$C=kC;const GM=ZM,PC=w.forwardRef(({className:e,...t},r)=>l.jsx(NC,{ref:r,className:be("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));PC.displayName=NC.displayName;const hm=w.forwardRef(({className:e,...t},r)=>l.jsx(jC,{ref:r,className:be("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}));hm.displayName=jC.displayName;const pm=w.forwardRef(({className:e,...t},r)=>l.jsx($C,{ref:r,className:be("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));pm.displayName=$C.displayName;function _l(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function TC(e){return _l(e)&&typeof e.command=="string"}function Th(e){return!_l(e)||Object.keys(e).length===0?!1:Object.values(e).every(TC)}function QM(e){let t=e.trim();return t.startsWith("```")?t.replace(/^```(?:json)?\s*\n?/i,"").replace(/\n?```\s*$/,"").trim():t}function JM(e){if(!_l(e))throw new Error("Configuration must be a JSON object");if(_l(e.config)&&Th(e.config.mcpServers))return{mcpServers:e.config.mcpServers};if(Th(e.mcpServers))return{mcpServers:e.mcpServers};if(_l(e)&&typeof e.command=="string"){const t=typeof e.name=="string"&&e.name.trim()?e.name.trim():"local-server",{name:r,...n}=e;if(!TC(n))throw new Error("Missing or invalid command");return{mcpServers:{[t]:n}}}if(Th(e))return{mcpServers:e};throw new Error(`Invalid configuration: expected a top-level "mcpServers" object. Example:
|
|
299
|
-
{
|
|
300
|
-
"mcpServers": {
|
|
301
|
-
"google-drive": {
|
|
302
|
-
"command": "npx",
|
|
303
|
-
"args": ["-y", "@piotr-agier/google-drive-mcp"]
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}`)}function YM(e){let t;try{t=JSON.parse(QM(e))}catch(r){throw new Error(`Failed to parse JSON: ${r instanceof Error?r.message:"Unknown error"}`)}return JM(t)}function XM({type:e,open:t,onOpenChange:r}){const[n,s]=w.useState("remote"),[o,i]=w.useState("json"),[a,c]=w.useState(`{
|
|
307
|
-
"mcpServers": {
|
|
308
|
-
"memory": {
|
|
309
|
-
"command": "npx",
|
|
310
|
-
"args": ["-y", "@modelcontextprotocol/server-memory"],
|
|
311
|
-
"env": {
|
|
312
|
-
"MEMORY_FILE_PATH": "/path/to/custom/memory.json"
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}`),[u,d]=w.useState(null),[f,g]=w.useState(null),[y,b]=w.useState(null),[m,v]=w.useState({name:"",type:"mcp",url:"http://localhost:8000/mcp",description:"",headers_enabled:!1,headers:{},cardColor:wr}),[h,p]=w.useState(`{
|
|
317
|
-
|
|
318
|
-
}`),[x,S]=w.useState(null),[C,T]=w.useState({name:"",type:"local-mcp",command:"",args:[""],env:{},description:"",cardColor:wr}),[$,O]=w.useState({name:"",type:"a2a",manifest_url:"http://localhost:8001/.well-known/a2a/manifest.json",description:"",cardColor:wr}),M=vr(),{toast:U}=sr(),j=()=>{try{g(null);const _=YM(a),E=Object.entries(_.mcpServers);if(E.length===0)throw new Error("No MCP servers found in configuration");if(E.length>1)throw new Error("Multiple servers not supported. Please configure one server at a time.");const[D,K]=E[0],{command:Z,args:le,env:re,description:X}=K;if(!Z||typeof Z!="string")throw new Error("Missing or invalid command");if(!le||!Array.isArray(le))throw new Error("Missing or invalid args array");const ge={name:D,command:Z,args:le.map(String),env:re&&typeof re=="object"?re:void 0,description:X&&typeof X=="string"?X:void 0};d(ge),i("review"),T({name:ge.name,type:"local-mcp",command:ge.command,args:ge.args,env:ge.env||{},description:ge.description||"",cardColor:wr}),k(D)}catch(_){g(_ instanceof Error?_.message:"Failed to parse JSON"),d(null)}},k=async _=>{try{const K=((await ke("GET","/api/services")).data||[]).find(Z=>Z.name===_);b(K?_:null)}catch(E){console.error("Failed to check name conflict:",E)}},L=async _=>{await k(_)},P=Ct({mutationFn:async _=>{if(e==="mcp"&&n==="local"){const E={mcpServers:{[_.name]:{command:_.command,args:_.args.filter(D=>D.trim()!==""),...Object.keys(_.env).length>0&&{env:_.env}}}};return console.log("Importing local MCP server:",E),ke("POST","/api/local-mcp/import",{config:JSON.stringify(E)})}else{const E={name:_.name,type:e,url:e==="mcp"?_.url:_.manifest_url,description:_.description,cardColor:_.cardColor,..._.headers_enabled&&{headers:_.headers}};return console.log("Sending service data:",E),ke("POST","/api/services",E)}},onSuccess:()=>{M.invalidateQueries({queryKey:["/api/services"]}),M.invalidateQueries({queryKey:["/api/collection/warnings"]}),U({title:"Service registered successfully!",description:`${(e==="mcp"?n==="remote"?m:C:$).name} has been added to your collection.`}),H()},onError:_=>{var E;console.error("Registration failed:",_),console.error("Error details:",{message:_==null?void 0:_.message,name:_==null?void 0:_.name,stack:_==null?void 0:_.stack,toString:_==null?void 0:_.toString(),constructor:(E=_==null?void 0:_.constructor)==null?void 0:E.name}),U({title:"Registration failed",description:(_==null?void 0:_.message)||"Failed to register service. Please try again.",variant:"destructive"})}}),B=async()=>{if(e==="mcp"&&n==="local"){if(o==="json")j();else if(o==="review"){if(await L(C.name),y){U({title:"Name Conflict",description:`A service with the name "${C.name}" already exists. Please choose a different name.`,variant:"destructive"});return}P.mutate(C)}}else{const _=e==="mcp"?n==="remote"?m:C:$;if(await L(_.name),y){U({title:"Name Conflict",description:`A service with the name "${_.name}" already exists. Please choose a different name.`,variant:"destructive"});return}if(e==="mcp"&&n==="remote"&&m.headers_enabled){const E=V();if(E===null)return;P.mutate({...m,headers:E});return}P.mutate(_)}},H=()=>{i("json"),c(`{
|
|
319
|
-
"mcpServers": {
|
|
320
|
-
"memory": {
|
|
321
|
-
"command": "npx",
|
|
322
|
-
"args": ["-y", "@modelcontextprotocol/server-memory"],
|
|
323
|
-
"env": {
|
|
324
|
-
"MEMORY_FILE_PATH": "/path/to/custom/memory.json"
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}`),d(null),g(null),b(null),v({name:"",type:"mcp",url:"http://localhost:8000/mcp",description:"",headers_enabled:!1,headers:{},cardColor:wr}),p(`{
|
|
329
|
-
|
|
330
|
-
}`),S(null),T({name:"",type:"local-mcp",command:"",args:[""],env:{},description:"",cardColor:wr}),O({name:"",type:"a2a",manifest_url:"http://localhost:8001/.well-known/a2a/manifest.json",description:"",cardColor:wr}),r(!1)},G=(_,E)=>{v(D=>({...D,[_]:E}))},q=_=>{G("headers_enabled",_),_&&h.trim()===`{
|
|
331
|
-
|
|
332
|
-
}`&&p(`{
|
|
333
|
-
"Authorization": "Bearer "
|
|
334
|
-
}`),_||S(null)},V=()=>{const _=h.trim();if(!_||_==="{}")return{};try{const E=JSON.parse(_);if(typeof E!="object"||E===null||Array.isArray(E))return S('Headers must be a JSON object (e.g. {"Authorization": "Bearer token"})'),null;for(const[D,K]of Object.entries(E))if(typeof K!="string")return S(`Header "${D}" must be a string value`),null;return S(null),E}catch{return S("Invalid JSON — fix syntax before registering"),null}},z=(_,E)=>{T(D=>({...D,[_]:E}))},I=(_,E)=>{O(D=>({...D,[_]:E}))},F=()=>{if(e==="mcp"&&n==="local"){if(o==="json")return"Parse Configuration";if(o==="review")return y?"Register Anyway":"Register Service"}return"Register Service"},N=()=>{var _,E;if(e==="mcp"&&n==="local"){if(o==="json")return!a.trim();if(o==="review")return!C.name.trim()||!C.command.trim()}else{const D=e==="mcp"?n==="remote"?m:C:$;return!D.name.trim()||e==="mcp"&&n==="remote"&&!((_=D.url)!=null&&_.trim())||e==="a2a"&&!((E=D.manifest_url)!=null&&E.trim())}return!1};return l.jsx(oi,{open:t,onOpenChange:r,children:l.jsxs(ao,{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:[l.jsxs(lo,{children:[l.jsxs(co,{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"?l.jsx(pd,{className:"w-6 h-6 mr-3",style:{color:"#92E4DD"}}):l.jsx(C2,{className:"w-6 h-6 mr-3",style:{color:"#92E4DD"}}),"Register ",e==="mcp"?"MCP Server":"A2A Agent"]}),l.jsx(Pa,{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"?l.jsxs(GM,{value:n,onValueChange:_=>s(_),className:"w-full",children:[l.jsxs(PC,{className:"grid w-full grid-cols-2 bg-white/10 border border-white/20",children:[l.jsxs(hm,{value:"remote",className:"data-[state=active]:bg-white/20 data-[state=active]:text-white text-gray-400",children:[l.jsx(pd,{className:"w-4 h-4 mr-2"}),"Remote MCP"]}),l.jsxs(hm,{value:"local",className:"data-[state=active]:bg-white/20 data-[state=active]:text-white text-gray-400",children:[l.jsx(I2,{className:"w-4 h-4 mr-2"}),"Local MCP"]})]}),l.jsxs(pm,{value:"remote",className:"space-y-4 mt-4",children:[l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Server Name"}),l.jsx(Be,{id:"name",placeholder:"e.g., Database Tools",value:m.name,onChange:_=>{G("name",_.target.value),_.target.value.trim()?L(_.target.value):b(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-service-name"}),y&&l.jsxs("div",{className:"flex items-center gap-2 mt-1 text-red-400 text-sm",children:[l.jsx(tn,{className:"w-4 h-4"}),l.jsx("span",{children:"A service with this name already exists"})]})]}),l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"url",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"MCP URL"}),l.jsx(Be,{id:"url",type:"url",placeholder:"http://localhost:8080/mcp or https://mcp.notion.com/mcp",value:m.url,onChange:_=>G("url",_.target.value),className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-mcp-url"}),l.jsxs("div",{className:"mt-1 text-xs text-gray-400",children:[l.jsx("p",{children:"Supported formats:"}),l.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[l.jsxs("li",{children:["HTTP MCP: ",l.jsx("code",{children:"http://localhost:8080/mcp"})]}),l.jsxs("li",{children:["SSE MCP: ",l.jsx("code",{children:"https://be.omnimcp.ai/api/v1/mcp/.../sse"})]}),l.jsxs("li",{children:["Notion MCP: ",l.jsx("code",{children:"https://mcp.notion.com/mcp"})]})]})]})]}),l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),l.jsx(Bn,{id:"description",placeholder:"Brief description of capabilities...",value:m.description,onChange:_=>G("description",_.target.value),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-description"})]})]}),l.jsxs(pm,{value:"local",className:"space-y-4 mt-4",children:[o==="json"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"local-json",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Local MCP Configuration (JSON)"}),l.jsx(Bn,{id:"local-json",placeholder:`{
|
|
335
|
-
"mcpServers": {
|
|
336
|
-
"memory": {
|
|
337
|
-
"command": "npx",
|
|
338
|
-
"args": ["-y", "@modelcontextprotocol/server-memory"]
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}`,value:a,onChange:_=>c(_.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"}),l.jsxs("div",{className:"mt-2 text-xs text-gray-400",children:[l.jsx("p",{children:"Enter your local MCP server configuration in JSON format."}),l.jsx("p",{children:"Example:"}),l.jsx("pre",{className:"bg-white/10 p-2 rounded-md text-xs text-gray-300",children:`{
|
|
342
|
-
"mcpServers": {
|
|
343
|
-
"memory": {
|
|
344
|
-
"command": "npx",
|
|
345
|
-
"args": ["-y", "@modelcontextprotocol/server-memory"],
|
|
346
|
-
"env": {
|
|
347
|
-
"MEMORY_FILE_PATH": "/path/to/custom/memory.json"
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}`})]})]}),l.jsxs(ce,{type:"button",className:"flex-1 border",style:{background:"linear-gradient(135deg, #C4B643, #D4C760)",borderColor:"#C4B643",color:"#0A0A07"},onClick:j,disabled:!a.trim()||a.trim().length<10,"data-testid":"button-parse-json",children:[l.jsx(nm,{className:"w-4 h-4 mr-2",style:{color:"#0A0A07"}}),"Parse Configuration"]})]}),o==="review"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"local-name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Server Name"}),l.jsx(Be,{id:"local-name",placeholder:"e.g., Memory Server",value:C.name,onChange:_=>{z("name",_.target.value),_.target.value.trim()?L(_.target.value):b(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-local-service-name"}),y&&l.jsxs("div",{className:"mt-2 text-xs text-red-400 flex items-center",children:[l.jsx(tn,{className:"w-4 h-4 mr-1"}),'A service with the name "',y,'" already exists.']})]}),l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"command",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Command"}),l.jsx(Be,{id:"command",placeholder:"e.g., npx, python, node",value:C.command,onChange:_=>z("command",_.target.value),className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-command"}),l.jsx("div",{className:"mt-1 text-xs text-gray-400",children:"The command to execute (e.g., npx, python, node)"})]}),l.jsxs("div",{children:[l.jsx(Oe,{className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Arguments"}),C.args.map((_,E)=>l.jsxs("div",{className:"flex gap-2 mb-2",children:[l.jsx(Be,{placeholder:`Argument ${E+1}`,value:_,onChange:D=>{const K=[...C.args];K[E]=D.target.value,z("args",K)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-arg-${E}`}),E===C.args.length-1&&l.jsx(ce,{type:"button",size:"sm",onClick:()=>z("args",[...C.args,""]),className:"bg-white/20 hover:bg-white/30 text-white",children:l.jsx(Ds,{className:"w-4 h-4"})}),C.args.length>1&&l.jsx(ce,{type:"button",size:"sm",variant:"destructive",onClick:()=>{const D=C.args.filter((K,Z)=>Z!==E);z("args",D)},className:"bg-red-500/80 hover:bg-red-500 text-white",children:l.jsx(gd,{className:"w-4 h-4"})})]},E)),l.jsx("div",{className:"mt-1 text-xs text-gray-400",children:"Command arguments (e.g., -y, @modelcontextprotocol/server-memory)"})]}),l.jsxs("div",{children:[l.jsx(Oe,{className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Environment Variables"}),Object.entries(C.env).length===0?l.jsx("div",{className:"text-gray-400 text-sm italic",children:"No environment variables configured"}):l.jsx("div",{className:"space-y-2",children:Object.entries(C.env).map(([_,E],D)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Be,{placeholder:"Variable name",value:_,onChange:K=>{const Z={...C.env};delete Z[_],Z[K.target.value]=E,z("env",Z)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-env-key-${D}`}),l.jsx(Be,{placeholder:"Value",value:E,onChange:K=>{const Z={...C.env};Z[_]=K.target.value,z("env",Z)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-env-value-${D}`}),l.jsx(ce,{type:"button",size:"sm",variant:"destructive",onClick:()=>{const K={...C.env};delete K[_],z("env",K)},className:"bg-red-500/80 hover:bg-red-500 text-white",children:l.jsx(gd,{className:"w-4 h-4"})})]},D))}),l.jsxs(ce,{type:"button",size:"sm",onClick:()=>{const _={...C.env};_[""]="",z("env",_)},className:"mt-2 bg-white/20 hover:bg-white/30 text-white",children:[l.jsx(Ds,{className:"w-4 h-4 mr-2"}),"Add Environment Variable"]}),l.jsx("div",{className:"mt-1 text-xs text-gray-400",children:"Environment variables for the MCP server process"})]}),l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"local-description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),l.jsx(Bn,{id:"local-description",placeholder:"Brief description of capabilities...",value:C.description,onChange:_=>z("description",_.target.value),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-local-description"})]}),l.jsxs("div",{className:"flex gap-3",children:[l.jsx(ce,{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"}),l.jsxs(ce,{type:"button",variant:"ghost",className:`flex-1 border-2 hover:opacity-90 ${Sn}`,style:kn(wr),onClick:B,disabled:N(),"data-testid":"button-register",children:[l.jsx(Ds,{className:"w-4 h-4 mr-2"}),P.isPending?"Registering...":F()]})]})]}),o==="complete"&&l.jsxs("div",{className:"text-center py-8",children:[l.jsx(nm,{className:"w-16 h-16 text-green-500 mx-auto mb-4"}),l.jsx("h3",{className:"text-xl font-bold mb-2",style:{color:"#92E4DD"},children:"Local MCP Registered!"}),l.jsx("p",{className:"text-gray-400 mb-4",children:"Your local MCP server has been successfully registered."}),l.jsx(ce,{type:"button",className:"flex-1 border",style:{background:"linear-gradient(135deg, #C4B643, #D4C760)",borderColor:"#C4B643",color:"#0A0A07"},onClick:H,"data-testid":"button-close",children:"Close"})]})]})]}):l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Agent Name"}),l.jsx(Be,{id:"name",placeholder:"e.g., Code Assistant",value:$.name,onChange:_=>{I("name",_.target.value),_.target.value.trim()?L(_.target.value):b(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-service-name"}),y&&l.jsxs("div",{className:"flex items-center gap-2 mt-1 text-red-400 text-sm",children:[l.jsx(tn,{className:"w-4 h-4"}),l.jsx("span",{children:"A service with this name already exists"})]})]}),l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"manifest_url",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Manifest URL"}),l.jsx(Be,{id:"manifest_url",type:"url",placeholder:"http://localhost:8001/.well-known/a2a/manifest.json",value:$.manifest_url,onChange:_=>I("manifest_url",_.target.value),className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-manifest-url"})]}),l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),l.jsx(Bn,{id:"description",placeholder:"Brief description of capabilities...",value:$.description,onChange:_=>I("description",_.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"&&l.jsxs("div",{className:"space-y-4 border border-white/10 rounded-lg p-4",children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("input",{type:"checkbox",id:"headers_enabled",checked:m.headers_enabled,onChange:_=>q(_.target.checked),className:"rounded border-white/20 bg-white/10"}),l.jsx(Oe,{htmlFor:"headers_enabled",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"🔐 Authentication Required"})]}),l.jsx("div",{className:"text-xs text-gray-400",children:l.jsx("p",{children:"Enable this if your MCP server requires authentication (API keys, tokens, etc.)."})}),m.headers_enabled&&l.jsxs("div",{className:"space-y-3 pl-6",children:[l.jsxs("div",{className:"text-xs text-gray-400 mb-2",children:[l.jsx("p",{children:"Configure HTTP headers for authentication. Common examples:"}),l.jsxs("ul",{className:"list-disc list-inside ml-2 mt-1 space-y-1",children:[l.jsxs("li",{children:[l.jsx("code",{children:"Authorization: Bearer YOUR_TOKEN"})," - For API tokens"]}),l.jsxs("li",{children:[l.jsx("code",{children:"X-API-Key: YOUR_API_KEY"})," - For API keys"]}),l.jsxs("li",{children:[l.jsx("code",{children:"X-Custom-Header: value"})," - For custom headers"]})]})]}),l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"headers",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"HTTP Headers (JSON)"}),l.jsx(Bn,{id:"headers",placeholder:`{
|
|
352
|
-
"Authorization": "Bearer YOUR_TOKEN_HERE",
|
|
353
|
-
"X-API-Key": "YOUR_API_KEY_HERE"
|
|
354
|
-
}`,value:h,onChange:_=>{p(_.target.value),x&&S(null)},onBlur:()=>{h.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&&l.jsxs("p",{className:"text-red-400 text-xs mt-1 flex items-center gap-1",children:[l.jsx(tn,{className:"w-3 h-3 shrink-0"}),x]}),l.jsx("div",{className:"text-xs text-gray-400 mt-1",children:l.jsx("p",{children:"Enter headers as JSON. Keys are header names, values are header values."})})]})]})]}),f&&l.jsxs("div",{className:"text-red-400 text-sm mt-2",children:[l.jsx(tn,{className:"w-4 h-4 mr-1"}),f]}),y&&l.jsxs("div",{className:"text-red-400 text-sm mt-2",children:[l.jsx(tn,{className:"w-4 h-4 mr-1"}),'A service with the name "',y,'" already exists. You can register it anyway, but it might overwrite the existing one.']}),l.jsxs("div",{className:"flex space-x-3 pt-4",children:[l.jsx(ce,{type:"button",variant:"secondary",className:"flex-1 border text-white",style:{background:"#ad095e",borderColor:"#ad095e"},onClick:H,"data-testid":"button-cancel",children:"Cancel"}),!(e==="mcp"&&n==="local")&&l.jsxs(ce,{type:"button",variant:"ghost",className:`flex-1 border-2 hover:opacity-90 ${Sn}`,style:kn(wr),disabled:P.isPending||N(),"data-testid":"button-register",onClick:B,children:[l.jsx(Ds,{className:"w-4 h-4 mr-2"}),P.isPending?"Registering...":"Register Service"]})]})]})})}function e4({decks:e,editingDeckId:t,onSelectDeck:r,isLoading:n}){const[s,o]=w.useState(!1),[i,a]=w.useState({name:"",description:""}),c=vr(),{toast:u}=sr(),d=Ct({mutationFn:async v=>ke("POST","/api/decks",{name:v.name,description:v.description,isActive:!1}),onSuccess:async v=>{var p;const h=await v.json();c.invalidateQueries({queryKey:["/api/decks"]}),(p=h.data)!=null&&p.id&&r(h.data.id),u({title:"Deck created",description:`${i.name} has been created successfully.`}),o(!1),a({name:"",description:""})},onError:v=>{u({title:"Failed to create deck",description:v.message,variant:"destructive"})}}),f=Ct({mutationFn:async v=>ke("DELETE",`/api/decks/${v}`,{}),onSuccess:()=>{c.invalidateQueries({queryKey:["/api/decks"]}),u({title:"Deck deleted",description:"Your deck has been deleted successfully."})},onError:v=>{v.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:v.message,variant:"destructive"})}}),g=async(v,h)=>{v.stopPropagation();try{const x=await(await ke("GET",`/api/scope/manifest-template?deckId=${encodeURIComponent(h.id)}&name=${encodeURIComponent(h.name)}`)).json();await navigator.clipboard.writeText(x.data.content),u({title:"Copied deck.yaml snippet",description:"Paste into .agent-deck/deck.yaml in repos that use this deck."})}catch(p){u({title:"Failed to copy manifest",description:p instanceof Error?p.message:"Unknown error",variant:"destructive"})}},y=(v,h)=>{v.stopPropagation(),window.confirm("Are you sure you want to delete this deck? This action cannot be undone.")&&f.mutate(h)},b=v=>{v.preventDefault(),d.mutate(i)},m=v=>{var h,p,x;return(((h=v.services)==null?void 0:h.length)??0)+(((p=v.credentials)==null?void 0:p.length)??0)+(((x=v.playbooks)==null?void 0:x.length)??0)};return n?l.jsx("div",{className:"bg-black/40 backdrop-blur-md rounded-2xl border border-white/10 p-6 shadow-2xl",children:l.jsxs("div",{className:"animate-pulse space-y-4",children:[l.jsx("div",{className:"h-6 bg-white/10 rounded"}),l.jsx("div",{className:"space-y-3",children:Array.from({length:3}).map((v,h)=>l.jsx("div",{className:"h-16 bg-white/5 rounded-lg"},h))})]})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"h-full flex flex-col","data-testid":"deck-management-panel",children:[l.jsxs("h2",{className:"text-lg font-bold mb-3 flex items-center",children:[l.jsx(om,{className:"w-4 h-4 mr-2",style:{color:"#92E4DD"}}),l.jsx("span",{style:{color:"#92E4DD"},children:"My Decks"})]}),l.jsx("div",{className:"mb-3",children:l.jsxs(ce,{onClick:()=>o(!0),className:"w-full border text-sm py-2",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},"data-testid":"create-deck-button",children:[l.jsx(Ds,{className:"w-3 h-3 mr-2"}),"Add Deck"]})}),l.jsx("div",{className:"flex-1 overflow-y-auto",children:l.jsx("div",{className:"space-y-2",children:e.map(v=>{const h=v.id===t,p=m(v);return l.jsxs("div",{className:`p-2 rounded-lg border cursor-pointer transition-all relative group ${h?"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(v.id),"data-testid":`deck-item-${v.id}`,children:[l.jsxs("div",{className:"absolute top-1 right-1 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200",children:[l.jsx(ce,{size:"sm",variant:"secondary",className:"h-5 w-5 p-0",onClick:x=>g(x,v),title:"Copy .agent-deck/deck.yaml snippet",children:l.jsx(Mk,{className:"w-2 h-2"})}),l.jsx(ce,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:x=>y(x,v.id),title:"Delete deck",children:l.jsx(hf,{className:"w-2 h-2"})})]}),l.jsxs("div",{children:[l.jsx("h3",{className:`font-semibold text-sm pr-12 ${h?"text-yellow-300":"text-white"}`,children:v.name}),l.jsx("p",{className:"text-xs text-gray-400",children:p>0?`${p} cards`:"Empty"})]})]},v.id)})})})]}),l.jsx(oi,{open:s,onOpenChange:o,children:l.jsxs(ao,{className:"sm:max-w-md bg-gradient-to-br from-cosmic-900 to-cosmic-800 border border-white/20 text-white",children:[l.jsx(lo,{children:l.jsxs(co,{className:"text-xl font-bold flex items-center",children:[l.jsx(Ds,{className:"w-5 h-5 mr-2 text-purple-400"}),"Create New Deck"]})}),l.jsxs("form",{onSubmit:b,className:"space-y-4","data-testid":"form-create-deck",children:[l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"deckName",className:"text-sm font-semibold",children:"Deck Name"}),l.jsx(Be,{id:"deckName",placeholder:"e.g., Hiring stack",value:i.name,onChange:v=>a(h=>({...h,name:v.target.value})),className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-deck-name"})]}),l.jsxs("div",{children:[l.jsx(Oe,{htmlFor:"deckDescription",className:"text-sm font-semibold",children:"Description"}),l.jsx(Bn,{id:"deckDescription",placeholder:"Brief description of this deck...",value:i.description,onChange:v=>a(h=>({...h,description:v.target.value})),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-deck-description"})]}),l.jsxs("div",{className:"flex space-x-3 pt-4",children:[l.jsx(ce,{type:"button",variant:"secondary",className:"flex-1",onClick:()=>o(!1),"data-testid":"button-cancel-create",children:"Cancel"}),l.jsx(ce,{type:"submit",className:"flex-1 bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-700 hover:to-blue-700",disabled:d.isPending,"data-testid":"button-submit-create",children:d.isPending?"Creating...":"Create Deck"})]})]})]})})]})}function t4({open:e,onOpenChange:t}){const[r,n]=w.useState(""),[s,o]=w.useState(""),i=vr(),{toast:a}=sr(),c=Ct({mutationFn:async()=>ke("POST","/api/credentials",{label:r.trim(),value:s}),onSuccess:()=>{i.invalidateQueries({queryKey:["/api/credentials/vault"]}),i.invalidateQueries({queryKey:["/api/decks"]}),a({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=>{a({title:"Could not save API key",description:d.message,variant:"destructive"})}}),u=r.trim().length>0&&s.trim().length>0;return l.jsx(oi,{open:e,onOpenChange:t,children:l.jsxs(ao,{className:"sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]",children:[l.jsxs(lo,{children:[l.jsx(co,{className:"text-[#E8F6F4]",children:"Register API key"}),l.jsx(Pa,{className:"text-[#A8C4C0]",children:"Name the service and paste the key. Agent Deck handles the rest — stored in your vault, never shown again."})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"credential-name",className:"text-[#CFEAE6]",children:"Service name"}),l.jsx(Be,{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]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"credential-value",className:"text-[#CFEAE6]",children:"API key"}),l.jsx(Be,{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]"})]}),l.jsx(ce,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${Sn}`,style:kn(lr),onClick:()=>c.mutate(),disabled:!u||c.isPending,children:"Save to vault"})]})]})})}function r4({open:e,onOpenChange:t}){const[r,n]=w.useState(""),[s,o]=w.useState(""),[i,a]=w.useState(""),[c,u]=w.useState(""),[d,f]=w.useState(""),[g,y]=w.useState([]),[b,m]=w.useState([]),v=vr(),{toast:h}=sr(),{data:p}=dr({queryKey:["/api/credentials/vault"],enabled:e}),{data:x}=dr({queryKey:["/api/services"],enabled:e}),S=(p==null?void 0:p.data)??[],C=(x==null?void 0:x.data)??[],T=Ct({mutationFn:async()=>ke("POST","/api/playbooks",{title:r.trim(),body:s,triggers:i.split(",").map(M=>M.trim()).filter(Boolean),dependsOnCredentialIds:g,dependsOnServiceIds:b,exec:c.trim()||void 0,skill:d.trim()||void 0,autoDetectDependencies:!0}),onSuccess:()=>{v.invalidateQueries({queryKey:["/api/playbooks/vault"]}),h({title:"Playbook saved",description:`${r.trim()} is in your collection.`}),t(!1),n(""),o(""),a(""),u(""),f(""),y([]),m([])},onError:M=>{h({title:"Could not save playbook",description:M.message,variant:"destructive"})}}),$=(M,U,j)=>{j(M.includes(U)?M.filter(k=>k!==U):[...M,U])},O=r.trim().length>0&&s.trim().length>0;return l.jsx(oi,{open:e,onOpenChange:t,children:l.jsxs(ao,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto border-border bg-[#161612] text-[#E8F6F4]",children:[l.jsxs(lo,{children:[l.jsx(co,{children:"Register Playbook"}),l.jsxs(Pa,{className:"text-[#A8C4C0]",children:["Prefer"," ",l.jsx("span",{className:"font-mono text-xs",children:"register_playbook"})," /"," ",l.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."]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"playbook-title",children:"Title"}),l.jsx(Be,{id:"playbook-title",placeholder:"Hiring inbox, Ashby API guide…",value:r,onChange:M=>n(M.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"playbook-triggers",children:"Triggers (comma-separated)"}),l.jsx(Be,{id:"playbook-triggers",placeholder:"check inbox, review applicants",value:i,onChange:M=>a(M.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"playbook-body",children:"Instructions (markdown)"}),l.jsx(Bn,{id:"playbook-body",rows:8,placeholder:`# Steps
|
|
355
|
-
1. …
|
|
356
|
-
2. …`,value:s,onChange:M=>o(M.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-sm"})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{children:"Extra API key deps (optional)"}),l.jsx("p",{className:"text-xs text-gray-500",children:"Merged with auto-detected refs from content."}),l.jsx("div",{className:"max-h-28 overflow-y-auto rounded border border-white/10 p-2 space-y-1",children:S.length===0?l.jsx("p",{className:"text-xs text-gray-500",children:"No API keys registered yet."}):S.map(M=>l.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:g.includes(M.id),onChange:()=>$(g,M.id,y)}),M.label]},M.id))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{children:"Extra MCP deps (optional)"}),l.jsx("p",{className:"text-xs text-gray-500",children:"Merged with auto-detected refs from content."}),l.jsx("div",{className:"max-h-28 overflow-y-auto rounded border border-white/10 p-2 space-y-1",children:C.length===0?l.jsx("p",{className:"text-xs text-gray-500",children:"No MCP services registered yet."}):C.map(M=>l.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:b.includes(M.id),onChange:()=>$(b,M.id,m)}),M.name]},M.id))})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"playbook-exec",children:"Suggested exec (optional)"}),l.jsx(Be,{id:"playbook-exec",placeholder:"agent-deck exec --connections … -- uv run …",value:c,onChange:M=>u(M.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"playbook-skill",children:"Skill path hint (optional)"}),l.jsx(Be,{id:"playbook-skill",placeholder:".cursor/skills/…/SKILL.md",value:d,onChange:M=>f(M.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),l.jsx(ce,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${Sn}`,style:kn(Qr),onClick:()=>T.mutate(),disabled:!O||T.isPending,children:"Save to collection"})]})]})})}function n4({playbookId:e,open:t,onOpenChange:r}){const{data:n,isLoading:s}=dr({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 l.jsx(oi,{open:t,onOpenChange:r,children:l.jsxs(ao,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto border-border bg-[#161612] text-[#E8F6F4]",children:[l.jsxs(lo,{children:[l.jsx(co,{children:(o==null?void 0:o.title)??"Playbook"}),l.jsx(Pa,{className:"text-[#A8C4C0]",children:(o==null?void 0:o.id)??e})]}),s||!o?l.jsx("p",{className:"text-sm text-gray-400",children:"Loading…"}):l.jsxs("div",{className:"space-y-4 text-sm",children:[l.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"," ",l.jsx("span",{className:"font-mono text-xs",children:"update_playbook"})," — dependencies are re-detected from the content automatically."]}),o.triggers.length>0&&l.jsxs("div",{children:[l.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Triggers"}),l.jsx("p",{className:"text-gray-300",children:o.triggers.join(", ")})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Dependencies"}),o.dependencies.credentials.length===0&&o.dependencies.services.length===0&&i===0?l.jsx("p",{className:"text-gray-400",children:"None declared."}):l.jsxs("ul",{className:"space-y-1 text-gray-300",children:[o.dependencies.credentials.map(a=>l.jsxs("li",{children:["API key: ",a.label]},a.id)),o.dependencies.services.map(a=>l.jsxs("li",{children:["MCP: ",a.label]},a.id)),o.dependencies.missingCredentialIds.map(a=>l.jsxs("li",{className:"text-amber-300 flex items-center gap-1",children:[l.jsx(tn,{className:"w-3 h-3"})," Missing API key: ",a]},a)),o.dependencies.missingServiceIds.map(a=>l.jsxs("li",{className:"text-amber-300 flex items-center gap-1",children:[l.jsx(tn,{className:"w-3 h-3"})," Missing MCP: ",a]},a))]})]}),o.exec&&l.jsxs("div",{children:[l.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Suggested exec"}),l.jsx("pre",{className:"rounded bg-black/40 p-2 text-xs overflow-x-auto",children:o.exec})]}),o.skill&&l.jsxs("div",{children:[l.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Skill hint"}),l.jsx("p",{className:"font-mono text-xs text-gray-300",children:o.skill})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Instructions"}),l.jsx("div",{className:"rounded bg-black/30 p-3 whitespace-pre-wrap text-gray-200",children:o.body})]})]})]})})}function s4({credentialId:e,open:t,onOpenChange:r}){const n=vr(),{toast:s}=sr(),[o,i]=w.useState(""),[a,c]=w.useState(""),[u,d]=w.useState(""),{data:f,isLoading:g}=dr({queryKey:e?[`/api/credentials/${e}`]:["credential-detail-disabled"],enabled:t&&!!e}),y=f==null?void 0:f.data;w.useEffect(()=>{y&&(i(y.label),c(y.docsUrl??""),d(""))},[y==null?void 0:y.id,y==null?void 0:y.label,y==null?void 0:y.docsUrl]);const b=Ct({mutationFn:async()=>{if(!e)throw new Error("No credential selected");const v=o.trim();if(!v)throw new Error("Name is required");const h=a.trim();if(h)try{new URL(h)}catch{throw new Error("Documentation link must be a valid URL")}await ke("PUT",`/api/credentials/${e}`,{label:v,docsUrl:h}),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:v=>{s({title:"Could not save API key",description:v.message,variant:"destructive"})}}),m=o.trim().length>0&&(o.trim()!==(y==null?void 0:y.label)||a.trim()!==((y==null?void 0:y.docsUrl)??"")||u.trim().length>0);return l.jsx(oi,{open:t,onOpenChange:r,children:l.jsxs(ao,{className:"sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]",children:[l.jsxs(lo,{children:[l.jsx(co,{className:"text-[#E8F6F4]",children:(y==null?void 0:y.label)??"API key"}),l.jsx(Pa,{className:"font-mono text-xs text-[#A8C4C0]",children:(y==null?void 0:y.id)??e})]}),g||!y?l.jsx("p",{className:"text-sm text-gray-400",children:"Loading…"}):l.jsxs("div",{className:"space-y-4",children:[!y.hasSecret&&l.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:[l.jsx(tn,{className:"mt-0.5 h-4 w-4 shrink-0"}),l.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."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"credential-detail-name",className:"text-[#CFEAE6]",children:"Name"}),l.jsx(Be,{id:"credential-detail-name",value:o,onChange:v=>i(v.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"credential-detail-key",className:"text-[#CFEAE6]",children:y.hasSecret?"Rotate API key":"API key"}),l.jsx(Be,{id:"credential-detail-key",type:"password",placeholder:y.hasSecret?"Leave blank to keep current key":"Paste key from the service dashboard",value:u,onChange:v=>d(v.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"}),y.hasSecret&&l.jsx("p",{className:"text-xs text-[#6B8581]",children:"Stored securely in Keychain. Enter a new value only when rotating."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"credential-detail-docs",className:"text-[#CFEAE6]",children:"Documentation link"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Be,{id:"credential-detail-docs",type:"url",placeholder:"https://…",value:a,onChange:v=>c(v.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"}),a.trim()&&l.jsx(ce,{type:"button",variant:"outline",size:"icon",className:"shrink-0 border-white/15 bg-[#0F0F0C] text-[#A8C4C0] hover:bg-white/5",onClick:()=>window.open(a.trim(),"_blank","noopener,noreferrer"),title:"Open documentation",children:l.jsx(Gn,{className:"h-4 w-4"})})]})]}),l.jsx(ce,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${Sn}`,style:kn(lr),onClick:()=>b.mutate(),disabled:!m||b.isPending,children:b.isPending?"Saving…":"Save changes"})]})]})})}const o4=ff("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 mn({className:e,variant:t,...r}){return l.jsx("div",{className:be(o4({variant:t}),e),...r})}function RC(e){const t=w.useRef({value:e,previous:e});return w.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var kf="Checkbox",[i4,HV]=ls(kf),[a4,Cv]=i4(kf);function l4(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:s,disabled:o,form:i,name:a,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[g,y]=Go({prop:r,defaultProp:s??!1,onChange:c,caller:kf}),[b,m]=w.useState(null),[v,h]=w.useState(null),p=w.useRef(!1),x=b?!!i||!!b.closest("form"):!0,S={checked:g,disabled:o,setChecked:y,control:b,setControl:m,name:a,form:i,value:d,hasConsumerStoppedPropagationRef:p,required:u,defaultChecked:Gs(s)?!1:s,isFormControl:x,bubbleInput:v,setBubbleInput:h};return l.jsx(a4,{scope:t,...S,children:c4(f)?f(S):n})}var IC="CheckboxTrigger",AC=w.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},s)=>{const{control:o,value:i,disabled:a,checked:c,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:g,isFormControl:y,bubbleInput:b}=Cv(IC,e),m=He(s,d),v=w.useRef(c);return w.useEffect(()=>{const h=o==null?void 0:o.form;if(h){const p=()=>f(v.current);return h.addEventListener("reset",p),()=>h.removeEventListener("reset",p)}},[o,f]),l.jsx(_e.button,{type:"button",role:"checkbox","aria-checked":Gs(c)?"mixed":c,"aria-required":u,"data-state":LC(c),"data-disabled":a?"":void 0,disabled:a,value:i,...n,ref:m,onKeyDown:ve(t,h=>{h.key==="Enter"&&h.preventDefault()}),onClick:ve(r,h=>{f(p=>Gs(p)?!0:!p),b&&y&&(g.current=h.isPropagationStopped(),g.current||h.stopPropagation())})})});AC.displayName=IC;var Ev=w.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:s,defaultChecked:o,required:i,disabled:a,value:c,onCheckedChange:u,form:d,...f}=e;return l.jsx(l4,{__scopeCheckbox:r,checked:s,defaultChecked:o,disabled:a,required:i,onCheckedChange:u,name:n,form:d,value:c,internal_do_not_use_render:({isFormControl:g})=>l.jsxs(l.Fragment,{children:[l.jsx(AC,{...f,ref:t,__scopeCheckbox:r}),g&&l.jsx(zC,{__scopeCheckbox:r})]})})});Ev.displayName=kf;var OC="CheckboxIndicator",MC=w.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...s}=e,o=Cv(OC,r);return l.jsx(io,{present:n||Gs(o.checked)||o.checked===!0,children:l.jsx(_e.span,{"data-state":LC(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});MC.displayName=OC;var DC="CheckboxBubbleInput",zC=w.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:s,checked:o,defaultChecked:i,required:a,disabled:c,name:u,value:d,form:f,bubbleInput:g,setBubbleInput:y}=Cv(DC,e),b=He(r,y),m=RC(o),v=i1(n);w.useEffect(()=>{const p=g;if(!p)return;const x=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(x,"checked").set,T=!s.current;if(m!==o&&C){const $=new Event("click",{bubbles:T});p.indeterminate=Gs(o),C.call(p,Gs(o)?!1:o),p.dispatchEvent($)}},[g,m,o,s]);const h=w.useRef(Gs(o)?!1:o);return l.jsx(_e.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??h.current,required:a,disabled:c,name:u,value:d,form:f,...t,tabIndex:-1,ref:b,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});zC.displayName=DC;function c4(e){return typeof e=="function"}function Gs(e){return e==="indeterminate"}function LC(e){return Gs(e)?"indeterminate":e?"checked":"unchecked"}const FC=w.forwardRef(({className:e,...t},r)=>l.jsx(Ev,{ref:r,className:be("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:l.jsx(MC,{className:be("flex items-center justify-center text-current"),children:l.jsx(Ak,{className:"h-4 w-4"})})}));FC.displayName=Ev.displayName;const UC=w.forwardRef(({className:e,...t},r)=>l.jsx("div",{className:"relative w-full overflow-auto",children:l.jsx("table",{ref:r,className:be("w-full caption-bottom text-sm",e),...t})}));UC.displayName="Table";const qC=w.forwardRef(({className:e,...t},r)=>l.jsx("thead",{ref:r,className:be("[&_tr]:border-b",e),...t}));qC.displayName="TableHeader";const VC=w.forwardRef(({className:e,...t},r)=>l.jsx("tbody",{ref:r,className:be("[&_tr:last-child]:border-0",e),...t}));VC.displayName="TableBody";const u4=w.forwardRef(({className:e,...t},r)=>l.jsx("tfoot",{ref:r,className:be("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));u4.displayName="TableFooter";const ol=w.forwardRef(({className:e,...t},r)=>l.jsx("tr",{ref:r,className:be("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));ol.displayName="TableRow";const Tu=w.forwardRef(({className:e,...t},r)=>l.jsx("th",{ref:r,className:be("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));Tu.displayName="TableHead";const pi=w.forwardRef(({className:e,...t},r)=>l.jsx("td",{ref:r,className:be("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));pi.displayName="TableCell";const d4=w.forwardRef(({className:e,...t},r)=>l.jsx("caption",{ref:r,className:be("mt-4 text-sm text-muted-foreground",e),...t}));d4.displayName="TableCaption";function Rh(e){return new Set(e.filter(t=>t.enabled===!1).map(t=>t.name))}function f4({serviceId:e,tools:t,isLoading:r}){const[n,s]=w.useState(""),[o,i]=w.useState(null),[a,c]=w.useState(()=>Rh(t)),u=vr(),{toast:d}=sr(),f=w.useMemo(()=>t.map(p=>`${p.name}:${p.enabled===!1?"0":"1"}`).sort().join("\0"),[t]);w.useEffect(()=>{c(Rh(t))},[e,f]);const g=Ct({mutationFn:async p=>{await ke("PUT",`/api/services/${e}/tool-settings`,{disabledTools:p})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/services",e,"tools"]}),u.invalidateQueries({queryKey:["/api/services"]})},onError:p=>{d({title:"Could not save tool settings",description:p.message,variant:"destructive"}),c(Rh(t))}}),y=p=>{c(p),g.mutate([...p])},b=(p,x)=>{const S=new Set(a);x?S.delete(p):S.add(p),y(S)},m=p=>{if(p){y(new Set);return}y(new Set(t.map(x=>x.name)))},v=w.useMemo(()=>{const p=n.trim().toLowerCase();return p?t.filter(x=>x.name.toLowerCase().includes(p)||x.description.toLowerCase().includes(p)):t},[t,n]),h=t.length-a.size;return r?l.jsx("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:l.jsx("p",{className:"text-sm text-gray-400",children:"Loading tools…"})}):t.length===0?null:l.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[l.jsxs("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[l.jsxs("h3",{className:"text-lg font-semibold flex items-center",children:[l.jsx(md,{className:"w-5 h-5 mr-2"}),"Tools",l.jsxs("span",{className:"ml-2 text-sm font-normal text-gray-400",children:[h," of ",t.length," enabled"]})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(ce,{type:"button",size:"sm",variant:"ghost",className:"h-8 text-xs text-[#A8C4C0] hover:text-white hover:bg-white/10",onClick:()=>m(!0),disabled:a.size===0||g.isPending,children:"Enable all"}),l.jsx(ce,{type:"button",size:"sm",variant:"ghost",className:"h-8 text-xs text-[#A8C4C0] hover:text-white hover:bg-white/10",onClick:()=>m(!1),disabled:h===0||g.isPending,children:"Disable all"})]})]}),l.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."}),l.jsxs("div",{className:"relative mb-3",children:[l.jsx(Dk,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500"}),l.jsx(Be,{value:n,onChange:p=>s(p.target.value),placeholder:"Search tools…",className:"border-white/15 bg-[#0F0F0C] pl-9 text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),l.jsx("div",{className:"rounded-md border border-white/10 overflow-hidden",children:l.jsxs(UC,{children:[l.jsx(qC,{children:l.jsxs(ol,{className:"border-white/10 hover:bg-transparent",children:[l.jsx(Tu,{className:"w-[72px] text-center text-[#A8C4C0]",children:"Enabled"}),l.jsx(Tu,{className:"w-[220px] text-[#A8C4C0]",children:"Tool"}),l.jsx(Tu,{className:"text-[#A8C4C0]",children:"Description"})]})}),l.jsx(VC,{children:v.length===0?l.jsx(ol,{className:"border-white/10 hover:bg-transparent",children:l.jsx(pi,{colSpan:3,className:"py-8 text-center text-sm text-gray-400",children:"No tools match your search."})}):v.map(p=>{const x=!a.has(p.name),S=o===p.name,C=p.inputSchema&&Object.keys(p.inputSchema).length>0;return l.jsxs(w.Fragment,{children:[l.jsxs(ol,{className:`border-white/10 ${x?"hover:bg-white/5":"opacity-60 hover:bg-white/5"}`,children:[l.jsx(pi,{className:"text-center",children:l.jsx("div",{className:"flex justify-center",children:l.jsx(FC,{checked:x,onCheckedChange:T=>b(p.name,T===!0),disabled:g.isPending,"aria-label":`${x?"Disable":"Enable"} ${p.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]"})})}),l.jsx(pi,{children:C?l.jsxs("button",{type:"button",onClick:()=>i(S?null:p.name),className:"flex w-full items-center gap-1 text-left font-mono text-sm text-[#92E4DD] hover:text-white",children:[l.jsx(ov,{className:`h-4 w-4 shrink-0 transition-transform ${S?"rotate-180":""}`}),p.name]}):l.jsx("span",{className:"font-mono text-sm text-[#92E4DD]",children:p.name})}),l.jsx(pi,{className:"text-sm text-gray-300",children:p.description||"—"})]}),C&&S&&l.jsx(ol,{className:"border-white/10 bg-black/30 hover:bg-black/30",children:l.jsx(pi,{colSpan:3,className:"py-3",children:l.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(p.inputSchema,null,2)})})})]},p.name)})})]})})]})}function Ih({items:e,className:t}){return e.length===0?null:l.jsx("ol",{className:`list-decimal list-inside space-y-1 text-xs ${t??""}`,children:e.map((r,n)=>l.jsx("li",{children:r},`${n}-${r.slice(0,24)}`))})}function ix({serviceId:e,onConnected:t}){const{toast:r}=sr(),[n,s]=w.useState(""),[o,i]=w.useState(""),[a,c]=w.useState(!1),[u,d]=w.useState(!1),[f,g]=w.useState(!1),{data:y,isLoading:b}=dr({queryKey:["/api/oauth",e,"setup"],queryFn:async()=>{const C=await ke("GET",`/api/oauth/${e}/setup`),T=await C.json();if(!C.ok||!T.success)throw new Error(T.error||"Failed to load OAuth setup");return T.data},enabled:!!e}),m=y==null?void 0:y.guide,v=!!(y!=null&&y.hasSavedCredentials),h=()=>{if(!u||(m==null?void 0:m.setupMode)!=="manual")return;const C={};return n.trim()&&(C.clientId=n.trim()),o.trim()&&(C.clientSecret=o.trim()),C},p=async(C,T)=>{try{await navigator.clipboard.writeText(T),r({title:"Copied",description:`${C} copied to clipboard.`})}catch{r({title:"Copy failed",description:"Select and copy manually.",variant:"destructive"})}};w.useEffect(()=>{(m==null?void 0:m.setupMode)==="manual"?d(!0):d(!1),g(!v)},[m==null?void 0:m.setupMode,v]),w.useEffect(()=>{y!=null&&y.savedOAuthClientId&&!n&&s(y.savedOAuthClientId)},[y==null?void 0:y.savedOAuthClientId,n]);const x=async C=>{var T,$,O;c(!0);try{const M=await ke("POST",`/api/oauth/${e}/connect`,C??{}),U=await M.json();if(!M.ok||!U.success){((T=U.data)!=null&&T.needsCredentials||(($=U.data)==null?void 0:$.setupMode)==="manual")&&d(!0),r({title:"OAuth setup",description:U.error||"Could not start OAuth flow.",variant:"destructive"});return}(O=U.data)!=null&&O.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(M){r({title:"OAuth setup failed",description:M instanceof Error?M.message:"Unknown error",variant:"destructive"})}finally{c(!1)}};if(b)return l.jsx("p",{className:"text-sm text-orange-200",children:"Loading setup guide…"});if(!m)return null;if(m.setupMode==="unavailable")return l.jsxs("div",{className:"space-y-3 text-sm text-orange-100",children:[l.jsx("p",{children:m.unavailableReason}),m.docsUrl&&l.jsxs(ce,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(m.docsUrl,"_blank"),children:[l.jsx(Gn,{className:"w-4 h-4 mr-1"}),"Provider docs"]})]});const S=m.setupMode==="dynamic"||m.setupMode==="managed"||m.setupMode==="manual";return l.jsxs("div",{className:"space-y-4 text-sm text-orange-100",children:[l.jsxs("div",{children:[l.jsx("p",{className:"font-medium text-orange-200",children:m.title}),m.summary&&l.jsx("p",{className:"mt-1 text-xs text-orange-100/90",children:m.summary}),S&&l.jsxs("p",{className:"mt-2 text-xs text-orange-100/80",children:["Redirect URI:"," ",l.jsx("code",{className:"text-orange-50",children:m.redirectUri})]}),m.easierAlternative&&l.jsx("p",{className:"mt-2 text-xs text-orange-100/70 border-l-2 border-orange-500/30 pl-2",children:m.easierAlternative})]}),v&&m.setupMode==="manual"&&l.jsxs("div",{className:"rounded-lg border border-green-500/30 bg-green-500/10 p-3 text-xs text-green-100",children:[l.jsx("p",{className:"font-medium text-green-200",children:"OAuth credentials saved"}),l.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."})]}),m.prerequisites&&m.prerequisites.length>0&&!v&&l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium text-orange-200 mb-1",children:"Before you start"}),l.jsx("ul",{className:"list-disc list-inside space-y-1 text-xs text-orange-100/90",children:m.prerequisites.map(C=>l.jsx("li",{children:C},C))})]}),(m.manifestJson||m.createAppUrl||S)&&l.jsxs("div",{className:"flex flex-wrap gap-2",children:[m.manifestJson&&l.jsxs(ce,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>void p("App manifest",m.manifestJson),children:[l.jsx($2,{className:"w-4 h-4 mr-1"}),"Copy manifest"]}),S&&l.jsxs(ce,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>void p("Redirect URI",m.redirectUri),children:[l.jsx(Mk,{className:"w-4 h-4 mr-1"}),"Copy redirect URI"]}),m.createAppUrl&&l.jsxs(ce,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(m.createAppUrl,"_blank"),children:[l.jsx(Gn,{className:"w-4 h-4 mr-1"}),m.createAppLabel??"Open app creator"]})]}),m.steps.length>0&&l.jsx("div",{children:v&&m.setupMode==="manual"?l.jsxs("details",{className:"rounded-lg border border-orange-500/20 bg-orange-500/5 p-3",children:[l.jsx("summary",{className:"cursor-pointer text-xs font-medium text-orange-200",children:"First-time Slack app setup"}),l.jsx("div",{className:"mt-2",children:l.jsx(Ih,{items:m.steps})})]}):l.jsxs(l.Fragment,{children:[m.setupMode==="informational"?l.jsx("p",{className:"text-xs font-medium text-orange-200 mb-1",children:"What to do"}):null,l.jsx(Ih,{items:m.steps})]})}),m.tokenAlternative&&l.jsxs("p",{className:"text-xs text-orange-100/80 border-l-2 border-orange-500/30 pl-2",children:[l.jsx("span",{className:"font-medium text-orange-200",children:"Alternative: "}),m.tokenAlternative]}),u&&m.setupMode==="manual"&&l.jsxs("div",{className:"space-y-3 rounded-lg border border-orange-500/20 bg-orange-500/5 p-3",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(Oe,{htmlFor:`oauth-client-id-${e}`,className:"text-orange-200",children:"Client ID"}),l.jsx(Be,{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?l.jsxs("div",{className:"space-y-1",children:[l.jsx(Oe,{htmlFor:`oauth-client-secret-${e}`,className:"text-orange-200",children:"Client Secret"}),l.jsx(Be,{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"})]}):l.jsx("p",{className:"text-xs text-orange-200/80",children:"Client secret is saved locally for this service."}),v&&l.jsx(ce,{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"}),(y==null?void 0:y.hasStoredClientSecret)&&f&&l.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."})]}),m.afterConnect&&m.afterConnect.length>0&&l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium text-orange-200 mb-1",children:"After connect"}),l.jsx(Ih,{items:m.afterConnect,className:"text-orange-100/80"})]}),S&&l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsx(ce,{size:"sm",className:"bg-orange-600 hover:bg-orange-700",disabled:a||u&&m.setupMode==="manual"&&!v&&(!n.trim()||!o.trim()),onClick:()=>x(h()),children:a?"Connecting…":v&&m.setupMode==="manual"?"Reconnect":m.setupMode==="dynamic"||m.setupMode==="managed"?"Connect":"Connect with credentials"}),m.docsUrl&&l.jsxs(ce,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(m.docsUrl,"_blank"),children:[l.jsx(Gn,{className:"w-4 h-4 mr-1"}),"Docs"]})]}),m.setupMode==="informational"&&m.docsUrl&&l.jsxs(ce,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(m.docsUrl,"_blank"),children:[l.jsx(Gn,{className:"w-4 h-4 mr-1"}),"Docs"]})]})}function h4(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 p4({service:e,isOpen:t,onClose:r}){var Ve,fn,Tr,hn,xt,cs,ho,us,po,Ma,Mn,Uf,Da,za,La,se,jt,mo,go,Qy,Jy,Yy;const[n,s]=w.useState(null),[o,i]=w.useState(!1),[a,c]=w.useState(""),[u,d]=w.useState(!1),[f,g]=w.useState(!1),[y,b]=w.useState(!1),[m,v]=w.useState(""),[h,p]=w.useState(""),[x,S]=w.useState(!1),[C,T]=w.useState(!1),[$,O]=w.useState(null),M=vr(),{toast:U}=sr(),j=e&&($==null?void 0:$.id)===e.id?$:e,k=j,L=!!(k&&k.id&&k.url),{data:P,isLoading:B,error:H,refetch:G}=dr({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 Se=await(await ke("POST","/api/mcp/discover",{url:k.url})).json();return console.log(`✅ MCP discovery successful for ${k.url}:`,Se),Se}catch(ue){throw console.log(`❌ MCP discovery failed for ${k.url}:`,ue),ue}},enabled:L&&k.type==="mcp"&&t,staleTime:0,gcTime:2*60*1e3}),q=((fn=(Ve=P==null?void 0:P.data)==null?void 0:Ve.oauth)==null?void 0:fn.required)===!0,{data:V,refetch:z}=dr({queryKey:["/api/oauth",k==null?void 0:k.id,"status"],queryFn:async()=>{const ue=await ke("GET",`/api/oauth/${k.id}/status`),Se=await ue.json();if(!ue.ok||!Se.success)throw new Error(Se.error||"Failed to load OAuth status");return Se.data},enabled:L&&k.type==="mcp"&&t&&q,refetchInterval:ue=>{const Se=ue.state.data;return Se!=null&&Se.authenticated?!1:2e3}}),F=q?V!=null&&V.authenticated?{status:"authenticated",message:null}:V!=null&&V.hasToken&&(V!=null&&V.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:L,enabled:L&&k.type==="mcp"&&t,mcpDiscoveryLoading:B,mcpDiscoveryData:P?JSON.stringify(P,null,2):null,mcpDiscoveryDataKeys:P?Object.keys(P):null,oauthRequired:(hn=(Tr=P==null?void 0:P.data)==null?void 0:Tr.oauth)==null?void 0:hn.required,oauthData:(xt=P==null?void 0:P.data)!=null&&xt.oauth?JSON.stringify(P.data.oauth,null,2):null,toolsQueryEnabled:L&&k.type==="mcp"&&t&&!((ho=(cs=P==null?void 0:P.data)==null?void 0:cs.oauth)!=null&&ho.required)});const{data:N,isLoading:_,error:E,refetch:D}=dr({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 Se=await(await ke("GET",`/api/services/${k.id}/tools`)).json();return console.log(`✅ MCP tools discovery successful for ${k.id}:`,Se),Se}catch(ue){throw console.log(`❌ MCP tools discovery failed for ${k.id}:`,ue),ue}},enabled:L&&(k.type==="mcp"||k.type==="local-mcp")&&t&&(k.type==="local-mcp"||F.status==="authenticated"||F.status==="not_required"),staleTime:0,gcTime:2*60*1e3});w.useEffect(()=>{if(!t||!(k!=null&&k.id)||k.type!=="mcp"&&k.type!=="local-mcp"||!(k.type==="local-mcp"||F.status==="authenticated"||F.status==="not_required")||_||E)return;let Se=!1;return(async()=>{try{const Gt=await(await ke("GET",`/api/services/${k.id}`)).json();!Se&&(Gt!=null&&Gt.success)&&Gt.data&&O(Gt.data),M.invalidateQueries({queryKey:["/api/services"]})}catch{}})(),()=>{Se=!0}},[t,k==null?void 0:k.id,k==null?void 0:k.type,_,E,F.status,M]),w.useEffect(()=>{if(!t||!(k!=null&&k.id)||k.type!=="a2a")return;let ue=!1;return(async()=>{try{await ke("GET",`/api/services/${k.id}/health`);const Vt=await(await ke("GET",`/api/services/${k.id}`)).json();!ue&&(Vt!=null&&Vt.success)&&Vt.data&&O(Vt.data),M.invalidateQueries({queryKey:["/api/services"]})}catch{}})(),()=>{ue=!0}},[t,k==null?void 0:k.id,k==null?void 0:k.type,M]),console.log("MCP Tools Query Debug:",{hasValidService:L,apiServiceType:k==null?void 0:k.type,isOpen:t,oauthRequired:(po=(us=P==null?void 0:P.data)==null?void 0:us.oauth)==null?void 0:po.required,oauthStatus:F.status,toolsQueryEnabled:L&&(k.type==="mcp"||k.type==="local-mcp")&&t&&(k.type==="local-mcp"||F.status==="authenticated"||F.status==="not_required"),mcpToolsLoading:_});const{data:K,isLoading:Z,error:le}=dr({queryKey:["/api/proxy/a2a",k==null?void 0:k.id,"manifest"],queryFn:async()=>{if(!k||k.type!=="a2a")return null;const Se=await(await ke("GET",`/api/proxy/a2a/${k.id}/manifest`)).text();return JSON.parse(Se)},enabled:L&&k.type==="a2a"&&t,staleTime:0,gcTime:2*60*1e3}),re=(N==null?void 0:N.data)||[],X=K,ge=_||Z;console.log("ServiceDetailsModal Debug:",{service:e==null?void 0:e.id,serviceType:e==null?void 0:e.type,isOpen:t,mcpDiscoveryLoading:B,mcpDiscoveryData:P,mcpDiscoveryError:H?String(H):null,mcpToolsLoading:_,a2aManifestLoading:Z,mcpToolsError:E?String(E):null,a2aManifestError:le?String(le):null,mcpToolsCount:re.length,mcpToolsData:N,hasA2aManifest:!!X,isLoading:ge,oauthRequired:(Mn=(Ma=P==null?void 0:P.data)==null?void 0:Ma.oauth)==null?void 0:Mn.required,oauthStatus:F.status,oauthMessage:F.message,oauthAuthenticated:V==null?void 0:V.authenticated,expiresAt:V==null?void 0:V.expiresAt}),w.useEffect(()=>{if(!t){O(null);return}e&&(O(e),c(e.cardColor||"#92E4DD"),v(e.name||""),p(e.description||""))},[e,t]);const Le=w.useRef(!1);w.useEffect(()=>{if(!t||!(k!=null&&k.id)){Le.current=!1;return}if(!(V!=null&&V.authenticated)){Le.current=!1;return}if(Le.current)return;Le.current=!0,(async()=>{U({title:"OAuth completed",description:"Authentication successful! Refreshing service status..."}),M.invalidateQueries({queryKey:["/api/services",k.id]}),M.invalidateQueries({queryKey:["/api/mcp/discover",k.url]}),M.invalidateQueries({queryKey:["/api/collection-warnings"]});try{const Se=await ke("GET",`/api/services/${k.id}`);if(Se.ok){const ht=await Se.json();O(ht.data??ht)}}catch{}await G(),M.invalidateQueries({queryKey:["/api/services",k.id,"tools"]}),await D()})()},[V==null?void 0:V.authenticated,t,k==null?void 0:k.id]),w.useEffect(()=>{const ue=Se=>{const ht=Se.target;o&&!ht.closest(".color-picker-container")&&i(!1)};return document.addEventListener("mousedown",ue),()=>{document.removeEventListener("mousedown",ue)}},[o]);const gt=()=>(e==null?void 0:e.type)==="mcp"?l.jsx(Tw,{className:"w-6 h-6"}):l.jsx(wh,{className:"w-6 h-6"}),Y=()=>(e==null?void 0:e.type)==="mcp"?"text-blue-400":"text-purple-400",pe=()=>(e==null?void 0:e.type)==="mcp"?"bg-blue-500/20":"bg-purple-500/20",J=ue=>new Date(ue).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),Me=async ue=>{if(e){d(!0),c(ue);try{if((await ke("PUT",`/api/services/${e.id}`,{cardColor:ue})).ok)M.invalidateQueries({queryKey:["/api/services"]}),M.invalidateQueries({queryKey:["/api/collection/warnings"]}),M.invalidateQueries({queryKey:["/api/decks"]}),M.invalidateQueries({queryKey:["/api/decks"]}),U({title:"Color updated",description:"Card color has been updated successfully."}),i(!1);else throw new Error("Failed to update color")}catch{c(e.cardColor||"#92E4DD"),U({title:"Update failed",description:"Failed to update card color. Please try again.",variant:"destructive"})}finally{d(!1)}}},ie=async()=>{if(!(!e||!m.trim())){S(!0);try{if((await ke("PUT",`/api/services/${e.id}`,{name:m.trim()})).ok){if($){const Se={...$,name:m.trim()};O(Se)}M.invalidateQueries({queryKey:["/api/services"]}),M.invalidateQueries({queryKey:["/api/collection/warnings"]}),M.invalidateQueries({queryKey:["/api/decks"]}),M.invalidateQueries({queryKey:["/api/decks"]}),U({title:"Name updated",description:"Service name has been updated successfully."}),g(!1)}else throw new Error("Failed to update name")}catch{U({title:"Update failed",description:"Failed to update service name. Please try again.",variant:"destructive"})}finally{S(!1)}}},Ie=async()=>{if(e){T(!0);try{if((await ke("PUT",`/api/services/${e.id}`,{description:h.trim()})).ok){if($){const Se={...$,description:h.trim()};O(Se)}M.invalidateQueries({queryKey:["/api/services"]}),M.invalidateQueries({queryKey:["/api/collection/warnings"]}),M.invalidateQueries({queryKey:["/api/decks"]}),M.invalidateQueries({queryKey:["/api/decks"]}),U({title:"Description updated",description:"Service description has been updated successfully."}),b(!1)}else throw new Error("Failed to update description")}catch{U({title:"Update failed",description:"Failed to update service description. Please try again.",variant:"destructive"})}finally{T(!1)}}},Pe=[{value:"#92E4DD",label:"Default"},{value:"#F9386D",label:"Red"},{value:"#E0E0E0",label:"Gray"},{value:"#FF6B00",label:"Orange"}];return l.jsx(oi,{open:t,onOpenChange:r,children:l.jsxs(ao,{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:[l.jsx(lo,{children:l.jsxs(co,{className:"text-2xl font-bold flex items-center",children:[gt(),l.jsx("div",{className:"ml-3 flex items-center",children:f?l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:m,onChange:ue=>v(ue.target.value),onKeyDown:ue=>{ue.key==="Enter"?ie():ue.key==="Escape"&&(g(!1),v((j==null?void 0:j.name)||""))},className:"bg-black/30 border border-white/20 rounded px-2 py-1 text-white text-2xl font-bold focus:outline-none focus:border-white/40",autoFocus:!0}),l.jsx(ce,{size:"sm",onClick:ie,disabled:x,className:"h-6 px-2 text-xs",children:x?"Saving...":"Save"}),l.jsx(ce,{size:"sm",variant:"outline",onClick:()=>{g(!1),v((j==null?void 0:j.name)||"")},className:"h-6 px-2 text-xs",children:"Cancel"})]}):l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"cursor-pointer hover:bg-white/10 px-2 py-1 rounded transition-colors",onClick:()=>g(!0),title:"Click to edit name",children:j==null?void 0:j.name}),l.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>g(!0),className:"h-6 w-6 p-0 opacity-0 hover:opacity-100 transition-opacity",title:"Edit name",children:l.jsx(md,{className:"w-3 h-3"})})]})}),l.jsx(mn,{className:`ml-3 ${pe()} ${Y()}`,children:(Uf=e==null?void 0:e.type)==null?void 0:Uf.toUpperCase()})]})}),e&&l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsxs("h3",{className:"text-lg font-semibold flex items-center",children:[l.jsx(k2,{className:"w-5 h-5 mr-2"}),"Service Overview"]}),l.jsxs("div",{className:"relative color-picker-container",children:[l.jsx(ce,{size:"sm",variant:"outline",className:"h-8 w-8 p-0 border-white/20 hover:bg-white/10",onClick:()=>i(!o),title:"Change card color",children:l.jsx("div",{className:"w-4 h-4 rounded-full border border-white/20",style:{backgroundColor:a||e.cardColor||"#92E4DD"}})}),o&&l.jsxs("div",{className:"absolute top-full right-0 mt-2 bg-black/90 border border-white/20 rounded-lg p-3 z-50 min-w-32",children:[l.jsx("div",{className:"text-xs text-gray-300 mb-2",children:"Choose Color:"}),l.jsx("div",{className:"grid grid-cols-1 gap-1",children:Pe.map(ue=>l.jsxs("button",{className:`flex items-center gap-2 px-2 py-1 rounded text-xs hover:bg-white/10 transition-colors ${(a||e.cardColor)===ue.value?"bg-white/20":""}`,onClick:()=>Me(ue.value),disabled:u,children:[l.jsx("div",{className:"w-3 h-3 rounded-full border border-white/20",style:{backgroundColor:ue.value}}),l.jsx("span",{className:"text-white",children:ue.label}),u&&e.cardColor===ue.value&&l.jsx("div",{className:"ml-auto w-3 h-3 border border-white/20 border-t-transparent rounded-full animate-spin"})]},ue.value))})]})]})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsx("p",{className:"text-gray-300 text-sm",children:"Description"}),!y&&l.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>b(!0),className:"h-6 w-6 p-0 opacity-0 hover:opacity-100 transition-opacity",title:"Edit description",children:l.jsx(md,{className:"w-3 h-3"})})]}),y?l.jsxs("div",{className:"space-y-2",children:[l.jsx("textarea",{value:h,onChange:ue=>p(ue.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}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(ce,{size:"sm",onClick:Ie,disabled:C,className:"h-6 px-2 text-xs",children:C?"Saving...":"Save"}),l.jsx(ce,{size:"sm",variant:"outline",onClick:()=>{b(!1),p((j==null?void 0:j.description)||"")},className:"h-6 px-2 text-xs",children:"Cancel"})]})]}):l.jsx("p",{className:"text-white cursor-pointer hover:bg-white/10 px-2 py-1 rounded transition-colors",onClick:()=>b(!0),title:"Click to edit description",children:(j==null?void 0:j.description)||"No description"})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Endpoint"}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(mn,{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&&l.jsx(mn,{variant:"outline",className:"border-green-500/30 text-green-300",children:"Custom Headers"})]}),l.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>window.open(k.url,"_blank"),className:"p-1 h-auto",children:l.jsx(Gn,{className:"w-4 h-4"})})]}),l.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&&l.jsxs("div",{className:"text-xs text-gray-400 bg-black/20 p-2 rounded border border-white/10",children:[l.jsx("p",{className:"font-semibold mb-1",children:"Custom Headers:"}),l.jsx("pre",{className:"text-xs overflow-x-auto",children:JSON.stringify(e.headers,null,2)})]})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Health Status"}),l.jsx(mn,{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":F.status==="required"||F.status==="expired"?"Auth required":"Unknown"})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Registered"}),l.jsx("p",{className:"text-white text-sm",children:J(k.registeredAt)})]})]})]}),ge&&l.jsxs("div",{className:"text-center py-8",children:[l.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-white mx-auto mb-4"}),l.jsx("p",{className:"text-gray-400",children:"Fetching service details..."})]}),n&&l.jsx("div",{className:"bg-red-500/20 border border-red-500/30 rounded-lg p-4",children:l.jsx("p",{className:"text-red-300",children:n})}),(e.type==="mcp"||e.type==="local-mcp")&&l.jsxs(l.Fragment,{children:[e.type==="local-mcp"&&l.jsxs("div",{className:"bg-cyan-500/15 border border-cyan-500/30 rounded-lg p-4 mb-4",children:[l.jsx("h3",{className:"text-cyan-200 font-semibold mb-2",children:"Local MCP — auth happens outside Agent Deck"}),l.jsx("div",{className:"text-cyan-100/90 text-sm space-y-2",children:h4(k)?l.jsxs(l.Fragment,{children:[l.jsxs("p",{children:["This card runs ",l.jsx("code",{className:"text-xs",children:"@piotr-agier/google-drive-mcp"})," on your machine. Agent Deck does ",l.jsx("strong",{children:"not"}),' handle Google OAuth for it. If Google shows "app not verified", that is ',l.jsx("strong",{children:"your Google Cloud project"}),", not Agent Deck."]}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-1",children:[l.jsxs("li",{children:["Create a GCP OAuth client type ",l.jsx("strong",{children:"Desktop app"})," (not Web)."]}),l.jsxs("li",{children:["Add yourself as a ",l.jsx("strong",{children:"Test user"})," on the consent screen."]}),l.jsxs("li",{children:["Run in terminal first:"," ",l.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"
|
|
357
|
-
export GOOGLE_DRIVE_MCP_AUTH_PORT=3100
|
|
358
|
-
npx @piotr-agier/google-drive-mcp auth`})]}),l.jsxs("li",{children:["Set ",l.jsx("code",{className:"text-xs",children:"GOOGLE_DRIVE_MCP_TOKEN_PATH"})," in the card env to the same token file (",l.jsx("code",{className:"text-xs",children:"~/.config/google-drive-mcp/tokens.json"}),")."]})]}),l.jsxs("p",{className:"text-xs text-cyan-200/80",children:["Full steps: ",l.jsx("code",{className:"text-xs",children:"docs/GOOGLE_DRIVE_WORKAROUND.md"})," in the repo."]})]}):l.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."})})]}),l.jsx(f4,{serviceId:k.id,tools:re,isLoading:_})]}),e.type==="a2a"&&X&&l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[l.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center",children:[l.jsx(A2,{className:"w-5 h-5 mr-2"}),"Agent Overview"]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Agent Name"}),l.jsx("p",{className:"text-white font-semibold",children:X.name})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Version"}),l.jsx("p",{className:"text-white",children:X.version})]}),l.jsxs("div",{className:"md:col-span-2",children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Description"}),l.jsx("p",{className:"text-white",children:X.description})]}),X.provider&&l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Provider"}),l.jsx("p",{className:"text-white",children:X.provider.organization})]}),X.documentationUrl&&l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Documentation"}),l.jsxs(ce,{size:"sm",variant:"ghost",onClick:()=>window.open(X.documentationUrl,"_blank"),className:"p-1 h-auto text-purple-300",children:[l.jsx(Gn,{className:"w-4 h-4 mr-1"}),"View Docs"]})]})]})]}),X.capabilities&&l.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[l.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center",children:[l.jsx(Ik,{className:"w-5 h-5 mr-2"}),"Capabilities"]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[X.capabilities.streaming&&l.jsx(mn,{className:"bg-green-500/20 text-green-300",children:"Streaming"}),X.capabilities.pushNotifications&&l.jsx(mn,{className:"bg-blue-500/20 text-blue-300",children:"Push Notifications"}),X.capabilities.stateTransitionHistory&&l.jsx(mn,{className:"bg-purple-500/20 text-purple-300",children:"State History"})]})]}),X.skills&&X.skills.length>0&&l.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[l.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center",children:[l.jsx(wh,{className:"w-5 h-5 mr-2"}),"Skills (",X.skills.length,")"]}),l.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:X.skills.map((ue,Se)=>l.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:[l.jsx("div",{className:"absolute top-2 left-2 text-xs font-bold",children:l.jsx("div",{className:"text-purple-300 leading-none",children:"S"})}),l.jsx("div",{className:"absolute bottom-2 right-2 text-xs font-bold rotate-180",children:l.jsx("div",{className:"text-purple-300 leading-none",children:"S"})}),l.jsxs("div",{className:"absolute inset-x-3 top-8 bottom-8 flex flex-col items-center justify-center text-center",children:[l.jsx("div",{className:"text-purple-300 mb-2",children:l.jsx(wh,{className:"w-6 h-6"})}),l.jsx("h4",{className:"font-bold text-sm mb-2 line-clamp-2 text-white",children:ue.name}),l.jsx("p",{className:"text-gray-300 text-xs line-clamp-4 mb-2",children:ue.description}),ue.tags&&ue.tags.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1 justify-center",children:ue.tags.slice(0,2).map((ht,Vt)=>l.jsx("span",{className:"text-purple-300 text-xs bg-purple-500/20 px-1 py-0.5 rounded",children:ht},Vt))})]}),l.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"})]},Se))})]}),(X.defaultInputModes||X.defaultOutputModes)&&l.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[l.jsxs("h3",{className:"text-lg font-semibold mb-3 flex items-center",children:[l.jsx(Tw,{className:"w-5 h-5 mr-2"}),"Data Modes"]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[X.defaultInputModes&&l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-2",children:"Input Modes"}),l.jsx("div",{className:"flex flex-wrap gap-2",children:X.defaultInputModes.map((ue,Se)=>l.jsx(mn,{className:"bg-blue-500/20 text-blue-300 text-xs",children:ue},Se))})]}),X.defaultOutputModes&&l.jsxs("div",{children:[l.jsx("p",{className:"text-gray-300 text-sm mb-2",children:"Output Modes"}),l.jsx("div",{className:"flex flex-wrap gap-2",children:X.defaultOutputModes.map((ue,Se)=>l.jsx(mn,{className:"bg-green-500/20 text-green-300 text-xs",children:ue},Se))})]})]})]})]}),(e==null?void 0:e.type)==="mcp"&&F.status==="not_required"&&(k==null?void 0:k.id)&&l.jsxs("div",{className:"bg-blue-500/20 border border-blue-500/30 rounded-lg p-4 mb-4",children:[l.jsx("h3",{className:"text-blue-300 font-semibold mb-2",children:"How to connect"}),l.jsx(ix,{serviceId:k.id})]}),(e==null?void 0:e.type)==="mcp"&&F.status!=="authenticated"&&F.status!=="not_required"&&l.jsxs("div",{className:`${F.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:[l.jsx("h3",{className:`${F.status==="expired"?"text-red-300":"text-orange-300"} font-semibold mb-2`,children:F.status==="expired"?"⏰ Token Expired":"🔐 Authentication Required"}),l.jsxs("div",{className:`${F.status==="expired"?"text-red-200":"text-orange-200"} text-sm space-y-2`,children:[l.jsx("p",{children:l.jsx("strong",{children:F.message})}),l.jsx("p",{children:F.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)&&l.jsx(ix,{serviceId:k.id,onConnected:()=>void z()}),((za=(Da=P==null?void 0:P.data)==null?void 0:Da.oauth)==null?void 0:za.resourceName)&&l.jsx("div",{className:"mt-3 p-2 bg-orange-500/10 rounded border border-orange-500/20 text-xs text-orange-100",children:l.jsxs("p",{children:[l.jsx("strong",{children:"Resource:"})," ",P.data.oauth.resourceName]})})]})]}),(e==null?void 0:e.type)==="mcp"&&l.jsxs("div",{className:"bg-gray-800/50 border border-gray-600/30 rounded-lg p-4 mb-4",children:[l.jsx("h3",{className:"text-gray-300 font-semibold mb-2",children:"Connection Logs"}),l.jsxs("div",{className:"text-gray-200 text-sm space-y-2",children:[l.jsxs("div",{className:"bg-black/30 p-2 rounded text-xs",children:[l.jsx("p",{children:l.jsx("strong",{children:"🔍 Attempting to discover tools for MCP service:"})}),l.jsxs("p",{children:["Service ID: ",e==null?void 0:e.id]}),l.jsxs("p",{children:["Service URL: ",k==null?void 0:k.url]}),l.jsxs("p",{children:["Status: ",_?"🔄 Loading...":E?"❌ Failed":"✅ Complete"]})]}),_&&l.jsxs("div",{className:"bg-yellow-500/20 p-2 rounded text-xs",children:[l.jsxs("p",{children:["🔄 Making HTTP request to: ",l.jsxs("code",{children:["GET /api/services/",e==null?void 0:e.id,"/tools"]})]}),l.jsxs("p",{children:["Target MCP server: ",l.jsx("code",{children:k==null?void 0:k.url})]})]}),E&&l.jsxs("div",{className:"bg-red-500/20 p-2 rounded text-xs",children:[l.jsx("p",{children:"❌ Request failed:"}),l.jsx("pre",{className:"whitespace-pre-wrap overflow-x-auto",children:E instanceof Error?E.message:String(E)}),l.jsxs("div",{className:"mt-2 p-2 bg-black/30 rounded",children:[l.jsx("p",{children:l.jsx("strong",{children:"🔍 What we tried:"})}),l.jsxs("p",{children:["• Service ID: ",e==null?void 0:e.id]}),l.jsxs("p",{children:["• Target URL: ",k==null?void 0:k.url]}),l.jsxs("p",{children:["• Request: GET /api/services/",e==null?void 0:e.id,"/tools"]}),(k==null?void 0:k.headers)&&l.jsxs("div",{children:[l.jsx("p",{children:l.jsx("strong",{children:"📋 Headers sent:"})}),l.jsx("pre",{className:"text-xs overflow-x-auto",children:JSON.stringify(k.headers,null,2)})]}),l.jsxs("div",{className:"mt-2",children:[l.jsx("p",{children:l.jsx("strong",{children:"💡 What this means:"})}),l.jsxs("p",{children:["• The MCP server at ",k==null?void 0:k.url," returned an error"]}),l.jsx("p",{children:"• This could be due to authentication issues, server being down, or invalid configuration"}),l.jsx("p",{children:"• Check the error message above for specific details from the MCP server"})]})]})]}),!_&&!E&&re.length>0&&l.jsx("div",{className:"bg-green-500/20 p-2 rounded text-xs",children:l.jsxs("p",{children:["✅ Successfully discovered ",re.length," tools from MCP server"]})}),!_&&!E&&re.length===0&&l.jsxs("div",{className:"bg-yellow-500/20 p-2 rounded text-xs",children:[l.jsx("p",{children:"⚠️ Connected to MCP server but no tools were found"}),l.jsx("p",{children:"This could mean the server has no tools or requires specific authentication"})]})]})]}),E&&(e.type==="mcp"||e.type==="local-mcp")&&l.jsxs("div",{className:"bg-red-500/20 border border-red-500/30 rounded-lg p-4",children:[l.jsx("h3",{className:"text-red-300 font-semibold mb-2",children:"MCP Tool Discovery Failed"}),l.jsxs("div",{className:"text-red-200 text-sm space-y-2",children:[l.jsx("p",{children:l.jsx("strong",{children:"Raw Error:"})}),l.jsx("pre",{className:"bg-black/30 p-2 rounded text-xs overflow-x-auto whitespace-pre-wrap",children:E instanceof Error?E.message:String(E)}),l.jsxs("p",{children:[l.jsx("strong",{children:"Service URL:"})," ",k==null?void 0:k.url]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Service ID:"})," ",k==null?void 0:k.id]}),(k==null?void 0:k.headers)&&l.jsxs("div",{children:[l.jsx("p",{children:l.jsx("strong",{children:"Custom Headers:"})}),l.jsx("pre",{className:"bg-black/30 p-2 rounded text-xs overflow-x-auto",children:JSON.stringify(k.headers,null,2)})]})]})]}),le&&e.type==="a2a"&&l.jsxs("div",{className:"bg-red-500/20 border border-red-500/30 rounded-lg p-4",children:[l.jsx("h3",{className:"text-red-300 font-semibold mb-2",children:"A2A Manifest Discovery Failed"}),l.jsxs("div",{className:"text-red-200 text-sm space-y-2",children:[l.jsx("p",{children:l.jsx("strong",{children:"Raw Error:"})}),l.jsx("pre",{className:"bg-black/30 p-2 rounded text-xs overflow-x-auto whitespace-pre-wrap",children:le instanceof Error?le.message:String(le)}),l.jsxs("p",{children:[l.jsx("strong",{children:"Service URL:"})," ",k==null?void 0:k.url]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Service ID:"})," ",k==null?void 0:k.id]})]})]}),!ge&&!E&&!le&&(e.type==="mcp"||e.type==="local-mcp")&&re.length===0&&(e.type==="local-mcp"||!((se=(La=P==null?void 0:P.data)==null?void 0:La.oauth)!=null&&se.required))&&l.jsxs("div",{className:"bg-yellow-500/20 border border-yellow-500/30 rounded-lg p-4",children:[l.jsx("h3",{className:"text-yellow-300 font-semibold mb-2",children:"No Tools Available"}),l.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."]}),l.jsxs("div",{className:"text-yellow-200 text-xs mt-2",children:[l.jsx("p",{children:l.jsx("strong",{children:"This could mean:"})}),l.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[l.jsx("li",{children:"The MCP server has no tools registered"}),l.jsx("li",{children:"Tools require specific authentication"}),l.jsx("li",{children:"Tools are only available after certain operations"})]})]})]}),(e.type==="mcp"||e.type==="local-mcp")&&l.jsxs("div",{className:"bg-blue-500/20 border border-blue-500/30 rounded-lg p-4",children:[l.jsx("h3",{className:"text-blue-300 font-semibold mb-2",children:"🔍 MCP Server Analysis"}),l.jsxs("div",{className:"text-blue-200 text-sm space-y-2",children:[l.jsxs("p",{children:[l.jsx("strong",{children:"Server URL:"})," ",k==null?void 0:k.url]}),B&&l.jsx("div",{className:"mt-3 p-3 bg-black/30 rounded",children:l.jsx("p",{children:"🔍 Analyzing MCP server configuration..."})}),P&&l.jsxs("div",{className:"mt-3 p-3 bg-black/30 rounded",children:[l.jsx("p",{children:l.jsx("strong",{children:"🔍 What we discovered:"})}),P.error&&P.analysis&&l.jsxs("div",{className:"text-yellow-200",children:[P.analysis.auth_type==="oauth2"&&l.jsxs("div",{children:[l.jsxs("p",{children:["• ",l.jsx("strong",{children:"OAuth 2.0 Authentication Required"})]}),l.jsx("p",{children:"• This MCP server requires OAuth 2.0 Bearer token authentication"}),l.jsx("p",{children:"• You'll need to provide OAuth credentials (client ID, client secret, authorization URL, token URL)"}),l.jsx("p",{children:"• Check the service provider's documentation for OAuth setup instructions"})]}),P.analysis.protocol==="sse"&&l.jsxs("div",{children:[l.jsxs("p",{children:["• ",l.jsx("strong",{children:"SSE Protocol Required"})]}),l.jsx("p",{children:"• This MCP server uses Server-Sent Events (SSE) protocol"}),l.jsx("p",{children:"• We'll need to connect using event streaming instead of HTTP"})]}),P.analysis.issue==="not_found"&&l.jsxs("div",{children:[l.jsxs("p",{children:["• ",l.jsx("strong",{children:"Server Not Found"})]}),l.jsx("p",{children:"• The MCP server URL might be incorrect"}),l.jsx("p",{children:"• Check if the server is running and the URL is correct"})]}),P.analysis.issue==="server_error"&&l.jsxs("div",{children:[l.jsxs("p",{children:["• ",l.jsx("strong",{children:"Server Error"})]}),l.jsx("p",{children:"• The MCP server is experiencing internal errors"}),l.jsx("p",{children:"• Try again later or contact the service provider"})]}),P.analysis.message&&l.jsxs("p",{children:["• ",l.jsx("strong",{children:"Analysis:"})," ",P.analysis.message]})]}),((mo=(jt=P==null?void 0:P.data)==null?void 0:jt.oauth)==null?void 0:mo.required)&&l.jsxs("div",{className:"text-yellow-200",children:[l.jsxs("p",{children:["• ",l.jsx("strong",{children:"OAuth 2.0 Authentication Required"})]}),P.data.oauth.authorizationUrl&&l.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[l.jsx(ce,{size:"sm",variant:"default",className:"h-7",onClick:async()=>{var ue,Se;if(k!=null&&k.id)try{U({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const ht=await ke("POST",`/api/oauth/${k.id}/auto-setup`,{});if(!ht.ok){const Gt=await ht.json();(ue=Gt.data)!=null&&ue.registrationUrl?(window.open(Gt.data.registrationUrl,"_blank"),U({title:"OAuth Registration Required",description:`${Gt.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):U({title:"OAuth Setup Failed",description:Gt.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Vt=await ht.json();Vt.success&&((Se=Vt.data)!=null&&Se.authorizationUrl)?(window.open(Vt.data.authorizationUrl,"_blank"),U({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),z()):U({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(ht){U({title:"OAuth Setup Failed",description:ht instanceof Error?ht.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),l.jsxs(ce,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(P.data.oauth.authorizationUrl,"_blank"),children:[l.jsx(Gn,{className:"w-4 h-4 mr-1"}),"Open Raw Authorization URL"]})]}),!P.data.oauth.authorizationUrl&&P.data.oauth.protectedResourceConfigUrl&&l.jsx("div",{className:"mt-2",children:l.jsxs(ce,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(P.data.oauth.protectedResourceConfigUrl,"_blank"),children:[l.jsx(Gn,{className:"w-4 h-4 mr-1"}),"View OAuth Configuration"]})}),P.data.oauth.authorizationServerMetadataUrl&&l.jsxs("div",{className:"mt-2 text-xs text-gray-300",children:[l.jsx("span",{className:"mr-1",children:"Auth Server Metadata:"}),l.jsx("button",{className:"underline text-blue-300",onClick:()=>window.open(P.data.oauth.authorizationServerMetadataUrl,"_blank"),children:P.data.oauth.authorizationServerMetadataUrl})]})]}),(P==null?void 0:P.success)&&!((Qy=(go=P==null?void 0:P.data)==null?void 0:go.oauth)!=null&&Qy.required)&&l.jsxs("div",{className:"text-green-200",children:[l.jsxs("p",{children:["• ",l.jsx("strong",{children:"✅ Server Analysis Complete"})]}),l.jsx("p",{children:"• MCP server is accessible and responding"}),l.jsx("p",{children:"• No authentication issues detected"}),l.jsx("p",{children:"• Protocol compatibility confirmed"})]}),((Yy=(Jy=P==null?void 0:P.data)==null?void 0:Jy.oauth)==null?void 0:Yy.required)&&l.jsxs("div",{className:"text-orange-200",children:[l.jsxs("p",{children:["• ",l.jsx("strong",{children:"🔐 OAuth 2.0 Authentication Required"})]}),l.jsx("p",{children:"• This MCP server requires OAuth authentication"}),P.data.oauth.resourceName&&l.jsxs("p",{children:["• Service: ",P.data.oauth.resourceName]}),P.data.oauth.authorizationUrl&&l.jsxs("p",{children:["• Authorization URL: ",P.data.oauth.authorizationUrl]}),P.data.oauth.tokenUrl&&l.jsxs("p",{children:["• Token URL: ",P.data.oauth.tokenUrl]}),l.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[l.jsx(ce,{size:"sm",variant:"default",className:"bg-orange-600 hover:bg-orange-700",onClick:async()=>{var ue,Se;if(k!=null&&k.id)try{U({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const ht=await ke("POST",`/api/oauth/${k.id}/auto-setup`,{});if(!ht.ok){const Gt=await ht.json();(ue=Gt.data)!=null&&ue.registrationUrl?(window.open(Gt.data.registrationUrl,"_blank"),U({title:"OAuth Registration Required",description:`${Gt.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):U({title:"OAuth Setup Failed",description:Gt.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const Vt=await ht.json();Vt.success&&((Se=Vt.data)!=null&&Se.authorizationUrl)?(window.open(Vt.data.authorizationUrl,"_blank"),U({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),z()):U({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(ht){U({title:"OAuth Setup Failed",description:ht instanceof Error?ht.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),l.jsx(ce,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-300 hover:bg-orange-500/10",onClick:()=>{const ue=`OAuth Setup Instructions:
|
|
359
|
-
|
|
360
|
-
1. Go to the service provider's OAuth/Developer settings
|
|
361
|
-
2. Create a new OAuth application
|
|
362
|
-
3. Set Redirect URL: http://localhost:8000/api/oauth/${k==null?void 0:k.id}/callback
|
|
363
|
-
4. Copy the Client ID and Client Secret
|
|
364
|
-
5. Edit this service and add the credentials
|
|
365
|
-
|
|
366
|
-
${P.data.oauth.authorizationUrl?`Authorization URL: ${P.data.oauth.authorizationUrl}`:""}
|
|
367
|
-
${P.data.oauth.tokenUrl?`Token URL: ${P.data.oauth.tokenUrl}`:""}
|
|
368
|
-
${P.data.oauth.issuer?`Issuer: ${P.data.oauth.issuer}`:""}`;U({title:"OAuth Setup Instructions",description:ue,duration:1e4})},children:"📋 Setup Instructions"})]})]}),l.jsxs("div",{className:"mt-2 text-xs",children:[l.jsx("p",{children:l.jsx("strong",{children:"💡 Next Steps:"})}),l.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[l.jsx("li",{children:"For OAuth servers: Provide OAuth credentials in service settings"}),l.jsx("li",{children:"For SSE servers: We'll automatically use the correct protocol"}),l.jsx("li",{children:"For connection issues: Verify the server URL and status"})]})]})]}),H&&l.jsxs("div",{className:"mt-3 p-3 bg-red-500/20 rounded",children:[l.jsx("p",{children:l.jsx("strong",{children:"❌ Discovery Failed"})}),l.jsx("p",{children:"Could not analyze MCP server configuration"}),l.jsx("pre",{className:"text-xs overflow-x-auto",children:H instanceof Error?H.message:String(H)})]})]})]}),!ge&&!E&&!le&&e.type==="a2a"&&!X&&l.jsxs("div",{className:"bg-yellow-500/20 border border-yellow-500/30 rounded-lg p-4",children:[l.jsx("h3",{className:"text-yellow-300 font-semibold mb-2",children:"Agent Details Not Available"}),l.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."]}),l.jsxs("div",{className:"text-yellow-200 text-xs mt-2",children:[l.jsx("p",{children:l.jsx("strong",{children:"This could mean:"})}),l.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[l.jsx("li",{children:"The agent doesn't provide a manifest"}),l.jsx("li",{children:"Manifest endpoint is not implemented"}),l.jsx("li",{children:"Agent requires specific authentication"})]})]})]})]})]})})}function m4(){const[e,t]=w.useState("connecting"),[r,n]=w.useState(null),s=w.useRef(null),o=w.useRef(null),i=vr();return w.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 ax(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 g4(e){const[t,r]=w.useState(null),[n,s]=w.useState(null),[o,i]=w.useState(null),[a,c]=w.useState(!1),u=vr(),{toast:d}=sr(),f=()=>{if(!e)throw new Error("Select a deck to edit first");return e},g=Ct({mutationFn:async j=>{var G,q,V;const k=f(),B=(G=(await(await ke("GET","/api/decks")).json()).data)==null?void 0:G.find(z=>z.id===k);if(!B)throw new Error("Selected deck not found");if((q=B.services)!=null&&q.some(z=>z.id===j))throw new Error("Service is already in the deck");const H=((V=B.services)==null?void 0:V.length)??0;return ke("POST",`/api/decks/${k}/services`,{serviceId:j,position:H})},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:j=>{d({title:"Failed to add service",description:j.message,variant:"destructive"})}}),y=Ct({mutationFn:async j=>{var H,G;const k=f(),B=(H=(await(await ke("GET","/api/decks")).json()).data)==null?void 0:H.find(q=>q.id===k);if((G=B==null?void 0:B.credentials)!=null&&G.some(q=>q.id===j))throw new Error("API key is already in the deck");return ke("POST",`/api/decks/${k}/credentials`,{credentialId:j})},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:j=>{d({title:"Failed to add API key",description:j.message,variant:"destructive"})}}),b=Ct({mutationFn:async j=>{var H,G;const k=f(),B=(H=(await(await ke("GET","/api/decks")).json()).data)==null?void 0:H.find(q=>q.id===k);if((G=B==null?void 0:B.playbooks)!=null&&G.some(q=>q.id===j))throw new Error("Playbook is already in the deck");return ke("POST",`/api/decks/${k}/playbooks`,{playbookId:j})},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:j=>{d({title:"Failed to add playbook",description:j.message,variant:"destructive"})}}),m=Ct({mutationFn:async j=>{const k=await ax("service",j);if(k.length>0){const P=k.map(H=>H.title).join(", ");if(!window.confirm(`Warning: ${k.length} playbook(s) depend on this MCP (${P}). Remove from deck anyway?`))throw new Error("Cancelled")}const L=f();return ke("DELETE",`/api/decks/${L}/services`,{serviceId:j})},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:j=>{j.message!=="Cancelled"&&d({title:"Failed to remove service",description:j.message,variant:"destructive"})}}),v=Ct({mutationFn:async j=>{const k=await ax("credential",j);if(k.length>0){const P=k.map(H=>H.title).join(", ");if(!window.confirm(`Warning: ${k.length} playbook(s) depend on this API key (${P}). Remove from deck anyway?`))throw new Error("Cancelled")}const L=f();return ke("DELETE",`/api/decks/${L}/credentials`,{credentialId:j})},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:j=>{j.message!=="Cancelled"&&d({title:"Failed to remove API key",description:j.message,variant:"destructive"})}}),h=Ct({mutationFn:async j=>{const k=f();return ke("DELETE",`/api/decks/${k}/playbooks`,{playbookId:j})},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:j=>{d({title:"Failed to remove playbook",description:j.message,variant:"destructive"})}}),p=(j,k)=>{j.currentTarget instanceof HTMLElement&&(j.currentTarget.style.opacity=k)},x=(j,k)=>{j.dataTransfer.setData("text/plain",k.id),j.dataTransfer.setData("application/json",JSON.stringify(k)),j.dataTransfer.effectAllowed=k.fromDeck?"move":"copy"},S=(j,k,L=!1)=>{r(k),s(null),i(null),c(L),x(j,{kind:"service",id:k.id,fromDeck:L}),p(j,"0.5")},C=(j,k,L=!1)=>{s(k),r(null),i(null),c(L),x(j,{kind:"credential",id:k.id,fromDeck:L}),p(j,"0.5")},T=(j,k,L=!1)=>{i(k),r(null),s(null),c(L),x(j,{kind:"playbook",id:k.id,fromDeck:L}),p(j,"0.5")},$=j=>{r(null),s(null),i(null),p(j,"1")},O=j=>{if(j.kind==="service"){j.fromDeck?m.mutate(j.id):g.mutate(j.id);return}if(j.kind==="credential"){j.fromDeck?v.mutate(j.id):y.mutate(j.id);return}j.fromDeck?h.mutate(j.id):b.mutate(j.id)};return{draggedService:t,draggedCredential:n,draggedPlaybook:o,isDraggingFromDeck:a,handleDragStart:S,handleCredentialDragStart:C,handlePlaybookDragStart:T,handleDragEnd:$,handleDrop:j=>{j.preventDefault();const k=j.dataTransfer.getData("application/json");if(k){try{O(JSON.parse(k))}catch{const L=j.dataTransfer.getData("text/plain");L&&t&&g.mutate(L)}r(null),s(null),i(null),c(!1)}},handleGlobalDrop:j=>{j.preventDefault();const k=j.dataTransfer.getData("application/json");if(k){try{const L=JSON.parse(k);L.fromDeck&&O(L)}catch{}r(null),s(null),i(null),c(!1)}},isDropping:g.isPending||y.isPending||b.isPending||m.isPending||v.isPending||h.isPending}}const Ah="agent-deck-editing-deck-id";function v4(e){const[t,r]=w.useState(()=>typeof window>"u"?null:localStorage.getItem(Ah));w.useEffect(()=>{if(e.length===0)return;if(!(t&&e.some(i=>i.id===t))){const i=e[0].id;r(i),localStorage.setItem(Ah,i)}},[e,t]);const n=o=>{r(o),localStorage.setItem(Ah,o)};return{editingDeck:e.find(o=>o.id===t)??null,editingDeckId:t,setEditingDeckId:n}}function lx(e,[t,r]){return Math.min(r,Math.max(t,e))}var y4=[" ","Enter","ArrowUp","ArrowDown"],w4=[" ","Enter"],Yo="Select",[Cf,Ef,x4]=ev(Yo),[Ta,KV]=ls(Yo,[x4,yf]),Nf=yf(),[b4,uo]=Ta(Yo),[_4,S4]=Ta(Yo),HC=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:o,value:i,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:g,required:y,form:b}=e,m=Nf(t),[v,h]=w.useState(null),[p,x]=w.useState(null),[S,C]=w.useState(!1),T=Sv(u),[$,O]=Go({prop:n,defaultProp:s??!1,onChange:o,caller:Yo}),[M,U]=Go({prop:i,defaultProp:a,onChange:c,caller:Yo}),j=w.useRef(null),k=v?b||!!v.closest("form"):!0,[L,P]=w.useState(new Set),B=Array.from(L).map(H=>H.props.value).join(";");return l.jsx(DA,{...m,children:l.jsxs(b4,{required:y,scope:t,trigger:v,onTriggerChange:h,valueNode:p,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:Zs(),value:M,onValueChange:U,open:$,onOpenChange:O,dir:T,triggerPointerDownPosRef:j,disabled:g,children:[l.jsx(Cf.Provider,{scope:t,children:l.jsx(_4,{scope:e.__scopeSelect,onNativeOptionAdd:w.useCallback(H=>{P(G=>new Set(G).add(H))},[]),onNativeOptionRemove:w.useCallback(H=>{P(G=>{const q=new Set(G);return q.delete(H),q})},[]),children:r})}),k?l.jsxs(pE,{"aria-hidden":!0,required:y,tabIndex:-1,name:d,autoComplete:f,value:M,onChange:H=>U(H.target.value),disabled:g,form:b,children:[M===void 0?l.jsx("option",{value:""}):null,Array.from(L)]},B):null]})})};HC.displayName=Yo;var KC="SelectTrigger",BC=w.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...s}=e,o=Nf(r),i=uo(KC,r),a=i.disabled||n,c=He(t,i.onTriggerChange),u=Ef(r),d=w.useRef("touch"),[f,g,y]=gE(m=>{const v=u().filter(x=>!x.disabled),h=v.find(x=>x.value===i.value),p=vE(v,m,h);p!==void 0&&i.onValueChange(p.value)}),b=m=>{a||(i.onOpenChange(!0),y()),m&&(i.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return l.jsx(g1,{asChild:!0,...o,children:l.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:a,"data-disabled":a?"":void 0,"data-placeholder":mE(i.value)?"":void 0,...s,ref:c,onClick:ve(s.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&b(m)}),onPointerDown:ve(s.onPointerDown,m=>{d.current=m.pointerType;const v=m.target;v.hasPointerCapture(m.pointerId)&&v.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(b(m),m.preventDefault())}),onKeyDown:ve(s.onKeyDown,m=>{const v=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&g(m.key),!(v&&m.key===" ")&&y4.includes(m.key)&&(b(),m.preventDefault())})})})});BC.displayName=KC;var WC="SelectValue",ZC=w.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,children:o,placeholder:i="",...a}=e,c=uo(WC,r),{onValueNodeHasChildrenChange:u}=c,d=o!==void 0,f=He(t,c.onValueNodeChange);return Ft(()=>{u(d)},[u,d]),l.jsx(_e.span,{...a,ref:f,style:{pointerEvents:"none"},children:mE(c.value)?l.jsx(l.Fragment,{children:i}):o})});ZC.displayName=WC;var k4="SelectIcon",GC=w.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...s}=e;return l.jsx(_e.span,{"aria-hidden":!0,...s,ref:t,children:n||"▼"})});GC.displayName=k4;var C4="SelectPortal",QC=e=>l.jsx(cf,{asChild:!0,...e});QC.displayName=C4;var Xo="SelectContent",JC=w.forwardRef((e,t)=>{const r=uo(Xo,e.__scopeSelect),[n,s]=w.useState();if(Ft(()=>{s(new DocumentFragment)},[]),!r.open){const o=n;return o?si.createPortal(l.jsx(YC,{scope:e.__scopeSelect,children:l.jsx(Cf.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),o):null}return l.jsx(XC,{...e,ref:t})});JC.displayName=Xo;var Wr=10,[YC,fo]=Ta(Xo),E4="SelectContentImpl",N4=ma("SelectContent.RemoveScroll"),XC=w.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:g,collisionPadding:y,sticky:b,hideWhenDetached:m,avoidCollisions:v,...h}=e,p=uo(Xo,r),[x,S]=w.useState(null),[C,T]=w.useState(null),$=He(t,K=>S(K)),[O,M]=w.useState(null),[U,j]=w.useState(null),k=Ef(r),[L,P]=w.useState(!1),B=w.useRef(!1);w.useEffect(()=>{if(x)return q1(x)},[x]),I1();const H=w.useCallback(K=>{const[Z,...le]=k().map(ge=>ge.ref.current),[re]=le.slice(-1),X=document.activeElement;for(const ge of K)if(ge===X||(ge==null||ge.scrollIntoView({block:"nearest"}),ge===Z&&C&&(C.scrollTop=0),ge===re&&C&&(C.scrollTop=C.scrollHeight),ge==null||ge.focus(),document.activeElement!==X))return},[k,C]),G=w.useCallback(()=>H([O,x]),[H,O,x]);w.useEffect(()=>{L&&G()},[L,G]);const{onOpenChange:q,triggerPointerDownPosRef:V}=p;w.useEffect(()=>{if(x){let K={x:0,y:0};const Z=re=>{var X,ge;K={x:Math.abs(Math.round(re.pageX)-(((X=V.current)==null?void 0:X.x)??0)),y:Math.abs(Math.round(re.pageY)-(((ge=V.current)==null?void 0:ge.y)??0))}},le=re=>{K.x<=10&&K.y<=10?re.preventDefault():x.contains(re.target)||q(!1),document.removeEventListener("pointermove",Z),V.current=null};return V.current!==null&&(document.addEventListener("pointermove",Z),document.addEventListener("pointerup",le,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Z),document.removeEventListener("pointerup",le,{capture:!0})}}},[x,q,V]),w.useEffect(()=>{const K=()=>q(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[q]);const[z,I]=gE(K=>{const Z=k().filter(X=>!X.disabled),le=Z.find(X=>X.ref.current===document.activeElement),re=vE(Z,K,le);re&&setTimeout(()=>re.ref.current.focus())}),F=w.useCallback((K,Z,le)=>{const re=!B.current&&!le;(p.value!==void 0&&p.value===Z||re)&&(M(K),re&&(B.current=!0))},[p.value]),N=w.useCallback(()=>x==null?void 0:x.focus(),[x]),_=w.useCallback((K,Z,le)=>{const re=!B.current&&!le;(p.value!==void 0&&p.value===Z||re)&&j(K)},[p.value]),E=n==="popper"?mm:eE,D=E===mm?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:g,collisionPadding:y,sticky:b,hideWhenDetached:m,avoidCollisions:v}:{};return l.jsx(YC,{scope:r,content:x,viewport:C,onViewportChange:T,itemRefCallback:F,selectedItem:O,onItemLeave:N,itemTextRefCallback:_,focusSelectedItem:G,selectedItemText:U,position:n,isPositioned:L,searchRef:z,children:l.jsx(wv,{as:N4,allowPinchZoom:!0,children:l.jsx(yv,{asChild:!0,trapped:p.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:ve(s,K=>{var Z;(Z=p.trigger)==null||Z.focus({preventScroll:!0}),K.preventDefault()}),children:l.jsx(dc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>p.onOpenChange(!1),children:l.jsx(E,{role:"listbox",id:p.contentId,"data-state":p.open?"open":"closed",dir:p.dir,onContextMenu:K=>K.preventDefault(),...h,...D,onPlaced:()=>P(!0),ref:$,style:{display:"flex",flexDirection:"column",outline:"none",...h.style},onKeyDown:ve(h.onKeyDown,K=>{const Z=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!Z&&K.key.length===1&&I(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let re=k().filter(X=>!X.disabled).map(X=>X.ref.current);if(["ArrowUp","End"].includes(K.key)&&(re=re.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const X=K.target,ge=re.indexOf(X);re=re.slice(ge+1)}setTimeout(()=>H(re)),K.preventDefault()}})})})})})})});XC.displayName=E4;var j4="SelectItemAlignedPosition",eE=w.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...s}=e,o=uo(Xo,r),i=fo(Xo,r),[a,c]=w.useState(null),[u,d]=w.useState(null),f=He(t,$=>d($)),g=Ef(r),y=w.useRef(!1),b=w.useRef(!0),{viewport:m,selectedItem:v,selectedItemText:h,focusSelectedItem:p}=i,x=w.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&u&&m&&v&&h){const $=o.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),M=o.valueNode.getBoundingClientRect(),U=h.getBoundingClientRect();if(o.dir!=="rtl"){const X=U.left-O.left,ge=M.left-X,Le=$.left-ge,gt=$.width+Le,Y=Math.max(gt,O.width),pe=window.innerWidth-Wr,J=lx(ge,[Wr,Math.max(Wr,pe-Y)]);a.style.minWidth=gt+"px",a.style.left=J+"px"}else{const X=O.right-U.right,ge=window.innerWidth-M.right-X,Le=window.innerWidth-$.right-ge,gt=$.width+Le,Y=Math.max(gt,O.width),pe=window.innerWidth-Wr,J=lx(ge,[Wr,Math.max(Wr,pe-Y)]);a.style.minWidth=gt+"px",a.style.right=J+"px"}const j=g(),k=window.innerHeight-Wr*2,L=m.scrollHeight,P=window.getComputedStyle(u),B=parseInt(P.borderTopWidth,10),H=parseInt(P.paddingTop,10),G=parseInt(P.borderBottomWidth,10),q=parseInt(P.paddingBottom,10),V=B+H+L+q+G,z=Math.min(v.offsetHeight*5,V),I=window.getComputedStyle(m),F=parseInt(I.paddingTop,10),N=parseInt(I.paddingBottom,10),_=$.top+$.height/2-Wr,E=k-_,D=v.offsetHeight/2,K=v.offsetTop+D,Z=B+H+K,le=V-Z;if(Z<=_){const X=j.length>0&&v===j[j.length-1].ref.current;a.style.bottom="0px";const ge=u.clientHeight-m.offsetTop-m.offsetHeight,Le=Math.max(E,D+(X?N:0)+ge+G),gt=Z+Le;a.style.height=gt+"px"}else{const X=j.length>0&&v===j[0].ref.current;a.style.top="0px";const Le=Math.max(_,B+m.offsetTop+(X?F:0)+D)+le;a.style.height=Le+"px",m.scrollTop=Z-_+m.offsetTop}a.style.margin=`${Wr}px 0`,a.style.minHeight=z+"px",a.style.maxHeight=k+"px",n==null||n(),requestAnimationFrame(()=>y.current=!0)}},[g,o.trigger,o.valueNode,a,u,m,v,h,o.dir,n]);Ft(()=>x(),[x]);const[S,C]=w.useState();Ft(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const T=w.useCallback($=>{$&&b.current===!0&&(x(),p==null||p(),b.current=!1)},[x,p]);return l.jsx(P4,{scope:r,contentWrapper:a,shouldExpandOnScrollRef:y,onScrollButtonChange:T,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:l.jsx(_e.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});eE.displayName=j4;var $4="SelectPopperPosition",mm=w.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=Wr,...o}=e,i=Nf(r);return l.jsx(v1,{...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)"}})});mm.displayName=$4;var[P4,Nv]=Ta(Xo,{}),gm="SelectViewport",tE=w.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...s}=e,o=fo(gm,r),i=Nv(gm,r),a=He(t,o.onViewportChange),c=w.useRef(0);return l.jsxs(l.Fragment,{children:[l.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}),l.jsx(Cf.Slot,{scope:r,children:l.jsx(_e.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:ve(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:g}=i;if(g!=null&&g.current&&f){const y=Math.abs(c.current-d.scrollTop);if(y>0){const b=window.innerHeight-Wr*2,m=parseFloat(f.style.minHeight),v=parseFloat(f.style.height),h=Math.max(m,v);if(h<b){const p=h+y,x=Math.min(b,p),S=p-x;f.style.height=x+"px",f.style.bottom==="0px"&&(d.scrollTop=S>0?S:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});tE.displayName=gm;var rE="SelectGroup",[T4,R4]=Ta(rE),I4=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Zs();return l.jsx(T4,{scope:r,id:s,children:l.jsx(_e.div,{role:"group","aria-labelledby":s,...n,ref:t})})});I4.displayName=rE;var nE="SelectLabel",sE=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=R4(nE,r);return l.jsx(_e.div,{id:s.id,...n,ref:t})});sE.displayName=nE;var kd="SelectItem",[A4,oE]=Ta(kd),iE=w.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:o,...i}=e,a=uo(kd,r),c=fo(kd,r),u=a.value===n,[d,f]=w.useState(o??""),[g,y]=w.useState(!1),b=He(t,p=>{var x;return(x=c.itemRefCallback)==null?void 0:x.call(c,p,n,s)}),m=Zs(),v=w.useRef("touch"),h=()=>{s||(a.onValueChange(n),a.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 l.jsx(A4,{scope:r,value:n,disabled:s,textId:m,isSelected:u,onItemTextChange:w.useCallback(p=>{f(x=>x||((p==null?void 0:p.textContent)??"").trim())},[]),children:l.jsx(Cf.ItemSlot,{scope:r,value:n,disabled:s,textValue:d,children:l.jsx(_e.div,{role:"option","aria-labelledby":m,"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:ve(i.onFocus,()=>y(!0)),onBlur:ve(i.onBlur,()=>y(!1)),onClick:ve(i.onClick,()=>{v.current!=="mouse"&&h()}),onPointerUp:ve(i.onPointerUp,()=>{v.current==="mouse"&&h()}),onPointerDown:ve(i.onPointerDown,p=>{v.current=p.pointerType}),onPointerMove:ve(i.onPointerMove,p=>{var x;v.current=p.pointerType,s?(x=c.onItemLeave)==null||x.call(c):v.current==="mouse"&&p.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ve(i.onPointerLeave,p=>{var x;p.currentTarget===document.activeElement&&((x=c.onItemLeave)==null||x.call(c))}),onKeyDown:ve(i.onKeyDown,p=>{var S;((S=c.searchRef)==null?void 0:S.current)!==""&&p.key===" "||(w4.includes(p.key)&&h(),p.key===" "&&p.preventDefault())})})})})});iE.displayName=kd;var il="SelectItemText",aE=w.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,...o}=e,i=uo(il,r),a=fo(il,r),c=oE(il,r),u=S4(il,r),[d,f]=w.useState(null),g=He(t,h=>f(h),c.onItemTextChange,h=>{var p;return(p=a.itemTextRefCallback)==null?void 0:p.call(a,h,c.value,c.disabled)}),y=d==null?void 0:d.textContent,b=w.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:y},c.value),[c.disabled,c.value,y]),{onNativeOptionAdd:m,onNativeOptionRemove:v}=u;return Ft(()=>(m(b),()=>v(b)),[m,v,b]),l.jsxs(l.Fragment,{children:[l.jsx(_e.span,{id:c.textId,...o,ref:g}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?si.createPortal(o.children,i.valueNode):null]})});aE.displayName=il;var lE="SelectItemIndicator",cE=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return oE(lE,r).isSelected?l.jsx(_e.span,{"aria-hidden":!0,...n,ref:t}):null});cE.displayName=lE;var vm="SelectScrollUpButton",uE=w.forwardRef((e,t)=>{const r=fo(vm,e.__scopeSelect),n=Nv(vm,e.__scopeSelect),[s,o]=w.useState(!1),i=He(t,n.onScrollButtonChange);return Ft(()=>{if(r.viewport&&r.isPositioned){let a=function(){const u=c.scrollTop>0;o(u)};const c=r.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(fE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});uE.displayName=vm;var ym="SelectScrollDownButton",dE=w.forwardRef((e,t)=>{const r=fo(ym,e.__scopeSelect),n=Nv(ym,e.__scopeSelect),[s,o]=w.useState(!1),i=He(t,n.onScrollButtonChange);return Ft(()=>{if(r.viewport&&r.isPositioned){let a=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;o(d)};const c=r.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(fE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});dE.displayName=ym;var fE=w.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=e,o=fo("SelectScrollButton",r),i=w.useRef(null),a=Ef(r),c=w.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return w.useEffect(()=>()=>c(),[c]),Ft(()=>{var d;const u=a().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),l.jsx(_e.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:ve(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:ve(s.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:ve(s.onPointerLeave,()=>{c()})})}),O4="SelectSeparator",hE=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return l.jsx(_e.div,{"aria-hidden":!0,...n,ref:t})});hE.displayName=O4;var wm="SelectArrow",M4=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Nf(r),o=uo(wm,r),i=fo(wm,r);return o.open&&i.position==="popper"?l.jsx(y1,{...s,...n,ref:t}):null});M4.displayName=wm;var D4="SelectBubbleInput",pE=w.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const s=w.useRef(null),o=He(n,s),i=RC(t);return w.useEffect(()=>{const a=s.current;if(!a)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(a,t),a.dispatchEvent(f)}},[i,t]),l.jsx(_e.select,{...r,style:{...uk,...r.style},ref:o,defaultValue:t})});pE.displayName=D4;function mE(e){return e===""||e===void 0}function gE(e){const t=Ur(e),r=w.useRef(""),n=w.useRef(0),s=w.useCallback(i=>{const a=r.current+i;t(a),function c(u){r.current=u,window.clearTimeout(n.current),u!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(a)},[t]),o=w.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return w.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function vE(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=z4(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 z4(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var L4=HC,yE=BC,F4=ZC,U4=GC,q4=QC,wE=JC,V4=tE,xE=sE,bE=iE,H4=aE,K4=cE,_E=uE,SE=dE,kE=hE;const B4=L4,W4=F4,CE=w.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(yE,{ref:n,className:be("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,l.jsx(U4,{asChild:!0,children:l.jsx(ov,{className:"h-4 w-4 opacity-50"})})]}));CE.displayName=yE.displayName;const EE=w.forwardRef(({className:e,...t},r)=>l.jsx(_E,{ref:r,className:be("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(j2,{className:"h-4 w-4"})}));EE.displayName=_E.displayName;const NE=w.forwardRef(({className:e,...t},r)=>l.jsx(SE,{ref:r,className:be("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(ov,{className:"h-4 w-4"})}));NE.displayName=SE.displayName;const jE=w.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>l.jsx(q4,{children:l.jsxs(wE,{ref:s,className:be("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:[l.jsx(EE,{}),l.jsx(V4,{className:be("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),l.jsx(NE,{})]})}));jE.displayName=wE.displayName;const Z4=w.forwardRef(({className:e,...t},r)=>l.jsx(xE,{ref:r,className:be("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Z4.displayName=xE.displayName;const mi=w.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(bE,{ref:n,className:be("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:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(K4,{children:l.jsx(Ak,{className:"h-4 w-4"})})}),l.jsx(H4,{children:t})]}));mi.displayName=bE.displayName;const G4=w.forwardRef(({className:e,...t},r)=>l.jsx(kE,{ref:r,className:be("-mx-1 my-1 h-px bg-muted",e),...t}));G4.displayName=kE.displayName;const Q4="/assets/AgentDeckLogo3-X5qCXS2A.png";function J4(){var Da,za,La;const[e,t]=w.useState(""),[r,n]=w.useState(""),[s,o]=w.useState(!1),[i,a]=w.useState(!1),[c,u]=w.useState(null),[d,f]=w.useState(!1),[g,y]=w.useState(!1),[b,m]=w.useState(null),[v,h]=w.useState(!1),[p,x]=w.useState(!1),[S,C]=w.useState(null),[T,$]=w.useState(!1),[O,M]=w.useState(null),{toast:U}=sr(),{connectionStatus:j}=m4(),{data:k,isLoading:L,error:P}=dr({queryKey:["/api/decks"]}),B=(k==null?void 0:k.data)||[],{editingDeck:H,editingDeckId:G,setEditingDeckId:q}=v4(B),{handleDragStart:V,handleCredentialDragStart:z,handlePlaybookDragStart:I,handleDragEnd:F,handleDrop:N,handleGlobalDrop:_,isDraggingFromDeck:E}=g4(G),{data:D,isLoading:K,error:Z}=dr({queryKey:["/api/services"]}),{data:le,isLoading:re}=dr({queryKey:["/api/credentials/vault"]}),{data:X,isLoading:ge}=dr({queryKey:["/api/playbooks/vault"]}),{data:Le}=dr({queryKey:["/api/collection/warnings"],staleTime:6e4}),gt=(D==null?void 0:D.data)||[],Y=(le==null?void 0:le.data)||[],pe=(X==null?void 0:X.data)||[],J=w.useMemo(()=>sO(Le==null?void 0:Le.data),[Le==null?void 0:Le.data]),Me=(se,jt)=>s?se==="service"?J.serviceWarnings.has(jt):se==="credential"?J.credentialWarnings.has(jt):J.playbookWarnings.has(jt):!0,ie=gt.filter(se=>{var go;if(!Me("service",se.id)||r==="api-key"||r==="playbook")return!1;const jt=se.name.toLowerCase().includes(e.toLowerCase())||((go=se.description)==null?void 0:go.toLowerCase().includes(e.toLowerCase())),mo=!r||r==="all"||se.type===r;return jt&&mo}),Ie=Y.filter(se=>!Me("credential",se.id)||r&&r!=="all"&&r!=="api-key"?!1:se.label.toLowerCase().includes(e.toLowerCase())),Pe=pe.filter(se=>!Me("playbook",se.id)||r&&r!=="all"&&r!=="playbook"?!1:se.title.toLowerCase().includes(e.toLowerCase())||se.body.toLowerCase().includes(e.toLowerCase())),Ve=ie.length+Ie.length+Pe.length;Z&&console.error("Services error:",Z),P&&console.error("Decks error:",P);const fn=()=>{t(""),n(""),o(!1)},Tr=!!(e||r||s),hn=new Set(((H==null?void 0:H.credentials)??[]).map(se=>se.id)),xt=new Set(((H==null?void 0:H.playbooks)??[]).map(se=>se.id)),cs=(H==null?void 0:H.services)||[],ho=(H==null?void 0:H.playbooks)||[],us=se=>{u(se),f(!0)},po=se=>{C(se.id),$(!0)},Ma=se=>{m(se.id),h(!0)},Mn=se=>{M(se)};if(Z||P){const se=(P instanceof Error?P.message:null)??(Z instanceof Error?Z.message:null)??"There was an error loading the application data.";return l.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-900",children:l.jsxs("div",{className:"text-center max-w-lg px-4",children:[l.jsx("h2",{className:"text-2xl font-bold text-red-400 mb-4",children:"Error Loading Data"}),l.jsx("p",{className:"text-gray-300 mb-2",children:"There was an error loading the application data."}),l.jsx("p",{className:"text-gray-400 text-sm mb-4",children:se}),l.jsxs("p",{className:"text-gray-500 text-xs mb-6",children:["Is the API running? Try ",l.jsx("code",{className:"text-gray-300",children:"agent-deck stop && agent-deck start"})]}),l.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 K||L||re||ge?l.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-900",children:l.jsxs("div",{className:"text-center",children:[l.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-yellow-400 mx-auto mb-4"}),l.jsx("p",{className:"text-gray-300",children:"Loading AgentDeck..."})]})}):l.jsxs("div",{className:"min-h-screen",onDrop:_,onDragOver:se=>se.preventDefault(),style:{position:"relative",...E&&{background:"linear-gradient(to bottom right, #1a1a2e, #16213e, #0f3460)"}},children:[l.jsx("header",{className:"relative z-20 bg-black/30 backdrop-blur-md border-b border-white/10",children:l.jsx("div",{className:"container mx-auto px-4 py-4",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center space-x-4",children:[l.jsx("img",{src:Q4,alt:"Agent Deck Logo",className:"h-16 w-16 object-contain"}),l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl font-bold bg-gradient-to-r from-yellow-400 to-yellow-600 bg-clip-text text-transparent",style:{background:"linear-gradient(to right, #C4B643, #D4C760)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:"AgentDeck"}),l.jsx("p",{className:"text-sm",style:{color:"#92E4DD"},children:"Build tool deck for your agent"})]})]}),l.jsxs("div",{className:"flex items-center space-x-6",children:[l.jsxs("div",{className:`flex items-center space-x-2 px-3 py-1 rounded-full border ${j==="connected"?"bg-emerald-500/20 border-emerald-500/30":"bg-red-500/20 border-red-500/30"}`,children:[l.jsx("div",{className:`w-2 h-2 rounded-full animate-pulse ${j==="connected"?"bg-emerald-400":"bg-red-400"}`}),l.jsx("button",{className:`text-sm hover:underline cursor-pointer ${j==="connected"?"text-emerald-300":"text-red-300"}`,"data-testid":"button-copy-mcp-url",onClick:()=>{navigator.clipboard.writeText("http://localhost:3001/mcp").then(()=>{U({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"})]}),H&&l.jsx("div",{className:"px-4 py-2 rounded-lg border",style:{backgroundColor:"rgba(196, 182, 67, 0.2)",borderColor:"rgba(196, 182, 67, 0.4)"},children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("i",{className:"fas fa-star",style:{color:"#C4B643"}}),l.jsx("span",{className:"text-sm font-medium","data-testid":"editing-deck-name",style:{color:"#92E4DD"},children:H.name}),l.jsxs("span",{className:"text-xs",style:{color:"#92E4DD",opacity:.7},"data-testid":"editing-deck-count",children:[(((Da=H.services)==null?void 0:Da.length)??0)+(((za=H.credentials)==null?void 0:za.length)??0)+(((La=H.playbooks)==null?void 0:La.length)??0)," ","cards"]})]})})]})]})})}),E&&l.jsx("div",{className:"fixed inset-0 pointer-events-none z-50 flex items-center justify-center",children:l.jsxs("div",{className:"bg-red-500/20 border-2 border-dashed border-red-500/50 rounded-lg p-8 text-center",children:[l.jsx("div",{className:"text-red-400 text-lg font-bold mb-2",children:"Drop to Remove"}),l.jsx("div",{className:"text-red-300 text-sm",children:"Release to remove card from deck"})]})}),l.jsx("main",{className:"container mx-auto px-4 py-6",children:l.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-4 gap-6 h-screen min-w-0",children:[l.jsxs("div",{className:"xl:col-span-1 space-y-6 min-w-0",children:[l.jsx("div",{className:"panel-surface p-4 h-80 overflow-hidden min-w-0",children:l.jsx(e4,{decks:B,editingDeckId:G,onSelectDeck:q,isLoading:L})}),l.jsxs("div",{className:"panel-surface p-4",children:[l.jsxs("h2",{className:"text-lg font-bold mb-3 flex items-center",children:[l.jsx(Ik,{className:"w-4 h-4 mr-2",style:{color:"#92E4DD"}}),l.jsx("span",{style:{color:"#92E4DD"},children:"Add Cards"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(ce,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${Sn}`,style:kn(wr),onClick:()=>a(!0),"data-testid":"button-register-mcp",children:[l.jsx(pd,{className:"w-3 h-3 mr-2"}),"Register MCP"]}),l.jsxs(ce,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${Sn}`,style:kn(lr),onClick:()=>y(!0),"data-testid":"button-register-api-key",children:[l.jsx(sm,{className:"w-3 h-3 mr-2"}),"Register API key"]}),l.jsxs(ce,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${Sn}`,style:kn(Qr),onClick:()=>x(!0),"data-testid":"button-register-playbook",children:[l.jsx(sv,{className:"w-3 h-3 mr-2"}),"Register Playbook"]})]})]})]}),l.jsxs("div",{className:"xl:col-span-3 flex h-full min-h-0 flex-col gap-6 min-w-0",children:[l.jsx("div",{className:"panel-surface h-80 shrink-0 overflow-hidden p-4 min-w-0",children:H?l.jsx("div",{className:"h-full",children:l.jsx(kO,{deck:H,services:cs,credentials:H.credentials??[],playbooks:ho,allServices:gt,collectionWarnings:J,onDrop:N,onDragStart:V,onCredentialDragStart:z,onPlaybookDragStart:I,onDragEnd:F,onCardClick:us,onPlaybookClick:po,onCredentialClick:Ma})}):l.jsxs("div",{className:"text-center h-full flex flex-col justify-center",children:[l.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:l.jsx(om,{className:"w-6 h-6 text-yellow-400"})}),l.jsx("h3",{className:"text-lg font-bold mb-2",style:{color:"#92E4DD"},children:"No deck selected"}),l.jsx("p",{className:"text-gray-300 mb-4 text-sm",children:"Create a deck or select one from the sidebar to edit its cards."}),l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsxs(ce,{onClick:()=>{const se=document.querySelector('[data-testid="create-deck-button"]');se&&se.click()},className:"border text-sm py-2",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},children:[l.jsx(Ds,{className:"w-4 h-4 mr-2"}),"Create New Deck"]}),l.jsxs(ce,{variant:"outline",className:"border-white/20 text-white hover:bg-white/10 text-sm py-2",onClick:()=>{const se=document.querySelector('[data-testid="deck-management-panel"]');se&&se.scrollIntoView({behavior:"smooth"})},children:[l.jsx(om,{className:"w-4 h-4 mr-2"}),"Manage Decks"]})]})]})}),l.jsxs("div",{className:"panel-surface flex min-h-0 flex-1 flex-col overflow-hidden p-4 min-w-0","data-testid":"collection-panel",children:[l.jsxs("div",{className:"mb-3 flex shrink-0 flex-wrap items-center justify-between gap-2",children:[l.jsxs("h2",{className:"text-lg font-bold flex items-center",children:[l.jsx(T2,{className:"w-4 h-4 mr-2",style:{color:"#92E4DD"}}),l.jsx("span",{style:{color:"#92E4DD"},children:"My Collection"}),l.jsxs("span",{className:"ml-3 text-sm font-normal text-gray-400",children:["(",Ve," cards)"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("div",{className:"relative",children:[l.jsx(Dk,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),l.jsx(Be,{placeholder:"Search...",value:e,onChange:se=>t(se.target.value),className:"w-48 pl-8 h-8 text-sm bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":"input-search"})]}),l.jsxs(B4,{value:r||"all",onValueChange:se=>n(se==="all"?"":se),children:[l.jsxs(CE,{className:"w-[7.5rem] h-8 bg-white/10 border-white/20 text-white text-xs shrink-0","data-testid":"select-type",children:[l.jsx(P2,{className:"w-3 h-3 mr-1 shrink-0"}),l.jsx(W4,{placeholder:"Type"})]}),l.jsxs(jE,{children:[l.jsx(mi,{value:"all",children:"All"}),l.jsx(mi,{value:"mcp",children:"MCP"}),l.jsx(mi,{value:"local-mcp",children:"Local MCP"}),l.jsx(mi,{value:"api-key",children:"API Key"}),l.jsx(mi,{value:"playbook",children:"Playbook"})]})]}),(e||r||s)&&l.jsx(ce,{size:"sm",variant:"outline",className:"h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10",onClick:fn,title:"Clear all filters",children:"Clear"})]})]}),J.total>0&&l.jsx("button",{type:"button",onClick:()=>o(se=>!se),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:l.jsxs("span",{className:"flex items-start gap-2",children:[l.jsx(tn,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-300"}),l.jsx("span",{children:s?l.jsxs(l.Fragment,{children:["Showing ",l.jsx("strong",{children:Ve})," card",Ve===1?"":"s"," needing attention.",l.jsx("span",{className:"text-amber-200/80",children:" Click to show all cards."})]}):l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:J.total})," card",J.total===1?"":"s"," need attention",J.byKind.oauth_expired+J.byKind.oauth_required>0&&l.jsxs(l.Fragment,{children:[" ","(",J.byKind.oauth_expired+J.byKind.oauth_required," ","OAuth)"]}),". ",l.jsx("span",{className:"text-amber-200/80",children:"Click to filter."})]})})]})}),l.jsx("div",{className:"min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-1 py-2",children:K||re||ge?l.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,5rem)] gap-y-2 pr-12",children:Array.from({length:10}).map((se,jt)=>l.jsx("div",{className:"animate-pulse",children:l.jsx("div",{className:"bg-white/10 rounded-lg w-32 h-48 aspect-[2/3]"})},jt))}):Ve===0?l.jsxs("div",{className:"text-center py-12",children:[l.jsx("div",{className:"text-gray-400 mb-4",children:l.jsx("i",{className:"fas fa-layer-group text-4xl"})}),l.jsx("h3",{className:"text-lg font-semibold text-gray-300 mb-2",children:"No cards yet"}),l.jsx("p",{className:"text-gray-400 text-sm mb-4",children:Tr?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"}),!Tr&&l.jsxs("div",{className:"flex gap-3 justify-center",children:[l.jsxs(ce,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${Sn}`,style:kn(wr),onClick:()=>a(!0),"data-testid":"button-register-mcp-empty",children:[l.jsx(pd,{className:"w-3 h-3 mr-1"}),"Register MCP"]}),l.jsxs(ce,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${Sn}`,style:kn(lr),onClick:()=>y(!0),"data-testid":"button-register-api-key-empty",children:[l.jsx(sm,{className:"w-3 h-3 mr-1"}),"Register API key"]})]})]}):l.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:[Pe.map((se,jt)=>l.jsx("div",{className:"relative group",style:{zIndex:O===se.id?999999:Ve-jt},children:l.jsx(hO,{playbook:se,isInActiveDeck:xt.has(se.id),activeDeck:H??void 0,isInCollection:!0,onDragStart:I,onDragEnd:F,onCardClick:po,onMouseEnter:()=>Mn(se.id),onMouseLeave:()=>Mn(null),warnings:J.playbookWarnings.get(se.id)})},se.id)),Ie.map((se,jt)=>l.jsx("div",{className:"relative group",style:{zIndex:O===se.id?999999:Ve-Pe.length-jt},children:l.jsx(dO,{credential:se,isInActiveDeck:hn.has(se.id),activeDeck:H??void 0,isInCollection:!0,onDragStart:z,onDragEnd:F,onMouseEnter:()=>Mn(se.id),onMouseLeave:()=>Mn(null),onCardClick:Ma,warnings:J.credentialWarnings.get(se.id)})},se.id)),ie.map((se,jt)=>{var mo;return l.jsx("div",{className:"relative group",style:{zIndex:O===se.id?999999:Ve-Pe.length-Ie.length-jt},children:l.jsx(lO,{service:se,onDragStart:V,onDragEnd:F,isInActiveDeck:((mo=H==null?void 0:H.services)==null?void 0:mo.some(go=>go.id===se.id))||!1,onCardClick:us,isInCollection:!0,onMouseEnter:()=>Mn(se.id),onMouseLeave:()=>Mn(null),activeDeck:H??void 0,warnings:J.serviceWarnings.get(se.id)})},se.id)})]})})]})]})]})}),l.jsxs("div",{className:"fixed inset-0 pointer-events-none z-0",children:[l.jsx("div",{className:"absolute top-20 left-20 w-96 h-96 bg-cyan-500/10 rounded-full blur-3xl animate-float"}),l.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"}}),l.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"}})]}),l.jsx(XM,{type:"mcp",open:i,onOpenChange:a}),l.jsx(p4,{service:c,isOpen:d,onClose:()=>f(!1)}),l.jsx(t4,{open:g,onOpenChange:y}),l.jsx(s4,{credentialId:b,open:v,onOpenChange:h}),l.jsx(r4,{open:p,onOpenChange:x}),l.jsx(n4,{playbookId:S,open:T,onOpenChange:$})]})}const xs=w.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:be("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));xs.displayName="Card";const bo=w.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:be("flex flex-col space-y-1.5 p-6",e),...t}));bo.displayName="CardHeader";const _o=w.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:be("text-2xl font-semibold leading-none tracking-tight",e),...t}));_o.displayName="CardTitle";const Ru=w.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:be("text-sm text-muted-foreground",e),...t}));Ru.displayName="CardDescription";const bs=w.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:be("p-6 pt-0",e),...t}));bs.displayName="CardContent";const Y4=w.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:be("flex items-center p-6 pt-0",e),...t}));Y4.displayName="CardFooter";function X4(){return l.jsx("div",{className:"min-h-screen w-full flex items-center justify-center bg-gray-50",children:l.jsx(xs,{className:"w-full max-w-md mx-4",children:l.jsxs(bs,{className:"pt-6",children:[l.jsxs("div",{className:"flex mb-4 gap-2",children:[l.jsx(Ok,{className:"h-8 w-8 text-red-500"}),l.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"404 Page Not Found"})]}),l.jsx("p",{className:"mt-4 text-sm text-gray-600",children:"Did you forget to add the page to the router?"})]})})})}function eD(){const[e]=LT(),[t,r]=w.useState("loading"),[n,s]=w.useState("Authenticating...");return w.useEffect(()=>{(async()=>{try{const i=new URL(window.location.href),a=i.searchParams.get("success"),c=i.searchParams.get("error");a==="true"?(r("success"),s("Authentication successful! This window will close automatically."),setTimeout(()=>{window.close()},2e3)):a==="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]),l.jsx("div",{className:"flex items-center justify-center min-h-screen bg-background",children:l.jsxs("div",{className:"text-center space-y-4",children:[t==="loading"&&l.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto"}),t==="success"&&l.jsx("div",{className:"text-green-500 text-4xl",children:"✓"}),t==="error"&&l.jsx("div",{className:"text-red-500 text-4xl",children:"✗"}),l.jsx("h1",{className:"text-xl font-semibold",children:n}),t==="error"&&l.jsx("button",{onClick:()=>window.close(),className:"px-4 py-2 bg-primary text-primary-foreground rounded hover:bg-primary/90",children:"Close Window"})]})})}function Ri(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(tD).join("&"),r.hash=r.hash.slice(0,1)+encodeURIComponent(r.hash.slice(1)),r.href}function tD([e,t]){return`${encodeURIComponent(e)}${t.length>0?`=${encodeURIComponent(t)}`:""}`}var cx=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=Ri(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 Ri(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=Ri(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?Ri(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 a=localStorage.getItem(i);a&&JSON.parse(a).serverUrlHash===this.serverUrlHash&&r.push(i)}catch(a){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${i} during clearStorage:`,a)}}}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 rD=Object.freeze({status:"aborted"});function W(e,t,r){function n(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(e),t(a,c);for(const d in i.prototype)d in a||Object.defineProperty(a,d,{value:i.prototype[d].bind(a)});a._zod.constr=i,a._zod.def=c}const s=(r==null?void 0:r.Parent)??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function i(a){var c;const u=r!=null&&r.Parent?new o:this;n(u,a),(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:a=>{var c,u;return r!=null&&r.Parent&&a instanceof r.Parent?!0:(u=(c=a==null?void 0:a._zod)==null?void 0:c.traits)==null?void 0:u.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}class Jl extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const $E={};function to(e){return $E}function nD(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 sD(e,t){return typeof t=="bigint"?t.toString():t}function jv(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function $v(e){return e==null}function Pv(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function oD(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 et(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 jf(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Qa(e){return JSON.stringify(e)}const PE=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Cd(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const iD=jv(()=>{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 Ed(e){if(Cd(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(Cd(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}const aD=new Set(["string","number","symbol"]);function mc(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ii(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 de(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 lD(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const cD={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 uD(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 ii(e,{...e._zod.def,shape:r,checks:[]})}function dD(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 ii(e,{...e._zod.def,shape:r,checks:[]})}function fD(e,t){if(!Ed(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 jf(this,"shape",n),n},checks:[]};return ii(e,r)}function hD(e,t){return ii(e,{...e._zod.def,get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return jf(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function pD(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 ii(t,{...t._zod.def,shape:s,checks:[]})}function mD(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 ii(t,{...t._zod.def,shape:s,checks:[]})}function Sl(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 To(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function nu(e){return typeof e=="string"?e:e==null?void 0:e.message}function ro(e,t,r){var s,o,i,a,c,u;const n={...e,path:e.path??[]};if(!e.message){const d=nu((i=(o=(s=e.inst)==null?void 0:s._zod.def)==null?void 0:o.error)==null?void 0:i.call(o,e))??nu((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??nu((c=r.customError)==null?void 0:c.call(r,e))??nu((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 Tv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Yl(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const TE=(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,sD,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},RE=W("$ZodError",TE),IE=W("$ZodError",TE,{Parent:Error});function gD(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 vD(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(a=>s({issues:a}));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 a=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return s(e),n}const yD=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 Jl;if(i.issues.length){const a=new((s==null?void 0:s.Err)??e)(i.issues.map(c=>ro(c,o,to())));throw PE(a,s==null?void 0:s.callee),a}return i.value},wD=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 a=new((s==null?void 0:s.Err)??e)(i.issues.map(c=>ro(c,o,to())));throw PE(a,s==null?void 0:s.callee),a}return i.value},AE=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 Jl;return o.issues.length?{success:!1,error:new(e??RE)(o.issues.map(i=>ro(i,s,to())))}:{success:!0,data:o.value}},OE=AE(IE),ME=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=>ro(i,s,to())))}:{success:!0,data:o.value}},xD=ME(IE),bD=/^[cC][^\s-]{8,}$/,_D=/^[0-9a-z]+$/,SD=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,kD=/^[0-9a-vA-V]{20}$/,CD=/^[A-Za-z0-9]{27}$/,ED=/^[a-zA-Z0-9_-]{21}$/,ND=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,jD=/^([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})$/,ux=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)$/,$D=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,PD="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function TD(){return new RegExp(PD,"u")}const RD=/^(?:(?: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])$/,ID=/^(([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})$/,AD=/^((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])$/,OD=/^(([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])$/,MD=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,DE=/^[A-Za-z0-9_-]*$/,DD=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,zD=/^\+(?:[0-9]){6,14}[0-9]$/,zE="(?:(?:\\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])))",LD=new RegExp(`^${zE}$`);function LE(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 FD(e){return new RegExp(`^${LE(e)}$`)}function UD(e){const t=LE({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(`^${zE}T(?:${n})$`)}const qD=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}$`)},VD=/^\d+$/,HD=/^-?\d+(?:\.\d+)?/i,KD=/true|false/i,BD=/null/i,WD=/^[^A-Z]*$/,ZD=/^[^a-z]*$/,yr=W("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),FE={number:"number",bigint:"bigint",object:"date"},UE=W("$ZodCheckLessThan",(e,t)=>{yr.init(e,t);const r=FE[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})}}),qE=W("$ZodCheckGreaterThan",(e,t)=>{yr.init(e,t);const r=FE[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})}}),GD=W("$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):oD(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})}}),QD=W("$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]=cD[t.format];e._zod.onattach.push(a=>{const c=a._zod.bag;c.format=t.format,c.minimum=s,c.maximum=o,r&&(c.pattern=VD)}),e._zod.check=a=>{const c=a.value;if(r){if(!Number.isInteger(c)){a.issues.push({expected:n,format:t.format,code:"invalid_type",input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?a.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}):a.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&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),c>o&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:o,inst:e})}}),JD=W("$ZodCheckMaxLength",(e,t)=>{var r;yr.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!$v(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=Tv(s);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),YD=W("$ZodCheckMinLength",(e,t)=>{var r;yr.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!$v(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=Tv(s);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),XD=W("$ZodCheckLengthEquals",(e,t)=>{var r;yr.init(e,t),(r=e._zod.def).when??(r.when=n=>{const s=n.value;return!$v(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=Tv(s),a=o>t.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),$f=W("$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=()=>{})}),ez=W("$ZodCheckRegex",(e,t)=>{$f.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})}}),tz=W("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=WD),$f.init(e,t)}),rz=W("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ZD),$f.init(e,t)}),nz=W("$ZodCheckIncludes",(e,t)=>{yr.init(e,t);const r=mc(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})}}),sz=W("$ZodCheckStartsWith",(e,t)=>{yr.init(e,t);const r=new RegExp(`^${mc(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})}}),oz=W("$ZodCheckEndsWith",(e,t)=>{yr.init(e,t);const r=new RegExp(`.*${mc(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})}}),iz=W("$ZodCheckOverwrite",(e,t)=>{yr.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class az{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(`
|
|
369
|
-
`).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(`
|
|
370
|
-
`))}}const lz={major:4,minor:0,patch:0},Ze=W("$ZodType",(e,t)=>{var s;var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=lz;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,a,c)=>{let u=Sl(i),d;for(const f of a){if(f._zod.def.when){if(!f._zod.def.when(i))continue}else if(u)continue;const g=i.issues.length,y=f._zod.check(i);if(y instanceof Promise&&(c==null?void 0:c.async)===!1)throw new Jl;if(d||y instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await y,i.issues.length!==g&&(u||(u=Sl(i,g)))});else{if(i.issues.length===g)continue;u||(u=Sl(i,g))}}return d?d.then(()=>i):i};e._zod.run=(i,a)=>{const c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Jl;return c.then(u=>o(u,n,a))}return o(c,n,a)}}e["~standard"]={validate:o=>{var i;try{const a=OE(e,o);return a.success?{value:a.data}:{issues:(i=a.error)==null?void 0:i.issues}}catch{return xD(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}}),Rv=W("$ZodString",(e,t)=>{var r;Ze.init(e,t),e._zod.pattern=[...((r=e==null?void 0:e._zod.bag)==null?void 0:r.patterns)??[]].pop()??qD(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}}),st=W("$ZodStringFormat",(e,t)=>{$f.init(e,t),Rv.init(e,t)}),cz=W("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=jD),st.init(e,t)}),uz=W("$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=ux(n))}else t.pattern??(t.pattern=ux());st.init(e,t)}),dz=W("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=$D),st.init(e,t)}),fz=W("$ZodURL",(e,t)=>{st.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:DD.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})}}}),hz=W("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=TD()),st.init(e,t)}),pz=W("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ED),st.init(e,t)}),mz=W("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=bD),st.init(e,t)}),gz=W("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=_D),st.init(e,t)}),vz=W("$ZodULID",(e,t)=>{t.pattern??(t.pattern=SD),st.init(e,t)}),yz=W("$ZodXID",(e,t)=>{t.pattern??(t.pattern=kD),st.init(e,t)}),wz=W("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=CD),st.init(e,t)}),xz=W("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=UD(t)),st.init(e,t)}),bz=W("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=LD),st.init(e,t)}),_z=W("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=FD(t)),st.init(e,t)}),Sz=W("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ND),st.init(e,t)}),kz=W("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=RD),st.init(e,t),e._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv4"})}),Cz=W("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ID),st.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})}}}),Ez=W("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=AD),st.init(e,t)}),Nz=W("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=OD),st.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 VE(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const jz=W("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=MD),st.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{VE(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function $z(e){if(!DE.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return VE(r)}const Pz=W("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=DE),st.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{$z(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Tz=W("$ZodE164",(e,t)=>{t.pattern??(t.pattern=zD),st.init(e,t)});function Rz(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 Iz=W("$ZodJWT",(e,t)=>{st.init(e,t),e._zod.check=r=>{Rz(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),HE=W("$ZodNumber",(e,t)=>{Ze.init(e,t),e._zod.pattern=e._zod.bag.pattern??HD,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}}),Az=W("$ZodNumber",(e,t)=>{QD.init(e,t),HE.init(e,t)}),Oz=W("$ZodBoolean",(e,t)=>{Ze.init(e,t),e._zod.pattern=KD,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}}),Mz=W("$ZodNull",(e,t)=>{Ze.init(e,t),e._zod.pattern=BD,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}}),Dz=W("$ZodAny",(e,t)=>{Ze.init(e,t),e._zod.parse=r=>r}),zz=W("$ZodUnknown",(e,t)=>{Ze.init(e,t),e._zod.parse=r=>r}),Lz=W("$ZodNever",(e,t)=>{Ze.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function dx(e,t,r){e.issues.length&&t.issues.push(...To(r,e.issues)),t.value[r]=e.value}const Fz=W("$ZodArray",(e,t)=>{Ze.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 a=s[i],c=t.element._zod.run({value:a,issues:[]},n);c instanceof Promise?o.push(c.then(u=>dx(u,r,i))):dx(c,r,i)}return o.length?Promise.all(o).then(()=>r):r}});function su(e,t,r){e.issues.length&&t.issues.push(...To(r,e.issues)),t.value[r]=e.value}function fx(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(...To(r,e.issues)):e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}const Uz=W("$ZodObject",(e,t)=>{Ze.init(e,t);const r=jv(()=>{const f=Object.keys(t.shape);for(const y of f)if(!(t.shape[y]instanceof Ze))throw new Error(`Invalid element at key "${y}": expected a Zod schema`);const g=lD(t.shape);return{shape:t.shape,keys:f,keySet:new Set(f),numKeys:f.length,optionalKeys:new Set(g)}});et(e._zod,"propValues",()=>{const f=t.shape,g={};for(const y in f){const b=f[y]._zod;if(b.values){g[y]??(g[y]=new Set);for(const m of b.values)g[y].add(m)}}return g});const n=f=>{const g=new az(["shape","payload","ctx"]),y=r.value,b=p=>{const x=Qa(p);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};g.write("const input = payload.value;");const m=Object.create(null);let v=0;for(const p of y.keys)m[p]=`key_${v++}`;g.write("const newResult = {}");for(const p of y.keys)if(y.optionalKeys.has(p)){const x=m[p];g.write(`const ${x} = ${b(p)};`);const S=Qa(p);g.write(`
|
|
371
|
-
if (${x}.issues.length) {
|
|
372
|
-
if (input[${S}] === undefined) {
|
|
373
|
-
if (${S} in input) {
|
|
374
|
-
newResult[${S}] = undefined;
|
|
375
|
-
}
|
|
376
|
-
} else {
|
|
377
|
-
payload.issues = payload.issues.concat(
|
|
378
|
-
${x}.issues.map((iss) => ({
|
|
379
|
-
...iss,
|
|
380
|
-
path: iss.path ? [${S}, ...iss.path] : [${S}],
|
|
381
|
-
}))
|
|
382
|
-
);
|
|
383
|
-
}
|
|
384
|
-
} else if (${x}.value === undefined) {
|
|
385
|
-
if (${S} in input) newResult[${S}] = undefined;
|
|
386
|
-
} else {
|
|
387
|
-
newResult[${S}] = ${x}.value;
|
|
388
|
-
}
|
|
389
|
-
`)}else{const x=m[p];g.write(`const ${x} = ${b(p)};`),g.write(`
|
|
390
|
-
if (${x}.issues.length) payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
|
|
391
|
-
...iss,
|
|
392
|
-
path: iss.path ? [${Qa(p)}, ...iss.path] : [${Qa(p)}]
|
|
393
|
-
})));`),g.write(`newResult[${Qa(p)}] = ${x}.value`)}g.write("payload.value = newResult;"),g.write("return payload;");const h=g.compile();return(p,x)=>h(f,p,x)};let s;const o=Cd,i=!$E.jitless,c=i&&iD.value,u=t.catchall;let d;e._zod.parse=(f,g)=>{d??(d=r.value);const y=f.value;if(!o(y))return f.issues.push({expected:"object",code:"invalid_type",input:y,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 S of d.keys){const C=x[S],T=C._zod.run({value:y[S],issues:[]},g),$=C._zod.optin==="optional"&&C._zod.optout==="optional";T instanceof Promise?b.push(T.then(O=>$?fx(O,f,S,y):su(O,f,S))):$?fx(T,f,S,y):su(T,f,S)}}if(!u)return b.length?Promise.all(b).then(()=>f):f;const m=[],v=d.keySet,h=u._zod,p=h.def.type;for(const x of Object.keys(y)){if(v.has(x))continue;if(p==="never"){m.push(x);continue}const S=h.run({value:y[x],issues:[]},g);S instanceof Promise?b.push(S.then(C=>su(C,f,x))):su(S,f,x)}return m.length&&f.issues.push({code:"unrecognized_keys",keys:m,input:y,inst:e}),b.length?Promise.all(b).then(()=>f):f}});function hx(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=>ro(o,n,to())))}),t}const KE=W("$ZodUnion",(e,t)=>{Ze.init(e,t),et(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),et(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),et(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),et(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=>Pv(n.source)).join("|")})$`)}}),e._zod.parse=(r,n)=>{let s=!1;const o=[];for(const i of t.options){const a=i._zod.run({value:r.value,issues:[]},n);if(a instanceof Promise)o.push(a),s=!0;else{if(a.issues.length===0)return a;o.push(a)}}return s?Promise.all(o).then(i=>hx(i,r,e,n)):hx(o,r,e,n)}}),qz=W("$ZodDiscriminatedUnion",(e,t)=>{KE.init(e,t);const r=e._zod.parse;et(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[a,c]of Object.entries(i)){s[a]||(s[a]=new Set);for(const u of c)s[a].add(u)}}return s});const n=jv(()=>{const s=t.options,o=new Map;for(const i of s){const a=i._zod.propValues[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const c of a){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(!Cd(i))return s.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),s;const a=n.value.get(i==null?void 0:i[t.discriminator]);return a?a._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)}}),Vz=W("$ZodIntersection",(e,t)=>{Ze.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])=>px(r,c,u)):px(r,o,i)}});function xm(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(Ed(e)&&Ed(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=xm(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=xm(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 px(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),Sl(e))return e;const n=xm(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 Hz=W("$ZodRecord",(e,t)=>{Ze.init(e,t),e._zod.parse=(r,n)=>{const s=r.value;if(!Ed(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(...To(c,d.issues)),r.value[c]=d.value})):(u.issues.length&&r.issues.push(...To(c,u.issues)),r.value[c]=u.value)}let a;for(const c in s)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:a})}else{r.value={};for(const i of Reflect.ownKeys(s)){if(i==="__proto__")continue;const a=t.keyType._zod.run({value:i,issues:[]},n);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(u=>ro(u,n,to())),input:i,path:[i],inst:e}),r.value[a.value]=a.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(...To(i,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(...To(i,c.issues)),r.value[a.value]=c.value)}}return o.length?Promise.all(o).then(()=>r):r}}),Kz=W("$ZodEnum",(e,t)=>{Ze.init(e,t);const r=nD(t.entries);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter(n=>aD.has(typeof n)).map(n=>typeof n=="string"?mc(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}}),Bz=W("$ZodLiteral",(e,t)=>{Ze.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?mc(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}}),Wz=W("$ZodTransform",(e,t)=>{Ze.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 Jl;return r.value=s,r}}),Zz=W("$ZodOptional",(e,t)=>{Ze.init(e,t),e._zod.optin="optional",e._zod.optout="optional",et(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),et(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Pv(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)}),Gz=W("$ZodNullable",(e,t)=>{Ze.init(e,t),et(e._zod,"optin",()=>t.innerType._zod.optin),et(e._zod,"optout",()=>t.innerType._zod.optout),et(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Pv(r.source)}|null)$`):void 0}),et(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)}),Qz=W("$ZodDefault",(e,t)=>{Ze.init(e,t),e._zod.optin="optional",et(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=>mx(o,t)):mx(s,t)}});function mx(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Jz=W("$ZodPrefault",(e,t)=>{Ze.init(e,t),e._zod.optin="optional",et(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))}),Yz=W("$ZodNonOptional",(e,t)=>{Ze.init(e,t),et(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=>gx(o,e)):gx(s,e)}});function gx(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 Xz=W("$ZodCatch",(e,t)=>{Ze.init(e,t),e._zod.optin="optional",et(e._zod,"optout",()=>t.innerType._zod.optout),et(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=>ro(i,n,to()))},input:r.value}),r.issues=[]),r)):(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(o=>ro(o,n,to()))},input:r.value}),r.issues=[]),r)}}),eL=W("$ZodPipe",(e,t)=>{Ze.init(e,t),et(e._zod,"values",()=>t.in._zod.values),et(e._zod,"optin",()=>t.in._zod.optin),et(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=>vx(o,t,n)):vx(s,t,n)}});function vx(e,t,r){return Sl(e)?e:t.out._zod.run({value:e.value,issues:e.issues},r)}const tL=W("$ZodReadonly",(e,t)=>{Ze.init(e,t),et(e._zod,"propValues",()=>t.innerType._zod.propValues),et(e._zod,"values",()=>t.innerType._zod.values),et(e._zod,"optin",()=>t.innerType._zod.optin),et(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(yx):yx(s)}});function yx(e){return e.value=Object.freeze(e.value),e}const rL=W("$ZodCustom",(e,t)=>{yr.init(e,t),Ze.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=>wx(o,r,n,e));wx(s,r,n,e)}});function wx(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(Yl(s))}}class nL{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 sL(){return new nL}const ou=sL();function oL(e,t){return new e({type:"string",...de(t)})}function iL(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...de(t)})}function xx(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...de(t)})}function aL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...de(t)})}function lL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...de(t)})}function cL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...de(t)})}function uL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...de(t)})}function BE(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...de(t)})}function dL(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...de(t)})}function fL(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...de(t)})}function hL(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...de(t)})}function pL(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...de(t)})}function mL(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...de(t)})}function gL(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...de(t)})}function vL(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...de(t)})}function yL(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...de(t)})}function wL(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...de(t)})}function xL(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...de(t)})}function bL(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...de(t)})}function _L(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...de(t)})}function SL(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...de(t)})}function kL(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...de(t)})}function CL(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...de(t)})}function EL(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...de(t)})}function NL(e,t){return new e({type:"string",format:"date",check:"string_format",...de(t)})}function jL(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...de(t)})}function $L(e,t){return new e({type:"string",format:"duration",check:"string_format",...de(t)})}function PL(e,t){return new e({type:"number",checks:[],...de(t)})}function TL(e,t){return new e({type:"number",coerce:!0,checks:[],...de(t)})}function RL(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...de(t)})}function IL(e,t){return new e({type:"boolean",...de(t)})}function AL(e,t){return new e({type:"null",...de(t)})}function OL(e){return new e({type:"any"})}function ML(e){return new e({type:"unknown"})}function DL(e,t){return new e({type:"never",...de(t)})}function bx(e,t){return new UE({check:"less_than",...de(t),value:e,inclusive:!1})}function Oh(e,t){return new UE({check:"less_than",...de(t),value:e,inclusive:!0})}function _x(e,t){return new qE({check:"greater_than",...de(t),value:e,inclusive:!1})}function Mh(e,t){return new qE({check:"greater_than",...de(t),value:e,inclusive:!0})}function Sx(e,t){return new GD({check:"multiple_of",...de(t),value:e})}function WE(e,t){return new JD({check:"max_length",...de(t),maximum:e})}function Nd(e,t){return new YD({check:"min_length",...de(t),minimum:e})}function ZE(e,t){return new XD({check:"length_equals",...de(t),length:e})}function zL(e,t){return new ez({check:"string_format",format:"regex",...de(t),pattern:e})}function LL(e){return new tz({check:"string_format",format:"lowercase",...de(e)})}function FL(e){return new rz({check:"string_format",format:"uppercase",...de(e)})}function UL(e,t){return new nz({check:"string_format",format:"includes",...de(t),includes:e})}function qL(e,t){return new sz({check:"string_format",format:"starts_with",...de(t),prefix:e})}function VL(e,t){return new oz({check:"string_format",format:"ends_with",...de(t),suffix:e})}function gc(e){return new iz({check:"overwrite",tx:e})}function HL(e){return gc(t=>t.normalize(e))}function KL(){return gc(e=>e.trim())}function BL(){return gc(e=>e.toLowerCase())}function WL(){return gc(e=>e.toUpperCase())}function ZL(e,t,r){return new e({type:"array",element:t,...de(r)})}function GL(e,t,r){const n=de(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function QL(e,t,r){return new e({type:"custom",check:"custom",fn:t,...de(r)})}const JL=W("ZodISODateTime",(e,t)=>{xz.init(e,t),ft.init(e,t)});function GE(e){return EL(JL,e)}const YL=W("ZodISODate",(e,t)=>{bz.init(e,t),ft.init(e,t)});function XL(e){return NL(YL,e)}const e3=W("ZodISOTime",(e,t)=>{_z.init(e,t),ft.init(e,t)});function t3(e){return jL(e3,e)}const r3=W("ZodISODuration",(e,t)=>{Sz.init(e,t),ft.init(e,t)});function n3(e){return $L(r3,e)}const s3=(e,t)=>{RE.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>vD(e,r)},flatten:{value:r=>gD(e,r)},addIssue:{value:r=>e.issues.push(r)},addIssues:{value:r=>e.issues.push(...r)},isEmpty:{get(){return e.issues.length===0}}})},Pf=W("ZodError",s3,{Parent:Error}),o3=yD(Pf),i3=wD(Pf),a3=AE(Pf),l3=ME(Pf),ot=W("ZodType",(e,t)=>(Ze.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)=>ii(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.parse=(r,n)=>o3(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>a3(e,r,n),e.parseAsync=async(r,n)=>i3(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>l3(e,r,n),e.spa=e.safeParseAsync,e.refine=(r,n)=>e.check(tF(r,n)),e.superRefine=r=>e.check(rF(r)),e.overwrite=r=>e.check(gc(r)),e.optional=()=>lt(e),e.nullable=()=>Ex(e),e.nullish=()=>lt(Ex(e)),e.nonoptional=r=>W3(e,r),e.array=()=>ee(e),e.or=r=>it([e,r]),e.and=r=>Av(e,r),e.transform=r=>_m(e,tN(r)),e.default=r=>H3(e,r),e.prefault=r=>B3(e,r),e.catch=r=>G3(e,r),e.pipe=r=>_m(e,r),e.readonly=()=>Y3(e),e.describe=r=>{const n=e.clone();return ou.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){var r;return(r=ou.get(e))==null?void 0:r.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return ou.get(e);const n=e.clone();return ou.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),QE=W("_ZodString",(e,t)=>{Rv.init(e,t),ot.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(zL(...n)),e.includes=(...n)=>e.check(UL(...n)),e.startsWith=(...n)=>e.check(qL(...n)),e.endsWith=(...n)=>e.check(VL(...n)),e.min=(...n)=>e.check(Nd(...n)),e.max=(...n)=>e.check(WE(...n)),e.length=(...n)=>e.check(ZE(...n)),e.nonempty=(...n)=>e.check(Nd(1,...n)),e.lowercase=n=>e.check(LL(n)),e.uppercase=n=>e.check(FL(n)),e.trim=()=>e.check(KL()),e.normalize=(...n)=>e.check(HL(...n)),e.toLowerCase=()=>e.check(BL()),e.toUpperCase=()=>e.check(WL())}),c3=W("ZodString",(e,t)=>{Rv.init(e,t),QE.init(e,t),e.email=r=>e.check(iL(u3,r)),e.url=r=>e.check(BE(JE,r)),e.jwt=r=>e.check(CL(E3,r)),e.emoji=r=>e.check(dL(f3,r)),e.guid=r=>e.check(xx(kx,r)),e.uuid=r=>e.check(aL(iu,r)),e.uuidv4=r=>e.check(lL(iu,r)),e.uuidv6=r=>e.check(cL(iu,r)),e.uuidv7=r=>e.check(uL(iu,r)),e.nanoid=r=>e.check(fL(h3,r)),e.guid=r=>e.check(xx(kx,r)),e.cuid=r=>e.check(hL(p3,r)),e.cuid2=r=>e.check(pL(m3,r)),e.ulid=r=>e.check(mL(g3,r)),e.base64=r=>e.check(_L(S3,r)),e.base64url=r=>e.check(SL(k3,r)),e.xid=r=>e.check(gL(v3,r)),e.ksuid=r=>e.check(vL(y3,r)),e.ipv4=r=>e.check(yL(w3,r)),e.ipv6=r=>e.check(wL(x3,r)),e.cidrv4=r=>e.check(xL(b3,r)),e.cidrv6=r=>e.check(bL(_3,r)),e.e164=r=>e.check(kL(C3,r)),e.datetime=r=>e.check(GE(r)),e.date=r=>e.check(XL(r)),e.time=r=>e.check(t3(r)),e.duration=r=>e.check(n3(r))});function A(e){return oL(c3,e)}const ft=W("ZodStringFormat",(e,t)=>{st.init(e,t),QE.init(e,t)}),u3=W("ZodEmail",(e,t)=>{dz.init(e,t),ft.init(e,t)}),kx=W("ZodGUID",(e,t)=>{cz.init(e,t),ft.init(e,t)}),iu=W("ZodUUID",(e,t)=>{uz.init(e,t),ft.init(e,t)}),JE=W("ZodURL",(e,t)=>{fz.init(e,t),ft.init(e,t)});function d3(e){return BE(JE,e)}const f3=W("ZodEmoji",(e,t)=>{hz.init(e,t),ft.init(e,t)}),h3=W("ZodNanoID",(e,t)=>{pz.init(e,t),ft.init(e,t)}),p3=W("ZodCUID",(e,t)=>{mz.init(e,t),ft.init(e,t)}),m3=W("ZodCUID2",(e,t)=>{gz.init(e,t),ft.init(e,t)}),g3=W("ZodULID",(e,t)=>{vz.init(e,t),ft.init(e,t)}),v3=W("ZodXID",(e,t)=>{yz.init(e,t),ft.init(e,t)}),y3=W("ZodKSUID",(e,t)=>{wz.init(e,t),ft.init(e,t)}),w3=W("ZodIPv4",(e,t)=>{kz.init(e,t),ft.init(e,t)}),x3=W("ZodIPv6",(e,t)=>{Cz.init(e,t),ft.init(e,t)}),b3=W("ZodCIDRv4",(e,t)=>{Ez.init(e,t),ft.init(e,t)}),_3=W("ZodCIDRv6",(e,t)=>{Nz.init(e,t),ft.init(e,t)}),S3=W("ZodBase64",(e,t)=>{jz.init(e,t),ft.init(e,t)}),k3=W("ZodBase64URL",(e,t)=>{Pz.init(e,t),ft.init(e,t)}),C3=W("ZodE164",(e,t)=>{Tz.init(e,t),ft.init(e,t)}),E3=W("ZodJWT",(e,t)=>{Iz.init(e,t),ft.init(e,t)}),Iv=W("ZodNumber",(e,t)=>{HE.init(e,t),ot.init(e,t),e.gt=(n,s)=>e.check(_x(n,s)),e.gte=(n,s)=>e.check(Mh(n,s)),e.min=(n,s)=>e.check(Mh(n,s)),e.lt=(n,s)=>e.check(bx(n,s)),e.lte=(n,s)=>e.check(Oh(n,s)),e.max=(n,s)=>e.check(Oh(n,s)),e.int=n=>e.check(Cx(n)),e.safe=n=>e.check(Cx(n)),e.positive=n=>e.check(_x(0,n)),e.nonnegative=n=>e.check(Mh(0,n)),e.negative=n=>e.check(bx(0,n)),e.nonpositive=n=>e.check(Oh(0,n)),e.multipleOf=(n,s)=>e.check(Sx(n,s)),e.step=(n,s)=>e.check(Sx(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 Fe(e){return PL(Iv,e)}const N3=W("ZodNumberFormat",(e,t)=>{Az.init(e,t),Iv.init(e,t)});function Cx(e){return RL(N3,e)}const j3=W("ZodBoolean",(e,t)=>{Oz.init(e,t),ot.init(e,t)});function Ye(e){return IL(j3,e)}const $3=W("ZodNull",(e,t)=>{Mz.init(e,t),ot.init(e,t)});function P3(e){return AL($3,e)}const T3=W("ZodAny",(e,t)=>{Dz.init(e,t),ot.init(e,t)});function R3(){return OL(T3)}const I3=W("ZodUnknown",(e,t)=>{zz.init(e,t),ot.init(e,t)});function ut(){return ML(I3)}const A3=W("ZodNever",(e,t)=>{Lz.init(e,t),ot.init(e,t)});function O3(e){return DL(A3,e)}const M3=W("ZodArray",(e,t)=>{Fz.init(e,t),ot.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(Nd(r,n)),e.nonempty=r=>e.check(Nd(1,r)),e.max=(r,n)=>e.check(WE(r,n)),e.length=(r,n)=>e.check(ZE(r,n)),e.unwrap=()=>e.element});function ee(e,t){return ZL(M3,e,t)}const YE=W("ZodObject",(e,t)=>{Uz.init(e,t),ot.init(e,t),et(e,"shape",()=>t.shape),e.keyof=()=>$r(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ut()}),e.loose=()=>e.clone({...e._zod.def,catchall:ut()}),e.strict=()=>e.clone({...e._zod.def,catchall:O3()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>fD(e,r),e.merge=r=>hD(e,r),e.pick=r=>uD(e,r),e.omit=r=>dD(e,r),e.partial=(...r)=>pD(rN,e,r[0]),e.required=(...r)=>mD(nN,e,r[0])});function te(e,t){const r={type:"object",get shape(){return jf(this,"shape",{...e}),this.shape},...de(t)};return new YE(r)}function Dt(e,t){return new YE({type:"object",get shape(){return jf(this,"shape",{...e}),this.shape},catchall:ut(),...de(t)})}const XE=W("ZodUnion",(e,t)=>{KE.init(e,t),ot.init(e,t),e.options=t.options});function it(e,t){return new XE({type:"union",options:e,...de(t)})}const D3=W("ZodDiscriminatedUnion",(e,t)=>{XE.init(e,t),qz.init(e,t)});function eN(e,t,r){return new D3({type:"union",options:t,discriminator:e,...de(r)})}const z3=W("ZodIntersection",(e,t)=>{Vz.init(e,t),ot.init(e,t)});function Av(e,t){return new z3({type:"intersection",left:e,right:t})}const L3=W("ZodRecord",(e,t)=>{Hz.init(e,t),ot.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function tt(e,t,r){return new L3({type:"record",keyType:e,valueType:t,...de(r)})}const bm=W("ZodEnum",(e,t)=>{Kz.init(e,t),ot.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 bm({...t,checks:[],...de(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 bm({...t,checks:[],...de(s),entries:o})}});function $r(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new bm({type:"enum",entries:r,...de(t)})}const F3=W("ZodLiteral",(e,t)=>{Bz.init(e,t),ot.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 F3({type:"literal",values:Array.isArray(e)?e:[e],...de(t)})}const U3=W("ZodTransform",(e,t)=>{Wz.init(e,t),ot.init(e,t),e._zod.parse=(r,n)=>{r.addIssue=o=>{if(typeof o=="string")r.issues.push(Yl(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(Yl(i))}};const s=t.transform(r.value,r);return s instanceof Promise?s.then(o=>(r.value=o,r)):(r.value=s,r)}});function tN(e){return new U3({type:"transform",transform:e})}const rN=W("ZodOptional",(e,t)=>{Zz.init(e,t),ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function lt(e){return new rN({type:"optional",innerType:e})}const q3=W("ZodNullable",(e,t)=>{Gz.init(e,t),ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Ex(e){return new q3({type:"nullable",innerType:e})}const V3=W("ZodDefault",(e,t)=>{Qz.init(e,t),ot.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function H3(e,t){return new V3({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const K3=W("ZodPrefault",(e,t)=>{Jz.init(e,t),ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function B3(e,t){return new K3({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const nN=W("ZodNonOptional",(e,t)=>{Yz.init(e,t),ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function W3(e,t){return new nN({type:"nonoptional",innerType:e,...de(t)})}const Z3=W("ZodCatch",(e,t)=>{Xz.init(e,t),ot.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function G3(e,t){return new Z3({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Q3=W("ZodPipe",(e,t)=>{eL.init(e,t),ot.init(e,t),e.in=t.in,e.out=t.out});function _m(e,t){return new Q3({type:"pipe",in:e,out:t})}const J3=W("ZodReadonly",(e,t)=>{tL.init(e,t),ot.init(e,t)});function Y3(e){return new J3({type:"readonly",innerType:e})}const sN=W("ZodCustom",(e,t)=>{rL.init(e,t),ot.init(e,t)});function X3(e){const t=new yr({check:"custom"});return t._zod.check=e,t}function eF(e,t){return GL(sN,e??(()=>!0),t)}function tF(e,t={}){return QL(sN,e,t)}function rF(e){const t=X3(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Yl(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(Yl(s))}},e(r.value,r)));return t}function oN(e,t){return _m(tN(e),t)}const nF={custom:"custom"};function sF(e){return TL(Iv,e)}const Tf="2025-11-25",oF=[Tf,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],So="io.modelcontextprotocol/related-task",Rf="2.0",Nt=eF(e=>e!==null&&(typeof e=="object"||typeof e=="function")),iN=it([A(),Fe().int()]),aN=A();Dt({ttl:Fe().optional(),pollInterval:Fe().optional()});const iF=te({ttl:Fe().optional()}),aF=te({taskId:A()}),Ov=Dt({progressToken:iN.optional(),[So]:aF.optional()}),Pr=te({_meta:Ov.optional()}),vc=Pr.extend({task:iF.optional()}),lF=e=>vc.safeParse(e).success,Ut=te({method:A(),params:Pr.loose().optional()}),qr=te({_meta:Ov.optional()}),Vr=te({method:A(),params:qr.loose().optional()}),qt=Dt({_meta:Ov.optional()}),If=it([A(),Fe().int()]),lN=te({jsonrpc:he(Rf),id:If,...Ut.shape}).strict(),Sm=e=>lN.safeParse(e).success,cN=te({jsonrpc:he(Rf),...Vr.shape}).strict(),cF=e=>cN.safeParse(e).success,Mv=te({jsonrpc:he(Rf),id:If,result:qt}).strict(),al=e=>Mv.safeParse(e).success;var xe;(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"})(xe||(xe={}));const Dv=te({jsonrpc:he(Rf),id:If.optional(),error:te({code:Fe().int(),message:A(),data:ut().optional()})}).strict(),uF=e=>Dv.safeParse(e).success,Iu=it([lN,cN,Mv,Dv]);it([Mv,Dv]);const Ii=qt.strict(),dF=qr.extend({requestId:If.optional(),reason:A().optional()}),zv=Vr.extend({method:he("notifications/cancelled"),params:dF}),fF=te({src:A(),mimeType:A().optional(),sizes:ee(A()).optional(),theme:$r(["light","dark"]).optional()}),yc=te({icons:ee(fF).optional()}),wa=te({name:A(),title:A().optional()}),uN=wa.extend({...wa.shape,...yc.shape,version:A(),websiteUrl:A().optional(),description:A().optional()}),hF=Av(te({applyDefaults:Ye().optional()}),tt(A(),ut())),pF=oN(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Av(te({form:hF.optional(),url:Nt.optional()}),tt(A(),ut()).optional())),mF=Dt({list:Nt.optional(),cancel:Nt.optional(),requests:Dt({sampling:Dt({createMessage:Nt.optional()}).optional(),elicitation:Dt({create:Nt.optional()}).optional()}).optional()}),gF=Dt({list:Nt.optional(),cancel:Nt.optional(),requests:Dt({tools:Dt({call:Nt.optional()}).optional()}).optional()}),vF=te({experimental:tt(A(),Nt).optional(),sampling:te({context:Nt.optional(),tools:Nt.optional()}).optional(),elicitation:pF.optional(),roots:te({listChanged:Ye().optional()}).optional(),tasks:mF.optional(),extensions:tt(A(),Nt).optional()}),yF=Pr.extend({protocolVersion:A(),capabilities:vF,clientInfo:uN}),wF=Ut.extend({method:he("initialize"),params:yF}),xF=te({experimental:tt(A(),Nt).optional(),logging:Nt.optional(),completions:Nt.optional(),prompts:te({listChanged:Ye().optional()}).optional(),resources:te({subscribe:Ye().optional(),listChanged:Ye().optional()}).optional(),tools:te({listChanged:Ye().optional()}).optional(),tasks:gF.optional(),extensions:tt(A(),Nt).optional()}),dN=qt.extend({protocolVersion:A(),capabilities:xF,serverInfo:uN,instructions:A().optional()}),fN=Vr.extend({method:he("notifications/initialized"),params:qr.optional()}),bF=e=>fN.safeParse(e).success,Lv=Ut.extend({method:he("ping"),params:Pr.optional()}),_F=te({progress:Fe(),total:lt(Fe()),message:lt(A())}),SF=te({...qr.shape,..._F.shape,progressToken:iN}),Fv=Vr.extend({method:he("notifications/progress"),params:SF}),kF=Pr.extend({cursor:aN.optional()}),wc=Ut.extend({params:kF.optional()}),xc=qt.extend({nextCursor:aN.optional()}),CF=$r(["working","input_required","completed","failed","cancelled"]),bc=te({taskId:A(),status:CF,ttl:it([Fe(),P3()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:lt(Fe()),statusMessage:lt(A())}),Xl=qt.extend({task:bc}),EF=qr.merge(bc),jd=Vr.extend({method:he("notifications/tasks/status"),params:EF}),Uv=Ut.extend({method:he("tasks/get"),params:Pr.extend({taskId:A()})}),qv=qt.merge(bc),Vv=Ut.extend({method:he("tasks/result"),params:Pr.extend({taskId:A()})});qt.loose();const Hv=wc.extend({method:he("tasks/list")}),Kv=xc.extend({tasks:ee(bc)}),Bv=Ut.extend({method:he("tasks/cancel"),params:Pr.extend({taskId:A()})}),NF=qt.merge(bc),hN=te({uri:A(),mimeType:lt(A()),_meta:tt(A(),ut()).optional()}),pN=hN.extend({text:A()}),Wv=A().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),mN=hN.extend({blob:Wv}),_c=$r(["user","assistant"]),Ra=te({audience:ee(_c).optional(),priority:Fe().min(0).max(1).optional(),lastModified:GE({offset:!0}).optional()}),gN=te({...wa.shape,...yc.shape,uri:A(),description:lt(A()),mimeType:lt(A()),size:lt(Fe()),annotations:Ra.optional(),_meta:lt(Dt({}))}),jF=te({...wa.shape,...yc.shape,uriTemplate:A(),description:lt(A()),mimeType:lt(A()),annotations:Ra.optional(),_meta:lt(Dt({}))}),$F=wc.extend({method:he("resources/list")}),$d=xc.extend({resources:ee(gN)}),PF=wc.extend({method:he("resources/templates/list")}),vN=xc.extend({resourceTemplates:ee(jF)}),Zv=Pr.extend({uri:A()}),TF=Zv,RF=Ut.extend({method:he("resources/read"),params:TF}),Gv=qt.extend({contents:ee(it([pN,mN]))}),yN=Vr.extend({method:he("notifications/resources/list_changed"),params:qr.optional()}),IF=Zv,AF=Ut.extend({method:he("resources/subscribe"),params:IF}),OF=Zv,MF=Ut.extend({method:he("resources/unsubscribe"),params:OF}),DF=qr.extend({uri:A()}),zF=Vr.extend({method:he("notifications/resources/updated"),params:DF}),LF=te({name:A(),description:lt(A()),required:lt(Ye())}),FF=te({...wa.shape,...yc.shape,description:lt(A()),arguments:lt(ee(LF)),_meta:lt(Dt({}))}),UF=wc.extend({method:he("prompts/list")}),Pd=xc.extend({prompts:ee(FF)}),qF=Pr.extend({name:A(),arguments:tt(A(),A()).optional()}),VF=Ut.extend({method:he("prompts/get"),params:qF}),Qv=te({type:he("text"),text:A(),annotations:Ra.optional(),_meta:tt(A(),ut()).optional()}),Jv=te({type:he("image"),data:Wv,mimeType:A(),annotations:Ra.optional(),_meta:tt(A(),ut()).optional()}),Yv=te({type:he("audio"),data:Wv,mimeType:A(),annotations:Ra.optional(),_meta:tt(A(),ut()).optional()}),HF=te({type:he("tool_use"),name:A(),id:A(),input:tt(A(),ut()),_meta:tt(A(),ut()).optional()}),KF=te({type:he("resource"),resource:it([pN,mN]),annotations:Ra.optional(),_meta:tt(A(),ut()).optional()}),BF=gN.extend({type:he("resource_link")}),Xv=it([Qv,Jv,Yv,BF,KF]),WF=te({role:_c,content:Xv}),ey=qt.extend({description:A().optional(),messages:ee(WF)}),wN=Vr.extend({method:he("notifications/prompts/list_changed"),params:qr.optional()}),ZF=te({title:A().optional(),readOnlyHint:Ye().optional(),destructiveHint:Ye().optional(),idempotentHint:Ye().optional(),openWorldHint:Ye().optional()}),GF=te({taskSupport:$r(["required","optional","forbidden"]).optional()}),xN=te({...wa.shape,...yc.shape,description:A().optional(),inputSchema:te({type:he("object"),properties:tt(A(),Nt).optional(),required:ee(A()).optional()}).catchall(ut()),outputSchema:te({type:he("object"),properties:tt(A(),Nt).optional(),required:ee(A()).optional()}).catchall(ut()).optional(),annotations:ZF.optional(),execution:GF.optional(),_meta:tt(A(),ut()).optional()}),QF=wc.extend({method:he("tools/list")}),ty=xc.extend({tools:ee(xN)}),Sc=qt.extend({content:ee(Xv).default([]),structuredContent:tt(A(),ut()).optional(),isError:Ye().optional()});Sc.or(qt.extend({toolResult:ut()}));const JF=vc.extend({name:A(),arguments:tt(A(),ut()).optional()}),YF=Ut.extend({method:he("tools/call"),params:JF}),bN=Vr.extend({method:he("notifications/tools/list_changed"),params:qr.optional()}),XF=te({autoRefresh:Ye().default(!0),debounceMs:Fe().int().nonnegative().default(300)}),_N=$r(["debug","info","notice","warning","error","critical","alert","emergency"]),eU=Pr.extend({level:_N}),tU=Ut.extend({method:he("logging/setLevel"),params:eU}),rU=qr.extend({level:_N,logger:A().optional(),data:ut()}),nU=Vr.extend({method:he("notifications/message"),params:rU}),sU=te({name:A().optional()}),oU=te({hints:ee(sU).optional(),costPriority:Fe().min(0).max(1).optional(),speedPriority:Fe().min(0).max(1).optional(),intelligencePriority:Fe().min(0).max(1).optional()}),iU=te({mode:$r(["auto","required","none"]).optional()}),aU=te({type:he("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:ee(Xv).default([]),structuredContent:te({}).loose().optional(),isError:Ye().optional(),_meta:tt(A(),ut()).optional()}),lU=eN("type",[Qv,Jv,Yv]),Td=eN("type",[Qv,Jv,Yv,HF,aU]),cU=te({role:_c,content:it([Td,ee(Td)]),_meta:tt(A(),ut()).optional()}),uU=vc.extend({messages:ee(cU),modelPreferences:oU.optional(),systemPrompt:A().optional(),includeContext:$r(["none","thisServer","allServers"]).optional(),temperature:Fe().optional(),maxTokens:Fe().int(),stopSequences:ee(A()).optional(),metadata:Nt.optional(),tools:ee(xN).optional(),toolChoice:iU.optional()}),SN=Ut.extend({method:he("sampling/createMessage"),params:uU}),kN=qt.extend({model:A(),stopReason:lt($r(["endTurn","stopSequence","maxTokens"]).or(A())),role:_c,content:lU}),CN=qt.extend({model:A(),stopReason:lt($r(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:_c,content:it([Td,ee(Td)])}),dU=te({type:he("boolean"),title:A().optional(),description:A().optional(),default:Ye().optional()}),fU=te({type:he("string"),title:A().optional(),description:A().optional(),minLength:Fe().optional(),maxLength:Fe().optional(),format:$r(["email","uri","date","date-time"]).optional(),default:A().optional()}),hU=te({type:$r(["number","integer"]),title:A().optional(),description:A().optional(),minimum:Fe().optional(),maximum:Fe().optional(),default:Fe().optional()}),pU=te({type:he("string"),title:A().optional(),description:A().optional(),enum:ee(A()),default:A().optional()}),mU=te({type:he("string"),title:A().optional(),description:A().optional(),oneOf:ee(te({const:A(),title:A()})),default:A().optional()}),gU=te({type:he("string"),title:A().optional(),description:A().optional(),enum:ee(A()),enumNames:ee(A()).optional(),default:A().optional()}),vU=it([pU,mU]),yU=te({type:he("array"),title:A().optional(),description:A().optional(),minItems:Fe().optional(),maxItems:Fe().optional(),items:te({type:he("string"),enum:ee(A())}),default:ee(A()).optional()}),wU=te({type:he("array"),title:A().optional(),description:A().optional(),minItems:Fe().optional(),maxItems:Fe().optional(),items:te({anyOf:ee(te({const:A(),title:A()}))}),default:ee(A()).optional()}),xU=it([yU,wU]),bU=it([gU,vU,xU]),_U=it([bU,dU,fU,hU]),SU=vc.extend({mode:he("form").optional(),message:A(),requestedSchema:te({type:he("object"),properties:tt(A(),_U),required:ee(A()).optional()})}),kU=vc.extend({mode:he("url"),message:A(),elicitationId:A(),url:A().url()}),CU=it([SU,kU]),EN=Ut.extend({method:he("elicitation/create"),params:CU}),EU=qr.extend({elicitationId:A()}),NU=Vr.extend({method:he("notifications/elicitation/complete"),params:EU}),NN=qt.extend({action:$r(["accept","decline","cancel"]),content:oN(e=>e===null?void 0:e,tt(A(),it([A(),Fe(),Ye(),ee(A())])).optional())}),jU=te({type:he("ref/resource"),uri:A()}),$U=te({type:he("ref/prompt"),name:A()}),PU=Pr.extend({ref:it([$U,jU]),argument:te({name:A(),value:A()}),context:te({arguments:tt(A(),A()).optional()}).optional()}),TU=Ut.extend({method:he("completion/complete"),params:PU}),jN=qt.extend({completion:Dt({values:ee(A()).max(100),total:lt(Fe().int()),hasMore:lt(Ye())})}),RU=te({uri:A().startsWith("file://"),name:A().optional(),_meta:tt(A(),ut()).optional()}),IU=Ut.extend({method:he("roots/list"),params:Pr.optional()}),AU=qt.extend({roots:ee(RU)}),OU=Vr.extend({method:he("notifications/roots/list_changed"),params:qr.optional()});it([Lv,wF,TU,tU,VF,UF,$F,PF,RF,AF,MF,YF,QF,Uv,Vv,Hv,Bv]);it([zv,Fv,fN,OU,jd]);it([Ii,kN,CN,NN,AU,qv,Kv,Xl]);it([Lv,SN,EN,IU,Uv,Vv,Hv,Bv]);it([zv,Fv,nU,zF,yN,bN,wN,jd,NU]);it([Ii,dN,jN,ey,Pd,$d,vN,Gv,Sc,ty,qv,Kv,Xl]);class ye 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===xe.UrlElicitationRequired&&n){const s=n;if(s.elicitations)return new MU(s.elicitations,r)}return new ye(t,r,n)}}class MU extends ye{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(xe.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){var t;return((t=this.data)==null?void 0:t.elicitations)??[]}}class Nx 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 Dh(e){}function $N(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=Dh,onError:r=Dh,onRetry:n=Dh,onComment:s}=e;let o="",i=!0,a,c="",u="";function d(m){const v=i?m.replace(/^\xEF\xBB\xBF/,""):m,[h,p]=DU(`${o}${v}`);for(const x of h)f(x);o=p,i=!1}function f(m){if(m===""){y();return}if(m.startsWith(":")){s&&s(m.slice(m.startsWith(": ")?2:1));return}const v=m.indexOf(":");if(v!==-1){const h=m.slice(0,v),p=m[v+1]===" "?2:1,x=m.slice(v+p);g(h,x,m);return}g(m,"",m)}function g(m,v,h){switch(m){case"event":u=v;break;case"data":c=`${c}${v}
|
|
394
|
-
`;break;case"id":a=v.includes("\0")?void 0:v;break;case"retry":/^\d+$/.test(v)?n(parseInt(v,10)):r(new Nx(`Invalid \`retry\` value: "${v}"`,{type:"invalid-retry",value:v,line:h}));break;default:r(new Nx(`Unknown field "${m.length>20?`${m.slice(0,20)}…`:m}"`,{type:"unknown-field",field:m,value:v,line:h}));break}}function y(){c.length>0&&t({id:a,event:u||void 0,data:c.endsWith(`
|
|
395
|
-
`)?c.slice(0,-1):c}),a=void 0,c="",u=""}function b(m={}){o&&m.consume&&f(o),i=!0,a=void 0,c="",u="",o=""}return{feed:d,reset:b}}function DU(e){const t=[];let r="",n=0;for(;n<e.length;){const s=e.indexOf("\r",n),o=e.indexOf(`
|
|
396
|
-
`,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 a=e.slice(n,i);t.push(a),n=i+1,e[n-1]==="\r"&&e[n]===`
|
|
397
|
-
`&&n++}}return[t,r]}class jx 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($x(this),r)}[Symbol.for("Deno.customInspect")](t,r){return t($x(this),r)}}function zU(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function km(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(km).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${km(e.cause)}`:e.message:`${e}`}function $x(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var PN=e=>{throw TypeError(e)},ry=(e,t,r)=>t.has(e)||PN("Cannot "+r),Te=(e,t,r)=>(ry(e,t,"read from private field"),r?r.call(e):t.get(e)),bt=(e,t,r)=>t.has(e)?PN("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),rt=(e,t,r,n)=>(ry(e,t,"write to private field"),t.set(e,r),r),Fn=(e,t,r)=>(ry(e,t,"access private method"),r),cr,ko,gi,Au,Rd,kl,Ai,Cl,Cs,vi,Ki,yi,ll,Zr,Cm,Em,Nm,Px,jm,$m,cl,Pm,Tm;class Ou extends EventTarget{constructor(t,r){var n,s;super(),bt(this,Zr),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,bt(this,cr),bt(this,ko),bt(this,gi),bt(this,Au),bt(this,Rd),bt(this,kl),bt(this,Ai),bt(this,Cl,null),bt(this,Cs),bt(this,vi),bt(this,Ki,null),bt(this,yi,null),bt(this,ll,null),bt(this,Em,async o=>{var i;Te(this,vi).reset();const{body:a,redirected:c,status:u,headers:d}=o;if(u===204){Fn(this,Zr,cl).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?rt(this,gi,new URL(o.url)):rt(this,gi,void 0),u!==200){Fn(this,Zr,cl).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){Fn(this,Zr,cl).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Te(this,cr)===this.CLOSED)return;rt(this,cr,this.OPEN);const f=new Event("open");if((i=Te(this,ll))==null||i.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){Fn(this,Zr,cl).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}const g=new TextDecoder,y=a.getReader();let b=!0;do{const{done:m,value:v}=await y.read();v&&Te(this,vi).feed(g.decode(v,{stream:!m})),m&&(b=!1,Te(this,vi).reset(),Fn(this,Zr,Pm).call(this))}while(b)}),bt(this,Nm,o=>{rt(this,Cs,void 0),!(o.name==="AbortError"||o.type==="aborted")&&Fn(this,Zr,Pm).call(this,km(o))}),bt(this,jm,o=>{typeof o.id=="string"&&rt(this,Cl,o.id);const i=new MessageEvent(o.event||"message",{data:o.data,origin:Te(this,gi)?Te(this,gi).origin:Te(this,ko).origin,lastEventId:o.id||""});Te(this,yi)&&(!o.event||o.event==="message")&&Te(this,yi).call(this,i),this.dispatchEvent(i)}),bt(this,$m,o=>{rt(this,kl,o)}),bt(this,Tm,()=>{rt(this,Ai,void 0),Te(this,cr)===this.CONNECTING&&Fn(this,Zr,Cm).call(this)});try{if(t instanceof URL)rt(this,ko,t);else if(typeof t=="string")rt(this,ko,new URL(t,LU()));else throw new Error("Invalid URL")}catch{throw zU("An invalid or illegal string was specified")}rt(this,vi,$N({onEvent:Te(this,jm),onRetry:Te(this,$m)})),rt(this,cr,this.CONNECTING),rt(this,kl,3e3),rt(this,Rd,(n=r==null?void 0:r.fetch)!=null?n:globalThis.fetch),rt(this,Au,(s=r==null?void 0:r.withCredentials)!=null?s:!1),Fn(this,Zr,Cm).call(this)}get readyState(){return Te(this,cr)}get url(){return Te(this,ko).href}get withCredentials(){return Te(this,Au)}get onerror(){return Te(this,Ki)}set onerror(t){rt(this,Ki,t)}get onmessage(){return Te(this,yi)}set onmessage(t){rt(this,yi,t)}get onopen(){return Te(this,ll)}set onopen(t){rt(this,ll,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,Ai)&&clearTimeout(Te(this,Ai)),Te(this,cr)!==this.CLOSED&&(Te(this,Cs)&&Te(this,Cs).abort(),rt(this,cr,this.CLOSED),rt(this,Cs,void 0))}}cr=new WeakMap,ko=new WeakMap,gi=new WeakMap,Au=new WeakMap,Rd=new WeakMap,kl=new WeakMap,Ai=new WeakMap,Cl=new WeakMap,Cs=new WeakMap,vi=new WeakMap,Ki=new WeakMap,yi=new WeakMap,ll=new WeakMap,Zr=new WeakSet,Cm=function(){rt(this,cr,this.CONNECTING),rt(this,Cs,new AbortController),Te(this,Rd)(Te(this,ko),Fn(this,Zr,Px).call(this)).then(Te(this,Em)).catch(Te(this,Nm))},Em=new WeakMap,Nm=new WeakMap,Px=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Te(this,Cl)?{"Last-Event-ID":Te(this,Cl)}:void 0},cache:"no-store",signal:(e=Te(this,Cs))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},jm=new WeakMap,$m=new WeakMap,cl=function(e,t){var r;Te(this,cr)!==this.CLOSED&&rt(this,cr,this.CLOSED);const n=new jx("error",{code:t,message:e});(r=Te(this,Ki))==null||r.call(this,n),this.dispatchEvent(n)},Pm=function(e,t){var r;if(Te(this,cr)===this.CLOSED)return;rt(this,cr,this.CONNECTING);const n=new jx("error",{code:t,message:e});(r=Te(this,Ki))==null||r.call(this,n),this.dispatchEvent(n),rt(this,Ai,setTimeout(Te(this,Tm),Te(this,kl)))},Tm=new WeakMap,Ou.CONNECTING=0,Ou.OPEN=1,Ou.CLOSED=2;function LU(){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 Id(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function TN(e=fetch,t){return t?async(r,n)=>{const s={...t,...n,headers:n!=null&&n.headers?{...Id(t.headers),...Id(n.headers)}:t.headers};return e(r,s)}:e}let ny;ny=globalThis.crypto;async function FU(e){return(await ny).getRandomValues(new Uint8Array(e))}async function UU(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let r="";const n=await FU(e);for(let s=0;s<e;s++){const o=n[s]%t.length;r+=t[o]}return r}async function qU(e){return await UU(e)}async function VU(e){const t=await(await ny).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function HU(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;const t=await qU(e),r=await VU(t);return{code_verifier:t,code_challenge:r}}const Ot=d3().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:nF.custom,message:"URL must be parseable",fatal:!0}),rD}).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"}),KU=Dt({resource:A().url(),authorization_servers:ee(Ot).optional(),jwks_uri:A().url().optional(),scopes_supported:ee(A()).optional(),bearer_methods_supported:ee(A()).optional(),resource_signing_alg_values_supported:ee(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:Ye().optional(),authorization_details_types_supported:ee(A()).optional(),dpop_signing_alg_values_supported:ee(A()).optional(),dpop_bound_access_tokens_required:Ye().optional()}),RN=Dt({issuer:A(),authorization_endpoint:Ot,token_endpoint:Ot,registration_endpoint:Ot.optional(),scopes_supported:ee(A()).optional(),response_types_supported:ee(A()),response_modes_supported:ee(A()).optional(),grant_types_supported:ee(A()).optional(),token_endpoint_auth_methods_supported:ee(A()).optional(),token_endpoint_auth_signing_alg_values_supported:ee(A()).optional(),service_documentation:Ot.optional(),revocation_endpoint:Ot.optional(),revocation_endpoint_auth_methods_supported:ee(A()).optional(),revocation_endpoint_auth_signing_alg_values_supported:ee(A()).optional(),introspection_endpoint:A().optional(),introspection_endpoint_auth_methods_supported:ee(A()).optional(),introspection_endpoint_auth_signing_alg_values_supported:ee(A()).optional(),code_challenge_methods_supported:ee(A()).optional(),client_id_metadata_document_supported:Ye().optional()}),BU=Dt({issuer:A(),authorization_endpoint:Ot,token_endpoint:Ot,userinfo_endpoint:Ot.optional(),jwks_uri:Ot,registration_endpoint:Ot.optional(),scopes_supported:ee(A()).optional(),response_types_supported:ee(A()),response_modes_supported:ee(A()).optional(),grant_types_supported:ee(A()).optional(),acr_values_supported:ee(A()).optional(),subject_types_supported:ee(A()),id_token_signing_alg_values_supported:ee(A()),id_token_encryption_alg_values_supported:ee(A()).optional(),id_token_encryption_enc_values_supported:ee(A()).optional(),userinfo_signing_alg_values_supported:ee(A()).optional(),userinfo_encryption_alg_values_supported:ee(A()).optional(),userinfo_encryption_enc_values_supported:ee(A()).optional(),request_object_signing_alg_values_supported:ee(A()).optional(),request_object_encryption_alg_values_supported:ee(A()).optional(),request_object_encryption_enc_values_supported:ee(A()).optional(),token_endpoint_auth_methods_supported:ee(A()).optional(),token_endpoint_auth_signing_alg_values_supported:ee(A()).optional(),display_values_supported:ee(A()).optional(),claim_types_supported:ee(A()).optional(),claims_supported:ee(A()).optional(),service_documentation:A().optional(),claims_locales_supported:ee(A()).optional(),ui_locales_supported:ee(A()).optional(),claims_parameter_supported:Ye().optional(),request_parameter_supported:Ye().optional(),request_uri_parameter_supported:Ye().optional(),require_request_uri_registration:Ye().optional(),op_policy_uri:Ot.optional(),op_tos_uri:Ot.optional(),client_id_metadata_document_supported:Ye().optional()}),WU=te({...BU.shape,...RN.pick({code_challenge_methods_supported:!0}).shape}),ZU=te({access_token:A(),id_token:A().optional(),token_type:A(),expires_in:sF().optional(),scope:A().optional(),refresh_token:A().optional()}).strip(),GU=te({error:A(),error_description:A().optional(),error_uri:A().optional()}),Tx=Ot.optional().or(he("").transform(()=>{})),QU=te({redirect_uris:ee(Ot),token_endpoint_auth_method:A().optional(),grant_types:ee(A()).optional(),response_types:ee(A()).optional(),client_name:A().optional(),client_uri:Ot.optional(),logo_uri:Tx,scope:A().optional(),contacts:ee(A()).optional(),tos_uri:Tx,policy_uri:A().optional(),jwks_uri:Ot.optional(),jwks:R3().optional(),software_id:A().optional(),software_version:A().optional(),software_statement:A().optional()}).strip(),JU=te({client_id:A(),client_secret:A().optional(),client_id_issued_at:Fe().optional(),client_secret_expires_at:Fe().optional()}).strip(),YU=QU.merge(JU);te({error:A(),error_description:A().optional()}).strip();te({token:A(),token_type_hint:A().optional()}).strip();function XU(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function e5({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 Rm extends Rt{}Rm.errorCode="invalid_request";class Ad extends Rt{}Ad.errorCode="invalid_client";class Od extends Rt{}Od.errorCode="invalid_grant";class Md extends Rt{}Md.errorCode="unauthorized_client";class Im extends Rt{}Im.errorCode="unsupported_grant_type";class Am extends Rt{}Am.errorCode="invalid_scope";class Om extends Rt{}Om.errorCode="access_denied";class xa extends Rt{}xa.errorCode="server_error";class Mm extends Rt{}Mm.errorCode="temporarily_unavailable";class Dm extends Rt{}Dm.errorCode="unsupported_response_type";class zm extends Rt{}zm.errorCode="unsupported_token_type";class Lm extends Rt{}Lm.errorCode="invalid_token";class Fm extends Rt{}Fm.errorCode="method_not_allowed";class Um extends Rt{}Um.errorCode="too_many_requests";class Dd extends Rt{}Dd.errorCode="invalid_client_metadata";class qm extends Rt{}qm.errorCode="insufficient_scope";class Vm extends Rt{}Vm.errorCode="invalid_target";const t5={[Rm.errorCode]:Rm,[Ad.errorCode]:Ad,[Od.errorCode]:Od,[Md.errorCode]:Md,[Im.errorCode]:Im,[Am.errorCode]:Am,[Om.errorCode]:Om,[xa.errorCode]:xa,[Mm.errorCode]:Mm,[Dm.errorCode]:Dm,[zm.errorCode]:zm,[Lm.errorCode]:Lm,[Fm.errorCode]:Fm,[Um.errorCode]:Um,[Dd.errorCode]:Dd,[qm.errorCode]:qm,[Vm.errorCode]:Vm};class _r extends Error{constructor(t){super(t??"Unauthorized")}}function r5(e){return["client_secret_basic","client_secret_post","none"].includes(e)}const zh="code",Lh="S256";function n5(e,t){const r=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&r5(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 s5(e,t,r,n){const{client_id:s,client_secret:o}=t;switch(e){case"client_secret_basic":o5(s,o,r);return;case"client_secret_post":i5(s,o,n);return;case"none":a5(s,n);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function o5(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 i5(e,t,r){r.set("client_id",e),t&&r.set("client_secret",t)}function a5(e,t){t.set("client_id",e)}async function IN(e){const t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{const n=GU.parse(JSON.parse(r)),{error:s,error_description:o,error_uri:i}=n,a=t5[s]||xa;return new a(o||"",i)}catch(n){const s=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new xa(s)}}async function nn(e,t){var r,n;try{return await Fh(e,t)}catch(s){if(s instanceof Ad||s instanceof Md)return await((r=e.invalidateCredentials)==null?void 0:r.call(e,"all")),await Fh(e,t);if(s instanceof Od)return await((n=e.invalidateCredentials)==null?void 0:n.call(e,"tokens")),await Fh(e,t);throw s}}async function Fh(e,{serverUrl:t,authorizationCode:r,scope:n,resourceMetadataUrl:s,fetchFn:o}){var x,S,C,T,$;const i=await((x=e.discoveryState)==null?void 0:x.call(e));let a,c,u,d=s;if(!d&&(i!=null&&i.resourceMetadataUrl)&&(d=new URL(i.resourceMetadataUrl)),i!=null&&i.authorizationServerUrl){if(c=i.authorizationServerUrl,a=i.resourceMetadata,u=i.authorizationServerMetadata??await ON(c,{fetchFn:o}),!a)try{a=await AN(t,{resourceMetadataUrl:d},o)}catch{}(u!==i.authorizationServerMetadata||a!==i.resourceMetadata)&&await((S=e.saveDiscoveryState)==null?void 0:S.call(e,{authorizationServerUrl:String(c),resourceMetadataUrl:d==null?void 0:d.toString(),resourceMetadata:a,authorizationServerMetadata:u}))}else{const O=await p5(t,{resourceMetadataUrl:d,fetchFn:o});c=O.authorizationServerUrl,u=O.authorizationServerMetadata,a=O.resourceMetadata,await((C=e.saveDiscoveryState)==null?void 0:C.call(e,{authorizationServerUrl:String(c),resourceMetadataUrl:d==null?void 0:d.toString(),resourceMetadata:a,authorizationServerMetadata:u}))}const f=await c5(t,e,a),g=n||((T=a==null?void 0:a.scopes_supported)==null?void 0:T.join(" "))||e.clientMetadata.scope;let y=await Promise.resolve(e.clientInformation());if(!y){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");const O=(u==null?void 0:u.client_id_metadata_document_supported)===!0,M=e.clientMetadataUrl;if(M&&!l5(M))throw new Dd(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${M}`);if(O&&M)y={client_id:M},await(($=e.saveClientInformation)==null?void 0:$.call(e,y));else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const j=await w5(c,{metadata:u,clientMetadata:e.clientMetadata,scope:g,fetchFn:o});await e.saveClientInformation(j),y=j}}const b=!e.redirectUrl;if(r!==void 0||b){const O=await y5(e,c,{metadata:u,resource:f,authorizationCode:r,fetchFn:o});return await e.saveTokens(O),"AUTHORIZED"}const m=await e.tokens();if(m!=null&&m.refresh_token)try{const O=await v5(c,{metadata:u,clientInformation:y,refreshToken:m.refresh_token,resource:f,addClientAuthentication:e.addClientAuthentication,fetchFn:o});return await e.saveTokens(O),"AUTHORIZED"}catch(O){if(!(!(O instanceof Rt)||O instanceof xa))throw O}const v=e.state?await e.state():void 0,{authorizationUrl:h,codeVerifier:p}=await m5(c,{metadata:u,clientInformation:y,state:v,redirectUrl:e.redirectUrl,scope:g,resource:f});return await e.saveCodeVerifier(p),await e.redirectToAuthorization(h),"REDIRECT"}function l5(e){if(!e)return!1;try{const t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function c5(e,t,r){const n=XU(e);if(t.validateResourceURL)return await t.validateResourceURL(n,r==null?void 0:r.resource);if(r){if(!e5({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 zd(e){const t=e.headers.get("WWW-Authenticate");if(!t)return{};const[r,n]=t.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};const s=Uh(e,"resource_metadata")||void 0;let o;if(s)try{o=new URL(s)}catch{}const i=Uh(e,"scope")||void 0,a=Uh(e,"error")||void 0;return{resourceMetadataUrl:o,scope:i,error:a}}function Uh(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 AN(e,t,r=fetch){var s,o;const n=await f5(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 KU.parse(await n.json())}async function sy(e,t,r=fetch){try{return await r(e,{headers:t})}catch(n){if(n instanceof TypeError)return t?sy(e,void 0,r):void 0;throw n}}function u5(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function Rx(e,t,r=fetch){return await sy(e,{"MCP-Protocol-Version":t},r)}function d5(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function f5(e,t,r,n){const s=new URL(e),o=(n==null?void 0:n.protocolVersion)??Tf;let i;if(n!=null&&n.metadataUrl)i=new URL(n.metadataUrl);else{const c=u5(t,s.pathname);i=new URL(c,(n==null?void 0:n.metadataServerUrl)??s),i.search=s.search}let a=await Rx(i,o,r);if(!(n!=null&&n.metadataUrl)&&d5(a,s.pathname)){const c=new URL(`/.well-known/${t}`,s);a=await Rx(c,o,r)}return a}function h5(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 ON(e,{fetchFn:t=fetch,protocolVersion:r=Tf}={}){var o;const n={"MCP-Protocol-Version":r,Accept:"application/json"},s=h5(e);for(const{url:i,type:a}of s){const c=await sy(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 ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}return a==="oauth"?RN.parse(await c.json()):WU.parse(await c.json())}}}async function p5(e,t){let r,n;try{r=await AN(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 ON(n,{fetchFn:t==null?void 0:t.fetchFn});return{authorizationServerUrl:n,authorizationServerMetadata:s,resourceMetadata:r}}async function m5(e,{metadata:t,clientInformation:r,redirectUrl:n,scope:s,state:o,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(zh))throw new Error(`Incompatible auth server: does not support response type ${zh}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(Lh))throw new Error(`Incompatible auth server: does not support code challenge method ${Lh}`)}else a=new URL("/authorize",e);const c=await HU(),u=c.code_verifier,d=c.code_challenge;return a.searchParams.set("response_type",zh),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",d),a.searchParams.set("code_challenge_method",Lh),a.searchParams.set("redirect_uri",String(n)),o&&a.searchParams.set("state",o),s&&a.searchParams.set("scope",s),s!=null&&s.includes("offline_access")&&a.searchParams.append("prompt","consent"),i&&a.searchParams.set("resource",i.href),{authorizationUrl:a,codeVerifier:u}}function g5(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function MN(e,{metadata:t,tokenRequestParams:r,clientInformation:n,addClientAuthentication:s,resource:o,fetchFn:i}){const a=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,a,t);else if(n){const d=(t==null?void 0:t.token_endpoint_auth_methods_supported)??[],f=n5(n,d);s5(f,n,c,r)}const u=await(i??fetch)(a,{method:"POST",headers:c,body:r});if(!u.ok)throw await IN(u);return ZU.parse(await u.json())}async function v5(e,{metadata:t,clientInformation:r,refreshToken:n,resource:s,addClientAuthentication:o,fetchFn:i}){const a=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),c=await MN(e,{metadata:t,tokenRequestParams:a,clientInformation:r,addClientAuthentication:o,resource:s,fetchFn:i});return{refresh_token:n,...c}}async function y5(e,t,{metadata:r,resource:n,authorizationCode:s,fetchFn:o}={}){const i=e.clientMetadata.scope;let a;if(e.prepareTokenRequest&&(a=await e.prepareTokenRequest(i)),!a){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();a=g5(s,u,e.redirectUrl)}const c=await e.clientInformation();return MN(t,{metadata:r,tokenRequestParams:a,clientInformation:c??void 0,addClientAuthentication:e.addClientAuthentication,resource:n,fetchFn:o})}async function w5(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 IN(i);return YU.parse(await i.json())}class x5 extends Error{constructor(t,r,n){super(`SSE error: ${r}`),this.code=t,this.event=n}}class b5{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=TN(r==null?void 0:r.fetch,r==null?void 0:r.requestInit)}async _authThenStart(){var r;if(!this._authProvider)throw new _r("No auth provider");let t;try{t=await nn(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 _r;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=Id((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 Ou(this._url.href,{...this._eventSourceInit,fetch:async(o,i)=>{const a=await this._commonHeaders();a.set("Accept","text/event-stream");const c=await t(o,{...i,headers:a});if(c.status===401&&c.headers.has("www-authenticate")){const{resourceMetadataUrl:u,scope:d}=zd(c);this._resourceMetadataUrl=u,this._scope=d}return c}}),this._abortController=new AbortController,this._eventSource.onerror=o=>{var a;if(o.code===401&&this._authProvider){this._authThenStart().then(n,s);return}const i=new x5(o.code,o.message,o);s(i),(a=this.onerror)==null||a.call(this,i)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",o=>{var a;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),(a=this.onerror)==null||a.call(this,c),this.close();return}n()}),this._eventSource.onmessage=o=>{var c,u;const i=o;let a;try{a=Iu.parse(JSON.parse(i.data))}catch(d){(c=this.onerror)==null||c.call(this,d);return}(u=this.onmessage)==null||u.call(this,a)}})}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 _r("No auth provider");if(await nn(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new _r("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},a=await(this._fetch??fetch)(this._endpoint,i);if(!a.ok){const c=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){const{resourceMetadataUrl:u,scope:d}=zd(a);if(this._resourceMetadataUrl=u,this._scope=d,await nn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new _r;return this.send(t)}throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${c}`)}await((n=a.body)==null?void 0:n.cancel())}catch(o){throw(s=this.onerror)==null||s.call(this,o),o}}setProtocolVersion(t){this._protocolVersion=t}}class _5 extends TransformStream{constructor({onError:t,onRetry:r,onComment:n}={}){let s;super({start(o){s=$N({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 S5={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class di extends Error{constructor(t,r){super(`Streamable HTTP error: ${r}`),this.code=t}}class k5{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=TN(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)??S5}async _authThenStart(){var r;if(!this._authProvider)throw new _r("No auth provider");let t;try{t=await nn(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 _r;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=Id((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 a=await(this._fetch??fetch)(this._url,{method:"GET",headers:i,signal:(n=this._abortController)==null?void 0:n.signal});if(!a.ok){if(await((s=a.body)==null?void 0:s.cancel()),a.status===401&&this._authProvider)return await this._authThenStart();if(a.status===405)return;throw new di(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.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 a;(a=this.onerror)==null||a.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,a=!1,c=!1;(async()=>{var d,f,g,y;try{const b=t.pipeThrough(new TextDecoderStream).pipeThrough(new _5({onRetry:h=>{this._serverRetryMs=h}})).getReader();for(;;){const{value:h,done:p}=await b.read();if(p)break;if(h.id&&(i=h.id,a=!0,s==null||s(h.id)),!!h.data&&(!h.event||h.event==="message"))try{const x=Iu.parse(JSON.parse(h.data));al(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||a)&&!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||a)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:s,replayMessageId:o},0)}catch(h){(y=this.onerror)==null||y.call(this,new Error(`Failed to reconnect: ${h instanceof Error?h.message:String(h)}`))}}})()}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 _r("No auth provider");if(await nn(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new _r("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,a,c;try{const{resumptionToken:u,onresumptiontoken:d}=r||{};if(u){this._startOrAuthSse({resumptionToken:u,replayMessageId:Sm(t)?t.id:void 0}).catch(p=>{var x;return(x=this.onerror)==null?void 0:x.call(this,p)});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},y=await(this._fetch??fetch)(this._url,g),b=y.headers.get("mcp-session-id");if(b&&(this._sessionId=b),!y.ok){const p=await y.text().catch(()=>null);if(y.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new di(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:x,scope:S}=zd(y);if(this._resourceMetadataUrl=x,this._scope=S,await nn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new _r;return this._hasCompletedAuthFlow=!0,this.send(t)}if(y.status===403&&this._authProvider){const{resourceMetadataUrl:x,scope:S,error:C}=zd(y);if(C==="insufficient_scope"){const T=y.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===T)throw new di(403,"Server returned 403 after trying upscoping");if(S&&(this._scope=S),x&&(this._resourceMetadataUrl=x),this._lastUpscopingHeader=T??void 0,await nn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new _r;return this.send(t)}}throw new di(y.status,`Error POSTing to endpoint: ${p}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,y.status===202){await((s=y.body)==null?void 0:s.cancel()),bF(t)&&this._startOrAuthSse({resumptionToken:void 0}).catch(p=>{var x;return(x=this.onerror)==null?void 0:x.call(this,p)});return}const v=(Array.isArray(t)?t:[t]).filter(p=>"method"in p&&"id"in p&&p.id!==void 0).length>0,h=y.headers.get("content-type");if(v)if(h!=null&&h.includes("text/event-stream"))this._handleSseStream(y.body,{onresumptiontoken:d},!1);else if(h!=null&&h.includes("application/json")){const p=await y.json(),x=Array.isArray(p)?p.map(S=>Iu.parse(S)):[Iu.parse(p)];for(const S of x)(o=this.onmessage)==null||o.call(this,S)}else throw await((i=y.body)==null?void 0:i.cancel()),new di(-1,`Unexpected content type: ${h}`);else await((a=y.body)==null?void 0:a.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 di(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 Af(e){return!!e._zod}function _s(e,t){return Af(e)?OE(e,t):e.safeParse(t)}function DN(e){var r,n;if(!e)return;let t;if(Af(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 C5(e){var s;if(Af(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 vo(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Ix(e){const t=DN(e),r=t==null?void 0:t.method;if(!r)throw new Error("Schema is missing a method literal");const n=C5(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Ax(e,t){const r=_s(e,t);if(!r.success)throw r.error;return r.data}const E5=6e4;class N5{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(zv,r=>{this._oncancel(r)}),this.setNotificationHandler(Fv,r=>{this._onprogress(r)}),this.setRequestHandler(Lv,r=>({})),this._taskStore=t==null?void 0:t.taskStore,this._taskMessageQueue=t==null?void 0:t.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Uv,async(r,n)=>{const s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new ye(xe.InvalidParams,"Failed to retrieve task: Task not found");return{...s}}),this.setRequestHandler(Vv,async(r,n)=>{const s=async()=>{var a;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,y=new ye(g.error.code,g.error.message,g.error.data);f(y)}else{const g=c.type==="response"?"Response":"Error";this._onerror(new Error(`${g} handler missing for request ${d}`))}continue}await((a=this._transport)==null?void 0:a.send(c.message,{relatedRequestId:n.requestId}))}}const i=await this._taskStore.getTask(o,n.sessionId);if(!i)throw new ye(xe.InvalidParams,`Task not found: ${o}`);if(!vo(i.status))return await this._waitForTaskUpdate(o,n.signal),await s();if(vo(i.status)){const c=await this._taskStore.getTaskResult(o,n.sessionId);return this._clearTaskQueue(o),{...c,_meta:{...c._meta,[So]:{taskId:o}}}}return await s()};return await s()}),this.setRequestHandler(Hv,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 ye(xe.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Bv,async(r,n)=>{try{const s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new ye(xe.InvalidParams,`Task not found: ${r.params.taskId}`);if(vo(s.status))throw new ye(xe.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 ye(xe.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...o}}catch(s){throw s instanceof ye?s:new ye(xe.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),ye.fromError(xe.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,a;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=(a=this._transport)==null?void 0:a.onmessage;this._transport.onmessage=(c,u)=>{s==null||s(c,u),al(c)||uF(c)?this._onresponse(c):Sm(c)?this._onrequest(c,u):cF(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=ye.fromError(xe.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,y;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[So])==null?void 0:g.taskId;if(n===void 0){const b={jsonrpc:"2.0",id:t.id,error:{code:xe.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(m=>this._onerror(new Error(`Failed to enqueue error response: ${m}`))):s==null||s.send(b).catch(m=>this._onerror(new Error(`Failed to send an error response: ${m}`)));return}const i=new AbortController;this._requestHandlerAbortControllers.set(t.id,i);const a=lF(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:(y=t.params)==null?void 0:y._meta,sendNotification:async b=>{if(i.signal.aborted)return;const m={relatedRequestId:t.id};o&&(m.relatedTask={taskId:o}),await this.notification(b,m)},sendRequest:async(b,m,v)=>{var x;if(i.signal.aborted)throw new ye(xe.ConnectionClosed,"Request was cancelled");const h={...v,relatedRequestId:t.id};o&&!h.relatedTask&&(h.relatedTask={taskId:o});const p=((x=h.relatedTask)==null?void 0:x.taskId)??o;return p&&c&&await c.updateTaskStatus(p,"input_required"),await this.request(b,m,h)},authInfo:r==null?void 0:r.authInfo,requestId:t.id,requestInfo:r==null?void 0:r.requestInfo,taskId:o,taskStore:c,taskRequestedTtl:a==null?void 0:a.ttl,closeSSEStream:r==null?void 0:r.closeSSEStream,closeStandaloneSSEStream:r==null?void 0:r.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async b=>{if(i.signal.aborted)return;const m={result:b,jsonrpc:"2.0",id:t.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:m,timestamp:Date.now()},s==null?void 0:s.sessionId):await(s==null?void 0:s.send(m))},async b=>{if(i.signal.aborted)return;const m={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(b.code)?b.code:xe.InternalError,message:b.message??"Internal error",...b.data!==void 0&&{data:b.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:m,timestamp:Date.now()},s==null?void 0:s.sessionId):await(s==null?void 0:s.send(m))}).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),a=this._timeoutInfo.get(s);if(a&&i&&a.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),al(t))n(t);else{const i=new ye(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(al(t)&&t.result&&typeof t.result=="object"){const i=t.result;if(i.task&&typeof i.task=="object"){const a=i.task;typeof a.taskId=="string"&&(o=!0,this._taskProgressTokens.set(a.taskId,r))}}if(o||this._progressHandlers.delete(r),al(t))s(t);else{const i=ye.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,a;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 ye?c:new ye(xe.InternalError,String(c))}}return}let o;try{const c=await this.request(t,Xl,n);if(c.task)o=c.task.taskId,yield{type:"taskCreated",task:c.task};else throw new ye(xe.InternalError,"Task creation did not return a task");for(;;){const u=await this.getTask({taskId:o},n);if(yield{type:"taskStatus",task:u},vo(u.status)){u.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)}:u.status==="failed"?yield{type:"error",error:new ye(xe.InternalError,`Task ${o} failed`)}:u.status==="cancelled"&&(yield{type:"error",error:new ye(xe.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)),(a=n==null?void 0:n.signal)==null||a.throwIfAborted()}}catch(c){yield{type:"error",error:c instanceof ye?c:new ye(xe.InternalError,String(c))}}}request(t,r,n){const{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i,task:a,relatedTask:c}=n??{};return new Promise((u,d)=>{var p,x,S,C,T;const f=$=>{d($)};if(!this._transport){f(new Error("Not connected"));return}if(((p=this._options)==null?void 0:p.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch($){f($);return}(x=n==null?void 0:n.signal)==null||x.throwIfAborted();const g=this._requestMessageId++,y={...t,jsonrpc:"2.0",id:g};n!=null&&n.onprogress&&(this._progressHandlers.set(g,n.onprogress),y.params={...t.params,_meta:{...((S=t.params)==null?void 0:S._meta)||{},progressToken:g}}),a&&(y.params={...y.params,task:a}),c&&(y.params={...y.params,_meta:{...((C=y.params)==null?void 0:C._meta)||{},[So]:c}});const b=$=>{var M;this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),(M=this._transport)==null||M.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String($)}},{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i}).catch(U=>this._onerror(new Error(`Failed to send cancellation: ${U}`)));const O=$ instanceof ye?$:new ye(xe.RequestTimeout,String($));d(O)};this._responseHandlers.set(g,$=>{var O;if(!((O=n==null?void 0:n.signal)!=null&&O.aborted)){if($ instanceof Error)return d($);try{const M=_s(r,$.result);M.success?u(M.data):d(M.error)}catch(M){d(M)}}}),(T=n==null?void 0:n.signal)==null||T.addEventListener("abort",()=>{var $;b(($=n==null?void 0:n.signal)==null?void 0:$.reason)});const m=(n==null?void 0:n.timeout)??E5,v=()=>b(ye.fromError(xe.RequestTimeout,"Request timed out",{timeout:m}));this._setupTimeout(g,m,n==null?void 0:n.maxTotalTimeout,v,(n==null?void 0:n.resetTimeoutOnProgress)??!1);const h=c==null?void 0:c.taskId;if(h){const $=O=>{const M=this._responseHandlers.get(g);M?M(O):this._onerror(new Error(`Response handler missing for side-channeled request ${g}`))};this._requestResolvers.set(g,$),this._enqueueTaskMessage(h,{type:"request",message:y,timestamp:Date.now()}).catch(O=>{this._cleanupTimeout(g),d(O)})}else this._transport.send(y,{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i}).catch($=>{this._cleanupTimeout(g),d($)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},qv,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},Kv,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},NF,r)}async notification(t,r){var a,c,u,d;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);const n=(a=r==null?void 0:r.relatedTask)==null?void 0:a.taskId;if(n){const f={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...((c=t.params)==null?void 0:c._meta)||{},[So]: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,y;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)||{},[So]:r.relatedTask}}}),(y=this._transport)==null||y.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)||{},[So]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(t,r){const n=Ix(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(s,o)=>{const i=Ax(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=Ix(t);this._notificationHandlers.set(n,s=>{const o=Ax(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"&&Sm(s.message)){const o=s.message.id,i=this._requestResolvers.get(o);i?(i(new ye(xe.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,a)=>{if(r.aborted){a(new ye(xe.InvalidRequest,"Request cancelled"));return}const c=setTimeout(i,n);r.addEventListener("abort",()=>{clearTimeout(c),a(new ye(xe.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 ye(xe.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(s,o,i)=>{await n.storeTaskResult(s,o,i,r);const a=await n.getTask(s,r);if(a){const c=jd.parse({method:"notifications/tasks/status",params:a});await this.notification(c),vo(a.status)&&this._cleanupTaskProgressHandler(s)}},getTaskResult:s=>n.getTaskResult(s,r),updateTaskStatus:async(s,o,i)=>{const a=await n.getTask(s,r);if(!a)throw new ye(xe.InvalidParams,`Task "${s}" not found - it may have been cleaned up`);if(vo(a.status))throw new ye(xe.InvalidParams,`Cannot update task "${s}" from terminal status "${a.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=jd.parse({method:"notifications/tasks/status",params:c});await this.notification(u),vo(c.status)&&this._cleanupTaskProgressHandler(s)}},listTasks:s=>n.listTasks(s,r)}}}function Ox(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function j5(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];Ox(i)&&Ox(o)?r[s]={...i,...o}:r[s]=o}return r}var Hm={exports:{}},zN={},an={},ba={},kc={},je={},ec={};(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(p){if(super(),!e.IDENTIFIER.test(p))throw new Error("CodeGen: name must be a valid identifier");this.str=p}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(p){super(),this._items=typeof p=="string"?[p]:p}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const p=this._items[0];return p===""||p==='""'}get str(){var p;return(p=this._str)!==null&&p!==void 0?p:this._str=this._items.reduce((x,S)=>`${x}${S}`,"")}get names(){var p;return(p=this._names)!==null&&p!==void 0?p:this._names=this._items.reduce((x,S)=>(S instanceof r&&(x[S.str]=(x[S.str]||0)+1),x),{})}}e._Code=n,e.nil=new n("");function s(h,...p){const x=[h[0]];let S=0;for(;S<p.length;)a(x,p[S]),x.push(h[++S]);return new n(x)}e._=s;const o=new n("+");function i(h,...p){const x=[y(h[0])];let S=0;for(;S<p.length;)x.push(o),a(x,p[S]),x.push(o,y(h[++S]));return c(x),new n(x)}e.str=i;function a(h,p){p instanceof n?h.push(...p._items):p instanceof r?h.push(p):h.push(f(p))}e.addCodeArg=a;function c(h){let p=1;for(;p<h.length-1;){if(h[p]===o){const x=u(h[p-1],h[p+1]);if(x!==void 0){h.splice(p-1,3,x);continue}h[p++]="+"}p++}}function u(h,p){if(p==='""')return h;if(h==='""')return p;if(typeof h=="string")return p instanceof r||h[h.length-1]!=='"'?void 0:typeof p!="string"?`${h.slice(0,-1)}${p}"`:p[0]==='"'?h.slice(0,-1)+p.slice(1):void 0;if(typeof p=="string"&&p[0]==='"'&&!(h instanceof r))return`"${h}${p.slice(1)}`}function d(h,p){return p.emptyStr()?h:h.emptyStr()?p:i`${h}${p}`}e.strConcat=d;function f(h){return typeof h=="number"||typeof h=="boolean"||h===null?h:y(Array.isArray(h)?h.join(","):h)}function g(h){return new n(y(h))}e.stringify=g;function y(h){return JSON.stringify(h).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=y;function b(h){return typeof h=="string"&&e.IDENTIFIER.test(h)?new n(`.${h}`):s`[${h}]`}e.getProperty=b;function m(h){if(typeof h=="string"&&e.IDENTIFIER.test(h))return new n(`${h}`);throw new Error(`CodeGen: invalid export name: ${h}, use explicit $id name mapping`)}e.getEsmExportName=m;function v(h){return new n(h.toString())}e.regexpCode=v})(ec);var Km={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=ec;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 a 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:y}=g,b=(f=d.key)!==null&&f!==void 0?f:d.ref;let m=this._values[y];if(m){const p=m.get(b);if(p)return p}else m=this._values[y]=new Map;m.set(b,g);const v=this._scope[y]||(this._scope[y]=[]),h=v.length;return v[h]=d.ref,g.setValue(d,{property:y,itemIndex:h}),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 y=t.nil;for(const b in u){const m=u[b];if(!m)continue;const v=f[b]=f[b]||new Map;m.forEach(h=>{if(v.has(h))return;v.set(h,n.Started);let p=d(h);if(p){const x=this.opts.es5?e.varKinds.var:e.varKinds.const;y=(0,t._)`${y}${x} ${h} = ${p};${this.opts._n}`}else if(p=g==null?void 0:g(h))y=(0,t._)`${y}${p}${this.opts._n}`;else throw new r(h);v.set(h,n.Completed)})}return y}}e.ValueScope=a})(Km);(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=ec,r=Km;var n=ec;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=Km;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(_,E){return this}}class i extends o{constructor(_,E,D){super(),this.varKind=_,this.name=E,this.rhs=D}render({es5:_,_n:E}){const D=_?r.varKinds.var:this.varKind,K=this.rhs===void 0?"":` = ${this.rhs}`;return`${D} ${this.name}${K};`+E}optimizeNames(_,E){if(_[this.name.str])return this.rhs&&(this.rhs=P(this.rhs,_,E)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class a extends o{constructor(_,E,D){super(),this.lhs=_,this.rhs=E,this.sideEffects=D}render({_n:_}){return`${this.lhs} = ${this.rhs};`+_}optimizeNames(_,E){if(!(this.lhs instanceof t.Name&&!_[this.lhs.str]&&!this.sideEffects))return this.rhs=P(this.rhs,_,E),this}get names(){const _=this.lhs instanceof t.Name?{}:{...this.lhs.names};return L(_,this.rhs)}}class c extends a{constructor(_,E,D,K){super(_,D,K),this.op=E}render({_n:_}){return`${this.lhs} ${this.op}= ${this.rhs};`+_}}class u extends o{constructor(_){super(),this.label=_,this.names={}}render({_n:_}){return`${this.label}:`+_}}class d extends o{constructor(_){super(),this.label=_,this.names={}}render({_n:_}){return`break${this.label?` ${this.label}`:""};`+_}}class f extends o{constructor(_){super(),this.error=_}render({_n:_}){return`throw ${this.error};`+_}get names(){return this.error.names}}class g extends o{constructor(_){super(),this.code=_}render({_n:_}){return`${this.code};`+_}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(_,E){return this.code=P(this.code,_,E),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class y extends o{constructor(_=[]){super(),this.nodes=_}render(_){return this.nodes.reduce((E,D)=>E+D.render(_),"")}optimizeNodes(){const{nodes:_}=this;let E=_.length;for(;E--;){const D=_[E].optimizeNodes();Array.isArray(D)?_.splice(E,1,...D):D?_[E]=D:_.splice(E,1)}return _.length>0?this:void 0}optimizeNames(_,E){const{nodes:D}=this;let K=D.length;for(;K--;){const Z=D[K];Z.optimizeNames(_,E)||(B(_,Z.names),D.splice(K,1))}return D.length>0?this:void 0}get names(){return this.nodes.reduce((_,E)=>k(_,E.names),{})}}class b extends y{render(_){return"{"+_._n+super.render(_)+"}"+_._n}}class m extends y{}class v extends b{}v.kind="else";class h extends b{constructor(_,E){super(E),this.condition=_}render(_){let E=`if(${this.condition})`+super.render(_);return this.else&&(E+="else "+this.else.render(_)),E}optimizeNodes(){super.optimizeNodes();const _=this.condition;if(_===!0)return this.nodes;let E=this.else;if(E){const D=E.optimizeNodes();E=this.else=Array.isArray(D)?new v(D):D}if(E)return _===!1?E instanceof h?E:E.nodes:this.nodes.length?this:new h(H(_),E instanceof h?[E]:E.nodes);if(!(_===!1||!this.nodes.length))return this}optimizeNames(_,E){var D;if(this.else=(D=this.else)===null||D===void 0?void 0:D.optimizeNames(_,E),!!(super.optimizeNames(_,E)||this.else))return this.condition=P(this.condition,_,E),this}get names(){const _=super.names;return L(_,this.condition),this.else&&k(_,this.else.names),_}}h.kind="if";class p extends b{}p.kind="for";class x extends p{constructor(_){super(),this.iteration=_}render(_){return`for(${this.iteration})`+super.render(_)}optimizeNames(_,E){if(super.optimizeNames(_,E))return this.iteration=P(this.iteration,_,E),this}get names(){return k(super.names,this.iteration.names)}}class S extends p{constructor(_,E,D,K){super(),this.varKind=_,this.name=E,this.from=D,this.to=K}render(_){const E=_.es5?r.varKinds.var:this.varKind,{name:D,from:K,to:Z}=this;return`for(${E} ${D}=${K}; ${D}<${Z}; ${D}++)`+super.render(_)}get names(){const _=L(super.names,this.from);return L(_,this.to)}}class C extends p{constructor(_,E,D,K){super(),this.loop=_,this.varKind=E,this.name=D,this.iterable=K}render(_){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(_)}optimizeNames(_,E){if(super.optimizeNames(_,E))return this.iterable=P(this.iterable,_,E),this}get names(){return k(super.names,this.iterable.names)}}class T extends b{constructor(_,E,D){super(),this.name=_,this.args=E,this.async=D}render(_){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(_)}}T.kind="func";class $ extends y{render(_){return"return "+super.render(_)}}$.kind="return";class O extends b{render(_){let E="try"+super.render(_);return this.catch&&(E+=this.catch.render(_)),this.finally&&(E+=this.finally.render(_)),E}optimizeNodes(){var _,E;return super.optimizeNodes(),(_=this.catch)===null||_===void 0||_.optimizeNodes(),(E=this.finally)===null||E===void 0||E.optimizeNodes(),this}optimizeNames(_,E){var D,K;return super.optimizeNames(_,E),(D=this.catch)===null||D===void 0||D.optimizeNames(_,E),(K=this.finally)===null||K===void 0||K.optimizeNames(_,E),this}get names(){const _=super.names;return this.catch&&k(_,this.catch.names),this.finally&&k(_,this.finally.names),_}}class M extends b{constructor(_){super(),this.error=_}render(_){return`catch(${this.error})`+super.render(_)}}M.kind="catch";class U extends b{render(_){return"finally"+super.render(_)}}U.kind="finally";class j{constructor(_,E={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...E,_n:E.lines?`
|
|
398
|
-
`:""},this._extScope=_,this._scope=new r.Scope({parent:_}),this._nodes=[new m]}toString(){return this._root.render(this.opts)}name(_){return this._scope.name(_)}scopeName(_){return this._extScope.name(_)}scopeValue(_,E){const D=this._extScope.value(_,E);return(this._values[D.prefix]||(this._values[D.prefix]=new Set)).add(D),D}getScopeValue(_,E){return this._extScope.getValue(_,E)}scopeRefs(_){return this._extScope.scopeRefs(_,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(_,E,D,K){const Z=this._scope.toName(E);return D!==void 0&&K&&(this._constants[Z.str]=D),this._leafNode(new i(_,Z,D)),Z}const(_,E,D){return this._def(r.varKinds.const,_,E,D)}let(_,E,D){return this._def(r.varKinds.let,_,E,D)}var(_,E,D){return this._def(r.varKinds.var,_,E,D)}assign(_,E,D){return this._leafNode(new a(_,E,D))}add(_,E){return this._leafNode(new c(_,e.operators.ADD,E))}code(_){return typeof _=="function"?_():_!==t.nil&&this._leafNode(new g(_)),this}object(..._){const E=["{"];for(const[D,K]of _)E.length>1&&E.push(","),E.push(D),(D!==K||this.opts.es5)&&(E.push(":"),(0,t.addCodeArg)(E,K));return E.push("}"),new t._Code(E)}if(_,E,D){if(this._blockNode(new h(_)),E&&D)this.code(E).else().code(D).endIf();else if(E)this.code(E).endIf();else if(D)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(_){return this._elseNode(new h(_))}else(){return this._elseNode(new v)}endIf(){return this._endBlockNode(h,v)}_for(_,E){return this._blockNode(_),E&&this.code(E).endFor(),this}for(_,E){return this._for(new x(_),E)}forRange(_,E,D,K,Z=this.opts.es5?r.varKinds.var:r.varKinds.let){const le=this._scope.toName(_);return this._for(new S(Z,le,E,D),()=>K(le))}forOf(_,E,D,K=r.varKinds.const){const Z=this._scope.toName(_);if(this.opts.es5){const le=E instanceof t.Name?E:this.var("_arr",E);return this.forRange("_i",0,(0,t._)`${le}.length`,re=>{this.var(Z,(0,t._)`${le}[${re}]`),D(Z)})}return this._for(new C("of",K,Z,E),()=>D(Z))}forIn(_,E,D,K=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(_,(0,t._)`Object.keys(${E})`,D);const Z=this._scope.toName(_);return this._for(new C("in",K,Z,E),()=>D(Z))}endFor(){return this._endBlockNode(p)}label(_){return this._leafNode(new u(_))}break(_){return this._leafNode(new d(_))}return(_){const E=new $;if(this._blockNode(E),this.code(_),E.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode($)}try(_,E,D){if(!E&&!D)throw new Error('CodeGen: "try" without "catch" and "finally"');const K=new O;if(this._blockNode(K),this.code(_),E){const Z=this.name("e");this._currNode=K.catch=new M(Z),E(Z)}return D&&(this._currNode=K.finally=new U,this.code(D)),this._endBlockNode(M,U)}throw(_){return this._leafNode(new f(_))}block(_,E){return this._blockStarts.push(this._nodes.length),_&&this.code(_).endBlock(E),this}endBlock(_){const E=this._blockStarts.pop();if(E===void 0)throw new Error("CodeGen: not in self-balancing block");const D=this._nodes.length-E;if(D<0||_!==void 0&&D!==_)throw new Error(`CodeGen: wrong number of nodes: ${D} vs ${_} expected`);return this._nodes.length=E,this}func(_,E=t.nil,D,K){return this._blockNode(new T(_,E,D)),K&&this.code(K).endFunc(),this}endFunc(){return this._endBlockNode(T)}optimize(_=1){for(;_-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(_){return this._currNode.nodes.push(_),this}_blockNode(_){this._currNode.nodes.push(_),this._nodes.push(_)}_endBlockNode(_,E){const D=this._currNode;if(D instanceof _||E&&D instanceof E)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${E?`${_.kind}/${E.kind}`:_.kind}"`)}_elseNode(_){const E=this._currNode;if(!(E instanceof h))throw new Error('CodeGen: "else" without "if"');return this._currNode=E.else=_,this}get _root(){return this._nodes[0]}get _currNode(){const _=this._nodes;return _[_.length-1]}set _currNode(_){const E=this._nodes;E[E.length-1]=_}}e.CodeGen=j;function k(N,_){for(const E in _)N[E]=(N[E]||0)+(_[E]||0);return N}function L(N,_){return _ instanceof t._CodeOrName?k(N,_.names):N}function P(N,_,E){if(N instanceof t.Name)return D(N);if(!K(N))return N;return new t._Code(N._items.reduce((Z,le)=>(le instanceof t.Name&&(le=D(le)),le instanceof t._Code?Z.push(...le._items):Z.push(le),Z),[]));function D(Z){const le=E[Z.str];return le===void 0||_[Z.str]!==1?Z:(delete _[Z.str],le)}function K(Z){return Z instanceof t._Code&&Z._items.some(le=>le instanceof t.Name&&_[le.str]===1&&E[le.str]!==void 0)}}function B(N,_){for(const E in _)N[E]=(N[E]||0)-(_[E]||0)}function H(N){return typeof N=="boolean"||typeof N=="number"||N===null?!N:(0,t._)`!${F(N)}`}e.not=H;const G=I(e.operators.AND);function q(...N){return N.reduce(G)}e.and=q;const V=I(e.operators.OR);function z(...N){return N.reduce(V)}e.or=z;function I(N){return(_,E)=>_===t.nil?E:E===t.nil?_:(0,t._)`${F(_)} ${N} ${F(E)}`}function F(N){return N instanceof t.Name?N:(0,t._)`(${N})`}})(je);var oe={};Object.defineProperty(oe,"__esModule",{value:!0});oe.checkStrictMode=oe.getErrorPath=oe.Type=oe.useFunc=oe.setEvaluated=oe.evaluatedPropsToName=oe.mergeEvaluated=oe.eachItem=oe.unescapeJsonPointer=oe.escapeJsonPointer=oe.escapeFragment=oe.unescapeFragment=oe.schemaRefOrVal=oe.schemaHasRulesButRef=oe.schemaHasRules=oe.checkUnknownRules=oe.alwaysValidSchema=oe.toHash=void 0;const Ke=je,$5=ec;function P5(e){const t={};for(const r of e)t[r]=!0;return t}oe.toHash=P5;function T5(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(LN(e,t),!FN(t,e.self.RULES.all))}oe.alwaysValidSchema=T5;function LN(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]||VN(e,`unknown keyword: "${o}"`)}oe.checkUnknownRules=LN;function FN(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(t[r])return!0;return!1}oe.schemaHasRules=FN;function R5(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}oe.schemaHasRulesButRef=R5;function I5({topSchemaRef:e,schemaPath:t},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Ke._)`${r}`}return(0,Ke._)`${e}${t}${(0,Ke.getProperty)(n)}`}oe.schemaRefOrVal=I5;function A5(e){return UN(decodeURIComponent(e))}oe.unescapeFragment=A5;function O5(e){return encodeURIComponent(oy(e))}oe.escapeFragment=O5;function oy(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}oe.escapeJsonPointer=oy;function UN(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}oe.unescapeJsonPointer=UN;function M5(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)}oe.eachItem=M5;function Mx({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(s,o,i,a)=>{const c=i===void 0?o:i instanceof Ke.Name?(o instanceof Ke.Name?e(s,o,i):t(s,o,i),i):o instanceof Ke.Name?(t(s,i,o),o):r(o,i);return a===Ke.Name&&!(c instanceof Ke.Name)?n(s,c):c}}oe.mergeEvaluated={props:Mx({mergeNames:(e,t,r)=>e.if((0,Ke._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,Ke._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,Ke._)`${r} || {}`).code((0,Ke._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,Ke._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,Ke._)`${r} || {}`),iy(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:qN}),items:Mx({mergeNames:(e,t,r)=>e.if((0,Ke._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,Ke._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,Ke._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,Ke._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function qN(e,t){if(t===!0)return e.var("props",!0);const r=e.var("props",(0,Ke._)`{}`);return t!==void 0&&iy(e,r,t),r}oe.evaluatedPropsToName=qN;function iy(e,t,r){Object.keys(r).forEach(n=>e.assign((0,Ke._)`${t}${(0,Ke.getProperty)(n)}`,!0))}oe.setEvaluated=iy;const Dx={};function D5(e,t){return e.scopeValue("func",{ref:t,code:Dx[t.code]||(Dx[t.code]=new $5._Code(t.code))})}oe.useFunc=D5;var Bm;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Bm||(oe.Type=Bm={}));function z5(e,t,r){if(e instanceof Ke.Name){const n=t===Bm.Num;return r?n?(0,Ke._)`"[" + ${e} + "]"`:(0,Ke._)`"['" + ${e} + "']"`:n?(0,Ke._)`"/" + ${e}`:(0,Ke._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Ke.getProperty)(e).toString():"/"+oy(e)}oe.getErrorPath=z5;function VN(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}oe.checkStrictMode=VN;var On={};Object.defineProperty(On,"__esModule",{value:!0});const Bt=je,L5={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")};On.default=L5;(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=oe,n=On;e.keywordError={message:({keyword:v})=>(0,t.str)`must pass "${v}" keyword validation`},e.keyword$DataError={message:({keyword:v,schemaType:h})=>h?(0,t.str)`"${v}" keyword must be ${h} ($data)`:(0,t.str)`"${v}" keyword is invalid ($data)`};function s(v,h=e.keywordError,p,x){const{it:S}=v,{gen:C,compositeRule:T,allErrors:$}=S,O=f(v,h,p);x??(T||$)?c(C,O):u(S,(0,t._)`[${O}]`)}e.reportError=s;function o(v,h=e.keywordError,p){const{it:x}=v,{gen:S,compositeRule:C,allErrors:T}=x,$=f(v,h,p);c(S,$),C||T||u(x,n.default.vErrors)}e.reportExtraError=o;function i(v,h){v.assign(n.default.errors,h),v.if((0,t._)`${n.default.vErrors} !== null`,()=>v.if(h,()=>v.assign((0,t._)`${n.default.vErrors}.length`,h),()=>v.assign(n.default.vErrors,null)))}e.resetErrorsCount=i;function a({gen:v,keyword:h,schemaValue:p,data:x,errsCount:S,it:C}){if(S===void 0)throw new Error("ajv implementation error");const T=v.name("err");v.forRange("i",S,n.default.errors,$=>{v.const(T,(0,t._)`${n.default.vErrors}[${$}]`),v.if((0,t._)`${T}.instancePath === undefined`,()=>v.assign((0,t._)`${T}.instancePath`,(0,t.strConcat)(n.default.instancePath,C.errorPath))),v.assign((0,t._)`${T}.schemaPath`,(0,t.str)`${C.errSchemaPath}/${h}`),C.opts.verbose&&(v.assign((0,t._)`${T}.schema`,p),v.assign((0,t._)`${T}.data`,x))})}e.extendErrors=a;function c(v,h){const p=v.const("err",h);v.if((0,t._)`${n.default.vErrors} === null`,()=>v.assign(n.default.vErrors,(0,t._)`[${p}]`),(0,t._)`${n.default.vErrors}.push(${p})`),v.code((0,t._)`${n.default.errors}++`)}function u(v,h){const{gen:p,validateName:x,schemaEnv:S}=v;S.$async?p.throw((0,t._)`new ${v.ValidationError}(${h})`):(p.assign((0,t._)`${x}.errors`,h),p.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(v,h,p){const{createErrors:x}=v.it;return x===!1?(0,t._)`{}`:g(v,h,p)}function g(v,h,p={}){const{gen:x,it:S}=v,C=[y(S,p),b(v,p)];return m(v,h,C),x.object(...C)}function y({errorPath:v},{instancePath:h}){const p=h?(0,t.str)`${v}${(0,r.getErrorPath)(h,r.Type.Str)}`:v;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,p)]}function b({keyword:v,it:{errSchemaPath:h}},{schemaPath:p,parentSchema:x}){let S=x?h:(0,t.str)`${h}/${v}`;return p&&(S=(0,t.str)`${S}${(0,r.getErrorPath)(p,r.Type.Str)}`),[d.schemaPath,S]}function m(v,{params:h,message:p},x){const{keyword:S,data:C,schemaValue:T,it:$}=v,{opts:O,propertyName:M,topSchemaRef:U,schemaPath:j}=$;x.push([d.keyword,S],[d.params,typeof h=="function"?h(v):h||(0,t._)`{}`]),O.messages&&x.push([d.message,typeof p=="function"?p(v):p]),O.verbose&&x.push([d.schema,T],[d.parentSchema,(0,t._)`${U}${j}`],[n.default.data,C]),M&&x.push([d.propertyName,M])}})(kc);Object.defineProperty(ba,"__esModule",{value:!0});ba.boolOrEmptySchema=ba.topBoolOrEmptySchema=void 0;const F5=kc,U5=je,q5=On,V5={message:"boolean schema is false"};function H5(e){const{gen:t,schema:r,validateName:n}=e;r===!1?HN(e,!1):typeof r=="object"&&r.$async===!0?t.return(q5.default.data):(t.assign((0,U5._)`${n}.errors`,null),t.return(!0))}ba.topBoolOrEmptySchema=H5;function K5(e,t){const{gen:r,schema:n}=e;n===!1?(r.var(t,!1),HN(e)):r.var(t,!0)}ba.boolOrEmptySchema=K5;function HN(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,F5.reportError)(s,V5,void 0,t)}var St={},ei={};Object.defineProperty(ei,"__esModule",{value:!0});ei.getRules=ei.isJSONType=void 0;const B5=["string","number","integer","boolean","null","object","array"],W5=new Set(B5);function Z5(e){return typeof e=="string"&&W5.has(e)}ei.isJSONType=Z5;function G5(){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:{}}}ei.getRules=G5;var Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});Jn.shouldUseRule=Jn.shouldUseGroup=Jn.schemaHasRulesForType=void 0;function Q5({schema:e,self:t},r){const n=t.RULES.types[r];return n&&n!==!0&&KN(e,n)}Jn.schemaHasRulesForType=Q5;function KN(e,t){return t.rules.some(r=>BN(e,r))}Jn.shouldUseGroup=KN;function BN(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))}Jn.shouldUseRule=BN;Object.defineProperty(St,"__esModule",{value:!0});St.reportTypeError=St.checkDataTypes=St.checkDataType=St.coerceAndCheckDataType=St.getJSONTypes=St.getSchemaTypes=St.DataType=void 0;const J5=ei,Y5=Jn,X5=kc,Ee=je,WN=oe;var Bi;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Bi||(St.DataType=Bi={}));function e9(e){const t=ZN(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}St.getSchemaTypes=e9;function ZN(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(J5.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}St.getJSONTypes=ZN;function t9(e,t){const{gen:r,data:n,opts:s}=e,o=r9(t,s.coerceTypes),i=t.length>0&&!(o.length===0&&t.length===1&&(0,Y5.schemaHasRulesForType)(e,t[0]));if(i){const a=ay(t,n,s.strictNumbers,Bi.Wrong);r.if(a,()=>{o.length?n9(e,t,o):ly(e)})}return i}St.coerceAndCheckDataType=t9;const GN=new Set(["string","number","integer","boolean","null"]);function r9(e,t){return t?e.filter(r=>GN.has(r)||t==="array"&&r==="array"):[]}function n9(e,t,r){const{gen:n,data:s,opts:o}=e,i=n.let("dataType",(0,Ee._)`typeof ${s}`),a=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(ay(t,s,o.strictNumbers),()=>n.assign(a,s))),n.if((0,Ee._)`${a} !== undefined`);for(const u of r)(GN.has(u)||u==="array"&&o.coerceTypes==="array")&&c(u);n.else(),ly(e),n.endIf(),n.if((0,Ee._)`${a} !== undefined`,()=>{n.assign(s,a),s9(e,a)});function c(u){switch(u){case"string":n.elseIf((0,Ee._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,Ee._)`"" + ${s}`).elseIf((0,Ee._)`${s} === null`).assign(a,(0,Ee._)`""`);return;case"number":n.elseIf((0,Ee._)`${i} == "boolean" || ${s} === null
|
|
399
|
-
|| (${i} == "string" && ${s} && ${s} == +${s})`).assign(a,(0,Ee._)`+${s}`);return;case"integer":n.elseIf((0,Ee._)`${i} === "boolean" || ${s} === null
|
|
400
|
-
|| (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,(0,Ee._)`+${s}`);return;case"boolean":n.elseIf((0,Ee._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf((0,Ee._)`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":n.elseIf((0,Ee._)`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(a,null);return;case"array":n.elseIf((0,Ee._)`${i} === "string" || ${i} === "number"
|
|
401
|
-
|| ${i} === "boolean" || ${s} === null`).assign(a,(0,Ee._)`[${s}]`)}}}function s9({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,Ee._)`${t} !== undefined`,()=>e.assign((0,Ee._)`${t}[${r}]`,n))}function Wm(e,t,r,n=Bi.Correct){const s=n===Bi.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===Bi.Correct?o:(0,Ee.not)(o);function i(a=Ee.nil){return(0,Ee.and)((0,Ee._)`typeof ${t} == "number"`,a,r?(0,Ee._)`isFinite(${t})`:Ee.nil)}}St.checkDataType=Wm;function ay(e,t,r,n){if(e.length===1)return Wm(e[0],t,r,n);let s;const o=(0,WN.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,Wm(i,t,r,n));return s}St.checkDataTypes=ay;const o9={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,Ee._)`{type: ${e}}`:(0,Ee._)`{type: ${t}}`};function ly(e){const t=i9(e);(0,X5.reportError)(t,o9)}St.reportTypeError=ly;function i9(e){const{gen:t,data:r,schema:n}=e,s=(0,WN.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}var Of={};Object.defineProperty(Of,"__esModule",{value:!0});Of.assignDefaults=void 0;const fi=je,a9=oe;function l9(e,t){const{properties:r,items:n}=e.schema;if(t==="object"&&r)for(const s in r)zx(e,s,r[s].default);else t==="array"&&Array.isArray(n)&&n.forEach((s,o)=>zx(e,o,s.default))}Of.assignDefaults=l9;function zx(e,t,r){const{gen:n,compositeRule:s,data:o,opts:i}=e;if(r===void 0)return;const a=(0,fi._)`${o}${(0,fi.getProperty)(t)}`;if(s){(0,a9.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,fi._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,fi._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,fi._)`${a} = ${(0,fi.stringify)(r)}`)}var jn={},$e={};Object.defineProperty($e,"__esModule",{value:!0});$e.validateUnion=$e.validateArray=$e.usePattern=$e.callValidateCode=$e.schemaProperties=$e.allSchemaProperties=$e.noPropertyInData=$e.propertyInData=$e.isOwnProperty=$e.hasPropFunc=$e.reportMissingProp=$e.checkMissingProp=$e.checkReportMissingProp=void 0;const Je=je,cy=oe,ps=On,c9=oe;function u9(e,t){const{gen:r,data:n,it:s}=e;r.if(dy(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:(0,Je._)`${t}`},!0),e.error()})}$e.checkReportMissingProp=u9;function d9({gen:e,data:t,it:{opts:r}},n,s){return(0,Je.or)(...n.map(o=>(0,Je.and)(dy(e,t,o,r.ownProperties),(0,Je._)`${s} = ${o}`)))}$e.checkMissingProp=d9;function f9(e,t){e.setParams({missingProperty:t},!0),e.error()}$e.reportMissingProp=f9;function QN(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Je._)`Object.prototype.hasOwnProperty`})}$e.hasPropFunc=QN;function uy(e,t,r){return(0,Je._)`${QN(e)}.call(${t}, ${r})`}$e.isOwnProperty=uy;function h9(e,t,r,n){const s=(0,Je._)`${t}${(0,Je.getProperty)(r)} !== undefined`;return n?(0,Je._)`${s} && ${uy(e,t,r)}`:s}$e.propertyInData=h9;function dy(e,t,r,n){const s=(0,Je._)`${t}${(0,Je.getProperty)(r)} === undefined`;return n?(0,Je.or)(s,(0,Je.not)(uy(e,t,r))):s}$e.noPropertyInData=dy;function JN(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}$e.allSchemaProperties=JN;function p9(e,t){return JN(t).filter(r=>!(0,cy.alwaysValidSchema)(e,t[r]))}$e.schemaProperties=p9;function m9({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:o},it:i},a,c,u){const d=u?(0,Je._)`${e}, ${t}, ${n}${s}`:t,f=[[ps.default.instancePath,(0,Je.strConcat)(ps.default.instancePath,o)],[ps.default.parentData,i.parentData],[ps.default.parentDataProperty,i.parentDataProperty],[ps.default.rootData,ps.default.rootData]];i.opts.dynamicRef&&f.push([ps.default.dynamicAnchors,ps.default.dynamicAnchors]);const g=(0,Je._)`${d}, ${r.object(...f)}`;return c!==Je.nil?(0,Je._)`${a}.call(${c}, ${g})`:(0,Je._)`${a}(${g})`}$e.callValidateCode=m9;const g9=(0,Je._)`new RegExp`;function v9({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,Je._)`${s.code==="new RegExp"?g9:(0,c9.useFunc)(e,s)}(${r}, ${n})`})}$e.usePattern=v9;function y9(e){const{gen:t,data:r,keyword:n,it:s}=e,o=t.name("valid");if(s.allErrors){const a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(o,!0),i(()=>t.break()),o;function i(a){const c=t.const("len",(0,Je._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:cy.Type.Num},o),t.if((0,Je.not)(o),a)})}}$e.validateArray=y9;function w9(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,cy.alwaysValidSchema)(s,c))&&!s.opts.unevaluated)return;const i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{const d=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);t.assign(i,(0,Je._)`${i} || ${a}`),e.mergeValidEvaluated(d,a)||t.if((0,Je.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}$e.validateUnion=w9;Object.defineProperty(jn,"__esModule",{value:!0});jn.validateKeywordUsage=jn.validSchemaType=jn.funcKeywordCode=jn.macroKeywordCode=void 0;const Xt=je,Co=On,x9=$e,b9=kc;function _9(e,t){const{gen:r,keyword:n,schema:s,parentSchema:o,it:i}=e,a=t.macro.call(i.self,s,o,i),c=YN(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);const u=r.name("valid");e.subschema({schema:a,schemaPath:Xt.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}jn.macroKeywordCode=_9;function S9(e,t){var r;const{gen:n,keyword:s,schema:o,parentSchema:i,$data:a,it:c}=e;C9(c,t);const u=!a&&t.compile?t.compile.call(c.self,o,i,c):t.validate,d=YN(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)m(),t.modifying&&Lx(e),v(()=>e.error());else{const h=t.async?y():b();t.modifying&&Lx(e),v(()=>k9(e,h))}}function y(){const h=n.let("ruleErrs",null);return n.try(()=>m((0,Xt._)`await `),p=>n.assign(f,!1).if((0,Xt._)`${p} instanceof ${c.ValidationError}`,()=>n.assign(h,(0,Xt._)`${p}.errors`),()=>n.throw(p))),h}function b(){const h=(0,Xt._)`${d}.errors`;return n.assign(h,null),m(Xt.nil),h}function m(h=t.async?(0,Xt._)`await `:Xt.nil){const p=c.opts.passContext?Co.default.this:Co.default.self,x=!("compile"in t&&!a||t.schema===!1);n.assign(f,(0,Xt._)`${h}${(0,x9.callValidateCode)(e,d,p,x)}`,t.modifying)}function v(h){var p;n.if((0,Xt.not)((p=t.valid)!==null&&p!==void 0?p:f),h)}}jn.funcKeywordCode=S9;function Lx(e){const{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Xt._)`${n.parentData}[${n.parentDataProperty}]`))}function k9(e,t){const{gen:r}=e;r.if((0,Xt._)`Array.isArray(${t})`,()=>{r.assign(Co.default.vErrors,(0,Xt._)`${Co.default.vErrors} === null ? ${t} : ${Co.default.vErrors}.concat(${t})`).assign(Co.default.errors,(0,Xt._)`${Co.default.vErrors}.length`),(0,b9.extendErrors)(e)},()=>e.error())}function C9({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function YN(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,Xt.stringify)(r)})}function E9(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")}jn.validSchemaType=E9;function N9({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(a=>!Object.prototype.hasOwnProperty.call(e,a)))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)}}jn.validateKeywordUsage=N9;var Qs={};Object.defineProperty(Qs,"__esModule",{value:!0});Qs.extendSubschemaMode=Qs.extendSubschemaData=Qs.getSubschema=void 0;const En=je,XN=oe;function j9(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 a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,En._)`${e.schemaPath}${(0,En.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,En._)`${e.schemaPath}${(0,En.getProperty)(t)}${(0,En.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,XN.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')}Qs.getSubschema=j9;function $9(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:a}=t;if(r!==void 0){const{errorPath:u,dataPathArr:d,opts:f}=t,g=a.let("data",(0,En._)`${t.data}${(0,En.getProperty)(r)}`,!0);c(g),e.errorPath=(0,En.str)`${u}${(0,XN.getErrorPath)(r,n,f.jsPropertySyntax)}`,e.parentDataProperty=(0,En._)`${r}`,e.dataPathArr=[...d,e.parentDataProperty]}if(s!==void 0){const u=s instanceof En.Name?s:a.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]}}Qs.extendSubschemaData=$9;function P9(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}Qs.extendSubschemaMode=P9;var Mt={},ej=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},tj={exports:{}},zs=tj.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(){};Mu(t,n,s,e,"",e)};zs.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};zs.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};zs.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};zs.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 Mu(e,t,r,n,s,o,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,o,i,a,c,u);for(var d in n){var f=n[d];if(Array.isArray(f)){if(d in zs.arrayKeywords)for(var g=0;g<f.length;g++)Mu(e,t,r,f[g],s+"/"+d+"/"+g,o,s,d,n,g)}else if(d in zs.propsKeywords){if(f&&typeof f=="object")for(var y in f)Mu(e,t,r,f[y],s+"/"+d+"/"+T9(y),o,s,d,n,y)}else(d in zs.keywords||e.allKeys&&!(d in zs.skipKeywords))&&Mu(e,t,r,f,s+"/"+d,o,s,d,n)}r(n,s,o,i,a,c,u)}}function T9(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var R9=tj.exports;Object.defineProperty(Mt,"__esModule",{value:!0});Mt.getSchemaRefs=Mt.resolveUrl=Mt.normalizeId=Mt._getFullPath=Mt.getFullPath=Mt.inlineRef=void 0;const I9=oe,A9=ej,O9=R9,M9=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function D9(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Zm(e):t?rj(e)<=t:!1}Mt.inlineRef=D9;const z9=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Zm(e){for(const t in e){if(z9.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(Zm)||typeof r=="object"&&Zm(r))return!0}return!1}function rj(e){let t=0;for(const r in e){if(r==="$ref")return 1/0;if(t++,!M9.has(r)&&(typeof e[r]=="object"&&(0,I9.eachItem)(e[r],n=>t+=rj(n)),t===1/0))return 1/0}return t}function nj(e,t="",r){r!==!1&&(t=Wi(t));const n=e.parse(t);return sj(e,n)}Mt.getFullPath=nj;function sj(e,t){return e.serialize(t).split("#")[0]+"#"}Mt._getFullPath=sj;const L9=/#\/?$/;function Wi(e){return e?e.replace(L9,""):""}Mt.normalizeId=Wi;function F9(e,t,r){return r=Wi(r),e.resolve(t,r)}Mt.resolveUrl=F9;const U9=/^[a-z_][-a-z0-9._]*$/i;function q9(e,t){if(typeof e=="boolean")return{};const{schemaId:r,uriResolver:n}=this.opts,s=Wi(e[r]||t),o={"":s},i=nj(n,s,!1),a={},c=new Set;return O9(e,{allKeys:!0},(f,g,y,b)=>{if(b===void 0)return;const m=i+g;let v=o[b];typeof f[r]=="string"&&(v=h.call(this,f[r])),p.call(this,f.$anchor),p.call(this,f.$dynamicAnchor),o[g]=v;function h(x){const S=this.opts.uriResolver.resolve;if(x=Wi(v?S(v,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!==Wi(m)&&(x[0]==="#"?(u(f,a[x],x),a[x]=f):this.refs[x]=m),x}function p(x){if(typeof x=="string"){if(!U9.test(x))throw new Error(`invalid anchor "${x}"`);h.call(this,`#${x}`)}}}),a;function u(f,g,y){if(g!==void 0&&!A9(f,g))throw d(y)}function d(f){return new Error(`reference "${f}" resolves to more than one schema`)}}Mt.getSchemaRefs=q9;Object.defineProperty(an,"__esModule",{value:!0});an.getData=an.KeywordCxt=an.validateFunctionCode=void 0;const oj=ba,Fx=St,fy=Jn,Ld=St,V9=Of,El=jn,qh=Qs,fe=je,we=On,H9=Mt,Yn=oe,Ja=kc;function K9(e){if(lj(e)&&(cj(e),aj(e))){Z9(e);return}ij(e,()=>(0,oj.topBoolOrEmptySchema)(e))}an.validateFunctionCode=K9;function ij({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"; ${Ux(r,s)}`),W9(e,s),e.code(o)}):e.func(t,(0,fe._)`${we.default.data}, ${B9(s)}`,n.$async,()=>e.code(Ux(r,s)).code(o))}function B9(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 W9(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 Z9(e){const{schema:t,opts:r,gen:n}=e;ij(e,()=>{r.$comment&&t.$comment&&dj(e),X9(e),n.let(we.default.vErrors,null),n.let(we.default.errors,0),r.unevaluated&&G9(e),uj(e),r6(e)})}function G9(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 Ux(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 Q9(e,t){if(lj(e)&&(cj(e),aj(e))){J9(e,t);return}(0,oj.boolOrEmptySchema)(e,t)}function aj({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 lj(e){return typeof e.schema!="boolean"}function J9(e,t){const{schema:r,gen:n,opts:s}=e;s.$comment&&r.$comment&&dj(e),e6(e),t6(e);const o=n.const("_errs",we.default.errors);uj(e,o),n.var(t,(0,fe._)`${o} === ${we.default.errors}`)}function cj(e){(0,Yn.checkUnknownRules)(e),Y9(e)}function uj(e,t){if(e.opts.jtd)return qx(e,[],!1,t);const r=(0,Fx.getSchemaTypes)(e.schema),n=(0,Fx.coerceAndCheckDataType)(e,r);qx(e,r,!n,t)}function Y9(e){const{schema:t,errSchemaPath:r,opts:n,self:s}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Yn.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function X9(e){const{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Yn.checkStrictMode)(e,"default is ignored in the schema root")}function e6(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,H9.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function t6(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function dj({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`,a=e.scopeValue("root",{ref:t.root});e.code((0,fe._)`${we.default.self}.opts.$comment(${o}, ${i}, ${a}.schema)`)}}function r6(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&&n6(e),t.return((0,fe._)`${we.default.errors} === 0`))}function n6({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 qx(e,t,r,n){const{gen:s,schema:o,data:i,allErrors:a,opts:c,self:u}=e,{RULES:d}=u;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,Yn.schemaHasRulesButRef)(o,d))){s.block(()=>pj(e,"$ref",d.all.$ref.definition));return}c.jtd||s6(e,t),s.block(()=>{for(const g of d.rules)f(g);f(d.post)});function f(g){(0,fy.shouldUseGroup)(o,g)&&(g.type?(s.if((0,Ld.checkDataType)(g.type,i,c.strictNumbers)),Vx(e,g),t.length===1&&t[0]===g.type&&r&&(s.else(),(0,Ld.reportTypeError)(e)),s.endIf()):Vx(e,g),a||s.if((0,fe._)`${we.default.errors} === ${n||0}`))}}function Vx(e,t){const{gen:r,schema:n,opts:{useDefaults:s}}=e;s&&(0,V9.assignDefaults)(e,t.type),r.block(()=>{for(const o of t.rules)(0,fy.shouldUseRule)(n,o)&&pj(e,o.keyword,o.definition,t.type)})}function s6(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(o6(e,t),e.opts.allowUnionTypes||i6(e,t),a6(e,e.dataTypes))}function o6(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{fj(e.dataTypes,r)||hy(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),c6(e,t)}}function i6(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&hy(e,"use allowUnionTypes to allow union type keyword")}function a6(e,t){const r=e.self.RULES.all;for(const n in r){const s=r[n];if(typeof s=="object"&&(0,fy.shouldUseRule)(e.schema,s)){const{type:o}=s.definition;o.length&&!o.some(i=>l6(t,i))&&hy(e,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function l6(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function fj(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function c6(e,t){const r=[];for(const n of e.dataTypes)fj(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function hy(e,t){const r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Yn.checkStrictMode)(e,t,e.opts.strictTypes)}class hj{constructor(t,r,n){if((0,El.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,Yn.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",mj(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,El.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?Ja.reportExtraError:Ja.reportError)(this,this.def.error,r)}$dataError(){(0,Ja.reportError)(this,this.def.$dataError||Ja.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ja.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(),a());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,Ld.checkDataTypes)(c,r,o.opts.strictNumbers,Ld.DataType.Wrong)}`}return fe.nil}function a(){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,qh.getSubschema)(this.it,t);(0,qh.extendSubschemaData)(n,this.it,t),(0,qh.extendSubschemaMode)(n,t);const s={...this.it,...n,items:void 0,props:void 0};return Q9(s,r),s}mergeEvaluated(t,r){const{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Yn.mergeEvaluated.props(s,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Yn.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}}an.KeywordCxt=hj;function pj(e,t,r,n){const s=new hj(e,r,t);"code"in r?r.code(s,n):s.$data&&r.validate?(0,El.funcKeywordCode)(s,r):"macro"in r?(0,El.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,El.funcKeywordCode)(s,r)}const u6=/^\/(?:[^~]|~0|~1)*$/,d6=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function mj(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,o;if(e==="")return we.default.rootData;if(e[0]==="/"){if(!u6.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);s=e,o=we.default.rootData}else{const u=d6.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 a=s.split("/");for(const u of a)u&&(o=(0,fe._)`${o}${(0,fe.getProperty)((0,Yn.unescapeJsonPointer)(u))}`,i=(0,fe._)`${i} && ${o}`);return i;function c(u,d){return`Cannot access ${u} ${d} levels up, current level is ${t}`}}an.getData=mj;var Cc={};Object.defineProperty(Cc,"__esModule",{value:!0});class f6 extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}Cc.default=f6;var Ia={};Object.defineProperty(Ia,"__esModule",{value:!0});const Vh=Mt;class h6 extends Error{constructor(t,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Vh.resolveUrl)(t,r,n),this.missingSchema=(0,Vh.normalizeId)((0,Vh.getFullPath)(t,this.missingRef))}}Ia.default=h6;var fr={};Object.defineProperty(fr,"__esModule",{value:!0});fr.resolveSchema=fr.getCompilingSchema=fr.resolveRef=fr.compileSchema=fr.SchemaEnv=void 0;const Kr=je,p6=Cc,yo=On,rn=Mt,Hx=oe,m6=an;class Mf{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,rn.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={}}}fr.SchemaEnv=Mf;function py(e){const t=gj.call(this,e);if(t)return t;const r=(0,rn.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new Kr.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o});let a;e.$async&&(a=i.scopeValue("Error",{ref:p6.default,code:(0,Kr._)`require("ajv/dist/runtime/validation_error").default`}));const c=i.scopeName("validate");e.validateName=c;const u={gen:i,allErrors:this.opts.allErrors,data:yo.default.data,parentData:yo.default.parentData,parentDataProperty:yo.default.parentDataProperty,dataNames:[yo.default.data],dataPathArr:[Kr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Kr.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Kr.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Kr._)`""`,opts:this.opts,self:this};let d;try{this._compilations.add(e),(0,m6.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);const f=i.toString();d=`${i.scopeRefs(yo.default.scope)}return ${f}`,this.opts.code.process&&(d=this.opts.code.process(d,e));const y=new Function(`${yo.default.self}`,`${yo.default.scope}`,d)(this,this.scope.get());if(this.scope.value(c,{ref:y}),y.errors=null,y.schema=e.schema,y.schemaEnv=e,e.$async&&(y.$async=!0),this.opts.code.source===!0&&(y.source={validateName:c,validateCode:f,scopeValues:i._values}),this.opts.unevaluated){const{props:b,items:m}=u;y.evaluated={props:b instanceof Kr.Name?void 0:b,items:m instanceof Kr.Name?void 0:m,dynamicProps:b instanceof Kr.Name,dynamicItems:m instanceof Kr.Name},y.source&&(y.source.evaluated=(0,Kr.stringify)(y.evaluated))}return e.validate=y,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)}}fr.compileSchema=py;function g6(e,t,r){var n;r=(0,rn.resolveUrl)(this.opts.uriResolver,t,r);const s=e.refs[r];if(s)return s;let o=w6.call(this,e,r);if(o===void 0){const i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(o=new Mf({schema:i,schemaId:a,root:e,baseId:t}))}if(o!==void 0)return e.refs[r]=v6.call(this,o)}fr.resolveRef=g6;function v6(e){return(0,rn.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:py.call(this,e)}function gj(e){for(const t of this._compilations)if(y6(t,e))return t}fr.getCompilingSchema=gj;function y6(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function w6(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Df.call(this,e,t)}function Df(e,t){const r=this.opts.uriResolver.parse(t),n=(0,rn._getFullPath)(this.opts.uriResolver,r);let s=(0,rn.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return Hh.call(this,r,e);const o=(0,rn.normalizeId)(n),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){const a=Df.call(this,e,i);return typeof(a==null?void 0:a.schema)!="object"?void 0:Hh.call(this,r,a)}if(typeof(i==null?void 0:i.schema)=="object"){if(i.validate||py.call(this,i),o===(0,rn.normalizeId)(t)){const{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(s=(0,rn.resolveUrl)(this.opts.uriResolver,s,u)),new Mf({schema:a,schemaId:c,root:e,baseId:s})}return Hh.call(this,r,i)}}fr.resolveSchema=Df;const x6=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Hh(e,{baseId:t,schema:r,root:n}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(const a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;const c=r[(0,Hx.unescapeFragment)(a)];if(c===void 0)return;r=c;const u=typeof r=="object"&&r[this.opts.schemaId];!x6.has(a)&&u&&(t=(0,rn.resolveUrl)(this.opts.uriResolver,t,u))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,Hx.schemaHasRulesButRef)(r,this.RULES)){const a=(0,rn.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=Df.call(this,n,a)}const{schemaId:i}=this.opts;if(o=o||new Mf({schema:r,schemaId:i,root:n,baseId:t}),o.schema!==o.root.schema)return o}const b6="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",_6="Meta-schema for $data reference (JSON AnySchema extension proposal)",S6="object",k6=["$data"],C6={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},E6=!1,N6={$id:b6,description:_6,type:S6,required:k6,properties:C6,additionalProperties:E6};var my={},zf={exports:{}};const j6={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 $6={HEX:j6};const{HEX:P6}=$6,T6=/^(?:(?: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 vj(e){if(wj(e,".")<3)return{host:e,isIPV4:!1};const t=e.match(T6)||[],[r]=t;return r?{host:I6(r,"."),isIPV4:!0}:{host:e,isIPV4:!1}}function Kx(e,t=!1){let r="",n=!0;for(const s of e){if(P6[s]===void 0)return;s!=="0"&&n===!0&&(n=!1),n||(r+=s)}return t&&r.length===0&&(r="0"),r}function R6(e){let t=0;const r={error:!1,address:"",zone:""},n=[],s=[];let o=!1,i=!1,a=!1;function c(){if(s.length){if(o===!1){const u=Kx(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&&(a=!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(""):a?n.push(s.join("")):n.push(Kx(s))),r.address=n.join(""),r}function yj(e){if(wj(e,":")<2)return{host:e,isIPV6:!1};const t=R6(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 I6(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 wj(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}const Bx=/^\.\.?\//u,Wx=/^\/\.(?:\/|$)/u,Zx=/^\/\.\.(?:\/|$)/u,A6=/^\/?(?:.|\n)*?(?=\/|$)/u;function O6(e){const t=[];for(;e.length;)if(e.match(Bx))e=e.replace(Bx,"");else if(e.match(Wx))e=e.replace(Wx,"/");else if(e.match(Zx))e=e.replace(Zx,"/"),t.pop();else if(e==="."||e==="..")e="";else{const r=e.match(A6);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 M6(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 D6(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=vj(r);if(n.isIPV4)r=n.host;else{const s=yj(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 z6={recomposeAuthority:D6,normalizeComponentEncoding:M6,removeDotSegments:O6,normalizeIPv4:vj,normalizeIPv6:yj};const L6=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,F6=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function xj(e){return typeof e.secure=="boolean"?e.secure:String(e.scheme).toLowerCase()==="wss"}function bj(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function _j(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 U6(e){return e.secure=xj(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function q6(e){if((e.port===(xj(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 V6(e,t){if(!e.path)return e.error="URN can not be parsed",e;const r=e.path.match(F6);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=gy[s];e.path=void 0,o&&(e=o.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function H6(e,t){const r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),s=`${r}:${t.nid||n}`,o=gy[s];o&&(e=o.serialize(e,t));const i=e,a=e.nss;return i.path=`${n||t.nid}:${a}`,t.skipEscape=!0,i}function K6(e,t){const r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!L6.test(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function B6(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t}const Sj={scheme:"http",domainHost:!0,parse:bj,serialize:_j},W6={scheme:"https",domainHost:Sj.domainHost,parse:bj,serialize:_j},Du={scheme:"ws",domainHost:!0,parse:U6,serialize:q6},Z6={scheme:"wss",domainHost:Du.domainHost,parse:Du.parse,serialize:Du.serialize},G6={scheme:"urn",parse:V6,serialize:H6,skipNormalize:!0},Q6={scheme:"urn:uuid",parse:K6,serialize:B6,skipNormalize:!0},gy={http:Sj,https:W6,ws:Du,wss:Z6,urn:G6,"urn:uuid":Q6};var J6=gy;const{normalizeIPv6:Y6,normalizeIPv4:X6,removeDotSegments:ul,recomposeAuthority:e8,normalizeComponentEncoding:au}=z6,vy=J6;function t8(e,t){return typeof e=="string"?e=$n(is(e,t),t):typeof e=="object"&&(e=is($n(e,t),t)),e}function r8(e,t,r){const n=Object.assign({scheme:"null"},r),s=kj(is(e,n),is(t,n),n,!0);return $n(s,{...n,skipEscape:!0})}function kj(e,t,r,n){const s={};return n||(e=is($n(e,r),r),t=is($n(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=ul(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=ul(t.path||""),s.query=t.query):(t.path?(t.path.charAt(0)==="/"?s.path=ul(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=ul(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 n8(e,t,r){return typeof e=="string"?(e=unescape(e),e=$n(au(is(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=$n(au(e,!0),{...r,skipEscape:!0})),typeof t=="string"?(t=unescape(t),t=$n(au(is(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=$n(au(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function $n(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=vy[(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=e8(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 a=r.path;!n.absolutePath&&(!o||!o.absolutePath)&&(a=ul(a)),i===void 0&&(a=a.replace(/^\/\//u,"/%2F")),s.push(a)}return r.query!==void 0&&s.push("?",r.query),r.fragment!==void 0&&s.push("#",r.fragment),s.join("")}const s8=Array.from({length:127},(e,t)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(t)));function o8(e){let t=0;for(let r=0,n=e.length;r<n;++r)if(t=e.charCodeAt(r),t>126||s8[t])return!0;return!1}const i8=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function is(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(i8);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=X6(n.host);if(c.isIPV4===!1){const u=Y6(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 a=vy[(r.scheme||n.scheme||"").toLowerCase()];if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&o===!1&&o8(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}(!a||a&&!a.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)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}const yy={SCHEMES:vy,normalize:t8,resolve:r8,resolveComponents:kj,equal:n8,serialize:$n,parse:is};zf.exports=yy;zf.exports.default=yy;zf.exports.fastUri=yy;var a8=zf.exports;Object.defineProperty(my,"__esModule",{value:!0});const Cj=a8;Cj.code='require("ajv/dist/runtime/uri").default';my.default=Cj;(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=an;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=Cc,s=Ia,o=ei,i=fr,a=je,c=Mt,u=St,d=oe,f=N6,g=my,y=(z,I)=>new RegExp(z,I);y.code="new RegExp";const b=["removeAdditional","useDefaults","coerceTypes"],m=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),v={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."},h={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},p=200;function x(z){var I,F,N,_,E,D,K,Z,le,re,X,ge,Le,gt,Y,pe,J,Me,ie,Ie,Pe,Ve,fn,Tr,hn;const xt=z.strict,cs=(I=z.code)===null||I===void 0?void 0:I.optimize,ho=cs===!0||cs===void 0?1:cs||0,us=(N=(F=z.code)===null||F===void 0?void 0:F.regExp)!==null&&N!==void 0?N:y,po=(_=z.uriResolver)!==null&&_!==void 0?_:g.default;return{strictSchema:(D=(E=z.strictSchema)!==null&&E!==void 0?E:xt)!==null&&D!==void 0?D:!0,strictNumbers:(Z=(K=z.strictNumbers)!==null&&K!==void 0?K:xt)!==null&&Z!==void 0?Z:!0,strictTypes:(re=(le=z.strictTypes)!==null&&le!==void 0?le:xt)!==null&&re!==void 0?re:"log",strictTuples:(ge=(X=z.strictTuples)!==null&&X!==void 0?X:xt)!==null&&ge!==void 0?ge:"log",strictRequired:(gt=(Le=z.strictRequired)!==null&&Le!==void 0?Le:xt)!==null&>!==void 0?gt:!1,code:z.code?{...z.code,optimize:ho,regExp:us}:{optimize:ho,regExp:us},loopRequired:(Y=z.loopRequired)!==null&&Y!==void 0?Y:p,loopEnum:(pe=z.loopEnum)!==null&&pe!==void 0?pe:p,meta:(J=z.meta)!==null&&J!==void 0?J:!0,messages:(Me=z.messages)!==null&&Me!==void 0?Me:!0,inlineRefs:(ie=z.inlineRefs)!==null&&ie!==void 0?ie:!0,schemaId:(Ie=z.schemaId)!==null&&Ie!==void 0?Ie:"$id",addUsedSchema:(Pe=z.addUsedSchema)!==null&&Pe!==void 0?Pe:!0,validateSchema:(Ve=z.validateSchema)!==null&&Ve!==void 0?Ve:!0,validateFormats:(fn=z.validateFormats)!==null&&fn!==void 0?fn:!0,unicodeRegExp:(Tr=z.unicodeRegExp)!==null&&Tr!==void 0?Tr:!0,int32range:(hn=z.int32range)!==null&&hn!==void 0?hn:!0,uriResolver:po}}class S{constructor(I={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,I=this.opts={...I,...x(I)};const{es5:F,lines:N}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:m,es5:F,lines:N}),this.logger=k(I.logger);const _=I.validateFormats;I.validateFormats=!1,this.RULES=(0,o.getRules)(),C.call(this,v,I,"NOT SUPPORTED"),C.call(this,h,I,"DEPRECATED","warn"),this._metaOpts=U.call(this),I.formats&&O.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),I.keywords&&M.call(this,I.keywords),typeof I.meta=="object"&&this.addMetaSchema(I.meta),$.call(this),I.validateFormats=_}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:I,meta:F,schemaId:N}=this.opts;let _=f;N==="id"&&(_={...f},_.id=_.$id,delete _.$id),F&&I&&this.addMetaSchema(_,_[N],!1)}defaultMeta(){const{meta:I,schemaId:F}=this.opts;return this.opts.defaultMeta=typeof I=="object"?I[F]||I:void 0}validate(I,F){let N;if(typeof I=="string"){if(N=this.getSchema(I),!N)throw new Error(`no schema with key or ref "${I}"`)}else N=this.compile(I);const _=N(F);return"$async"in N||(this.errors=N.errors),_}compile(I,F){const N=this._addSchema(I,F);return N.validate||this._compileSchemaEnv(N)}compileAsync(I,F){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:N}=this.opts;return _.call(this,I,F);async function _(re,X){await E.call(this,re.$schema);const ge=this._addSchema(re,X);return ge.validate||D.call(this,ge)}async function E(re){re&&!this.getSchema(re)&&await _.call(this,{$ref:re},!0)}async function D(re){try{return this._compileSchemaEnv(re)}catch(X){if(!(X instanceof s.default))throw X;return K.call(this,X),await Z.call(this,X.missingSchema),D.call(this,re)}}function K({missingSchema:re,missingRef:X}){if(this.refs[re])throw new Error(`AnySchema ${re} is loaded but ${X} cannot be resolved`)}async function Z(re){const X=await le.call(this,re);this.refs[re]||await E.call(this,X.$schema),this.refs[re]||this.addSchema(X,re,F)}async function le(re){const X=this._loading[re];if(X)return X;try{return await(this._loading[re]=N(re))}finally{delete this._loading[re]}}}addSchema(I,F,N,_=this.opts.validateSchema){if(Array.isArray(I)){for(const D of I)this.addSchema(D,void 0,N,_);return this}let E;if(typeof I=="object"){const{schemaId:D}=this.opts;if(E=I[D],E!==void 0&&typeof E!="string")throw new Error(`schema ${D} must be string`)}return F=(0,c.normalizeId)(F||E),this._checkUnique(F),this.schemas[F]=this._addSchema(I,N,F,_,!0),this}addMetaSchema(I,F,N=this.opts.validateSchema){return this.addSchema(I,F,!0,N),this}validateSchema(I,F){if(typeof I=="boolean")return!0;let N;if(N=I.$schema,N!==void 0&&typeof N!="string")throw new Error("$schema must be a string");if(N=N||this.opts.defaultMeta||this.defaultMeta(),!N)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const _=this.validate(N,I);if(!_&&F){const E="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(E);else throw new Error(E)}return _}getSchema(I){let F;for(;typeof(F=T.call(this,I))=="string";)I=F;if(F===void 0){const{schemaId:N}=this.opts,_=new i.SchemaEnv({schema:{},schemaId:N});if(F=i.resolveSchema.call(this,_,I),!F)return;this.refs[I]=F}return F.validate||this._compileSchemaEnv(F)}removeSchema(I){if(I instanceof RegExp)return this._removeAllSchemas(this.schemas,I),this._removeAllSchemas(this.refs,I),this;switch(typeof I){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const F=T.call(this,I);return typeof F=="object"&&this._cache.delete(F.schema),delete this.schemas[I],delete this.refs[I],this}case"object":{const F=I;this._cache.delete(F);let N=I[this.opts.schemaId];return N&&(N=(0,c.normalizeId)(N),delete this.schemas[N],delete this.refs[N]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(I){for(const F of I)this.addKeyword(F);return this}addKeyword(I,F){let N;if(typeof I=="string")N=I,typeof F=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),F.keyword=N);else if(typeof I=="object"&&F===void 0){if(F=I,N=F.keyword,Array.isArray(N)&&!N.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(P.call(this,N,F),!F)return(0,d.eachItem)(N,E=>B.call(this,E)),this;G.call(this,F);const _={...F,type:(0,u.getJSONTypes)(F.type),schemaType:(0,u.getJSONTypes)(F.schemaType)};return(0,d.eachItem)(N,_.type.length===0?E=>B.call(this,E,_):E=>_.type.forEach(D=>B.call(this,E,_,D))),this}getKeyword(I){const F=this.RULES.all[I];return typeof F=="object"?F.definition:!!F}removeKeyword(I){const{RULES:F}=this;delete F.keywords[I],delete F.all[I];for(const N of F.rules){const _=N.rules.findIndex(E=>E.keyword===I);_>=0&&N.rules.splice(_,1)}return this}addFormat(I,F){return typeof F=="string"&&(F=new RegExp(F)),this.formats[I]=F,this}errorsText(I=this.errors,{separator:F=", ",dataVar:N="data"}={}){return!I||I.length===0?"No errors":I.map(_=>`${N}${_.instancePath} ${_.message}`).reduce((_,E)=>_+F+E)}$dataMetaSchema(I,F){const N=this.RULES.all;I=JSON.parse(JSON.stringify(I));for(const _ of F){const E=_.split("/").slice(1);let D=I;for(const K of E)D=D[K];for(const K in N){const Z=N[K];if(typeof Z!="object")continue;const{$data:le}=Z.definition,re=D[K];le&&re&&(D[K]=V(re))}}return I}_removeAllSchemas(I,F){for(const N in I){const _=I[N];(!F||F.test(N))&&(typeof _=="string"?delete I[N]:_&&!_.meta&&(this._cache.delete(_.schema),delete I[N]))}}_addSchema(I,F,N,_=this.opts.validateSchema,E=this.opts.addUsedSchema){let D;const{schemaId:K}=this.opts;if(typeof I=="object")D=I[K];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof I!="boolean")throw new Error("schema must be object or boolean")}let Z=this._cache.get(I);if(Z!==void 0)return Z;N=(0,c.normalizeId)(D||N);const le=c.getSchemaRefs.call(this,I,N);return Z=new i.SchemaEnv({schema:I,schemaId:K,meta:F,baseId:N,localRefs:le}),this._cache.set(Z.schema,Z),E&&!N.startsWith("#")&&(N&&this._checkUnique(N),this.refs[N]=Z),_&&this.validateSchema(I,!0),Z}_checkUnique(I){if(this.schemas[I]||this.refs[I])throw new Error(`schema with key or id "${I}" already exists`)}_compileSchemaEnv(I){if(I.meta?this._compileMetaSchema(I):i.compileSchema.call(this,I),!I.validate)throw new Error("ajv implementation error");return I.validate}_compileMetaSchema(I){const F=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,I)}finally{this.opts=F}}}S.ValidationError=n.default,S.MissingRefError=s.default,e.default=S;function C(z,I,F,N="error"){for(const _ in z){const E=_;E in I&&this.logger[N](`${F}: option ${_}. ${z[E]}`)}}function T(z){return z=(0,c.normalizeId)(z),this.schemas[z]||this.refs[z]}function $(){const z=this.opts.schemas;if(z)if(Array.isArray(z))this.addSchema(z);else for(const I in z)this.addSchema(z[I],I)}function O(){for(const z in this.opts.formats){const I=this.opts.formats[z];I&&this.addFormat(z,I)}}function M(z){if(Array.isArray(z)){this.addVocabulary(z);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const I in z){const F=z[I];F.keyword||(F.keyword=I),this.addKeyword(F)}}function U(){const z={...this.opts};for(const I of b)delete z[I];return z}const j={log(){},warn(){},error(){}};function k(z){if(z===!1)return j;if(z===void 0)return console;if(z.log&&z.warn&&z.error)return z;throw new Error("logger must implement log, warn and error methods")}const L=/^[a-z_$][a-z0-9_$:-]*$/i;function P(z,I){const{RULES:F}=this;if((0,d.eachItem)(z,N=>{if(F.keywords[N])throw new Error(`Keyword ${N} is already defined`);if(!L.test(N))throw new Error(`Keyword ${N} has invalid name`)}),!!I&&I.$data&&!("code"in I||"validate"in I))throw new Error('$data keyword must have "code" or "validate" function')}function B(z,I,F){var N;const _=I==null?void 0:I.post;if(F&&_)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:E}=this;let D=_?E.post:E.rules.find(({type:Z})=>Z===F);if(D||(D={type:F,rules:[]},E.rules.push(D)),E.keywords[z]=!0,!I)return;const K={keyword:z,definition:{...I,type:(0,u.getJSONTypes)(I.type),schemaType:(0,u.getJSONTypes)(I.schemaType)}};I.before?H.call(this,D,K,I.before):D.rules.push(K),E.all[z]=K,(N=I.implements)===null||N===void 0||N.forEach(Z=>this.addKeyword(Z))}function H(z,I,F){const N=z.rules.findIndex(_=>_.keyword===F);N>=0?z.rules.splice(N,0,I):(z.rules.push(I),this.logger.warn(`rule ${F} is not defined`))}function G(z){let{metaSchema:I}=z;I!==void 0&&(z.$data&&this.opts.$data&&(I=V(I)),z.validateSchema=this.compile(I,!0))}const q={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function V(z){return{anyOf:[z,q]}}})(zN);var wy={},xy={},by={};Object.defineProperty(by,"__esModule",{value:!0});const l8={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};by.default=l8;var ti={};Object.defineProperty(ti,"__esModule",{value:!0});ti.callRef=ti.getValidate=void 0;const c8=Ia,Gx=$e,ar=je,hi=On,Qx=fr,lu=oe,u8={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:o,validateName:i,opts:a,self:c}=n,{root:u}=o;if((r==="#"||r==="#/")&&s===u.baseId)return f();const d=Qx.resolveRef.call(c,u,s,r);if(d===void 0)throw new c8.default(n.opts.uriResolver,s,r);if(d instanceof Qx.SchemaEnv)return g(d);return y(d);function f(){if(o===u)return zu(e,i,o,o.$async);const b=t.scopeValue("root",{ref:u});return zu(e,(0,ar._)`${b}.validate`,u,u.$async)}function g(b){const m=Ej(e,b);zu(e,m,b,b.$async)}function y(b){const m=t.scopeValue("schema",a.code.source===!0?{ref:b,code:(0,ar.stringify)(b)}:{ref:b}),v=t.name("valid"),h=e.subschema({schema:b,dataTypes:[],schemaPath:ar.nil,topSchemaRef:m,errSchemaPath:r},v);e.mergeEvaluated(h),e.ok(v)}}};function Ej(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,ar._)`${r.scopeValue("wrapper",{ref:t})}.validate`}ti.getValidate=Ej;function zu(e,t,r,n){const{gen:s,it:o}=e,{allErrors:i,schemaEnv:a,opts:c}=o,u=c.passContext?hi.default.this:ar.nil;n?d():f();function d(){if(!a.$async)throw new Error("async schema referenced by sync schema");const b=s.let("valid");s.try(()=>{s.code((0,ar._)`await ${(0,Gx.callValidateCode)(e,t,u)}`),y(t),i||s.assign(b,!0)},m=>{s.if((0,ar._)`!(${m} instanceof ${o.ValidationError})`,()=>s.throw(m)),g(m),i||s.assign(b,!1)}),e.ok(b)}function f(){e.result((0,Gx.callValidateCode)(e,t,u),()=>y(t),()=>g(t))}function g(b){const m=(0,ar._)`${b}.errors`;s.assign(hi.default.vErrors,(0,ar._)`${hi.default.vErrors} === null ? ${m} : ${hi.default.vErrors}.concat(${m})`),s.assign(hi.default.errors,(0,ar._)`${hi.default.vErrors}.length`)}function y(b){var m;if(!o.opts.unevaluated)return;const v=(m=r==null?void 0:r.validate)===null||m===void 0?void 0:m.evaluated;if(o.props!==!0)if(v&&!v.dynamicProps)v.props!==void 0&&(o.props=lu.mergeEvaluated.props(s,v.props,o.props));else{const h=s.var("props",(0,ar._)`${b}.evaluated.props`);o.props=lu.mergeEvaluated.props(s,h,o.props,ar.Name)}if(o.items!==!0)if(v&&!v.dynamicItems)v.items!==void 0&&(o.items=lu.mergeEvaluated.items(s,v.items,o.items));else{const h=s.var("items",(0,ar._)`${b}.evaluated.items`);o.items=lu.mergeEvaluated.items(s,h,o.items,ar.Name)}}}ti.callRef=zu;ti.default=u8;Object.defineProperty(xy,"__esModule",{value:!0});const d8=by,f8=ti,h8=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",d8.default,f8.default];xy.default=h8;var _y={},Sy={};Object.defineProperty(Sy,"__esModule",{value:!0});const Fd=je,ms=Fd.operators,Ud={maximum:{okStr:"<=",ok:ms.LTE,fail:ms.GT},minimum:{okStr:">=",ok:ms.GTE,fail:ms.LT},exclusiveMaximum:{okStr:"<",ok:ms.LT,fail:ms.GTE},exclusiveMinimum:{okStr:">",ok:ms.GT,fail:ms.LTE}},p8={message:({keyword:e,schemaCode:t})=>(0,Fd.str)`must be ${Ud[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Fd._)`{comparison: ${Ud[e].okStr}, limit: ${t}}`},m8={keyword:Object.keys(Ud),type:"number",schemaType:"number",$data:!0,error:p8,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,Fd._)`${r} ${Ud[t].fail} ${n} || isNaN(${r})`)}};Sy.default=m8;var ky={};Object.defineProperty(ky,"__esModule",{value:!0});const Nl=je,g8={message:({schemaCode:e})=>(0,Nl.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,Nl._)`{multipleOf: ${e}}`},v8={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:g8,code(e){const{gen:t,data:r,schemaCode:n,it:s}=e,o=s.opts.multipleOfPrecision,i=t.let("res"),a=o?(0,Nl._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:(0,Nl._)`${i} !== parseInt(${i})`;e.fail$data((0,Nl._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};ky.default=v8;var Cy={},Ey={};Object.defineProperty(Ey,"__esModule",{value:!0});function Nj(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}Ey.default=Nj;Nj.code='require("ajv/dist/runtime/ucs2length").default';Object.defineProperty(Cy,"__esModule",{value:!0});const Eo=je,y8=oe,w8=Ey,x8={message({keyword:e,schemaCode:t}){const r=e==="maxLength"?"more":"fewer";return(0,Eo.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Eo._)`{limit: ${e}}`},b8={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:x8,code(e){const{keyword:t,data:r,schemaCode:n,it:s}=e,o=t==="maxLength"?Eo.operators.GT:Eo.operators.LT,i=s.opts.unicode===!1?(0,Eo._)`${r}.length`:(0,Eo._)`${(0,y8.useFunc)(e.gen,w8.default)}(${r})`;e.fail$data((0,Eo._)`${i} ${o} ${n}`)}};Cy.default=b8;var Ny={};Object.defineProperty(Ny,"__esModule",{value:!0});const _8=$e,qd=je,S8={message:({schemaCode:e})=>(0,qd.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,qd._)`{pattern: ${e}}`},k8={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:S8,code(e){const{data:t,$data:r,schema:n,schemaCode:s,it:o}=e,i=o.opts.unicodeRegExp?"u":"",a=r?(0,qd._)`(new RegExp(${s}, ${i}))`:(0,_8.usePattern)(e,n);e.fail$data((0,qd._)`!${a}.test(${t})`)}};Ny.default=k8;var jy={};Object.defineProperty(jy,"__esModule",{value:!0});const jl=je,C8={message({keyword:e,schemaCode:t}){const r=e==="maxProperties"?"more":"fewer";return(0,jl.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,jl._)`{limit: ${e}}`},E8={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:C8,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?jl.operators.GT:jl.operators.LT;e.fail$data((0,jl._)`Object.keys(${r}).length ${s} ${n}`)}};jy.default=E8;var $y={};Object.defineProperty($y,"__esModule",{value:!0});const Ya=$e,$l=je,N8=oe,j8={message:({params:{missingProperty:e}})=>(0,$l.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,$l._)`{missingProperty: ${e}}`},$8={keyword:"required",type:"object",schemaType:"array",$data:!0,error:j8,code(e){const{gen:t,schema:r,schemaCode:n,data:s,$data:o,it:i}=e,{opts:a}=i;if(!o&&r.length===0)return;const c=r.length>=a.loopRequired;if(i.allErrors?u():d(),a.strictRequired){const y=e.parentSchema.properties,{definedProperties:b}=e.it;for(const m of r)if((y==null?void 0:y[m])===void 0&&!b.has(m)){const v=i.schemaEnv.baseId+i.errSchemaPath,h=`required property "${m}" is not defined at "${v}" (strictRequired)`;(0,N8.checkStrictMode)(i,h,i.opts.strictRequired)}}function u(){if(c||o)e.block$data($l.nil,f);else for(const y of r)(0,Ya.checkReportMissingProp)(e,y)}function d(){const y=t.let("missing");if(c||o){const b=t.let("valid",!0);e.block$data(b,()=>g(y,b)),e.ok(b)}else t.if((0,Ya.checkMissingProp)(e,r,y)),(0,Ya.reportMissingProp)(e,y),t.else()}function f(){t.forOf("prop",n,y=>{e.setParams({missingProperty:y}),t.if((0,Ya.noPropertyInData)(t,s,y,a.ownProperties),()=>e.error())})}function g(y,b){e.setParams({missingProperty:y}),t.forOf(y,n,()=>{t.assign(b,(0,Ya.propertyInData)(t,s,y,a.ownProperties)),t.if((0,$l.not)(b),()=>{e.error(),t.break()})},$l.nil)}}};$y.default=$8;var Py={};Object.defineProperty(Py,"__esModule",{value:!0});const Pl=je,P8={message({keyword:e,schemaCode:t}){const r=e==="maxItems"?"more":"fewer";return(0,Pl.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Pl._)`{limit: ${e}}`},T8={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:P8,code(e){const{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?Pl.operators.GT:Pl.operators.LT;e.fail$data((0,Pl._)`${r}.length ${s} ${n}`)}};Py.default=T8;var Ty={},Ec={};Object.defineProperty(Ec,"__esModule",{value:!0});const jj=ej;jj.code='require("ajv/dist/runtime/equal").default';Ec.default=jj;Object.defineProperty(Ty,"__esModule",{value:!0});const Kh=St,It=je,R8=oe,I8=Ec,A8={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}}`},O8={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:A8,code(e){const{gen:t,data:r,$data:n,schema:s,parentSchema:o,schemaCode:i,it:a}=e;if(!n&&!s)return;const c=t.let("valid"),u=o.items?(0,Kh.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`),m=t.let("j");e.setParams({i:b,j:m}),t.assign(c,!0),t.if((0,It._)`${b} > 1`,()=>(f()?g:y)(b,m))}function f(){return u.length>0&&!u.some(b=>b==="object"||b==="array")}function g(b,m){const v=t.name("item"),h=(0,Kh.checkDataTypes)(u,v,a.opts.strictNumbers,Kh.DataType.Wrong),p=t.const("indices",(0,It._)`{}`);t.for((0,It._)`;${b}--;`,()=>{t.let(v,(0,It._)`${r}[${b}]`),t.if(h,(0,It._)`continue`),u.length>1&&t.if((0,It._)`typeof ${v} == "string"`,(0,It._)`${v} += "_"`),t.if((0,It._)`typeof ${p}[${v}] == "number"`,()=>{t.assign(m,(0,It._)`${p}[${v}]`),e.error(),t.assign(c,!1).break()}).code((0,It._)`${p}[${v}] = ${b}`)})}function y(b,m){const v=(0,R8.useFunc)(t,I8.default),h=t.name("outer");t.label(h).for((0,It._)`;${b}--;`,()=>t.for((0,It._)`${m} = ${b}; ${m}--;`,()=>t.if((0,It._)`${v}(${r}[${b}], ${r}[${m}])`,()=>{e.error(),t.assign(c,!1).break(h)})))}}};Ty.default=O8;var Ry={};Object.defineProperty(Ry,"__esModule",{value:!0});const Gm=je,M8=oe,D8=Ec,z8={message:"must be equal to constant",params:({schemaCode:e})=>(0,Gm._)`{allowedValue: ${e}}`},L8={keyword:"const",$data:!0,error:z8,code(e){const{gen:t,data:r,$data:n,schemaCode:s,schema:o}=e;n||o&&typeof o=="object"?e.fail$data((0,Gm._)`!${(0,M8.useFunc)(t,D8.default)}(${r}, ${s})`):e.fail((0,Gm._)`${o} !== ${r}`)}};Ry.default=L8;var Iy={};Object.defineProperty(Iy,"__esModule",{value:!0});const dl=je,F8=oe,U8=Ec,q8={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,dl._)`{allowedValues: ${e}}`},V8={keyword:"enum",schemaType:"array",$data:!0,error:q8,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 a=s.length>=i.opts.loopEnum;let c;const u=()=>c??(c=(0,F8.useFunc)(t,U8.default));let d;if(a||n)d=t.let("valid"),e.block$data(d,f);else{if(!Array.isArray(s))throw new Error("ajv implementation error");const y=t.const("vSchema",o);d=(0,dl.or)(...s.map((b,m)=>g(y,m)))}e.pass(d);function f(){t.assign(d,!1),t.forOf("v",o,y=>t.if((0,dl._)`${u()}(${r}, ${y})`,()=>t.assign(d,!0).break()))}function g(y,b){const m=s[b];return typeof m=="object"&&m!==null?(0,dl._)`${u()}(${r}, ${y}[${b}])`:(0,dl._)`${r} === ${m}`}}};Iy.default=V8;Object.defineProperty(_y,"__esModule",{value:!0});const H8=Sy,K8=ky,B8=Cy,W8=Ny,Z8=jy,G8=$y,Q8=Py,J8=Ty,Y8=Ry,X8=Iy,eq=[H8.default,K8.default,B8.default,W8.default,Z8.default,G8.default,Q8.default,J8.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Y8.default,X8.default];_y.default=eq;var Ay={},Aa={};Object.defineProperty(Aa,"__esModule",{value:!0});Aa.validateAdditionalItems=void 0;const No=je,Qm=oe,tq={message:({params:{len:e}})=>(0,No.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,No._)`{limit: ${e}}`},rq={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:tq,code(e){const{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Qm.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}$j(e,n)}};function $j(e,t){const{gen:r,schema:n,data:s,keyword:o,it:i}=e;i.items=!0;const a=r.const("len",(0,No._)`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,No._)`${a} <= ${t.length}`);else if(typeof n=="object"&&!(0,Qm.alwaysValidSchema)(i,n)){const u=r.var("valid",(0,No._)`${a} <= ${t.length}`);r.if((0,No.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,d=>{e.subschema({keyword:o,dataProp:d,dataPropType:Qm.Type.Num},u),i.allErrors||r.if((0,No.not)(u),()=>r.break())})}}Aa.validateAdditionalItems=$j;Aa.default=rq;var Oy={},Oa={};Object.defineProperty(Oa,"__esModule",{value:!0});Oa.validateTuple=void 0;const Jx=je,Lu=oe,nq=$e,sq={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return Pj(e,"additionalItems",t);r.items=!0,!(0,Lu.alwaysValidSchema)(r,t)&&e.ok((0,nq.validateArray)(e))}};function Pj(e,t,r=e.schema){const{gen:n,parentSchema:s,data:o,keyword:i,it:a}=e;d(s),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Lu.mergeEvaluated.items(n,r.length,a.items));const c=n.name("valid"),u=n.const("len",(0,Jx._)`${o}.length`);r.forEach((f,g)=>{(0,Lu.alwaysValidSchema)(a,f)||(n.if((0,Jx._)`${u} > ${g}`,()=>e.subschema({keyword:i,schemaProp:g,dataProp:g},c)),e.ok(c))});function d(f){const{opts:g,errSchemaPath:y}=a,b=r.length,m=b===f.minItems&&(b===f.maxItems||f[t]===!1);if(g.strictTuples&&!m){const v=`"${i}" is ${b}-tuple, but minItems or maxItems/${t} are not specified or different at path "${y}"`;(0,Lu.checkStrictMode)(a,v,g.strictTuples)}}}Oa.validateTuple=Pj;Oa.default=sq;Object.defineProperty(Oy,"__esModule",{value:!0});const oq=Oa,iq={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,oq.validateTuple)(e,"items")};Oy.default=iq;var My={};Object.defineProperty(My,"__esModule",{value:!0});const Yx=je,aq=oe,lq=$e,cq=Aa,uq={message:({params:{len:e}})=>(0,Yx.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Yx._)`{limit: ${e}}`},dq={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:uq,code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;n.items=!0,!(0,aq.alwaysValidSchema)(n,t)&&(s?(0,cq.validateAdditionalItems)(e,s):e.ok((0,lq.validateArray)(e)))}};My.default=dq;var Dy={};Object.defineProperty(Dy,"__esModule",{value:!0});const Ir=je,cu=oe,fq={message:({params:{min:e,max:t}})=>t===void 0?(0,Ir.str)`must contain at least ${e} valid item(s)`:(0,Ir.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Ir._)`{minContains: ${e}}`:(0,Ir._)`{minContains: ${e}, maxContains: ${t}}`},hq={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:fq,code(e){const{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;let i,a;const{minContains:c,maxContains:u}=n;o.opts.next?(i=c===void 0?1:c,a=u):i=1;const d=t.const("len",(0,Ir._)`${s}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,cu.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,cu.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,cu.alwaysValidSchema)(o,r)){let m=(0,Ir._)`${d} >= ${i}`;a!==void 0&&(m=(0,Ir._)`${m} && ${d} <= ${a}`),e.pass(m);return}o.items=!0;const f=t.name("valid");a===void 0&&i===1?y(f,()=>t.if(f,()=>t.break())):i===0?(t.let(f,!0),a!==void 0&&t.if((0,Ir._)`${s}.length > 0`,g)):(t.let(f,!1),g()),e.result(f,()=>e.reset());function g(){const m=t.name("_valid"),v=t.let("count",0);y(m,()=>t.if(m,()=>b(v)))}function y(m,v){t.forRange("i",0,d,h=>{e.subschema({keyword:"contains",dataProp:h,dataPropType:cu.Type.Num,compositeRule:!0},m),v()})}function b(m){t.code((0,Ir._)`${m}++`),a===void 0?t.if((0,Ir._)`${m} >= ${i}`,()=>t.assign(f,!0).break()):(t.if((0,Ir._)`${m} > ${a}`,()=>t.assign(f,!1).break()),i===1?t.assign(f,!0):t.if((0,Ir._)`${m} >= ${i}`,()=>t.assign(f,!0)))}}};Dy.default=hq;var Tj={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=je,r=oe,n=$e;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},
|
|
402
|
-
missingProperty: ${f},
|
|
403
|
-
depsCount: ${u},
|
|
404
|
-
deps: ${d}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(c){const[u,d]=o(c);i(c,u),a(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 y=d.let("missing");for(const b in u){const m=u[b];if(m.length===0)continue;const v=(0,n.propertyInData)(d,f,b,g.opts.ownProperties);c.setParams({property:b,depsCount:m.length,deps:m.join(", ")}),g.allErrors?d.if(v,()=>{for(const h of m)(0,n.checkReportMissingProp)(c,h)}):(d.if((0,t._)`${v} && (${(0,n.checkMissingProp)(c,m,y)})`),(0,n.reportMissingProp)(c,y),d.else())}}e.validatePropertyDeps=i;function a(c,u=c.schema){const{gen:d,data:f,keyword:g,it:y}=c,b=d.name("valid");for(const m in u)(0,r.alwaysValidSchema)(y,u[m])||(d.if((0,n.propertyInData)(d,f,m,y.opts.ownProperties),()=>{const v=c.subschema({keyword:g,schemaProp:m},b);c.mergeValidEvaluated(v,b)},()=>d.var(b,!0)),c.ok(b))}e.validateSchemaDeps=a,e.default=s})(Tj);var zy={};Object.defineProperty(zy,"__esModule",{value:!0});const Rj=je,pq=oe,mq={message:"property name must be valid",params:({params:e})=>(0,Rj._)`{propertyName: ${e.propertyName}}`},gq={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:mq,code(e){const{gen:t,schema:r,data:n,it:s}=e;if((0,pq.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,Rj.not)(o),()=>{e.error(!0),s.allErrors||t.break()})}),e.ok(o)}};zy.default=gq;var Lf={};Object.defineProperty(Lf,"__esModule",{value:!0});const uu=$e,Br=je,vq=On,du=oe,yq={message:"must NOT have additional properties",params:({params:e})=>(0,Br._)`{additionalProperty: ${e.additionalProperty}}`},wq={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:yq,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:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,du.alwaysValidSchema)(i,r))return;const u=(0,uu.allSchemaProperties)(n.properties),d=(0,uu.allSchemaProperties)(n.patternProperties);f(),e.ok((0,Br._)`${o} === ${vq.default.errors}`);function f(){t.forIn("key",s,v=>{!u.length&&!d.length?b(v):t.if(g(v),()=>b(v))})}function g(v){let h;if(u.length>8){const p=(0,du.schemaRefOrVal)(i,n.properties,"properties");h=(0,uu.isOwnProperty)(t,p,v)}else u.length?h=(0,Br.or)(...u.map(p=>(0,Br._)`${v} === ${p}`)):h=Br.nil;return d.length&&(h=(0,Br.or)(h,...d.map(p=>(0,Br._)`${(0,uu.usePattern)(e,p)}.test(${v})`))),(0,Br.not)(h)}function y(v){t.code((0,Br._)`delete ${s}[${v}]`)}function b(v){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){y(v);return}if(r===!1){e.setParams({additionalProperty:v}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,du.alwaysValidSchema)(i,r)){const h=t.name("valid");c.removeAdditional==="failing"?(m(v,h,!1),t.if((0,Br.not)(h),()=>{e.reset(),y(v)})):(m(v,h),a||t.if((0,Br.not)(h),()=>t.break()))}}function m(v,h,p){const x={keyword:"additionalProperties",dataProp:v,dataPropType:du.Type.Str};p===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(x,h)}}};Lf.default=wq;var Ly={};Object.defineProperty(Ly,"__esModule",{value:!0});const xq=an,Xx=$e,Bh=oe,eb=Lf,bq={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&&eb.default.code(new xq.KeywordCxt(o,eb.default,"additionalProperties"));const i=(0,Xx.allSchemaProperties)(r);for(const f of i)o.definedProperties.add(f);o.opts.unevaluated&&i.length&&o.props!==!0&&(o.props=Bh.mergeEvaluated.props(t,(0,Bh.toHash)(i),o.props));const a=i.filter(f=>!(0,Bh.alwaysValidSchema)(o,r[f]));if(a.length===0)return;const c=t.name("valid");for(const f of a)u(f)?d(f):(t.if((0,Xx.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)}}};Ly.default=bq;var Fy={};Object.defineProperty(Fy,"__esModule",{value:!0});const tb=$e,fu=je,rb=oe,nb=oe,_q={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:s,it:o}=e,{opts:i}=o,a=(0,tb.allSchemaProperties)(r),c=a.filter(m=>(0,rb.alwaysValidSchema)(o,r[m]));if(a.length===0||c.length===a.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 fu.Name)&&(o.props=(0,nb.evaluatedPropsToName)(t,o.props));const{props:f}=o;g();function g(){for(const m of a)u&&y(m),o.allErrors?b(m):(t.var(d,!0),b(m),t.if(d))}function y(m){for(const v in u)new RegExp(m).test(v)&&(0,rb.checkStrictMode)(o,`property ${v} matches pattern ${m} (use allowMatchingProperties)`)}function b(m){t.forIn("key",n,v=>{t.if((0,fu._)`${(0,tb.usePattern)(e,m)}.test(${v})`,()=>{const h=c.includes(m);h||e.subschema({keyword:"patternProperties",schemaProp:m,dataProp:v,dataPropType:nb.Type.Str},d),o.opts.unevaluated&&f!==!0?t.assign((0,fu._)`${f}[${v}]`,!0):!h&&!o.allErrors&&t.if((0,fu.not)(d),()=>t.break())})})}}};Fy.default=_q;var Uy={};Object.defineProperty(Uy,"__esModule",{value:!0});const Sq=oe,kq={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,Sq.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"}};Uy.default=kq;var qy={};Object.defineProperty(qy,"__esModule",{value:!0});const Cq=$e,Eq={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Cq.validateUnion,error:{message:"must match a schema in anyOf"}};qy.default=Eq;var Vy={};Object.defineProperty(Vy,"__esModule",{value:!0});const Fu=je,Nq=oe,jq={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Fu._)`{passingSchemas: ${e.passing}}`},$q={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:jq,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),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){o.forEach((d,f)=>{let g;(0,Nq.alwaysValidSchema)(s,d)?t.var(c,!0):g=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},c),f>0&&t.if((0,Fu._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Fu._)`[${a}, ${f}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,f),g&&e.mergeEvaluated(g,Fu.Name)})})}}};Vy.default=$q;var Hy={};Object.defineProperty(Hy,"__esModule",{value:!0});const Pq=oe,Tq={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,Pq.alwaysValidSchema)(n,o))return;const a=e.subschema({keyword:"allOf",schemaProp:i},s);e.ok(s),e.mergeEvaluated(a)})}};Hy.default=Tq;var Ky={};Object.defineProperty(Ky,"__esModule",{value:!0});const Vd=je,Ij=oe,Rq={message:({params:e})=>(0,Vd.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Vd._)`{failingKeyword: ${e.ifClause}}`},Iq={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Rq,code(e){const{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Ij.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const s=sb(n,"then"),o=sb(n,"else");if(!s&&!o)return;const i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),s&&o){const d=t.let("ifClause");e.setParams({ifClause:d}),t.if(a,u("then",d),u("else",d))}else s?t.if(a,u("then")):t.if((0,Vd.not)(a),u("else"));e.pass(i,()=>e.error(!0));function c(){const d=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(d)}function u(d,f){return()=>{const g=e.subschema({keyword:d},a);t.assign(i,a),e.mergeValidEvaluated(g,i),f?t.assign(f,(0,Vd._)`${d}`):e.setParams({ifClause:d})}}}};function sb(e,t){const r=e.schema[t];return r!==void 0&&!(0,Ij.alwaysValidSchema)(e,r)}Ky.default=Iq;var By={};Object.defineProperty(By,"__esModule",{value:!0});const Aq=oe,Oq={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Aq.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};By.default=Oq;Object.defineProperty(Ay,"__esModule",{value:!0});const Mq=Aa,Dq=Oy,zq=Oa,Lq=My,Fq=Dy,Uq=Tj,qq=zy,Vq=Lf,Hq=Ly,Kq=Fy,Bq=Uy,Wq=qy,Zq=Vy,Gq=Hy,Qq=Ky,Jq=By;function Yq(e=!1){const t=[Bq.default,Wq.default,Zq.default,Gq.default,Qq.default,Jq.default,qq.default,Vq.default,Uq.default,Hq.default,Kq.default];return e?t.push(Dq.default,Lq.default):t.push(Mq.default,zq.default),t.push(Fq.default),t}Ay.default=Yq;var Wy={},Zy={};Object.defineProperty(Zy,"__esModule",{value:!0});const vt=je,Xq={message:({schemaCode:e})=>(0,vt.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,vt._)`{format: ${e}}`},eV={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Xq,code(e,t){const{gen:r,data:n,$data:s,schema:o,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:d,self:f}=a;if(!c.validateFormats)return;s?g():y();function g(){const b=r.scopeValue("formats",{ref:f.formats,code:c.code.formats}),m=r.const("fDef",(0,vt._)`${b}[${i}]`),v=r.let("fType"),h=r.let("format");r.if((0,vt._)`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>r.assign(v,(0,vt._)`${m}.type || "string"`).assign(h,(0,vt._)`${m}.validate`),()=>r.assign(v,(0,vt._)`"string"`).assign(h,m)),e.fail$data((0,vt.or)(p(),x()));function p(){return c.strictSchema===!1?vt.nil:(0,vt._)`${i} && !${h}`}function x(){const S=d.$async?(0,vt._)`(${m}.async ? await ${h}(${n}) : ${h}(${n}))`:(0,vt._)`${h}(${n})`,C=(0,vt._)`(typeof ${h} == "function" ? ${S} : ${h}.test(${n}))`;return(0,vt._)`${h} && ${h} !== true && ${v} === ${t} && !${C}`}}function y(){const b=f.formats[o];if(!b){p();return}if(b===!0)return;const[m,v,h]=x(b);m===t&&e.pass(S());function p(){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 T=C instanceof RegExp?(0,vt.regexpCode)(C):c.code.formats?(0,vt._)`${c.code.formats}${(0,vt.getProperty)(o)}`:void 0,$=r.scopeValue("formats",{key:o,ref:C,code:T});return typeof C=="object"&&!(C instanceof RegExp)?[C.type||"string",C.validate,(0,vt._)`${$}.validate`]:["string",C,$]}function S(){if(typeof b=="object"&&!(b instanceof RegExp)&&b.async){if(!d.$async)throw new Error("async format in sync schema");return(0,vt._)`await ${h}(${n})`}return typeof v=="function"?(0,vt._)`${h}(${n})`:(0,vt._)`${h}.test(${n})`}}}};Zy.default=eV;Object.defineProperty(Wy,"__esModule",{value:!0});const tV=Zy,rV=[tV.default];Wy.default=rV;var _a={};Object.defineProperty(_a,"__esModule",{value:!0});_a.contentVocabulary=_a.metadataVocabulary=void 0;_a.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];_a.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(wy,"__esModule",{value:!0});const nV=xy,sV=_y,oV=Ay,iV=Wy,ob=_a,aV=[nV.default,sV.default,(0,oV.default)(),iV.default,ob.metadataVocabulary,ob.contentVocabulary];wy.default=aV;var Gy={},Ff={};Object.defineProperty(Ff,"__esModule",{value:!0});Ff.DiscrError=void 0;var ib;(function(e){e.Tag="tag",e.Mapping="mapping"})(ib||(Ff.DiscrError=ib={}));Object.defineProperty(Gy,"__esModule",{value:!0});const wi=je,Jm=Ff,ab=fr,lV=Ia,cV=oe,uV={message:({params:{discrError:e,tagName:t}})=>e===Jm.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,wi._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},dV={keyword:"discriminator",type:"object",schemaType:"object",error:uV,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 a=n.propertyName;if(typeof a!="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,wi._)`${r}${(0,wi.getProperty)(a)}`);t.if((0,wi._)`typeof ${u} == "string"`,()=>d(),()=>e.error(!1,{discrError:Jm.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function d(){const y=g();t.if(!1);for(const b in y)t.elseIf((0,wi._)`${u} === ${b}`),t.assign(c,f(y[b]));t.else(),e.error(!1,{discrError:Jm.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function f(y){const b=t.name("valid"),m=e.subschema({keyword:"oneOf",schemaProp:y},b);return e.mergeEvaluated(m,wi.Name),b}function g(){var y;const b={},m=h(s);let v=!0;for(let S=0;S<i.length;S++){let C=i[S];if(C!=null&&C.$ref&&!(0,cV.schemaHasRulesButRef)(C,o.self.RULES)){const $=C.$ref;if(C=ab.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,$),C instanceof ab.SchemaEnv&&(C=C.schema),C===void 0)throw new lV.default(o.opts.uriResolver,o.baseId,$)}const T=(y=C==null?void 0:C.properties)===null||y===void 0?void 0:y[a];if(typeof T!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);v=v&&(m||h(C)),p(T,S)}if(!v)throw new Error(`discriminator: "${a}" must be required`);return b;function h({required:S}){return Array.isArray(S)&&S.includes(a)}function p(S,C){if(S.const)x(S.const,C);else if(S.enum)for(const T of S.enum)x(T,C);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function x(S,C){if(typeof S!="string"||S in b)throw new Error(`discriminator: "${a}" values must be unique strings`);b[S]=C}}}};Gy.default=dV;const fV="http://json-schema.org/draft-07/schema#",hV="http://json-schema.org/draft-07/schema#",pV="Core schema meta-schema",mV={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:[]}},gV=["object","boolean"],vV={$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:"#"}},yV={$schema:fV,$id:hV,title:pV,definitions:mV,type:gV,properties:vV,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=zN,n=wy,s=Gy,o=yV,i=["/properties"],a="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,a,!1),this.refs["http://json-schema.org/schema"]=a}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}}t.Ajv=c,e.exports=t=c,e.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=an;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=Cc;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var g=Ia;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return g.default}})})(Hm,Hm.exports);var Aj=Hm.exports;const wV=Hd(Aj);var Ym={exports:{}},Oj={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(j,k){return{validate:j,compare:k}}e.fullFormats={date:t(o,i),time:t(c(!0),u),"date-time":t(g(!0),y),"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:h,"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:T},int64:{type:"number",validate:$},float:{type:"number",validate:O},double:{type:"number",validate:O},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,y),"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(j){return j%4===0&&(j%100!==0||j%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(j){const k=n.exec(j);if(!k)return!1;const L=+k[1],P=+k[2],B=+k[3];return P>=1&&P<=12&&B>=1&&B<=(P===2&&r(L)?29:s[P])}function i(j,k){if(j&&k)return j>k?1:j<k?-1:0}const a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(j){return function(L){const P=a.exec(L);if(!P)return!1;const B=+P[1],H=+P[2],G=+P[3],q=P[4],V=P[5]==="-"?-1:1,z=+(P[6]||0),I=+(P[7]||0);if(z>23||I>59||j&&!q)return!1;if(B<=23&&H<=59&&G<60)return!0;const F=H-I*V,N=B-z*V-(F<0?1:0);return(N===23||N===-1)&&(F===59||F===-1)&&G<61}}function u(j,k){if(!(j&&k))return;const L=new Date("2020-01-01T"+j).valueOf(),P=new Date("2020-01-01T"+k).valueOf();if(L&&P)return L-P}function d(j,k){if(!(j&&k))return;const L=a.exec(j),P=a.exec(k);if(L&&P)return j=L[1]+L[2]+L[3],k=P[1]+P[2]+P[3],j>k?1:j<k?-1:0}const f=/t|\s/i;function g(j){const k=c(j);return function(P){const B=P.split(f);return B.length===2&&o(B[0])&&k(B[1])}}function y(j,k){if(!(j&&k))return;const L=new Date(j).valueOf(),P=new Date(k).valueOf();if(L&&P)return L-P}function b(j,k){if(!(j&&k))return;const[L,P]=j.split(f),[B,H]=k.split(f),G=i(L,B);if(G!==void 0)return G||u(P,H)}const m=/\/|:/,v=/^(?:[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 h(j){return m.test(j)&&v.test(j)}const p=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function x(j){return p.lastIndex=0,p.test(j)}const S=-2147483648,C=2**31-1;function T(j){return Number.isInteger(j)&&j<=C&&j>=S}function $(j){return Number.isInteger(j)}function O(){return!0}const M=/[^\\]\\Z/;function U(j){if(M.test(j))return!1;try{return new RegExp(j),!0}catch{return!1}}})(Oj);var Mj={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const t=Aj,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:a,schemaCode:c})=>(0,r.str)`should be ${s[a].okStr} ${c}`,params:({keyword:a,schemaCode:c})=>(0,r._)`{comparison: ${s[a].okStr}, limit: ${c}}`};e.formatLimitDefinition={keyword:Object.keys(s),type:"string",schemaType:"string",$data:!0,error:o,code(a){const{gen:c,data:u,schemaCode:d,keyword:f,it:g}=a,{opts:y,self:b}=g;if(!y.validateFormats)return;const m=new t.KeywordCxt(g,b.RULES.all.format.definition,"format");m.$data?v():h();function v(){const x=c.scopeValue("formats",{ref:b.formats,code:y.code.formats}),S=c.const("fmt",(0,r._)`${x}[${m.schemaCode}]`);a.fail$data((0,r.or)((0,r._)`typeof ${S} != "object"`,(0,r._)`${S} instanceof RegExp`,(0,r._)`typeof ${S}.compare != "function"`,p(S)))}function h(){const x=m.schema,S=b.formats[x];if(!S||S===!0)return;if(typeof S!="object"||S instanceof RegExp||typeof S.compare!="function")throw new Error(`"${f}": format "${x}" does not define "compare" function`);const C=c.scopeValue("formats",{key:x,ref:S,code:y.code.formats?(0,r._)`${y.code.formats}${(0,r.getProperty)(x)}`:void 0});a.fail$data(p(C))}function p(x){return(0,r._)`${x}.compare(${u}, ${d}) ${s[f].fail} 0`}},dependencies:["format"]};const i=a=>(a.addKeyword(e.formatLimitDefinition),a);e.default=i})(Mj);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=Oj,n=Mj,s=je,o=new s.Name("fullFormats"),i=new s.Name("fastFormats"),a=(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],y=d.formats||r.formatNames;return c(u,y,f,g),d.keywords&&(0,n.default)(u),u};a.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 y,b;(y=(b=u.opts.code).formats)!==null&&y!==void 0||(b.formats=(0,s._)`require("ajv-formats/dist/formats").${g}`);for(const m of d)u.addFormat(m,f[m])}e.exports=t=a,Object.defineProperty(t,"__esModule",{value:!0}),t.default=a})(Ym,Ym.exports);var xV=Ym.exports;const bV=Hd(xV);function _V(){const e=new wV({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return bV(e),e}class SV{constructor(t){this._ajv=t??_V()}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 kV{constructor(t){this._client=t}async*callToolStream(t,r=Sc,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),a=s.getToolOutputValidator(t.name);for await(const c of i){if(c.type==="result"&&a){const u=c.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new ye(xe.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{const d=a(u.structuredContent);if(!d.valid){yield{type:"error",error:new ye(xe.InvalidParams,`Structured content does not match the tool's output schema: ${d.errorMessage}`)};return}}catch(d){if(d instanceof ye){yield{type:"error",error:d};return}yield{type:"error",error:new ye(xe.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 CV(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 EV(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 Uu(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&&Uu(o,r[s])}}if(Array.isArray(e.anyOf))for(const r of e.anyOf)typeof r!="boolean"&&Uu(r,t);if(Array.isArray(e.oneOf))for(const r of e.oneOf)typeof r!="boolean"&&Uu(r,t)}}function NV(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 jV extends N5{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 SV,r!=null&&r.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(t){var r,n,s,o,i,a;t.tools&&((n=(r=this._serverCapabilities)==null?void 0:r.tools)!=null&&n.listChanged)&&this._setupListChangedHandler("tools",bN,t.tools,async()=>(await this.listTools()).tools),t.prompts&&((o=(s=this._serverCapabilities)==null?void 0:s.prompts)!=null&&o.listChanged)&&this._setupListChangedHandler("prompts",wN,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&((a=(i=this._serverCapabilities)==null?void 0:i.resources)!=null&&a.listChanged)&&this._setupListChangedHandler("resources",yN,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new kV(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=j5(this._capabilities,t)}setRequestHandler(t,r){var a;const n=DN(t),s=n==null?void 0:n.method;if(!s)throw new Error("Schema is missing a method literal");let o;if(Af(s)){const c=s,u=(a=c._zod)==null?void 0:a.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,S;const f=_s(EN,u);if(!f.success){const C=f.error instanceof Error?f.error.message:String(f.error);throw new ye(xe.InvalidParams,`Invalid elicitation request: ${C}`)}const{params:g}=f.data;g.mode=g.mode??"form";const{supportsFormMode:y,supportsUrlMode:b}=NV(this._capabilities.elicitation);if(g.mode==="form"&&!y)throw new ye(xe.InvalidParams,"Client does not support form-mode elicitation requests");if(g.mode==="url"&&!b)throw new ye(xe.InvalidParams,"Client does not support URL-mode elicitation requests");const m=await Promise.resolve(r(u,d));if(g.task){const C=_s(Xl,m);if(!C.success){const T=C.error instanceof Error?C.error.message:String(C.error);throw new ye(xe.InvalidParams,`Invalid task creation result: ${T}`)}return C.data}const v=_s(NN,m);if(!v.success){const C=v.error instanceof Error?v.error.message:String(v.error);throw new ye(xe.InvalidParams,`Invalid elicitation result: ${C}`)}const h=v.data,p=g.mode==="form"?g.requestedSchema:void 0;if(g.mode==="form"&&h.action==="accept"&&h.content&&p&&(S=(x=this._capabilities.elicitation)==null?void 0:x.form)!=null&&S.applyDefaults)try{Uu(p,h.content)}catch{}return h};return super.setRequestHandler(t,c)}if(i==="sampling/createMessage"){const c=async(u,d)=>{const f=_s(SN,u);if(!f.success){const h=f.error instanceof Error?f.error.message:String(f.error);throw new ye(xe.InvalidParams,`Invalid sampling request: ${h}`)}const{params:g}=f.data,y=await Promise.resolve(r(u,d));if(g.task){const h=_s(Xl,y);if(!h.success){const p=h.error instanceof Error?h.error.message:String(h.error);throw new ye(xe.InvalidParams,`Invalid task creation result: ${p}`)}return h.data}const m=g.tools||g.toolChoice?CN:kN,v=_s(m,y);if(!v.success){const h=v.error instanceof Error?v.error.message:String(v.error);throw new ye(xe.InvalidParams,`Invalid sampling result: ${h}`)}return v.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:Tf,capabilities:this._capabilities,clientInfo:this._clientInfo}},dN,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!oF.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;CV((n=(r=this._serverCapabilities)==null?void 0:r.tasks)==null?void 0:n.requests,t,"Server")}assertTaskHandlerCapability(t){var r;this._capabilities&&EV((r=this._capabilities.tasks)==null?void 0:r.requests,t,"Client")}async ping(t){return this.request({method:"ping"},Ii,t)}async complete(t,r){return this.request({method:"completion/complete",params:t},jN,r)}async setLoggingLevel(t,r){return this.request({method:"logging/setLevel",params:{level:t}},Ii,r)}async getPrompt(t,r){return this.request({method:"prompts/get",params:t},ey,r)}async listPrompts(t,r){return this.request({method:"prompts/list",params:t},Pd,r)}async listResources(t,r){return this.request({method:"resources/list",params:t},$d,r)}async listResourceTemplates(t,r){return this.request({method:"resources/templates/list",params:t},vN,r)}async readResource(t,r){return this.request({method:"resources/read",params:t},Gv,r)}async subscribeResource(t,r){return this.request({method:"resources/subscribe",params:t},Ii,r)}async unsubscribeResource(t,r){return this.request({method:"resources/unsubscribe",params:t},Ii,r)}async callTool(t,r=Sc,n){if(this.isToolTaskRequired(t.name))throw new ye(xe.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 ye(xe.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 ye(xe.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof ye?i:new ye(xe.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},ty,r);return this.cacheToolMetadata(n.tools),n}_setupListChangedHandler(t,r,n,s){const o=XF.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:a}=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(a){const f=this._listChangedDebounceTimers.get(t);f&&clearTimeout(f);const g=setTimeout(u,a);this._listChangedDebounceTimers.set(t,g)}else u()};this.setNotificationHandler(r,d)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function Xa(e,t){if(!e)throw new Error(t)}var lb=3e3,$V=5e3,Wh=5*60*1e3;function PV(e){const{url:t,clientName:r,clientUri:n,callbackUrl:s=typeof window<"u"?Ri(new URL("/oauth/callback",window.location.origin).toString()):"/oauth/callback",storageKeyPrefix:o="mcp:auth",clientConfig:i={},customHeaders:a={},autoRetry:c=!1,autoReconnect:u=lb,transportType:d="auto",preventAutoAuth:f=!1,onPopupWindow:g}=e,[y,b]=w.useState("discovering"),[m,v]=w.useState([]),[h,p]=w.useState([]),[x,S]=w.useState([]),[C,T]=w.useState([]),[$,O]=w.useState(void 0),[M,U]=w.useState([]),[j,k]=w.useState(void 0),L=w.useRef(null),P=w.useRef(null),B=w.useRef(null),H=w.useRef(!1),G=w.useRef(!0),q=w.useRef(0),V=w.useRef(null),z=w.useRef(y),I=w.useRef(u),F=w.useRef(null);w.useEffect(()=>{z.current=y,I.current=u},[y,u]);const N=w.useCallback((Y,pe,...J)=>{const Me=J.length>0?`${pe} ${J.map(ie=>JSON.stringify(ie)).join(" ")}`:pe;console[Y](`[useMcp] ${Me}`),G.current&&U(ie=>[...ie.slice(-100),{level:Y,message:Me,timestamp:Date.now()}])},[]),_=w.useCallback(async(Y=!1)=>{Y||N("info","Disconnecting..."),H.current=!1,V.current&&clearTimeout(V.current),V.current=null;const pe=P.current;if(L.current=null,P.current=null,G.current&&!Y&&(b("discovering"),v([]),p([]),S([]),T([]),O(void 0),k(void 0)),pe)try{await pe.close(),Y||N("debug","Transport closed")}catch(J){Y||N("warn","Error closing transport:",J)}},[N]),E=w.useCallback((Y,pe)=>{var J;if(N("error",Y,pe??""),G.current){b("failed"),O(Y);const Me=(J=B.current)==null?void 0:J.getLastAttemptedAuthUrl();Me&&(k(Me),N("info","Manual authentication URL may be available.",Me))}H.current=!1},[N]),D=w.useCallback(async()=>{if(H.current){N("debug","Connection attempt already in progress.");return}if(!G.current){N("debug","Connect called after unmount, aborting.");return}H.current=!0,q.current+=1,O(void 0),k(void 0),F.current=null,b("discovering"),N("info",`Connecting attempt #${q.current} to ${t}...`),B.current||(B.current=new cx(t,{storageKeyPrefix:o,clientName:r,clientUri:n,callbackUrl:s,preventAutoAuth:f,onPopupWindow:g}),N("debug","BrowserOAuthClientProvider initialized in connect.")),L.current||(L.current=new jV({name:i.name||"use-mcp-react-client",version:i.version||"0.1.0"},{capabilities:{}}),N("debug","MCP Client initialized in connect."));const Y=async J=>{N("info",`Attempting connection with ${J.toUpperCase()} transport...`),z.current!=="authenticating"&&b("connecting");let Me;try{Xa(B.current,"Auth Provider must be initialized"),Xa(L.current,"Client must be initialized"),P.current&&(await P.current.close().catch(Ve=>N("warn",`Error closing previous transport: ${Ve.message}`)),P.current=null);const ie={authProvider:B.current,requestInit:{headers:{Accept:"application/json, text/event-stream",...a}}},Ie=Ri(t),Pe=new URL(Ie);N("debug",`Creating ${J.toUpperCase()} transport for URL: ${Pe.toString()}`),N("debug","Transport options:",{authProvider:!!B.current,headers:a,url:Pe.toString()}),J==="http"?(N("debug","Creating StreamableHTTPClientTransport..."),Me=new k5(Pe,ie),N("debug","StreamableHTTPClientTransport created successfully")):(N("debug","Creating SSEClientTransport..."),Me=new b5(Pe,ie),N("debug","SSEClientTransport created successfully")),P.current=Me,N("debug",`${J.toUpperCase()} transport created and assigned to ref.`)}catch(ie){return E(`Failed to create ${J.toUpperCase()} transport: ${ie instanceof Error?ie.message:String(ie)}`,ie instanceof Error?ie:void 0),"failed"}Me.onmessage=ie=>{var Ie,Pe;N("debug",`[Transport] Received: ${JSON.stringify(ie)}`),(Pe=(Ie=L.current)==null?void 0:Ie.handleMessage)==null||Pe.call(Ie,ie)},Me.onerror=ie=>{N("warn",`Transport error event (${J.toUpperCase()}):`,ie),N("debug","Error details:",{message:ie.message,stack:ie.stack,name:ie.name,cause:ie.cause}),E(`Transport error (${J.toUpperCase()}): ${ie.message}`,ie)},Me.onclose=()=>{if(!G.current||H.current)return;N("info",`Transport connection closed (${F.current||"unknown"} type).`);const ie=z.current,Ie=I.current;if(ie==="ready"&&Ie){const Pe=typeof Ie=="number"?Ie:lb;N("info",`Attempting to reconnect in ${Pe}ms...`),b("connecting"),setTimeout(()=>{G.current&&D()},Pe)}else ie!=="failed"&&ie!=="authenticating"&&E("Connection closed unexpectedly.")};try{N("info",`Connecting client via ${J.toUpperCase()}...`),N("debug","About to call client.connect() with transport instance"),N("debug",`Transport instance type: ${Me.constructor.name}`),await L.current.connect(Me),N("info",`Client connected via ${J.toUpperCase()}. Loading tools, resources, and prompts...`),F.current=J,b("loading");const ie=await L.current.request({method:"tools/list"},ty);let Ie={resources:[],resourceTemplates:[]};try{Ie=await L.current.request({method:"resources/list"},$d)}catch(Ve){N("debug","Server does not support resources/list method",Ve)}let Pe={prompts:[]};try{Pe=await L.current.request({method:"prompts/list"},Pd)}catch(Ve){N("debug","Server does not support prompts/list method",Ve)}if(G.current){v(ie.tools),p(Ie.resources),S(Array.isArray(Ie.resourceTemplates)?Ie.resourceTemplates:[]),T(Pe.prompts);const Ve=[`Loaded ${ie.tools.length} tools`];return(Ie.resources.length>0||Ie.resourceTemplates&&Ie.resourceTemplates.length>0)&&(Ve.push(`${Ie.resources.length} resources`),Array.isArray(Ie.resourceTemplates)&&Ie.resourceTemplates.length>0&&Ve.push(`${Ie.resourceTemplates.length} resource templates`)),Pe.prompts.length>0&&Ve.push(`${Pe.prompts.length} prompts`),N("info",Ve.join(", ")+"."),b("ready"),q.current=0,"success"}else return"failed"}catch(ie){N("debug",`Client connect error via ${J.toUpperCase()}:`,ie),N("debug","Connect error details:",{message:ie instanceof Error?ie.message:String(ie),stack:ie instanceof Error?ie.stack:"N/A",name:ie instanceof Error?ie.name:"Unknown",cause:ie instanceof Error?ie.cause:void 0});const Ie=ie instanceof Error?ie:new Error(String(ie)),Pe=Ie.message,Ve=Pe.includes("404")||Pe.includes("Not Found"),fn=Pe.includes("405")||Pe.includes("Method Not Allowed"),Tr=Pe==="Failed to fetch"||Pe==="NetworkError when attempting to fetch resource."||Pe==="Load failed";if(J==="http"&&(Ve||fn||Tr))return N("warn",`HTTP transport failed (${Tr?"CORS":Ve?"404":"405"}).`),"fallback";if(Ie instanceof _r||Pe.includes("Unauthorized")||Pe.includes("401")){N("info","Authentication required."),Xa(B.current,"Auth Provider not available for auth flow");const hn=await B.current.tokens();if(f&&!hn)return N("info","Authentication required but auto-auth prevented. User action needed."),b("pending_auth"),"auth_redirect";z.current!=="authenticating"&&z.current!=="pending_auth"&&(b("authenticating"),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{},Wh));try{const xt=await nn(B.current,{serverUrl:t});if(!G.current)return"failed";if(xt==="AUTHORIZED")return N("info","Authentication successful via existing token or refresh. Re-attempting connection..."),V.current&&clearTimeout(V.current),H.current=!1,D(),"failed";if(xt==="REDIRECT")return N("info","Redirecting for authentication. Waiting for callback..."),"auth_redirect"}catch(xt){return G.current&&(V.current&&clearTimeout(V.current),E(`Failed to initiate authentication: ${xt instanceof Error?xt.message:String(xt)}`,xt instanceof Error?xt:void 0)),"failed"}}return E(`Failed to connect via ${J.toUpperCase()}: ${Pe}`,Ie),"failed"}};let pe="failed";if(console.log({transportType:d}),d==="sse")N("debug","Using SSE-only transport mode"),pe=await Y("sse");else if(d==="http")N("debug","Using HTTP-only transport mode"),pe=await Y("http");else{N("debug","Using auto transport mode (HTTP with SSE fallback)");const J=await Y("http");if(J==="fallback"&&G.current&&z.current!=="authenticating"){N("info","HTTP failed, attempting SSE fallback...");const Me=await Y("sse");pe=Me,Me==="failed"&&G.current}else pe=J}(pe==="success"||pe==="failed")&&(H.current=!1),N("debug",`Connection sequence finished with status: ${pe}`)},[N,E,_,nn,t,o,r,n,s,i.name,i.version]),K=w.useCallback(async(Y,pe)=>{if(z.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${y}). Cannot call tool "${Y}".`);N("info",`Calling tool: ${Y}`,pe);try{const J=await L.current.request({method:"tools/call",params:{name:Y,arguments:pe}},Sc);return N("info",`Tool "${Y}" call successful:`,J),J}catch(J){N("error",`Error calling tool "${Y}": ${J instanceof Error?J.message:String(J)}`,J);const Me=J instanceof Error?J:new Error(String(J));if(Me instanceof _r||Me.message.includes("Unauthorized")||Me.message.includes("401")){N("warn","Tool call unauthorized, attempting re-authentication..."),b("authenticating"),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{},Wh);try{Xa(B.current,"Auth Provider not available for tool re-auth");const ie=await nn(B.current,{serverUrl:t});if(!G.current)return;ie==="AUTHORIZED"?(N("info","Re-authentication successful. Retrying tool call is recommended, or reconnecting."),V.current&&clearTimeout(V.current),H.current=!1,D()):ie==="REDIRECT"&&N("info","Redirecting for re-authentication for tool call.")}catch(ie){if(!G.current)return;V.current&&clearTimeout(V.current),E(`Re-authentication failed: ${ie instanceof Error?ie.message:String(ie)}`,ie instanceof Error?ie:void 0)}}if(z.current!=="authenticating")throw J;return}},[y,t,N,E,D]),Z=w.useCallback(()=>{z.current==="failed"?(N("info","Retry requested..."),D()):N("warn",`Retry called but state is not 'failed' (state: ${z.current}). Ignoring.`)},[N,D]),le=w.useCallback(async()=>{var pe;N("info","Manual authentication requested...");const Y=z.current;if(Y==="failed")N("info","Attempting to reconnect and authenticate via retry..."),Z();else if(Y==="pending_auth"){N("info","Proceeding with authentication from pending state..."),b("authenticating"),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{},Wh);try{Xa(B.current,"Auth Provider not available for manual auth");const J=await nn(B.current,{serverUrl:t});if(!G.current)return;J==="AUTHORIZED"?(N("info","Manual authentication successful. Re-attempting connection..."),V.current&&clearTimeout(V.current),H.current=!1,D()):J==="REDIRECT"&&N("info","Redirecting for manual authentication. Waiting for callback...")}catch(J){if(!G.current)return;V.current&&clearTimeout(V.current),E(`Manual authentication failed: ${J instanceof Error?J.message:String(J)}`,J instanceof Error?J:void 0)}}else if(Y==="authenticating"){N("warn","Already attempting authentication. Check for blocked popups or wait for timeout.");const J=(pe=B.current)==null?void 0:pe.getLastAttemptedAuthUrl();J&&!j&&(k(J),N("info","Manual authentication URL retrieved:",J))}else N("info",`Client not in a state requiring manual authentication trigger (state: ${Y}). If needed, try disconnecting and reconnecting.`)},[N,Z,j,t,E,D]),re=w.useCallback(()=>{if(B.current){const Y=B.current.clearStorage();N("info",`Cleared ${Y} item(s) from localStorage for ${t}.`),k(void 0),_()}else N("warn","Auth provider not initialized, cannot clear storage.")},[t,N,_]),X=w.useCallback(async()=>{if(z.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${y}). Cannot list resources.`);N("info","Listing resources...");try{const Y=await L.current.request({method:"resources/list"},$d);G.current&&(p(Y.resources),S(Array.isArray(Y.resourceTemplates)?Y.resourceTemplates:[]),N("info",`Listed ${Y.resources.length} resources, ${Array.isArray(Y.resourceTemplates)?Y.resourceTemplates.length:0} resource templates.`))}catch(Y){throw N("error",`Error listing resources: ${Y instanceof Error?Y.message:String(Y)}`,Y),Y}},[y,N]),ge=w.useCallback(async Y=>{if(z.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${y}). Cannot read resource "${Y}".`);N("info",`Reading resource: ${Y}`);try{const pe=await L.current.request({method:"resources/read",params:{uri:Y}},Gv);return N("info",`Resource "${Y}" read successfully`),pe}catch(pe){throw N("error",`Error reading resource "${Y}": ${pe instanceof Error?pe.message:String(pe)}`,pe),pe}},[y,N]),Le=w.useCallback(async()=>{if(z.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${y}). Cannot list prompts.`);N("info","Listing prompts...");try{const Y=await L.current.request({method:"prompts/list"},Pd);G.current&&(T(Y.prompts),N("info",`Listed ${Y.prompts.length} prompts.`))}catch(Y){throw N("error",`Error listing prompts: ${Y instanceof Error?Y.message:String(Y)}`,Y),Y}},[y,N]),gt=w.useCallback(async(Y,pe)=>{if(z.current!=="ready"||!L.current)throw new Error(`MCP client is not ready (current state: ${y}). Cannot get prompt "${Y}".`);N("info",`Getting prompt: ${Y}`,pe);try{const J=await L.current.request({method:"prompts/get",params:{name:Y,arguments:pe}},ey);return N("info",`Prompt "${Y}" retrieved successfully`),J}catch(J){throw N("error",`Error getting prompt "${Y}": ${J instanceof Error?J.message:String(J)}`,J),J}},[y,N]);return w.useEffect(()=>{const Y=pe=>{var J;pe.origin===window.location.origin&&((J=pe.data)==null?void 0:J.type)==="mcp_auth_callback"&&(N("info","Received auth callback message.",pe.data),V.current&&clearTimeout(V.current),pe.data.success?(N("info","Authentication successful via popup. Reconnecting client..."),H.current=!1,D()):E(`Authentication failed in callback: ${pe.data.error||"Unknown reason."}`))};return window.addEventListener("message",Y),N("debug","Auth callback message listener added."),()=>{window.removeEventListener("message",Y),N("debug","Auth callback message listener removed."),V.current&&clearTimeout(V.current)}},[N,E,D]),w.useEffect(()=>(G.current=!0,N("debug","useMcp mounted, initiating connection."),q.current=0,(!B.current||B.current.serverUrl!==t)&&(B.current=new cx(t,{storageKeyPrefix:o,clientName:r,clientUri:n,callbackUrl:s,preventAutoAuth:f,onPopupWindow:g}),N("debug","BrowserOAuthClientProvider initialized/updated on mount/option change.")),D(),()=>{G.current=!1,N("debug","useMcp unmounting, disconnecting."),_(!0)}),[t,o,s,r,n,i.name,i.version,D,_]),w.useEffect(()=>{let Y=null;if(y==="failed"&&c&&q.current>0){const pe=typeof c=="number"?c:$V;N("info",`Connection failed, auto-retrying in ${pe}ms...`),Y=setTimeout(()=>{G.current&&z.current==="failed"&&Z()},pe)}return()=>{Y&&clearTimeout(Y)}},[y,c,Z,N]),{state:y,tools:m,resources:h,resourceTemplates:x,prompts:C,error:$,log:M,authUrl:j,callTool:K,listResources:X,readResource:ge,listPrompts:Le,getPrompt:gt,retry:Z,disconnect:_,authenticate:le,clearStorage:re}}function TV({service:e,autoConnect:t=!1,onConnected:r,onError:n}){const{toast:s}=sr(),{state:o,tools:i,resources:a,prompts:c,error:u,authUrl:d,callTool:f,readResource:g,listResources:y,getPrompt:b,listPrompts:m,retry:v,disconnect:h,authenticate:p,clearStorage:x}=PV({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}),S=o==="ready",C=o==="connecting"||o==="loading",T=o==="authenticating"||o==="pending_auth",$=o==="failed";return yn.useEffect(()=>{S&&r&&(r(),s({title:"Connected to MCP service",description:`Successfully connected to ${e.name}`}))},[S,r,e.name,s]),yn.useEffect(()=>{$&&u&&n&&(n(u),s({title:"MCP connection failed",description:u,variant:"destructive"}))},[$,u,n,s]),{isConnected:S,isConnecting:C,isAuthenticating:T,hasError:$,error:u,tools:i,resources:a,prompts:c,connect:()=>{v()},disconnect:h,retry:v,authenticate:p,callTool:async(L,P)=>{try{return await f(L,P)}catch(B){const H=B instanceof Error?B.message:"Unknown error";throw s({title:"Tool call failed",description:H,variant:"destructive"}),B}},readResource:async L=>{try{return await g(L)}catch(P){const B=P instanceof Error?P.message:"Unknown error";throw s({title:"Resource read failed",description:B,variant:"destructive"}),P}},listResources:async()=>{try{await y()}catch(L){const P=L instanceof Error?L.message:"Unknown error";throw s({title:"Resource listing failed",description:P,variant:"destructive"}),L}},getPrompt:async(L,P)=>{try{return await b(L,P)}catch(B){const H=B instanceof Error?B.message:"Unknown error";throw s({title:"Prompt retrieval failed",description:H,variant:"destructive"}),B}},listPrompts:async()=>{try{await m()}catch(L){const P=L instanceof Error?L.message:"Unknown error";throw s({title:"Prompt listing failed",description:P,variant:"destructive"}),L}},authUrl:d,clearStorage:x}}function RV(){const[e,t]=w.useState("https://api.githubcopilot.com/mcp"),[r,n]=w.useState("get_me"),[s,o]=w.useState("{}"),[i,a]=w.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:y,tools:b,resources:m,prompts:v,connect:h,disconnect:p,retry:x,authenticate:S,callTool:C,authUrl:T,clearStorage:$}=TV({service:c,autoConnect:!1,onConnected:()=>{console.log("Connected to test MCP service")},onError:j=>{console.error("Test MCP service error:",j)}}),M=d?{status:"connecting",icon:Rw,color:"text-yellow-500"}:f?{status:"authenticating",icon:Gc,color:"text-blue-500"}:u?{status:"connected",icon:nm,color:"text-green-500"}:g?{status:"error",icon:Pw,color:"text-red-500"}:{status:"disconnected",icon:Pw,color:"text-gray-500"},U=async()=>{try{let j={};s.trim()&&(j=JSON.parse(s));const k=await C(r,j);a(JSON.stringify(k,null,2))}catch(j){a(`Error: ${j instanceof Error?j.message:"Unknown error"}`)}};return l.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[l.jsxs("div",{className:"text-center",children:[l.jsx("h1",{className:"text-3xl font-bold mb-2",children:"use-mcp Integration Test"}),l.jsx("p",{className:"text-muted-foreground",children:"Testing the new use-mcp library integration with OAuth support"})]}),l.jsxs(xs,{children:[l.jsxs(bo,{children:[l.jsxs(_o,{className:"flex items-center gap-2",children:[l.jsx(M.icon,{className:`w-5 h-5 ${M.color}`}),"Connection Status: ",M.status]}),l.jsx(Ru,{children:"Current connection state and available actions"})]}),l.jsxs(bs,{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(Oe,{children:"Service URL"}),l.jsx(Be,{value:e,onChange:j=>t(j.target.value),placeholder:"Enter MCP service URL"})]}),l.jsxs("div",{className:"flex gap-2",children:[!u&&!d&&l.jsx(ce,{onClick:h,children:"Connect"}),u&&l.jsx(ce,{onClick:p,variant:"outline",children:"Disconnect"}),g&&l.jsxs(ce,{onClick:x,variant:"outline",children:[l.jsx(Rw,{className:"w-4 h-4 mr-1"}),"Retry"]}),T&&!u&&l.jsxs(ce,{onClick:S,variant:"outline",children:[l.jsx(Gc,{className:"w-4 h-4 mr-1"}),"Authenticate"]})]})]}),y&&l.jsxs("div",{className:"flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md",children:[l.jsx(Ok,{className:"w-4 h-4 text-destructive"}),l.jsx("span",{className:"text-sm text-destructive",children:y})]})]})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[l.jsxs(xs,{children:[l.jsx(bo,{children:l.jsxs(_o,{className:"flex items-center gap-2",children:[l.jsx(md,{className:"w-4 h-4"}),"Tools (",b.length,")"]})}),l.jsx(bs,{children:b.length===0?l.jsx("p",{className:"text-sm text-muted-foreground",children:u?"No tools available":"Connect to see tools"}):l.jsxs("div",{className:"space-y-2",children:[b.slice(0,5).map((j,k)=>l.jsx("div",{className:"text-sm",children:l.jsx(mn,{variant:"outline",className:"text-xs",children:j.name})},k)),b.length>5&&l.jsxs("p",{className:"text-xs text-muted-foreground",children:["+",b.length-5," more tools"]})]})})]}),l.jsxs(xs,{children:[l.jsx(bo,{children:l.jsxs(_o,{children:["Resources (",m.length,")"]})}),l.jsx(bs,{children:l.jsx("p",{className:"text-sm text-muted-foreground",children:u?`${m.length} resources available`:"Connect to see resources"})})]}),l.jsxs(xs,{children:[l.jsx(bo,{children:l.jsxs(_o,{children:["Prompts (",v.length,")"]})}),l.jsx(bs,{children:l.jsx("p",{className:"text-sm text-muted-foreground",children:u?`${v.length} prompts available`:"Connect to see prompts"})})]})]}),u&&l.jsxs(xs,{children:[l.jsxs(bo,{children:[l.jsx(_o,{children:"Test Tool Call"}),l.jsx(Ru,{children:"Test calling a tool on the connected MCP service"})]}),l.jsxs(bs,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"toolName",children:"Tool Name"}),l.jsx(Be,{id:"toolName",value:r,onChange:j=>n(j.target.value),placeholder:"e.g., get_me"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{htmlFor:"toolArgs",children:"Arguments (JSON)"}),l.jsx(Be,{id:"toolArgs",value:s,onChange:j=>o(j.target.value),placeholder:'{"key": "value"}'})]})]}),l.jsxs(ce,{onClick:U,disabled:!u,children:[l.jsx(R2,{className:"w-4 h-4 mr-1"}),"Call Tool"]}),i&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(Oe,{children:"Result"}),l.jsx(Bn,{value:i,readOnly:!0,rows:10,className:"font-mono text-sm"})]})]})]}),T&&l.jsxs(xs,{children:[l.jsxs(bo,{children:[l.jsxs(_o,{className:"flex items-center gap-2",children:[l.jsx(Gc,{className:"w-4 h-4"}),"OAuth Authentication"]}),l.jsx(Ru,{children:"This service requires OAuth authentication"})]}),l.jsxs(bs,{className:"space-y-4",children:[l.jsx("div",{className:"p-3 bg-blue-50 border border-blue-200 rounded-md",children:l.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.'})}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(ce,{onClick:S,variant:"outline",children:[l.jsx(Gc,{className:"w-4 h-4 mr-1"}),"Start OAuth Flow"]}),l.jsx(ce,{onClick:$,variant:"outline",children:"Clear OAuth Data"})]})]})]})]})}function IV(){return l.jsxs(qT,{children:[l.jsx(Kc,{path:"/",component:J4}),l.jsx(Kc,{path:"/oauth/callback",component:eD}),l.jsx(Kc,{path:"/mcp-test",component:RV}),l.jsx(Kc,{component:X4})]})}function AV(){return l.jsx(cR,{client:kR,children:l.jsxs(tO,{children:[l.jsx(gI,{}),l.jsx(IV,{})]})})}TS(document.getElementById("root")).render(l.jsx(w.StrictMode,{children:l.jsx(AV,{})}));
|